mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 17:40:13 +01:00
This commit is contained in:
parent
671851235a
commit
4e3341985c
9 changed files with 25 additions and 23 deletions
|
|
@ -142,11 +142,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
&.dragover__top::after {
|
&.dragover__top::after {
|
||||||
top: -3px;
|
top: -2.5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.dragover__bottom::after {
|
&.dragover__bottom::after {
|
||||||
bottom: -2px;
|
bottom: -2.5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover [data-type="block-more"] {
|
&:hover [data-type="block-more"] {
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@
|
||||||
|
|
||||||
.b3-button[data-type="addColumn"] {
|
.b3-button[data-type="addColumn"] {
|
||||||
margin-left: 28px;
|
margin-left: 28px;
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
width: 16px;
|
width: 16px;
|
||||||
height: 16px;
|
height: 16px;
|
||||||
|
|
@ -105,6 +106,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.av__row.dragover__top::after {
|
.av__row.dragover__top::after {
|
||||||
top: -2px
|
top: -1.5px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ export const keymap = {
|
||||||
});
|
});
|
||||||
item.updateProtyleToolbar([]).forEach(toolbarItem => {
|
item.updateProtyleToolbar([]).forEach(toolbarItem => {
|
||||||
if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
|
if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
const dockKeymap = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name];
|
const dockKeymap = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name];
|
||||||
const keyValue = updateHotkeyTip(dockKeymap.custom);
|
const keyValue = updateHotkeyTip(dockKeymap.custom);
|
||||||
|
|
@ -71,7 +71,7 @@ export const keymap = {
|
||||||
<span data-type="update" class="config-keymap__key">${keyValue}</span>
|
<span data-type="update" class="config-keymap__key">${keyValue}</span>
|
||||||
<input data-key="plugin${Constants.ZWSP}${item.name}${Constants.ZWSP}${toolbarItem.name}" data-value="${dockKeymap.custom}" data-default="${dockKeymap.default}" class="b3-text-field fn__none" value="${keyValue}" spellcheck="false">
|
<input data-key="plugin${Constants.ZWSP}${item.name}${Constants.ZWSP}${toolbarItem.name}" data-value="${dockKeymap.custom}" data-default="${dockKeymap.default}" class="b3-text-field fn__none" value="${keyValue}" spellcheck="false">
|
||||||
</label>`;
|
</label>`;
|
||||||
})
|
});
|
||||||
Object.keys(item.docks).forEach(key => {
|
Object.keys(item.docks).forEach(key => {
|
||||||
const dockConfig = item.docks[key].config;
|
const dockConfig = item.docks[key].config;
|
||||||
if (!dockConfig.hotkey) {
|
if (!dockConfig.hotkey) {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ const renderDoc = (element: HTMLElement, currentPage: number, id: string) => {
|
||||||
}
|
}
|
||||||
const opElement = element.querySelector('.b3-select[data-type="opselect"]') as HTMLSelectElement;
|
const opElement = element.querySelector('.b3-select[data-type="opselect"]') as HTMLSelectElement;
|
||||||
const listElement = element.querySelector(".b3-list--background");
|
const listElement = element.querySelector(".b3-list--background");
|
||||||
element.querySelector('.protyle-title__input').classList.add("fn__none");
|
element.querySelector(".protyle-title__input").classList.add("fn__none");
|
||||||
element.querySelector('.history__text[data-type="docPanel"]').classList.add("fn__none");
|
element.querySelector('.history__text[data-type="docPanel"]').classList.add("fn__none");
|
||||||
element.querySelector('.history__text[data-type="mdPanel"]').classList.add("fn__none");
|
element.querySelector('.history__text[data-type="mdPanel"]').classList.add("fn__none");
|
||||||
fetchPost("/api/history/searchHistory", {
|
fetchPost("/api/history/searchHistory", {
|
||||||
|
|
@ -36,7 +36,7 @@ const renderDoc = (element: HTMLElement, currentPage: number, id: string) => {
|
||||||
} else {
|
} else {
|
||||||
nextElement.setAttribute("disabled", "disabled");
|
nextElement.setAttribute("disabled", "disabled");
|
||||||
}
|
}
|
||||||
const pageNumElement = element.querySelector('[data-type="jumpRepoPage"]')
|
const pageNumElement = element.querySelector('[data-type="jumpRepoPage"]');
|
||||||
if (response.data.pageCount > 1) {
|
if (response.data.pageCount > 1) {
|
||||||
pageNumElement.removeAttribute("disabled");
|
pageNumElement.removeAttribute("disabled");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -134,8 +134,8 @@ export const openDocHistory = (options: {
|
||||||
typewriterMode: false,
|
typewriterMode: false,
|
||||||
});
|
});
|
||||||
disabledProtyle(historyEditor.protyle);
|
disabledProtyle(historyEditor.protyle);
|
||||||
const pageNumElement = dialog.element.querySelector('[data-type="jumpRepoPage"]')
|
const pageNumElement = dialog.element.querySelector('[data-type="jumpRepoPage"]');
|
||||||
const titleElement = dialog.element.querySelector(".protyle-title__input")
|
const titleElement = dialog.element.querySelector(".protyle-title__input");
|
||||||
dialog.element.addEventListener("click", (event) => {
|
dialog.element.addEventListener("click", (event) => {
|
||||||
let target = event.target as HTMLElement;
|
let target = event.target as HTMLElement;
|
||||||
while (target && !target.isEqualNode(dialog.element)) {
|
while (target && !target.isEqualNode(dialog.element)) {
|
||||||
|
|
@ -176,7 +176,7 @@ export const openDocHistory = (options: {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
titleElement.textContent = item.title;
|
titleElement.textContent = item.title;
|
||||||
titleElement.classList.remove("fn__none")
|
titleElement.classList.remove("fn__none");
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
});
|
});
|
||||||
target.parentElement.querySelector(".b3-list-item--focus")?.classList.remove("b3-list-item--focus");
|
target.parentElement.querySelector(".b3-list-item--focus")?.classList.remove("b3-list-item--focus");
|
||||||
|
|
|
||||||
|
|
@ -445,7 +445,7 @@ export const openHistory = (app: App) => {
|
||||||
icon: "iconHistory",
|
icon: "iconHistory",
|
||||||
title: window.siyuan.languages.dataHistory,
|
title: window.siyuan.languages.dataHistory,
|
||||||
bindEvent(element) {
|
bindEvent(element) {
|
||||||
element.firstElementChild.setAttribute("style", "background-color:var(--b3-theme-background);height:100%")
|
element.firstElementChild.setAttribute("style", "background-color:var(--b3-theme-background);height:100%");
|
||||||
bindEvent(app, element.firstElementChild);
|
bindEvent(app, element.firstElementChild);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ export class Plugin {
|
||||||
|
|
||||||
this.updateProtyleToolbar([]).forEach(toolbarItem => {
|
this.updateProtyleToolbar([]).forEach(toolbarItem => {
|
||||||
if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
|
if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
if (!window.siyuan.config.keymap.plugin) {
|
if (!window.siyuan.config.keymap.plugin) {
|
||||||
window.siyuan.config.keymap.plugin = {};
|
window.siyuan.config.keymap.plugin = {};
|
||||||
|
|
@ -96,9 +96,9 @@ export class Plugin {
|
||||||
window.siyuan.config.keymap.plugin[options.name][toolbarItem.name] = {
|
window.siyuan.config.keymap.plugin[options.name][toolbarItem.name] = {
|
||||||
default: toolbarItem.hotkey,
|
default: toolbarItem.hotkey,
|
||||||
custom: toolbarItem.hotkey,
|
custom: toolbarItem.hotkey,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public onload() {
|
public onload() {
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ const genSelectItemHTML = (type: "selected" | "empty" | "unselect", id?: string,
|
||||||
if (type === "empty") {
|
if (type === "empty") {
|
||||||
if (id) {
|
if (id) {
|
||||||
return `<button class="b3-menu__item" data-type="setRelationCell">
|
return `<button class="b3-menu__item" data-type="setRelationCell">
|
||||||
<span class="b3-menu__label">${window.siyuan.languages.newRowInRelation.replace('${x}', text).replace('${y}', id)}</span>
|
<span class="b3-menu__label">${window.siyuan.languages.newRowInRelation.replace("${x}", text).replace("${y}", id)}</span>
|
||||||
</button>`;
|
</button>`;
|
||||||
}
|
}
|
||||||
return `<button class="b3-menu__item">
|
return `<button class="b3-menu__item">
|
||||||
|
|
@ -407,7 +407,7 @@ export const setRelationCell = (protyle: IProtyle, nodeElement: HTMLElement, tar
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const blockID = target.querySelector(".popover__block").getAttribute("data-id");
|
const blockID = target.querySelector(".popover__block").getAttribute("data-id");
|
||||||
const content = target.querySelector("b").textContent
|
const content = target.querySelector("b").textContent;
|
||||||
const rowId = Lute.NewNodeID();
|
const rowId = Lute.NewNodeID();
|
||||||
transaction(protyle, [{
|
transaction(protyle, [{
|
||||||
action: "insertAttrViewBlock",
|
action: "insertAttrViewBlock",
|
||||||
|
|
|
||||||
|
|
@ -69,15 +69,15 @@ export class Toolbar {
|
||||||
/// #endif
|
/// #endif
|
||||||
this.toolbarHeight = 29;
|
this.toolbarHeight = 29;
|
||||||
protyle.app.plugins.forEach(item => {
|
protyle.app.plugins.forEach(item => {
|
||||||
const pluginToolbar = item.updateProtyleToolbar(options.toolbar)
|
const pluginToolbar = item.updateProtyleToolbar(options.toolbar);
|
||||||
pluginToolbar.forEach(toolbarItem => {
|
pluginToolbar.forEach(toolbarItem => {
|
||||||
if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
|
if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
if (window.siyuan.config.keymap.plugin && window.siyuan.config.keymap.plugin[item.name] && window.siyuan.config.keymap.plugin[item.name][toolbarItem.name]) {
|
if (window.siyuan.config.keymap.plugin && window.siyuan.config.keymap.plugin[item.name] && window.siyuan.config.keymap.plugin[item.name][toolbarItem.name]) {
|
||||||
toolbarItem.hotkey = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name].custom;
|
toolbarItem.hotkey = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name].custom;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
options.toolbar = toolbarKeyToMenu(pluginToolbar);
|
options.toolbar = toolbarKeyToMenu(pluginToolbar);
|
||||||
});
|
});
|
||||||
options.toolbar.forEach((menuItem: IMenuItem) => {
|
options.toolbar.forEach((menuItem: IMenuItem) => {
|
||||||
|
|
@ -90,15 +90,15 @@ export class Toolbar {
|
||||||
this.element.innerHTML = "";
|
this.element.innerHTML = "";
|
||||||
protyle.options.toolbar = toolbarKeyToMenu(Constants.PROTYLE_TOOLBAR);
|
protyle.options.toolbar = toolbarKeyToMenu(Constants.PROTYLE_TOOLBAR);
|
||||||
protyle.app.plugins.forEach(item => {
|
protyle.app.plugins.forEach(item => {
|
||||||
const pluginToolbar = item.updateProtyleToolbar(protyle.options.toolbar)
|
const pluginToolbar = item.updateProtyleToolbar(protyle.options.toolbar);
|
||||||
pluginToolbar.forEach(toolbarItem => {
|
pluginToolbar.forEach(toolbarItem => {
|
||||||
if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
|
if (typeof toolbarItem === "string" || Constants.INLINE_TYPE.concat("|").includes(toolbarItem.name) || !toolbarItem.hotkey) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
if (window.siyuan.config.keymap.plugin && window.siyuan.config.keymap.plugin[item.name] && window.siyuan.config.keymap.plugin[item.name][toolbarItem.name]) {
|
if (window.siyuan.config.keymap.plugin && window.siyuan.config.keymap.plugin[item.name] && window.siyuan.config.keymap.plugin[item.name][toolbarItem.name]) {
|
||||||
toolbarItem.hotkey = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name].custom;
|
toolbarItem.hotkey = window.siyuan.config.keymap.plugin[item.name][toolbarItem.name].custom;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
protyle.options.toolbar = toolbarKeyToMenu(pluginToolbar);
|
protyle.options.toolbar = toolbarKeyToMenu(pluginToolbar);
|
||||||
});
|
});
|
||||||
protyle.options.toolbar.forEach((menuItem: IMenuItem) => {
|
protyle.options.toolbar.forEach((menuItem: IMenuItem) => {
|
||||||
|
|
|
||||||
|
|
@ -1332,7 +1332,8 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
addDragover(targetElement);
|
addDragover(targetElement);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (targetElement.getAttribute("data-type") === "NodeListItem" || fileTreeIds.indexOf("-") > -1) {
|
// 忘记为什么要限定文档树的拖拽了,先放开 https://github.com/siyuan-note/siyuan/pull/13284#issuecomment-2503853135
|
||||||
|
if (targetElement.getAttribute("data-type") === "NodeListItem") {
|
||||||
if (event.clientY > nodeRect.top + nodeRect.height / 2) {
|
if (event.clientY > nodeRect.top + nodeRect.height / 2) {
|
||||||
targetElement.classList.add("dragover__bottom");
|
targetElement.classList.add("dragover__bottom");
|
||||||
addDragover(targetElement);
|
addDragover(targetElement);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue