diff --git a/app/src/mobile/util/setEmpty.ts b/app/src/mobile/util/setEmpty.ts
index f11cc94df09..7bdf33e850a 100644
--- a/app/src/mobile/util/setEmpty.ts
+++ b/app/src/mobile/util/setEmpty.ts
@@ -6,6 +6,7 @@ import {getRecentDocs} from "../menu/getRecentDocs";
import {openHistory} from "../../history/history";
import {App} from "../../index";
import {setTitle} from "../../dialog/processSystem";
+import {isIPhone} from "../../protyle/util/compatibility";
export const setEmpty = (app: App) => {
setTitle(window.siyuan.languages.siyuanNote);
@@ -31,7 +32,7 @@ export const setEmpty = (app: App) => {
+
${window.siyuan.languages.userGuide}
`;
emptyElement.addEventListener("click", (event) => {
@@ -77,7 +78,7 @@ export const setEmpty = (app: App) => {
};
export const setEditor = () => {
- const toolbarNameElement = document.getElementById("toolbarName") as HTMLInputElement;
+ const toolbarNameElement = document.getElementById("toolbarName") as HTMLInputElement;
setTitle(toolbarNameElement.value);
toolbarNameElement.classList.remove("fn__hidden");
document.getElementById("editor").classList.remove("fn__none");
diff --git a/app/src/plugin/Setting.ts b/app/src/plugin/Setting.ts
index c3b58766595..3225c928537 100644
--- a/app/src/plugin/Setting.ts
+++ b/app/src/plugin/Setting.ts
@@ -7,6 +7,7 @@ export class Setting {
private destroyCallback: () => void;
private width: string;
private height: string;
+ public dialog:Dialog;
constructor(options: {
height?: string,
@@ -97,5 +98,6 @@ export class Setting {
}
dialog.destroy();
});
+ this.dialog = dialog;
}
}
diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts
index d12a61ba602..2bb2badb6ff 100644
--- a/app/src/protyle/gutter/index.ts
+++ b/app/src/protyle/gutter/index.ts
@@ -52,7 +52,7 @@ import {setPosition} from "../../util/setPosition";
import {avRender} from "../render/av/render";
import {emitOpenMenu} from "../../plugin/EventBus";
import {insertAttrViewBlockAnimation} from "../render/av/row";
-import {avContextmenu} from "../render/av/action";
+import {avContextmenu, duplicateCompletely} from "../render/av/action";
import {getPlainText} from "../util/paste";
import {Menu} from "../../plugin/Menu";
import {addEditorToDatabase} from "../render/av/addToDatabase";
@@ -756,6 +756,7 @@ export class Gutter {
}).element);
}
const copyMenu: IMenu[] = [{
+ iconHTML: "",
label: window.siyuan.languages.copy,
accelerator: "⌘C",
click() {
@@ -767,6 +768,7 @@ export class Gutter {
document.execCommand("copy");
}
}, {
+ iconHTML: "",
label: window.siyuan.languages.copyPlainText,
accelerator: window.siyuan.config.keymap.editor.general.copyPlainText.custom,
click() {
@@ -778,6 +780,7 @@ export class Gutter {
focusBlock(selectsElement[0]);
}
}, {
+ iconHTML: "",
label: window.siyuan.languages.duplicate,
accelerator: window.siyuan.config.keymap.editor.general.duplicate.custom,
disabled: protyle.disabled,
@@ -1210,8 +1213,18 @@ export class Gutter {
}
}).element);
}
+
const copyMenu = (copySubMenu(id, true, nodeElement) as IMenu[]).concat([{
- label: window.siyuan.languages.copy,
+ iconHTML: "",
+ label: window.siyuan.languages.copyPlainText,
+ accelerator: window.siyuan.config.keymap.editor.general.copyPlainText.custom,
+ click() {
+ copyPlainText(getPlainText(nodeElement as HTMLElement).trimEnd());
+ focusBlock(nodeElement);
+ }
+ }, {
+ iconHTML: "",
+ label: type === "NodeAttributeView" ? window.siyuan.languages.copyMirror : window.siyuan.languages.copy,
accelerator: "⌘C",
click() {
if (isNotEditBlock(nodeElement)) {
@@ -1222,23 +1235,28 @@ export class Gutter {
document.execCommand("copy");
}
}, {
- label: window.siyuan.languages.copyPlainText,
- accelerator: window.siyuan.config.keymap.editor.general.copyPlainText.custom,
- click() {
- copyPlainText(getPlainText(nodeElement as HTMLElement).trimEnd());
- focusBlock(nodeElement);
- }
- }, {
- label: window.siyuan.languages.duplicate,
+ iconHTML: "",
+ label: type === "NodeAttributeView" ? window.siyuan.languages.duplicateMirror : window.siyuan.languages.duplicate,
accelerator: window.siyuan.config.keymap.editor.general.duplicate.custom,
disabled: protyle.disabled,
click() {
duplicateBlock([nodeElement], protyle);
}
}]);
+ if (type === "NodeAttributeView") {
+ copyMenu.push({
+ iconHTML: "",
+ label: window.siyuan.languages.duplicateCompletely,
+ accelerator: window.siyuan.config.keymap.editor.general.duplicateCompletely.custom,
+ disabled: protyle.disabled,
+ click() {
+ duplicateCompletely(protyle, nodeElement as HTMLElement);
+ }
+ });
+ }
const copyTextRefMenu = this.genCopyTextRef([nodeElement]);
if (copyTextRefMenu) {
- copyMenu.splice(copyMenu.length - 1, 0, copyTextRefMenu);
+ copyMenu.splice(7, 0, copyTextRefMenu);
}
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.copy,
@@ -1980,6 +1998,7 @@ export class Gutter {
return false;
}
return {
+ iconHTML: "",
accelerator: window.siyuan.config.keymap.editor.general.copyText.custom,
label: window.siyuan.languages.copyText,
click() {
diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts
index bf331f3b557..2d8109189eb 100644
--- a/app/src/protyle/hint/extend.ts
+++ b/app/src/protyle/hint/extend.ts
@@ -289,9 +289,6 @@ export const hintSlash = (key: string, protyle: IProtyle) => {
};
export const hintTag = (key: string, protyle: IProtyle): IHintData[] => {
- if (!window.siyuan.config.editor.markdown.inlineTag) {
- return [];
- }
protyle.hint.genLoading(protyle);
fetchPost("/api/search/searchTag", {
k: key,
diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts
index f1055ab1e16..42d35061b80 100644
--- a/app/src/protyle/render/av/action.ts
+++ b/app/src/protyle/render/av/action.ts
@@ -19,7 +19,7 @@ import {deleteRow, insertRows, selectRow, setPageSize, updateHeader} from "./row
import {emitOpenMenu} from "../../../plugin/EventBus";
import {openMenuPanel} from "./openMenuPanel";
import {hintRef} from "../../hint/extend";
-import {focusByRange} from "../../util/selection";
+import {focusBlock, focusByRange} from "../../util/selection";
import {showMessage} from "../../../dialog/message";
import {previewImage} from "../../preview/image";
import {unicode2Emoji} from "../../../emoji";
@@ -31,6 +31,8 @@ import {isOnlyMeta, writeText} from "../../util/compatibility";
import {openSearchAV} from "./relation";
import {Constants} from "../../../constants";
import {hideElements} from "../../ui/hideElements";
+import {fetchPost} from "../../../util/fetch";
+import {scrollCenter} from "../../../util/highlightById";
export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLElement }) => {
if (isOnlyMeta(event)) {
@@ -489,3 +491,26 @@ export const removeAttrViewColAnimation = (blockElement: Element, id: string) =>
item.remove();
});
};
+
+export const duplicateCompletely = (protyle:IProtyle, nodeElement:HTMLElement) => {
+ fetchPost("/api/av/duplicateAttributeViewBlock", {avID: nodeElement.getAttribute("data-av-id")}, (response) => {
+ nodeElement.classList.remove("protyle-wysiwyg--select")
+ const tempElement = document.createElement("template");
+ tempElement.innerHTML = protyle.lute.SpinBlockDOM(`
`)
+ const cloneElement = tempElement.content.firstElementChild;
+ nodeElement.after(cloneElement);
+ avRender(cloneElement, protyle, () => {
+ focusBlock(cloneElement);
+ scrollCenter(protyle);
+ });
+ transaction(protyle, [{
+ action: "insert",
+ data: cloneElement.outerHTML,
+ id: response.data.blockID,
+ previousID: nodeElement.dataset.nodeId,
+ }], [{
+ action: "delete",
+ id: response.data.blockID,
+ }]);
+ });
+}
diff --git a/app/src/protyle/render/av/asset.ts b/app/src/protyle/render/av/asset.ts
index e0095e9453c..1de43567876 100644
--- a/app/src/protyle/render/av/asset.ts
+++ b/app/src/protyle/render/av/asset.ts
@@ -16,6 +16,7 @@ import {fetchPost} from "../../../util/fetch";
import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest";
import {genCellValueByElement, getTypeByCellElement} from "./cell";
import {writeText} from "../../util/compatibility";
+import {escapeAttr} from "../../../util/escape";
export const bindAssetEvent = (options: {
protyle: IProtyle,
@@ -58,10 +59,10 @@ export const getAssetHTML = (cellElements: HTMLElement[]) => {
`;
} else {
- contentHTML = ``;
+ contentHTML = ``;
}
- html += `