mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-03 14:11:47 +01:00
🚨
This commit is contained in:
parent
a8f3b1762a
commit
b2ba9ace07
10 changed files with 33 additions and 36 deletions
|
|
@ -608,7 +608,7 @@ export class Gutter {
|
|||
html += item.outerHTML;
|
||||
});
|
||||
if (protyle.disabled) {
|
||||
html = getEnableHTML(html)
|
||||
html = getEnableHTML(html);
|
||||
}
|
||||
writeText(protyle.lute.BlockDOM2HTML(html));
|
||||
}
|
||||
|
|
@ -983,9 +983,9 @@ export class Gutter {
|
|||
}, {
|
||||
label: window.siyuan.languages.copy + " HTML",
|
||||
click() {
|
||||
let html = nodeElement.outerHTML
|
||||
let html = nodeElement.outerHTML;
|
||||
if (protyle.disabled) {
|
||||
html = getEnableHTML(html)
|
||||
html = getEnableHTML(html);
|
||||
}
|
||||
writeText(protyle.lute.BlockDOM2HTML(html));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import {highlightRender} from "../markdown/highlightRender";
|
|||
import {getContenteditableElement, hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";
|
||||
import {processRender} from "../util/processCode";
|
||||
import {BlockRef} from "./BlockRef";
|
||||
import {hintMoveBlock, hintRenderAssets, hintRenderTemplate, hintRenderWidget} from "../hint/extend";
|
||||
import {hintRenderAssets, hintRenderTemplate, hintRenderWidget} from "../hint/extend";
|
||||
import {blockRender} from "../markdown/blockRender";
|
||||
/// #if !BROWSER
|
||||
import {clipboard, nativeImage, NativeImage} from "electron";
|
||||
|
|
@ -33,8 +33,6 @@ import {isArrayEqual, isBrowser, isMobile} from "../../util/functions";
|
|||
import * as dayjs from "dayjs";
|
||||
import {insertEmptyBlock} from "../../block/util";
|
||||
import {matchHotKey} from "../util/hotKey";
|
||||
import {unicode2Emoji} from "../../emoji";
|
||||
import {escapeHtml} from "../../util/escape";
|
||||
import {hideElements} from "../ui/hideElements";
|
||||
import {renderAssetsPreview} from "../../asset/renderAssets";
|
||||
import {electronUndo} from "../undo";
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ const moveToNew = (protyle: IProtyle, sourceElements: Element[], targetElement:
|
|||
isSameDoc: boolean, isBottom: boolean, isCopy: boolean) => {
|
||||
let topSourceElement;
|
||||
const targetId = targetElement.getAttribute("data-node-id");
|
||||
const newSourceId = newSourceElement.getAttribute("data-node-id")
|
||||
const newSourceId = newSourceElement.getAttribute("data-node-id");
|
||||
const doOperations: IOperation[] = [];
|
||||
const undoOperations: IOperation[] = [];
|
||||
targetElement.insertAdjacentElement(isBottom ? "afterend" : "beforebegin", newSourceElement);
|
||||
|
|
@ -34,24 +34,24 @@ const moveToNew = (protyle: IProtyle, sourceElements: Element[], targetElement:
|
|||
data: newSourceElement.outerHTML,
|
||||
id: newSourceId,
|
||||
previousID: targetId,
|
||||
})
|
||||
});
|
||||
} else {
|
||||
doOperations.push({
|
||||
action: "insert",
|
||||
data: newSourceElement.outerHTML,
|
||||
id: newSourceId,
|
||||
nextID: targetId,
|
||||
})
|
||||
});
|
||||
}
|
||||
sourceElements.reverse().forEach((item, index) => {
|
||||
const itemId = item.getAttribute("data-node-id")
|
||||
const itemId = item.getAttribute("data-node-id");
|
||||
if (index === sourceElements.length - 1) {
|
||||
topSourceElement = getTopAloneElement(item);
|
||||
if (topSourceElement.isSameNode(item)) {
|
||||
topSourceElement = undefined;
|
||||
}
|
||||
}
|
||||
const copyId = Lute.NewNodeID()
|
||||
const copyId = Lute.NewNodeID();
|
||||
if (isCopy) {
|
||||
undoOperations.push({
|
||||
action: "delete",
|
||||
|
|
@ -119,7 +119,7 @@ const moveToNew = (protyle: IProtyle, sourceElements: Element[], targetElement:
|
|||
undoOperations,
|
||||
topSourceElement,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
const moveTo = async (protyle: IProtyle, sourceElements: Element[], targetElement: Element,
|
||||
isSameDoc: boolean, position: InsertPosition, isCopy: boolean) => {
|
||||
|
|
@ -147,8 +147,8 @@ const moveTo = async (protyle: IProtyle, sourceElements: Element[], targetElemen
|
|||
foldHeadingIds.push({id, parentID});
|
||||
}
|
||||
}
|
||||
let copyId
|
||||
let copyElement
|
||||
let copyId;
|
||||
let copyElement;
|
||||
if (isCopy) {
|
||||
copyId = Lute.NewNodeID();
|
||||
undoOperations.push({
|
||||
|
|
@ -262,7 +262,7 @@ const dragSb = async (protyle: IProtyle, sourceElements: Element[], targetElemen
|
|||
parentID: sbElement.parentElement.getAttribute("data-node-id") || protyle.block.parentID || protyle.block.rootID
|
||||
}];
|
||||
if (newSourceElement) {
|
||||
const newSourceId = newSourceElement.getAttribute("data-node-id")
|
||||
const newSourceId = newSourceElement.getAttribute("data-node-id");
|
||||
sbElement.insertAdjacentElement("afterbegin", targetElement);
|
||||
doOperations.push({
|
||||
action: "move",
|
||||
|
|
@ -293,7 +293,7 @@ const dragSb = async (protyle: IProtyle, sourceElements: Element[], targetElemen
|
|||
topSourceElement = undefined;
|
||||
}
|
||||
}
|
||||
const copyId = Lute.NewNodeID()
|
||||
const copyId = Lute.NewNodeID();
|
||||
if (isCopy) {
|
||||
undoOperations.push({
|
||||
action: "delete",
|
||||
|
|
@ -355,7 +355,7 @@ const dragSb = async (protyle: IProtyle, sourceElements: Element[], targetElemen
|
|||
topSourceElement = undefined;
|
||||
}
|
||||
}
|
||||
const copyId = Lute.NewNodeID()
|
||||
const copyId = Lute.NewNodeID();
|
||||
if (index === 0) {
|
||||
afterPreviousID = isCopy ? copyId : id;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -278,7 +278,7 @@ export class WYSIWYG {
|
|||
}
|
||||
}
|
||||
if (protyle.disabled) {
|
||||
html = getEnableHTML(html)
|
||||
html = getEnableHTML(html);
|
||||
}
|
||||
event.clipboardData.setData("text/plain", textPlain || protyle.lute.BlockDOM2StdMd(html).trimEnd());
|
||||
event.clipboardData.setData("text/html", html + Constants.ZWSP);
|
||||
|
|
|
|||
|
|
@ -23,4 +23,4 @@ export const getEnableHTML = (html: string) => {
|
|||
}
|
||||
});
|
||||
return tempElement.innerHTML;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue