This commit is contained in:
parent
a2c3c8c56f
commit
42c061b118
3 changed files with 12 additions and 4 deletions
|
@ -442,11 +442,18 @@ ${unicode2Emoji(emoji.unicode, true)}</button>`;
|
|||
range.insertNode(document.createElement("wbr"));
|
||||
html = nodeElement.outerHTML;
|
||||
range.deleteContents();
|
||||
const tempElement = document.createElement("template");
|
||||
let tempElement = document.createElement("div");
|
||||
tempElement.innerHTML = value.replace(/<mark>/g, "").replace(/<\/mark>/g, "");
|
||||
range.insertNode(tempElement.content.cloneNode(true));
|
||||
tempElement = tempElement.firstChild as HTMLDivElement;
|
||||
range.insertNode(tempElement);
|
||||
range.setStart(tempElement.firstChild, 0);
|
||||
range.setEnd(tempElement.lastChild, tempElement.lastChild.textContent.length);
|
||||
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
||||
focusByWbr(nodeElement, range);
|
||||
const wbrElement = nodeElement.querySelector("wbr");
|
||||
if (wbrElement) {
|
||||
wbrElement.remove();
|
||||
}
|
||||
focusByRange(range);
|
||||
return;
|
||||
} else if (this.splitChar === ":") {
|
||||
addEmoji(value);
|
||||
|
|
|
@ -54,7 +54,7 @@ export const insertHTML = (html: string, protyle: IProtyle, isBlock = false) =>
|
|||
if (inlineMathElement) {
|
||||
// 表格内选中数学公式 https://ld246.com/article/1631708573504
|
||||
inlineMathElement.remove();
|
||||
} else if (range.startContainer.nodeType === 3 && range.startContainer.parentElement.getAttribute("data-type").indexOf("block-ref")>-1) {
|
||||
} else if (range.startContainer.nodeType === 3 && range.startContainer.parentElement.getAttribute("data-type")?.indexOf("block-ref")>-1) {
|
||||
// ref 选中处理 https://ld246.com/article/1629214377537
|
||||
range.startContainer.parentElement.remove();
|
||||
// 选中 ref**bbb** 后 alt+[
|
||||
|
|
|
@ -503,6 +503,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
if (!event.altKey && !event.shiftKey && !isCtrl(event) && (event.key.indexOf("Arrow") > -1 || event.key === "Enter") &&
|
||||
!protyle.hint.element.classList.contains("fn__none") && protyle.hint.select(event, protyle)) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
if (matchHotKey("⌘/", event)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue