mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-07-03 14:09:06 +02:00
This commit is contained in:
@@ -472,10 +472,6 @@
|
||||
animation: scale 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
[data-type="backslash"] span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div[data-type="NodeMathBlock"] {
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
|
||||
@@ -339,20 +339,12 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
|
||||
selectsElement.forEach(item => {
|
||||
// 不能使用 [contenteditable="true"], 否则嵌入块无法复制
|
||||
item.querySelectorAll("[spellcheck]").forEach(editItem => {
|
||||
const cloneNode = editItem.cloneNode(true) as HTMLElement;
|
||||
cloneNode.querySelectorAll('[data-type="backslash"]').forEach(slashItem => {
|
||||
slashItem.firstElementChild.remove();
|
||||
});
|
||||
html += cloneNode.textContent + "\n";
|
||||
html += editItem.textContent + "\n";
|
||||
});
|
||||
});
|
||||
copyPlainText(html.trimEnd());
|
||||
} else {
|
||||
const cloneContents = range.cloneContents();
|
||||
cloneContents.querySelectorAll('[data-type="backslash"]').forEach(item => {
|
||||
item.firstElementChild.remove();
|
||||
});
|
||||
writeText(cloneContents.textContent);
|
||||
writeText(range.toString());
|
||||
}
|
||||
event.preventDefault();
|
||||
return true;
|
||||
|
||||
@@ -623,11 +623,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
|
||||
accelerator: window.siyuan.config.keymap.editor.general.copyPlainText.custom,
|
||||
click() {
|
||||
focusByRange(getEditorRange(nodeElement));
|
||||
const cloneContents = getSelection().getRangeAt(0).cloneContents();
|
||||
cloneContents.querySelectorAll('[data-type="backslash"]').forEach(item => {
|
||||
item.firstElementChild.remove();
|
||||
});
|
||||
copyPlainText(cloneContents.textContent);
|
||||
copyPlainText(getSelection().getRangeAt(0).toString());
|
||||
}
|
||||
}).element);
|
||||
if (protyle.disabled) {
|
||||
|
||||
@@ -627,11 +627,7 @@ export class Gutter {
|
||||
let html = "";
|
||||
selectsElement.forEach(item => {
|
||||
item.querySelectorAll("[spellcheck]").forEach(editItem => {
|
||||
const cloneNode = editItem.cloneNode(true) as HTMLElement;
|
||||
cloneNode.querySelectorAll('[data-type="backslash"]').forEach(slashItem => {
|
||||
slashItem.firstElementChild.remove();
|
||||
});
|
||||
html += cloneNode.textContent + "\n";
|
||||
html += editItem.textContent + "\n";
|
||||
});
|
||||
});
|
||||
copyPlainText(html.trimEnd());
|
||||
@@ -1068,11 +1064,7 @@ export class Gutter {
|
||||
click() {
|
||||
let text = "";
|
||||
nodeElement.querySelectorAll("[spellcheck]").forEach(item => {
|
||||
const cloneNode = item.cloneNode(true) as HTMLElement;
|
||||
cloneNode.querySelectorAll('[data-type="backslash"]').forEach(slashItem => {
|
||||
slashItem.firstElementChild.remove();
|
||||
});
|
||||
text += cloneNode.textContent + "\n";
|
||||
text += item.textContent + "\n";
|
||||
});
|
||||
copyPlainText(text.trimEnd());
|
||||
}
|
||||
|
||||
@@ -1585,11 +1585,7 @@ export class Toolbar {
|
||||
this.subElement.classList.add("fn__none");
|
||||
} else if (action === "copyPlainText") {
|
||||
focusByRange(getEditorRange(nodeElement));
|
||||
const cloneContents = getSelection().getRangeAt(0).cloneContents();
|
||||
cloneContents.querySelectorAll('[data-type="backslash"]').forEach(item => {
|
||||
item.firstElementChild.remove();
|
||||
});
|
||||
copyPlainText(cloneContents.textContent);
|
||||
copyPlainText(getSelection().getRangeAt(0).toString());
|
||||
this.subElement.classList.add("fn__none");
|
||||
} else if (action === "pasteAsPlainText") {
|
||||
focusByRange(getEditorRange(nodeElement));
|
||||
|
||||
Reference in New Issue
Block a user