mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-27 03:48:48 +01:00
This commit is contained in:
parent
e108d10647
commit
d1ed86efe7
2 changed files with 17 additions and 7 deletions
|
|
@ -631,7 +631,7 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
|
|||
label: window.siyuan.languages.copy,
|
||||
icon: "iconCopy",
|
||||
click() {
|
||||
writeText(protyle.lute.BlockDOM2StdMd(element.outerHTML));
|
||||
writeText(protyle.lute.BlockDOM2StdMd(element.outerHTML).trim());
|
||||
}
|
||||
}).element);
|
||||
if (!protyle.disabled) {
|
||||
|
|
|
|||
|
|
@ -398,12 +398,22 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
|
|||
// 编辑器内部粘贴
|
||||
const tempElement = document.createElement("div");
|
||||
tempElement.innerHTML = siyuanHTML;
|
||||
if (tempElement.childElementCount === 1 && ((tempElement.firstElementChild as HTMLElement).dataset?.type || "").split(" ").includes("block-ref")) {
|
||||
protyle.toolbar.setInlineMark(protyle, "block-ref", "range", {
|
||||
type: "id",
|
||||
color: `${(tempElement.firstElementChild as HTMLElement).dataset.id}${Constants.ZWSP}s${Constants.ZWSP}${range.toString()}`
|
||||
});
|
||||
return;
|
||||
if (tempElement.childElementCount === 1) {
|
||||
const types = ((tempElement.firstElementChild as HTMLElement).dataset?.type || "").split(" ")
|
||||
if(types.includes("block-ref")) {
|
||||
protyle.toolbar.setInlineMark(protyle, "block-ref", "range", {
|
||||
type: "id",
|
||||
color: `${(tempElement.firstElementChild as HTMLElement).dataset.id}${Constants.ZWSP}s${Constants.ZWSP}${range.toString()}`
|
||||
});
|
||||
return;
|
||||
}
|
||||
if(types.includes("a")) {
|
||||
protyle.toolbar.setInlineMark(protyle, "a", "range", {
|
||||
type: "a",
|
||||
color: `${(tempElement.firstElementChild as HTMLElement).dataset.href}${Constants.ZWSP}${range.toString()}`
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
let isBlock = false;
|
||||
tempElement.querySelectorAll("[data-node-id]").forEach((e) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue