Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/17613

Vanessabce0d55990e3
diff --git a/app/src/protyle/wysiwyg/getBlock.ts b/app/src/protyle/wysiwyg/getBlock.ts
index 3cb81d851c..96ca39d461 100644
--- a/app/src/protyle/wysiwyg/getBlock.ts
+++ b/app/src/protyle/wysiwyg/getBlock.ts
@@ -83,7 +83,7 @@ export const getContenteditableElement = (element: Element): Element => {
return element;
}
if (element.classList.contains("protyle-title__input")) {
- return element;
+ return element;
}
let blockElement = element;
if (!blockElement.getAttribute("data-node-id")) {
@@ -252,6 +252,9 @@ export const isEndOfBlock = (range: Range) => {
if (hasNextSibling(nextSibling)) {
return false;
} else {
+ if (nextSibling.nodeType === 1 && (nextSibling as Element).classList.contains("emoji") && range.endOffset === 0) {
+ return false;
+ }
if (nextSibling.parentElement.getAttribute("spellcheck")) {
return true;
}
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index 24933b682b..9c713b9299 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -717,6 +717,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
// 页面向左箭头丢失焦点 https://github.com/siyuan-note/siyuan/issues/2768
const firstEditElement = getContenteditableElement(nodeElement);
if (firstEditElement && !nodeElement.classList.contains("table") &&
+ range.startOffset === 0 && range.collapsed &&
getSelectionOffset(firstEditElement, undefined, range).start === 0) {
event.stopPropagation();
event.preventDefault();
@@ -2035,7 +2036,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
}
const nodeEditableElement = getContenteditableElement(nodeElement);
const position = getSelectionOffset(nodeEditableElement, protyle.wysiwyg.element, range);
- if (position.start === 0 && event.key === "ArrowLeft" && !isIncludesHotKey("⌥⇧←")) {
+ if (position.start === 0 && range.startOffset === 0 && event.key === "ArrowLeft" && !isIncludesHotKey("⌥⇧←")) {
event.preventDefault();
event.stopPropagation();
return;