mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 01:20:12 +01:00
🚨
This commit is contained in:
parent
0e23e2c04b
commit
574a98f5d0
10 changed files with 25 additions and 32 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
import {getRandom, isMobile} from "../util/functions";
|
import {getRandom, isMobile} from "../util/functions";
|
||||||
import {setPosition} from "../util/setPosition";
|
|
||||||
import {fetchPost} from "../util/fetch";
|
import {fetchPost} from "../util/fetch";
|
||||||
import {hasClosestByClassName} from "../protyle/util/hasClosest";
|
import {hasClosestByClassName} from "../protyle/util/hasClosest";
|
||||||
import {Constants} from "../constants";
|
import {Constants} from "../constants";
|
||||||
|
|
@ -200,7 +199,7 @@ export const openEmojiPanel = (id: string, target: HTMLElement, isNotebook = fal
|
||||||
</div>`;
|
</div>`;
|
||||||
window.siyuan.menus.menu.element.firstElementChild.querySelector(".emojis__item").classList.add("emojis__item--current");
|
window.siyuan.menus.menu.element.firstElementChild.querySelector(".emojis__item").classList.add("emojis__item--current");
|
||||||
const rect = target.getBoundingClientRect();
|
const rect = target.getBoundingClientRect();
|
||||||
window.siyuan.menus.menu.popup({x: rect.left, y: rect.top + rect.height})
|
window.siyuan.menus.menu.popup({x: rect.left, y: rect.top + rect.height});
|
||||||
const inputElement = window.siyuan.menus.menu.element.querySelector(".b3-text-field") as HTMLInputElement;
|
const inputElement = window.siyuan.menus.menu.element.querySelector(".b3-text-field") as HTMLInputElement;
|
||||||
const emojisContentElement = window.siyuan.menus.menu.element.querySelector(".emojis__panel");
|
const emojisContentElement = window.siyuan.menus.menu.element.querySelector(".emojis__panel");
|
||||||
inputElement.addEventListener("compositionend", () => {
|
inputElement.addEventListener("compositionend", () => {
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import {fetchPost} from "../util/fetch";
|
||||||
import {hideMessage, showMessage} from "../dialog/message";
|
import {hideMessage, showMessage} from "../dialog/message";
|
||||||
import {Dialog} from "../dialog";
|
import {Dialog} from "../dialog";
|
||||||
import {focusBlock, focusByRange, getEditorRange} from "../protyle/util/selection";
|
import {focusBlock, focusByRange, getEditorRange} from "../protyle/util/selection";
|
||||||
import {setPosition} from "../util/setPosition";
|
|
||||||
import {updateTransaction} from "../protyle/wysiwyg/transaction";
|
import {updateTransaction} from "../protyle/wysiwyg/transaction";
|
||||||
/// #if !MOBILE
|
/// #if !MOBILE
|
||||||
import {getAllModels} from "../layout/getAll";
|
import {getAllModels} from "../layout/getAll";
|
||||||
|
|
@ -267,7 +266,7 @@ export const openFileAttr = (attrs: IObject, id: string, focusName = "bookmark")
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
window.siyuan.menus.menu.element.style.zIndex = "310";
|
window.siyuan.menus.menu.element.style.zIndex = "310";
|
||||||
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY + 16})
|
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY + 16});
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -466,7 +465,7 @@ export const openAttr = (nodeElement: Element, protyle: IProtyle, focusName = "b
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
window.siyuan.menus.menu.element.style.zIndex = "310";
|
window.siyuan.menus.menu.element.style.zIndex = "310";
|
||||||
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY + 16})
|
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY + 16});
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
||||||
x: rect.left,
|
x: rect.left,
|
||||||
y: rect.top + 13,
|
y: rect.top + 13,
|
||||||
h: 26
|
h: 26
|
||||||
})
|
});
|
||||||
window.siyuan.menus.menu.element.querySelector("input").select();
|
window.siyuan.menus.menu.element.querySelector("input").select();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -771,7 +771,7 @@ export const linkMenu = (protyle: IProtyle, linkElement: HTMLElement, focusText
|
||||||
x: rect.left,
|
x: rect.left,
|
||||||
y: rect.top + 13,
|
y: rect.top + 13,
|
||||||
h: 26
|
h: 26
|
||||||
})
|
});
|
||||||
if (focusText || protyle.lute.IsValidLinkDest(linkAddress)) {
|
if (focusText || protyle.lute.IsValidLinkDest(linkAddress)) {
|
||||||
window.siyuan.menus.menu.element.querySelectorAll("input")[1].select();
|
window.siyuan.menus.menu.element.querySelectorAll("input")[1].select();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,6 @@ import {
|
||||||
import {removeBlock} from "../wysiwyg/remove";
|
import {removeBlock} from "../wysiwyg/remove";
|
||||||
import {focusBlock, focusByRange, getEditorRange} from "../util/selection";
|
import {focusBlock, focusByRange, getEditorRange} from "../util/selection";
|
||||||
import {hideElements} from "../ui/hideElements";
|
import {hideElements} from "../ui/hideElements";
|
||||||
import {setPosition} from "../../util/setPosition";
|
|
||||||
import {processRender} from "../util/processCode";
|
import {processRender} from "../util/processCode";
|
||||||
import {highlightRender} from "../markdown/highlightRender";
|
import {highlightRender} from "../markdown/highlightRender";
|
||||||
import {blockRender} from "../markdown/blockRender";
|
import {blockRender} from "../markdown/blockRender";
|
||||||
|
|
@ -170,7 +169,7 @@ export class Gutter {
|
||||||
openAttr(protyle.wysiwyg.element.querySelector(`[data-node-id="${id}"]`), protyle);
|
openAttr(protyle.wysiwyg.element.querySelector(`[data-node-id="${id}"]`), protyle);
|
||||||
} else {
|
} else {
|
||||||
this.renderMenu(protyle, buttonElement);
|
this.renderMenu(protyle, buttonElement);
|
||||||
window.siyuan.menus.menu.popup({x: event.clientX - 16, y: event.clientY - 16}, true)
|
window.siyuan.menus.menu.popup({x: event.clientX - 16, y: event.clientY - 16}, true);
|
||||||
// https://ld246.com/article/1648433751993
|
// https://ld246.com/article/1648433751993
|
||||||
if (!protyle.toolbar.range) {
|
if (!protyle.toolbar.range) {
|
||||||
protyle.toolbar.range = getEditorRange(protyle.wysiwyg.element.firstElementChild);
|
protyle.toolbar.range = getEditorRange(protyle.wysiwyg.element.firstElementChild);
|
||||||
|
|
@ -185,7 +184,7 @@ export class Gutter {
|
||||||
}
|
}
|
||||||
if (!window.siyuan.ctrlIsPressed && !window.siyuan.altIsPressed && !window.siyuan.shiftIsPressed) {
|
if (!window.siyuan.ctrlIsPressed && !window.siyuan.altIsPressed && !window.siyuan.shiftIsPressed) {
|
||||||
this.renderMenu(protyle, buttonElement);
|
this.renderMenu(protyle, buttonElement);
|
||||||
window.siyuan.menus.menu.popup({x: event.clientX - 16, y: event.clientY - 16}, true)
|
window.siyuan.menus.menu.popup({x: event.clientX - 16, y: event.clientY - 16}, true);
|
||||||
}
|
}
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import {uploadFiles} from "../upload";
|
||||||
import {fetchPost} from "../../util/fetch";
|
import {fetchPost} from "../../util/fetch";
|
||||||
import {getRandomEmoji, openEmojiPanel, unicode2Emoji, updateFileTreeEmoji, updateOutlineEmoji} from "../../emoji";
|
import {getRandomEmoji, openEmojiPanel, unicode2Emoji, updateFileTreeEmoji, updateOutlineEmoji} from "../../emoji";
|
||||||
import {upDownHint} from "../../util/upDownHint";
|
import {upDownHint} from "../../util/upDownHint";
|
||||||
import {setPosition} from "../../util/setPosition";
|
|
||||||
/// #if !MOBILE
|
/// #if !MOBILE
|
||||||
import {openGlobalSearch} from "../../search/util";
|
import {openGlobalSearch} from "../../search/util";
|
||||||
/// #endif
|
/// #endif
|
||||||
|
|
@ -423,7 +422,7 @@ export class Background {
|
||||||
this.addTags(listItemElement.textContent);
|
this.addTags(listItemElement.textContent);
|
||||||
});
|
});
|
||||||
const rect = this.iconElement.nextElementSibling.getBoundingClientRect();
|
const rect = this.iconElement.nextElementSibling.getBoundingClientRect();
|
||||||
window.siyuan.menus.menu.popup({x: rect.left, y: rect.top + rect.height})
|
window.siyuan.menus.menu.popup({x: rect.left, y: rect.top + rect.height});
|
||||||
inputElement.focus();
|
inputElement.focus();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import {openBacklink, openGraph, openOutline} from "../../layout/dock/util";
|
||||||
import {setTitle} from "../../dialog/processSystem";
|
import {setTitle} from "../../dialog/processSystem";
|
||||||
import {getNoContainerElement} from "../wysiwyg/getBlock";
|
import {getNoContainerElement} from "../wysiwyg/getBlock";
|
||||||
import {commonHotkey} from "../wysiwyg/commonHotkey";
|
import {commonHotkey} from "../wysiwyg/commonHotkey";
|
||||||
import {setPosition} from "../../util/setPosition";
|
|
||||||
import {code160to32} from "../util/code160to32";
|
import {code160to32} from "../util/code160to32";
|
||||||
import {deleteFile} from "../../editor/deleteFile";
|
import {deleteFile} from "../../editor/deleteFile";
|
||||||
|
|
||||||
|
|
@ -192,7 +191,7 @@ export class Title {
|
||||||
focusByRange(range);
|
focusByRange(range);
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY})
|
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY});
|
||||||
});
|
});
|
||||||
this.element.querySelector(".protyle-attr").addEventListener("click", (event: MouseEvent & { target: HTMLElement }) => {
|
this.element.querySelector(".protyle-attr").addEventListener("click", (event: MouseEvent & { target: HTMLElement }) => {
|
||||||
fetchPost("/api/block/getDocInfo", {
|
fetchPost("/api/block/getDocInfo", {
|
||||||
|
|
|
||||||
|
|
@ -289,7 +289,7 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
|
||||||
}, (response) => {
|
}, (response) => {
|
||||||
let searchHTML = "";
|
let searchHTML = "";
|
||||||
if (response.data.newDoc) {
|
if (response.data.newDoc) {
|
||||||
const blockRefText = `((newFile "${oldValue}"${Constants.ZWSP}'${response.data.k}${Lute.Caret}'))`
|
const blockRefText = `((newFile "${oldValue}"${Constants.ZWSP}'${response.data.k}${Lute.Caret}'))`;
|
||||||
searchHTML += `<button class="b3-list-item b3-list-item--two fn__block${response.data.blocks.length === 0 ? " b3-list-item--focus" : ""}" data-value="${encodeURIComponent(blockRefText)}"><div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconFile"></use></svg>
|
searchHTML += `<button class="b3-list-item b3-list-item--two fn__block${response.data.blocks.length === 0 ? " b3-list-item--focus" : ""}" data-value="${encodeURIComponent(blockRefText)}"><div class="b3-list-item__first"><svg class="b3-list-item__graphic"><use xlink:href="#iconFile"></use></svg>
|
||||||
<span class="b3-list-item__text">${window.siyuan.languages.newFile} <mark>${response.data.k}</mark></span></div></button>`;
|
<span class="b3-list-item__text">${window.siyuan.languages.newFile} <mark>${response.data.k}</mark></span></div></button>`;
|
||||||
}
|
}
|
||||||
|
|
@ -308,7 +308,7 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
|
||||||
if (attrHTML) {
|
if (attrHTML) {
|
||||||
attrHTML = `<div class="fn__flex b3-list-item__meta" style="line-height: 1">${attrHTML}</div>`;
|
attrHTML = `<div class="fn__flex b3-list-item__meta" style="line-height: 1">${attrHTML}</div>`;
|
||||||
}
|
}
|
||||||
const blockRefHTML = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${oldValue}</span>`
|
const blockRefHTML = `<span data-type="block-ref" data-id="${item.id}" data-subtype="s">${oldValue}</span>`;
|
||||||
searchHTML += `<button class="b3-list-item b3-list-item--two fn__block${index === 0 ? " b3-list-item--focus" : ""}" data-value="${encodeURIComponent(blockRefHTML)}">${attrHTML}<div class="b3-list-item__first">
|
searchHTML += `<button class="b3-list-item b3-list-item--two fn__block${index === 0 ? " b3-list-item--focus" : ""}" data-value="${encodeURIComponent(blockRefHTML)}">${attrHTML}<div class="b3-list-item__first">
|
||||||
<svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${iconName}"></use></svg>
|
<svg class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${iconName}"></use></svg>
|
||||||
<span class="b3-list-item__text">${item.content}</span>
|
<span class="b3-list-item__text">${item.content}</span>
|
||||||
|
|
@ -413,7 +413,7 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
|
||||||
// 新建文件
|
// 新建文件
|
||||||
if (Constants.BLOCK_HINT_KEYS.includes(this.splitChar) && value.startsWith("((newFile ") && value.endsWith(`${Lute.Caret}'))`)) {
|
if (Constants.BLOCK_HINT_KEYS.includes(this.splitChar) && value.startsWith("((newFile ") && value.endsWith(`${Lute.Caret}'))`)) {
|
||||||
focusByRange(range);
|
focusByRange(range);
|
||||||
const fileNames = value.substring(11, value.length - 4).split(`"${Constants.ZWSP}'`)
|
const fileNames = value.substring(11, value.length - 4).split(`"${Constants.ZWSP}'`);
|
||||||
const realFileName = fileNames.length === 1 ? fileNames[0] : fileNames[1];
|
const realFileName = fileNames.length === 1 ? fileNames[0] : fileNames[1];
|
||||||
getSavePath(protyle.path, protyle.notebookId, (pathString) => {
|
getSavePath(protyle.path, protyle.notebookId, (pathString) => {
|
||||||
fetchPost("/api/filetree/createDocWithMd", {
|
fetchPost("/api/filetree/createDocWithMd", {
|
||||||
|
|
@ -421,9 +421,9 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
|
||||||
path: pathPosix().join(pathString, realFileName),
|
path: pathPosix().join(pathString, realFileName),
|
||||||
markdown: ""
|
markdown: ""
|
||||||
}, response => {
|
}, response => {
|
||||||
let blockRefHTML = `<span data-type="block-ref" data-id="${response.data}" data-subtype="d">${escapeHtml(realFileName)}</span>`
|
let blockRefHTML = `<span data-type="block-ref" data-id="${response.data}" data-subtype="d">${escapeHtml(realFileName)}</span>`;
|
||||||
if (fileNames.length === 2) {
|
if (fileNames.length === 2) {
|
||||||
blockRefHTML = `<span data-type="block-ref" data-id="${response.data}" data-subtype="s">${escapeHtml(fileNames[0])}</span>`
|
blockRefHTML = `<span data-type="block-ref" data-id="${response.data}" data-subtype="s">${escapeHtml(fileNames[0])}</span>`;
|
||||||
}
|
}
|
||||||
insertHTML(genEmptyBlock(false, false, blockRefHTML), protyle);
|
insertHTML(genEmptyBlock(false, false, blockRefHTML), protyle);
|
||||||
});
|
});
|
||||||
|
|
@ -605,7 +605,7 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
|
||||||
window.siyuan.menus.menu.popup({
|
window.siyuan.menus.menu.popup({
|
||||||
x: rect.left,
|
x: rect.left,
|
||||||
y: rect.top
|
y: rect.top
|
||||||
}, true)
|
}, true);
|
||||||
window.siyuan.menus.menu.element.querySelector('[data-id="assetSubMenu"]').classList.add("b3-menu__item--show");
|
window.siyuan.menus.menu.element.querySelector('[data-id="assetSubMenu"]').classList.add("b3-menu__item--show");
|
||||||
window.siyuan.menus.menu.element.querySelectorAll("input")[0].focus();
|
window.siyuan.menus.menu.element.querySelectorAll("input")[0].focus();
|
||||||
} else if (value === "---") {
|
} else if (value === "---") {
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,6 @@ import {keydown} from "./keydown";
|
||||||
import {openMobileFileById} from "../../mobile/editor";
|
import {openMobileFileById} from "../../mobile/editor";
|
||||||
import {removeBlock} from "./remove";
|
import {removeBlock} from "./remove";
|
||||||
import {highlightRender} from "../markdown/highlightRender";
|
import {highlightRender} from "../markdown/highlightRender";
|
||||||
import {setPosition} from "../../util/setPosition";
|
|
||||||
import {openAttr} from "../../menus/commonMenuItem";
|
import {openAttr} from "../../menus/commonMenuItem";
|
||||||
import {blockRender} from "../markdown/blockRender";
|
import {blockRender} from "../markdown/blockRender";
|
||||||
/// #if !MOBILE
|
/// #if !MOBILE
|
||||||
|
|
@ -427,7 +426,7 @@ export class WYSIWYG {
|
||||||
// 多选块
|
// 多选块
|
||||||
hideElements(["util"], protyle);
|
hideElements(["util"], protyle);
|
||||||
protyle.gutter.renderMenu(protyle, selectElements[0]);
|
protyle.gutter.renderMenu(protyle, selectElements[0]);
|
||||||
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY})
|
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const target = event.target as HTMLElement;
|
const target = event.target as HTMLElement;
|
||||||
|
|
@ -437,7 +436,7 @@ export class WYSIWYG {
|
||||||
focusSideBlock(embedElement);
|
focusSideBlock(embedElement);
|
||||||
}
|
}
|
||||||
protyle.gutter.renderMenu(protyle, embedElement);
|
protyle.gutter.renderMenu(protyle, embedElement);
|
||||||
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY})
|
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (protyle.disabled) {
|
if (protyle.disabled) {
|
||||||
|
|
@ -484,7 +483,7 @@ export class WYSIWYG {
|
||||||
(isMobile() || beforeContextmenuRange && nodeElement.contains(beforeContextmenuRange.startContainer))) {
|
(isMobile() || beforeContextmenuRange && nodeElement.contains(beforeContextmenuRange.startContainer))) {
|
||||||
if (!isMobile() || protyle.toolbar?.element.classList.contains("fn__none")) {
|
if (!isMobile() || protyle.toolbar?.element.classList.contains("fn__none")) {
|
||||||
contentMenu(protyle, nodeElement);
|
contentMenu(protyle, nodeElement);
|
||||||
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY + 13, h: 26})
|
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY + 13, h: 26});
|
||||||
protyle.toolbar?.element.classList.add("fn__none");
|
protyle.toolbar?.element.classList.add("fn__none");
|
||||||
if (nodeElement.classList.contains("table")) {
|
if (nodeElement.classList.contains("table")) {
|
||||||
nodeElement.querySelector("table").classList.remove("select");
|
nodeElement.querySelector("table").classList.remove("select");
|
||||||
|
|
@ -494,7 +493,7 @@ export class WYSIWYG {
|
||||||
} else if (protyle.toolbar.range.toString() === "") {
|
} else if (protyle.toolbar.range.toString() === "") {
|
||||||
hideElements(["util"], protyle);
|
hideElements(["util"], protyle);
|
||||||
protyle.gutter.renderMenu(protyle, nodeElement);
|
protyle.gutter.renderMenu(protyle, nodeElement);
|
||||||
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY})
|
window.siyuan.menus.menu.popup({x: event.clientX, y: event.clientY});
|
||||||
protyle.toolbar?.element.classList.add("fn__none");
|
protyle.toolbar?.element.classList.add("fn__none");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1132,7 +1131,7 @@ export class WYSIWYG {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
window.siyuan.menus.menu.popup({x: mouseUpEvent.clientX - 8, y: mouseUpEvent.clientY - 16})
|
window.siyuan.menus.menu.popup({x: mouseUpEvent.clientX - 8, y: mouseUpEvent.clientY - 16});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1570,7 +1569,7 @@ export class WYSIWYG {
|
||||||
window.siyuan.menus.menu.popup({
|
window.siyuan.menus.menu.popup({
|
||||||
x: rect.left,
|
x: rect.left,
|
||||||
y: rect.top
|
y: rect.top
|
||||||
}, true)
|
}, true);
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
return;
|
return;
|
||||||
|
|
@ -1662,7 +1661,7 @@ export class WYSIWYG {
|
||||||
window.siyuan.menus.menu.popup({
|
window.siyuan.menus.menu.popup({
|
||||||
x: event.clientX - 16,
|
x: event.clientX - 16,
|
||||||
y: event.clientY - 16
|
y: event.clientY - 16
|
||||||
}, true)
|
}, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,6 @@ import {openBy, openFileById} from "../../editor/util";
|
||||||
import {commonHotkey} from "./commonHotkey";
|
import {commonHotkey} from "./commonHotkey";
|
||||||
/// #endif
|
/// #endif
|
||||||
import {linkMenu, refMenu, setFold, zoomOut} from "../../menus/protyle";
|
import {linkMenu, refMenu, setFold, zoomOut} from "../../menus/protyle";
|
||||||
import {setPosition} from "../../util/setPosition";
|
|
||||||
import {removeEmbed} from "./removeEmbed";
|
import {removeEmbed} from "./removeEmbed";
|
||||||
import {openAttr} from "../../menus/commonMenuItem";
|
import {openAttr} from "../../menus/commonMenuItem";
|
||||||
import {Constants} from "../../constants";
|
import {Constants} from "../../constants";
|
||||||
|
|
@ -541,7 +540,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
}
|
}
|
||||||
protyle.gutter.renderMenu(protyle, actionElement);
|
protyle.gutter.renderMenu(protyle, actionElement);
|
||||||
const rect = nodeElement.getBoundingClientRect();
|
const rect = nodeElement.getBoundingClientRect();
|
||||||
window.siyuan.menus.menu.popup({x: rect.left, y: rect.top}, true)
|
window.siyuan.menus.menu.popup({x: rect.left, y: rect.top}, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -665,7 +664,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
||||||
// 删除
|
// 删除
|
||||||
if (!event.altKey && !event.shiftKey && !isCtrl(event) && (event.key === "Backspace" || event.key === "Delete")) {
|
if (!event.altKey && !event.shiftKey && !isCtrl(event) && (event.key === "Backspace" || event.key === "Delete")) {
|
||||||
// https://github.com/siyuan-note/siyuan/issues/5547
|
// https://github.com/siyuan-note/siyuan/issues/5547
|
||||||
const previousSibling = hasPreviousSibling(range.startContainer) as HTMLElement
|
const previousSibling = hasPreviousSibling(range.startContainer) as HTMLElement;
|
||||||
if (range.startOffset === 1 && range.startContainer.textContent === Constants.ZWSP &&
|
if (range.startOffset === 1 && range.startContainer.textContent === Constants.ZWSP &&
|
||||||
previousSibling && previousSibling.nodeType !== 3 && previousSibling.classList.contains("img")) {
|
previousSibling && previousSibling.nodeType !== 3 && previousSibling.classList.contains("img")) {
|
||||||
previousSibling.classList.add("img--select");
|
previousSibling.classList.add("img--select");
|
||||||
|
|
|
||||||
|
|
@ -753,4 +753,4 @@ export const updateBatchTransaction = (nodeElements: Element[], protyle: IProtyl
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
transaction(protyle, operations, undoOperations);
|
transaction(protyle, operations, undoOperations);
|
||||||
}
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue