mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-23 10:00:13 +01:00
This commit is contained in:
parent
56904648b9
commit
1eaa79c999
2 changed files with 17 additions and 18 deletions
|
|
@ -1716,21 +1716,20 @@ export const tagMenu = (protyle: IProtyle, tagElement: HTMLElement) => {
|
||||||
label: window.siyuan.languages.copy,
|
label: window.siyuan.languages.copy,
|
||||||
icon: "iconCopy",
|
icon: "iconCopy",
|
||||||
click() {
|
click() {
|
||||||
writeText(protyle.lute.BlockDOM2StdMd(tagElement.outerHTML));
|
const range = document.createRange()
|
||||||
|
range.selectNode(tagElement);
|
||||||
|
focusByRange(range)
|
||||||
|
document.execCommand("copy");
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
label: window.siyuan.languages.cut,
|
label: window.siyuan.languages.cut,
|
||||||
icon: "iconCut",
|
icon: "iconCut",
|
||||||
click() {
|
click() {
|
||||||
writeText(protyle.lute.BlockDOM2StdMd(tagElement.outerHTML));
|
const range = document.createRange()
|
||||||
|
range.selectNode(tagElement);
|
||||||
const oldHTML = nodeElement.outerHTML;
|
focusByRange(range)
|
||||||
tagElement.insertAdjacentHTML("afterend", "<wbr>");
|
document.execCommand("cut");
|
||||||
tagElement.remove();
|
|
||||||
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
|
||||||
updateTransaction(protyle, id, nodeElement.outerHTML, oldHTML);
|
|
||||||
focusByWbr(nodeElement, protyle.toolbar.range);
|
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
|
|
@ -1781,7 +1780,10 @@ export const inlineMathMenu = (protyle: IProtyle, element: Element) => {
|
||||||
label: window.siyuan.languages.copy,
|
label: window.siyuan.languages.copy,
|
||||||
icon: "iconCopy",
|
icon: "iconCopy",
|
||||||
click() {
|
click() {
|
||||||
writeText(protyle.lute.BlockDOM2StdMd(element.outerHTML));
|
const range = document.createRange()
|
||||||
|
range.selectNode(element);
|
||||||
|
focusByRange(range)
|
||||||
|
document.execCommand("copy");
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
if (!protyle.disabled) {
|
if (!protyle.disabled) {
|
||||||
|
|
@ -1789,13 +1791,10 @@ export const inlineMathMenu = (protyle: IProtyle, element: Element) => {
|
||||||
icon: "iconCut",
|
icon: "iconCut",
|
||||||
label: window.siyuan.languages.cut,
|
label: window.siyuan.languages.cut,
|
||||||
click() {
|
click() {
|
||||||
writeText(protyle.lute.BlockDOM2StdMd(element.outerHTML));
|
const range = document.createRange()
|
||||||
|
range.selectNode(element);
|
||||||
element.insertAdjacentHTML("afterend", "<wbr>");
|
focusByRange(range)
|
||||||
element.remove();
|
document.execCommand("cut");
|
||||||
nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
|
|
||||||
updateTransaction(protyle, id, nodeElement.outerHTML, html);
|
|
||||||
focusByWbr(nodeElement, protyle.toolbar.range);
|
|
||||||
}
|
}
|
||||||
}).element);
|
}).element);
|
||||||
window.siyuan.menus.menu.append(new MenuItem({
|
window.siyuan.menus.menu.append(new MenuItem({
|
||||||
|
|
|
||||||
|
|
@ -1775,7 +1775,7 @@ export class WYSIWYG {
|
||||||
protyle.toolbar.range = getEditorRange(protyle.element);
|
protyle.toolbar.range = getEditorRange(protyle.element);
|
||||||
|
|
||||||
if (target.tagName === "SPAN" && !isNotEditBlock(nodeElement)) { // https://ld246.com/article/1665141518103
|
if (target.tagName === "SPAN" && !isNotEditBlock(nodeElement)) { // https://ld246.com/article/1665141518103
|
||||||
let types = target.getAttribute("data-type")?.split(" ");
|
let types = target.getAttribute("data-type")?.split(" ") || [];
|
||||||
if (types.length === 0) {
|
if (types.length === 0) {
|
||||||
// https://github.com/siyuan-note/siyuan/issues/8960
|
// https://github.com/siyuan-note/siyuan/issues/8960
|
||||||
types = (target.dataset.type || "").split(" ");
|
types = (target.dataset.type || "").split(" ");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue