This commit is contained in:
parent
54537af390
commit
21dd205fde
1 changed files with 18 additions and 1 deletions
|
@ -6,7 +6,7 @@ import {
|
|||
focusByWbr,
|
||||
getEditorRange,
|
||||
getSelectionOffset, getSelectionPosition,
|
||||
selectAll,
|
||||
selectAll, setFirstNodeRange,
|
||||
} from "../util/selection";
|
||||
import {
|
||||
hasClosestBlock,
|
||||
|
@ -860,6 +860,23 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
// https://github.com/siyuan-note/siyuan/issues/9690
|
||||
const inlineElement = hasClosestByMatchTag(range.startContainer, "SPAN")
|
||||
if (position.start === 2 && inlineElement &&
|
||||
getSelectionOffset(inlineElement, protyle.wysiwyg.element, range).start === 1 &&
|
||||
inlineElement.textContent.startsWith(Constants.ZWSP)) {
|
||||
focusBlock(nodeElement);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
if (position.start === 1 && !inlineElement && editElement.textContent.startsWith(Constants.ZWSP)) {
|
||||
setFirstNodeRange(editElement, range);
|
||||
removeBlock(protyle, nodeElement, range);
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (nodeElement.classList.contains("code-block") && getContenteditableElement(nodeElement).textContent === "\n") {
|
||||
// 空代码块全选删除异常 https://github.com/siyuan-note/siyuan/issues/6706
|
||||
|
|
Loading…
Add table
Reference in a new issue