`;
+ nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
+ updateTransaction(protyle, id, nodeElement.outerHTML, oldHTML);
+ focusByWbr(nodeElement, protyle.toolbar.range);
+ }
+ }]);
+ if (element.parentElement.textContent.trim() === element.textContent.trim() && element.parentElement.tagName === "DIV") {
+ submenu.push({
+ label: window.siyuan.languages.blockEmbed,
+ icon: "iconSQL",
+ click() {
+ const html = `${nodeElement.querySelector(".protyle-attr").outerHTML}
`;
+ nodeElement.outerHTML = html;
+ updateTransaction(protyle, id, html, oldHTML);
+ blockRender(protyle, protyle.wysiwyg.element);
+ }
+ });
}
- }]);
- if (element.parentElement.textContent.trim() === element.textContent.trim() && element.parentElement.tagName === "DIV") {
submenu.push({
- label: window.siyuan.languages.blockEmbed,
- icon: "iconSQL",
+ label: window.siyuan.languages.defBlock,
+ click() {
+ fetchPost("/api/block/swapBlockRef", {
+ refID: id,
+ defID: refBlockId,
+ includeChildren: false
+ });
+ }
+ });
+ submenu.push({
+ label: window.siyuan.languages.defBlockChildren,
click() {
- const html = `${nodeElement.querySelector(".protyle-attr").outerHTML}
`;
- nodeElement.outerHTML = html;
- updateTransaction(protyle, id, html, oldHTML);
- blockRender(protyle, protyle.wysiwyg.element);
+ fetchPost("/api/block/swapBlockRef", {
+ refID: id,
+ defID: refBlockId,
+ includeChildren: true
+ });
}
});
+ window.siyuan.menus.menu.append(new MenuItem({
+ label: window.siyuan.languages.turnInto,
+ icon: "iconRefresh",
+ submenu
+ }).element);
}
- submenu.push({
- label: window.siyuan.languages.defBlock,
- click() {
- fetchPost("/api/block/swapBlockRef", {
- refID: id,
- defID: refBlockId,
- includeChildren: false
- });
- }
- });
- submenu.push({
- label: window.siyuan.languages.defBlockChildren,
- click() {
- fetchPost("/api/block/swapBlockRef", {
- refID: id,
- defID: refBlockId,
- includeChildren: true
- });
- }
- });
- window.siyuan.menus.menu.append(new MenuItem({
- label: window.siyuan.languages.turnInto,
- icon: "iconRefresh",
- submenu
- }).element);
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.copy,
icon: "iconCopy",
@@ -389,18 +393,19 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
writeText(`((${refBlockId} ${quote}${element.textContent}${quote}))`);
}
}).element);
- window.siyuan.menus.menu.append(new MenuItem({
- label: window.siyuan.languages.remove,
- icon: "iconTrashcan",
- click() {
- element.insertAdjacentHTML("afterend", "");
- element.remove();
- nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
- updateTransaction(protyle, id, nodeElement.outerHTML, oldHTML);
- focusByWbr(nodeElement, protyle.toolbar.range);
- }
- }).element);
-
+ if (!protyle.disabled) {
+ window.siyuan.menus.menu.append(new MenuItem({
+ label: window.siyuan.languages.remove,
+ icon: "iconTrashcan",
+ click() {
+ element.insertAdjacentHTML("afterend", "");
+ element.remove();
+ nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
+ updateTransaction(protyle, id, nodeElement.outerHTML, oldHTML);
+ focusByWbr(nodeElement, protyle.toolbar.range);
+ }
+ }).element);
+ }
if (protyle?.app?.plugins) {
emitOpenMenu({
plugins: protyle.app.plugins,
@@ -419,20 +424,22 @@ export const refMenu = (protyle: IProtyle, element: HTMLElement) => {
y: rect.top + 26,
h: 26
});
- window.siyuan.menus.menu.element.querySelector("input").select();
- window.siyuan.menus.menu.removeCB = () => {
- if (nodeElement.outerHTML !== oldHTML) {
- nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
- updateTransaction(protyle, id, nodeElement.outerHTML, oldHTML);
- oldHTML = nodeElement.outerHTML;
- }
- const currentRange = getSelection().rangeCount === 0 ? undefined : getSelection().getRangeAt(0);
- if (currentRange && !protyle.element.contains(currentRange.startContainer)) {
- protyle.toolbar.range.selectNodeContents(element);
- protyle.toolbar.range.collapse(false);
- focusByRange(protyle.toolbar.range);
- }
- };
+ if (!protyle.disabled) {
+ window.siyuan.menus.menu.element.querySelector("input").select();
+ window.siyuan.menus.menu.removeCB = () => {
+ if (nodeElement.outerHTML !== oldHTML) {
+ nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss"));
+ updateTransaction(protyle, id, nodeElement.outerHTML, oldHTML);
+ oldHTML = nodeElement.outerHTML;
+ }
+ const currentRange = getSelection().rangeCount === 0 ? undefined : getSelection().getRangeAt(0);
+ if (currentRange && !protyle.element.contains(currentRange.startContainer)) {
+ protyle.toolbar.range.selectNodeContents(element);
+ protyle.toolbar.range.collapse(false);
+ focusByRange(protyle.toolbar.range);
+ }
+ };
+ }
};
export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {
@@ -1664,7 +1671,7 @@ export const setFold = (protyle: IProtyle, nodeElement: Element, isOpen?: boolea
focusBlock(nodeElement, undefined, false);
}
}
- nodeElement.querySelectorAll(".img--select, .av__cell--select, .av__row--select").forEach((item:HTMLElement) => {
+ nodeElement.querySelectorAll(".img--select, .av__cell--select, .av__row--select").forEach((item: HTMLElement) => {
if (item.classList.contains("av__row--select")) {
item.classList.remove("av__row--select");
item.querySelector(".av__firstcol use").setAttribute("xlink:href", "#iconUncheck");
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index bf9570e1d79..c15c16aa216 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -1302,7 +1302,7 @@ export class WYSIWYG {
if (types.length > 0) {
removeSearchMark(target);
}
- if (types.includes("block-ref") && !protyle.disabled) {
+ if (types.includes("block-ref")) {
refMenu(protyle, target);
// 阻止 popover
target.setAttribute("prevent-popover", "true");
diff --git a/scripts/win-build.bat b/scripts/win-build.bat
index 68f1b64acca..8e2f50da4a6 100644
--- a/scripts/win-build.bat
+++ b/scripts/win-build.bat
@@ -33,9 +33,9 @@ echo 'Building Electron'
cd app
call pnpm run dist
-@REM cd ..
+cd ..
-@REM echo 'Building Appx'
-@REM echo 'Building Appx should be disabled if you do not need it. Not configured correctly will lead to build failures'
-@REM cd . > app\build\win-unpacked\resources\ms-store
-@REM electron-windows-store --input-directory app\build\win-unpacked --output-directory app\build\ --package-version 1.0.0.0 --package-name SiYuan --manifest app\appx\AppxManifest.xml --assets app\appx\assets\ --make-pri true
+echo 'Building Appx'
+echo 'Building Appx should be disabled if you do not need it. Not configured correctly will lead to build failures'
+cd . > app\build\win-unpacked\resources\ms-store
+electron-windows-store --input-directory app\build\win-unpacked --output-directory app\build\ --package-version 1.0.0.0 --package-name SiYuan --manifest app\appx\AppxManifest.xml --assets app\appx\assets\ --make-pri true