mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-04 07:48:49 +01:00
This commit is contained in:
parent
8094e28b13
commit
69cc3bd361
2 changed files with 9 additions and 0 deletions
|
|
@ -608,6 +608,7 @@ export class Toolbar {
|
|||
if (newNodes.length === 1 && newNodes[0].textContent === Constants.ZWSP) {
|
||||
this.range.setStart(newNodes[0], 1);
|
||||
this.range.collapse(true);
|
||||
keepZWPS = false;
|
||||
}
|
||||
if (!keepZWPS) {
|
||||
// 合并元素
|
||||
|
|
@ -693,6 +694,12 @@ export class Toolbar {
|
|||
currentNode = hasNextSibling(newNodes[i - 1]) as HTMLElement;
|
||||
}
|
||||
if (!currentNode) {
|
||||
if (previousElement.nodeType !== 3) {
|
||||
const currentType = (previousElement.getAttribute("data-type") || "").split(" ");
|
||||
if (currentType.includes("code") || currentType.includes("tag") || currentType.includes("kbd")) {
|
||||
previousElement.insertAdjacentText("afterend", Constants.ZWSP);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (currentNode.nodeType === 3) {
|
||||
|
|
|
|||
|
|
@ -972,6 +972,8 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
if (position.start === 2 && inlineElement &&
|
||||
getSelectionOffset(inlineElement, protyle.wysiwyg.element, range).start === 1 &&
|
||||
inlineElement.innerText.startsWith(Constants.ZWSP) &&
|
||||
// 7.1 ctrl+g 后删除 https://github.com/siyuan-note/siyuan/issues/14290#issuecomment-2867478746
|
||||
inlineElement.innerText !== Constants.ZWSP &&
|
||||
// 需排除行内代码前有一个字符的情况
|
||||
editElement.innerText.startsWith(Constants.ZWSP)) {
|
||||
focusBlock(nodeElement);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue