Vanessa 2022-09-27 23:36:07 +08:00
parent aa29fc044b
commit 3adf0d6d63
7 changed files with 42 additions and 1 deletions

View file

@ -1171,6 +1171,33 @@ export class Gutter {
}
}]
}).element);
} else if (type === "NodeHeading" && !window.siyuan.config.readonly) {
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
const headingSubMenu = [];
if (subType !== "h1") {
headingSubMenu.push({
icon: "iconHeading1",
label: window.siyuan.languages.heading1,
click() {
protyle.toolbar.showRender(protyle, nodeElement);
}
})
}
window.siyuan.menus.menu.append(new MenuItem({
type: "submenu",
icon: "iconRefresh",
label: window.siyuan.languages.tWithSubtitle,
submenu: headingSubMenu
}).element);
window.siyuan.menus.menu.append(new MenuItem({
icon: "iconCopy",
label: window.siyuan.languages.copyHeadings,
click() {
fetchPost("/api/block/getHeadingChildrenDOM", {id: nodeElement.getAttribute("data-node-id")}, (response) => {
writeText(response.data + Constants.ZWSP);
})
}
}).element);
}
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
window.siyuan.menus.menu.append(new MenuItem({
@ -1188,7 +1215,7 @@ export class Gutter {
const ids = protyle.path.split("/");
if (ids.length > 2) {
/// #if MOBILE
openMobileFileById(ids[ids.length - 2],[Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL]);
openMobileFileById(ids[ids.length - 2], [Constants.CB_GET_FOCUS, Constants.CB_GET_SCROLL]);
/// #else
openFileById({
id: ids[ids.length - 2],

View file

@ -109,6 +109,10 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
files = event.dataTransfer.items;
}
}
// 复制标题及其下方块使用 writeText需将 textPLain 转换为 textHTML
if (textPlain.endsWith(Constants.ZWSP) && !textHTML) {
textHTML = textPlain
}
/// #if !MOBILE
if (!textHTML && !textPlain && ("clipboardData" in event)) {
if ("darwin" === window.siyuan.config.system.os) {