An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:iphone: 点击底部键盘不弹起
Vanessabbf4faf496e7
diff --git a/app/src/protyle/ui/initUI.ts b/app/src/protyle/ui/initUI.tsindex 8c03024cd0..1ab9fbe9e6 100644--- a/app/src/protyle/ui/initUI.ts+++ b/app/src/protyle/ui/initUI.ts@@ -128,60 +128,58 @@ export const initUI = (protyle: IProtyle) => {(!event.target.classList.contains("protyle-content") && !event.target.classList.contains("protyle-wysiwyg"))) {return;}- // 选中最后一个块末尾点击底部时,range 会有值,需等待- setTimeout(() => {- // 选中文本禁止添加空块 https://github.com/siyuan-note/siyuan/issues/13905- if (window.getSelection().rangeCount > 0) {- const currentRange = window.getSelection().getRangeAt(0);- if (currentRange.toString() !== "" && protyle.wysiwyg.element.contains(currentRange.startContainer)) {- return;- }+ // https://github.com/siyuan-note/siyuan/issues/14190 选中最后一个块末尾点击底部时,range 会有值,需使用 setTimeout,最新测试无需 setTimeout 了,且会影响移动端键盘弹起故移除+ // 选中文本禁止添加空块 https://github.com/siyuan-note/siyuan/issues/13905+ if (window.getSelection().rangeCount > 0) {+ const currentRange = window.getSelection().getRangeAt(0);+ if (currentRange.toString() !== "" && protyle.wysiwyg.element.contains(currentRange.startContainer)) {+ return;}- const lastElement = protyle.wysiwyg.element.lastElementChild;- const lastRect = lastElement.getBoundingClientRect();- const range = document.createRange();- if (event.y > lastRect.bottom) {- const lastEditElement = getContenteditableElement(getLastBlock(lastElement));- if (!protyle.options.click.preventInsetEmptyBlock && (- !lastEditElement ||- (lastElement.getAttribute("data-type") !== "NodeParagraph" && protyle.wysiwyg.element.getAttribute("data-doc-type") !== "NodeListItem") ||- (lastElement.getAttribute("data-type") === "NodeParagraph" && getContenteditableElement(lastEditElement).innerHTML !== ""))- ) {- let emptyElement: Element;- if (lastElement.getAttribute("data-type") === "NodeHeading" && lastElement.getAttribute("fold") === "1") {- emptyElement = genHeadingElement(lastElement) as Element;- } else {- emptyElement = genEmptyElement(false, false);- }- protyle.wysiwyg.element.insertAdjacentElement("beforeend", emptyElement);- transaction(protyle, [{- action: "insert",- data: emptyElement.outerHTML,- id: emptyElement.getAttribute("data-node-id"),- previousID: emptyElement.previousElementSibling.getAttribute("data-node-id"),- parentID: protyle.block.parentID- }], [{- action: "delete",- id: emptyElement.getAttribute("data-node-id")- }]);- const emptyEditElement = getContenteditableElement(emptyElement) as HTMLInputElement;- range.selectNodeContents(emptyEditElement);- range.collapse(true);- focusByRange(range);- // 需等待 range 更新再次进行渲染- if (protyle.options.render.breadcrumb) {- setTimeout(() => {- protyle.breadcrumb.render(protyle);- }, Constants.TIMEOUT_TRANSITION);- }- } else if (lastEditElement) {- range.selectNodeContents(lastEditElement);- range.collapse(false);- focusByRange(range);+ }+ const lastElement = protyle.wysiwyg.element.lastElementChild;+ const lastRect = lastElement.getBoundingClientRect();+ const range = document.createRange();+ if (event.y > lastRect.bottom) {+ const lastEditElement = getContenteditableElement(getLastBlock(lastElement));+ if (!protyle.options.click.preventInsetEmptyBlock && (+ !lastEditElement ||+ (lastElement.getAttribute("data-type") !== "NodeParagraph" && protyle.wysiwyg.element.getAttribute("data-doc-type") !== "NodeListItem") ||+ (lastElement.getAttribute("data-type") === "NodeParagraph" && getContenteditableElement(lastEditElement).innerHTML !== ""))+ ) {+ let emptyElement: Element;+ if (lastElement.getAttribute("data-type") === "NodeHeading" && lastElement.getAttribute("fold") === "1") {+ emptyElement = genHeadingElement(lastElement) as Element;+ } else {+ emptyElement = genEmptyElement(false, false);}- protyle.toolbar.range = range;+ protyle.wysiwyg.element.insertAdjacentElement("beforeend", emptyElement);+ transaction(protyle, [{+ action: "insert",+ data: emptyElement.outerHTML,+ id: emptyElement.getAttribute("data-node-id"),+ previousID: emptyElement.previousElementSibling.getAttribute("data-node-id"),+ parentID: protyle.block.parentID+ }], [{+ action: "delete",+ id: emptyElement.getAttribute("data-node-id")+ }]);+ const emptyEditElement = getContenteditableElement(emptyElement) as HTMLInputElement;+ range.selectNodeContents(emptyEditElement);+ range.collapse(true);+ focusByRange(range);+ // 需等待 range 更新再次进行渲染+ if (protyle.options.render.breadcrumb) {+ setTimeout(() => {+ protyle.breadcrumb.render(protyle);+ }, Constants.TIMEOUT_TRANSITION);+ }+ } else if (lastEditElement) {+ range.selectNodeContents(lastEditElement);+ range.collapse(false);+ focusByRange(range);}- });+ protyle.toolbar.range = range;+ }});let overAttr = false;const isTouch = isTouchDevice();