mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-26 17:04:07 +01:00
This commit is contained in:
parent
2231d089df
commit
8680611ed9
2 changed files with 11 additions and 1 deletions
|
|
@ -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) => {
|
||||
|
|
|
|||
|
|
@ -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")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue