🚨
This commit is contained in:
parent
cc5003549c
commit
5d051d0c64
10 changed files with 26 additions and 26 deletions
|
@ -428,7 +428,7 @@ export const keymap = {
|
|||
keys[1] = "headings";
|
||||
}
|
||||
let hasConflict = false;
|
||||
const isAssistKey = ["⌘", "⇧", "⌥", "⌃"].includes(keymapStr.substr(keymapStr.length - 1, 1))
|
||||
const isAssistKey = ["⌘", "⇧", "⌥", "⌃"].includes(keymapStr.substr(keymapStr.length - 1, 1));
|
||||
if (isAssistKey ||
|
||||
["⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⌃D", "⇧⌘→", "⇧⌘←", "⌘Home", "⌘End", "⇧↩", "↩", "PageUp", "PageDown", "⌫", "⌦", "Escape"].includes(keymapStr) ||
|
||||
// 跳转到下/上一个编辑页签不能包含 ctrl, 否则不能监听到 keyup
|
||||
|
|
|
@ -210,4 +210,4 @@ export const publish = {
|
|||
}</ul>`;
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
|
|
|
@ -705,7 +705,7 @@ export class Files extends Model {
|
|||
public init(init = true) {
|
||||
let html = "";
|
||||
let closeHtml = "";
|
||||
let closeCounter = 0
|
||||
let closeCounter = 0;
|
||||
window.siyuan.notebooks.forEach((item) => {
|
||||
if (item.closed) {
|
||||
closeCounter++;
|
||||
|
@ -716,8 +716,8 @@ export class Files extends Model {
|
|||
});
|
||||
this.element.innerHTML = html;
|
||||
this.closeElement.lastElementChild.innerHTML = closeHtml;
|
||||
const counterElement = this.closeElement.querySelector(".counter")
|
||||
counterElement.textContent = closeCounter.toString()
|
||||
const counterElement = this.closeElement.querySelector(".counter");
|
||||
counterElement.textContent = closeCounter.toString();
|
||||
if (closeCounter) {
|
||||
counterElement.classList.remove("fn__none");
|
||||
} else {
|
||||
|
@ -752,7 +752,7 @@ export class Files extends Model {
|
|||
this.closeElement.lastElementChild.innerHTML = closeHTML;
|
||||
const counterElement = this.closeElement.querySelector(".counter");
|
||||
counterElement.textContent = (parseInt(counterElement.textContent) + 1).toString();
|
||||
counterElement.classList.remove("fn__none")
|
||||
counterElement.classList.remove("fn__none");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -797,10 +797,10 @@ export class Files extends Model {
|
|||
}
|
||||
const liElement = this.closeElement.querySelector(`li[data-url="${data.data.box.id}"]`) as HTMLElement;
|
||||
if (liElement) {
|
||||
const counterElement = this.closeElement.querySelector(".counter")
|
||||
counterElement.textContent = (parseInt(counterElement.textContent) - 1).toString()
|
||||
const counterElement = this.closeElement.querySelector(".counter");
|
||||
counterElement.textContent = (parseInt(counterElement.textContent) - 1).toString();
|
||||
if (counterElement.textContent === "0") {
|
||||
counterElement.classList.add("fn__none")
|
||||
counterElement.classList.add("fn__none");
|
||||
}
|
||||
liElement.remove();
|
||||
}
|
||||
|
|
|
@ -1019,7 +1019,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme
|
|||
fetchPost("/api/asset/getImageOCRText", {
|
||||
path: imgElement.getAttribute("src")
|
||||
}, (response) => {
|
||||
const textarea =element.querySelector("textarea")
|
||||
const textarea =element.querySelector("textarea");
|
||||
textarea.value = response.data.text;
|
||||
textarea.dataset.ocrText = response.data.text;
|
||||
});
|
||||
|
|
|
@ -304,8 +304,8 @@ export class MobileFiles extends Model {
|
|||
});
|
||||
this.element.innerHTML = html;
|
||||
this.closeElement.lastElementChild.innerHTML = closeHtml;
|
||||
const counterElement = this.closeElement.querySelector(".counter")
|
||||
counterElement.textContent = closeCounter.toString()
|
||||
const counterElement = this.closeElement.querySelector(".counter");
|
||||
counterElement.textContent = closeCounter.toString();
|
||||
if (closeCounter) {
|
||||
counterElement.classList.remove("fn__none");
|
||||
} else {
|
||||
|
@ -419,7 +419,7 @@ export class MobileFiles extends Model {
|
|||
this.closeElement.lastElementChild.innerHTML = closeHTML;
|
||||
const counterElement = this.closeElement.querySelector(".counter");
|
||||
counterElement.textContent = (parseInt(counterElement.textContent) + 1).toString();
|
||||
counterElement.classList.remove("fn__none")
|
||||
counterElement.classList.remove("fn__none");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -474,10 +474,10 @@ export class MobileFiles extends Model {
|
|||
const liElement = this.closeElement.querySelector(`li[data-url="${data.data.box.id}"]`) as HTMLElement;
|
||||
if (liElement) {
|
||||
liElement.remove();
|
||||
const counterElement = this.closeElement.querySelector(".counter")
|
||||
counterElement.textContent = (parseInt(counterElement.textContent) - 1).toString()
|
||||
const counterElement = this.closeElement.querySelector(".counter");
|
||||
counterElement.textContent = (parseInt(counterElement.textContent) - 1).toString();
|
||||
if (counterElement.textContent === "0") {
|
||||
counterElement.classList.add("fn__none")
|
||||
counterElement.classList.add("fn__none");
|
||||
}
|
||||
}
|
||||
setNoteBook((notebooks: INotebook[]) => {
|
||||
|
|
|
@ -90,7 +90,7 @@ export class Gutter {
|
|||
selectElements.push(item);
|
||||
});
|
||||
} else {
|
||||
protyle.wysiwyg.element.querySelector(`[data-node-id="${buttonElement.getAttribute("data-node-id")}"]`)?.classList.add("protyle-wysiwyg--select")
|
||||
protyle.wysiwyg.element.querySelector(`[data-node-id="${buttonElement.getAttribute("data-node-id")}"]`)?.classList.add("protyle-wysiwyg--select");
|
||||
selectElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));
|
||||
selectElements.forEach(item => {
|
||||
selectIds.push(item.getAttribute("data-node-id"));
|
||||
|
|
|
@ -103,7 +103,7 @@ export class Title {
|
|||
return;
|
||||
}
|
||||
if (event.key === "ArrowDown") {
|
||||
const rects = getSelection().getRangeAt(0).getClientRects()
|
||||
const rects = getSelection().getRangeAt(0).getClientRects();
|
||||
// https://github.com/siyuan-note/siyuan/issues/11729
|
||||
if (this.editElement.getBoundingClientRect().bottom - rects[rects.length - 1].bottom < 25) {
|
||||
const noContainerElement = getNoContainerElement(protyle.wysiwyg.element.firstElementChild);
|
||||
|
|
|
@ -527,7 +527,7 @@ const dragSb = async (protyle: IProtyle, sourceElements: Element[], targetElemen
|
|||
item.protyle.undo.clear();
|
||||
return true;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
/// #endif
|
||||
}
|
||||
|
@ -711,7 +711,7 @@ const dragSame = async (protyle: IProtyle, sourceElements: Element[], targetElem
|
|||
item.protyle.undo.clear();
|
||||
return true;
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
/// #endif
|
||||
}
|
||||
|
|
|
@ -338,9 +338,9 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false,
|
|||
}
|
||||
}
|
||||
let lastElement: Element;
|
||||
let insertBefore = false
|
||||
let insertBefore = false;
|
||||
if (!range.toString() && insertByCursor) {
|
||||
const positon = getSelectionOffset(blockElement, protyle.wysiwyg.element, range)
|
||||
const positon = getSelectionOffset(blockElement, protyle.wysiwyg.element, range);
|
||||
if (positon.start === 0 && editableElement.textContent !== "") {
|
||||
insertBefore = true;
|
||||
}
|
||||
|
|
|
@ -93,9 +93,9 @@ export const upSelect = (options: {
|
|||
} else {
|
||||
const tdElement = hasClosestByMatchTag(options.range.startContainer, "TD") || hasClosestByMatchTag(options.range.startContainer, "TH");
|
||||
const nodeEditableElement = (tdElement || getContenteditableElement(options.nodeElement) || options.nodeElement) as HTMLElement;
|
||||
const startIndex = getSelectionOffset(nodeEditableElement, options.editorElement, options.range).start
|
||||
const startIndex = getSelectionOffset(nodeEditableElement, options.editorElement, options.range).start;
|
||||
const innerText = nodeEditableElement.innerText;
|
||||
const isExpandUp = matchHotKey(window.siyuan.config.keymap.editor.general.expandUp.custom, options.event)
|
||||
const isExpandUp = matchHotKey(window.siyuan.config.keymap.editor.general.expandUp.custom, options.event);
|
||||
if (!isMac() && isExpandUp) {
|
||||
// Windows 中 ⌥⇧↑ 默认无选中功能会导致 https://ld246.com/article/1716635371149
|
||||
} else if (startIndex > 0) {
|
||||
|
@ -141,9 +141,9 @@ export const downSelect = (options: {
|
|||
} else {
|
||||
const tdElement = hasClosestByMatchTag(options.range.startContainer, "TD") || hasClosestByMatchTag(options.range.startContainer, "TH");
|
||||
const nodeEditableElement = (tdElement || getContenteditableElement(options.nodeElement) || options.nodeElement) as HTMLElement;
|
||||
const endIndex = getSelectionOffset(nodeEditableElement, options.editorElement, options.range).end
|
||||
const endIndex = getSelectionOffset(nodeEditableElement, options.editorElement, options.range).end;
|
||||
const innerText = nodeEditableElement.innerText;
|
||||
const isExpandDown = matchHotKey(window.siyuan.config.keymap.editor.general.expandDown.custom, options.event)
|
||||
const isExpandDown = matchHotKey(window.siyuan.config.keymap.editor.general.expandDown.custom, options.event);
|
||||
if (!isMac() && isExpandDown) {
|
||||
// Windows 中 ⌥⇧↓ 默认无选中功能会导致 https://ld246.com/article/1716635371149
|
||||
} else if (endIndex < innerText.length) {
|
||||
|
|
Loading…
Add table
Reference in a new issue