diff --git a/app/src/mobile/menu/search.ts b/app/src/mobile/menu/search.ts index 447e74b00..6c691c64b 100644 --- a/app/src/mobile/menu/search.ts +++ b/app/src/mobile/menu/search.ts @@ -350,7 +350,7 @@ const initSearchEvent = (element: Element, config: ISearchOption) => { event.stopPropagation(); event.preventDefault(); break; - } else if (type === "include" && !target.hasAttribute("disabled")){ + } else if (type === "include" && !target.hasAttribute("disabled")) { target.classList.toggle("toolbar__icon--active"); if (target.classList.contains("toolbar__icon--active")) { config.idPath.forEach((item, index) => { diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index f75fdf0b3..45d84dc15 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -185,6 +185,12 @@ export class WYSIWYG { /// #endif } + private emojiToMd(element:HTMLElement) { + element.querySelectorAll(".emoji").forEach((item: HTMLElement) => { + item.outerHTML = `:${item.getAttribute("alt")}:` + }) + } + private bindCommonEvent(protyle: IProtyle) { this.element.addEventListener("copy", (event: ClipboardEvent & { target: HTMLElement }) => { window.siyuan.ctrlIsPressed = false; // https://github.com/siyuan-note/siyuan/issues/6373 @@ -257,9 +263,11 @@ export class WYSIWYG { } else if (!["DIV", "TD", "TH", "TR"].includes(range.startContainer.parentElement.tagName)) { // 复制行内元素 https://github.com/siyuan-note/insider/issues/191 tempElement.append(range.startContainer.parentElement.cloneNode(true)); + this.emojiToMd(tempElement) } else { // 直接复制块 https://github.com/siyuan-note/insider/issues/318 tempElement.append(range.cloneContents()); + this.emojiToMd(tempElement) } html = tempElement.innerHTML; } else if (selectImgElement) { @@ -281,6 +289,7 @@ export class WYSIWYG { html = spanElement.outerHTML; } else { tempElement.append(range.cloneContents()); + this.emojiToMd(tempElement) const inlineMathElement = hasClosestByAttribute(range.commonAncestorContainer, "data-type", "inline-math"); if (inlineMathElement) { // 表格内复制数学公式 https://ld246.com/article/1631708573504 @@ -1140,6 +1149,7 @@ export class WYSIWYG { } } } + this.emojiToMd(tempElement); html = tempElement.innerHTML; // https://github.com/siyuan-note/siyuan/issues/4321 if (!nodeElement.classList.contains("table")) {