mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 08:30:12 +01:00
This commit is contained in:
parent
f788aa96e2
commit
3ae4585c0c
1 changed files with 26 additions and 23 deletions
|
|
@ -285,7 +285,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
if (selectElements.length > 0) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
} else {
|
||||
const start = getSelectionOffset(nodeElement, editorElement, range).start;
|
||||
if (start !== 0) {
|
||||
const editElement = getContenteditableElement(nodeElement);
|
||||
|
|
@ -299,6 +299,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
range.collapse(true);
|
||||
hideElements(["toolbar"], protyle);
|
||||
if (selectElements.length === 0) {
|
||||
|
|
@ -332,7 +333,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
if (selectElements.length > 0) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
}
|
||||
} else {
|
||||
const editElement = getContenteditableElement(nodeElement);
|
||||
const end = getSelectionOffset(nodeElement, editorElement, range).end;
|
||||
if (end < editElement.textContent.length) {
|
||||
|
|
@ -345,6 +346,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
range.collapse(false);
|
||||
hideElements(["toolbar"], protyle);
|
||||
const selectLastElement = selectElements[selectElements.length - 1];
|
||||
|
|
@ -985,6 +987,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select").forEach(item => {
|
||||
item.classList.remove("protyle-wysiwyg--select");
|
||||
});
|
||||
range.collapse(false);
|
||||
nodeElement.classList.add("protyle-wysiwyg--select");
|
||||
countBlockWord([nodeElement.getAttribute("data-node-id")]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue