Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:recycle: https://github.com/siyuan-note/siyuan/pull/16041

Vanessa8b1ff779ac96
diff --git a/app/src/assets/scss/component/_list.scss b/app/src/assets/scss/component/_list.scss
index fd9557b2bb..203d0d634c 100644
--- a/app/src/assets/scss/component/_list.scss
+++ b/app/src/assets/scss/component/_list.scss
@@ -293,30 +293,7 @@
}
&__switch {
- svg, img {
- height: 16px;
- width: 16px;
- color: var(--b3-theme-on-surface);
- }
-
- text-align: center;
- font-size: 14px;
- font-family: var(--b3-font-family-emoji);
- margin-right: 4px;
- line-height: 22px;
- transition: var(--b3-transition);
- height: 22px;
- padding: 0 4px;
- flex-shrink: 0;
- border-radius: var(--b3-border-radius);
- display: inline-flex;
- align-items: center;
- justify-content: center;
-
- &:hover {
- color: var(--b3-theme-on-background);
- background-color: var(--b3-list-icon-hover);
- }
+ @extend .b3-list-item__icon
}
.counter {
diff --git a/app/src/assets/scss/protyle/_protyle.scss b/app/src/assets/scss/protyle/_protyle.scss
index 3641cc6f29..e10a190941 100644
--- a/app/src/assets/scss/protyle/_protyle.scss
+++ b/app/src/assets/scss/protyle/_protyle.scss
@@ -421,6 +421,30 @@
}
}
+.protyle-password {
+ text-align: center;
+
+ &__button {
+ align-self: center;
+ left: unset;
+ right: 5px;
+ }
+
+ &__content {
+ display: flex;
+ width: 260px;
+ margin: 0 auto;
+ }
+
+ &__logo {
+ font-size: 80px;
+ }
+
+ &__tip {
+ font-size: 2rem;
+ }
+}
+
table[contenteditable="false"] + .protyle-action__table > .table__resize {
display: none !important;
}
diff --git a/app/src/layout/dock/Files.ts b/app/src/layout/dock/Files.ts
index 0c73da03e0..fad9f2c625 100644
--- a/app/src/layout/dock/Files.ts
+++ b/app/src/layout/dock/Files.ts
@@ -9,7 +9,7 @@ import {newFile} from "../../util/newFile";
import {initFileMenu, initNavigationMenu, sortMenu} from "../../menus/navigation";
import {MenuItem} from "../../menus/Menu";
import {showMessage} from "../../dialog/message";
-import {getPublishAccessOption, getPublishAccessOptionByLevel, openPublishAccessDialog} from "../../dialog/publishAccessDialog";
+import {getPublishAccessOption, getPublishAccessOptionByLevel, openPublishAccessDialog} from "../../protyle/util/publishAccess";
import {fetchPost, fetchSyncPost} from "../../util/fetch";
import {openEmojiPanel, unicode2Emoji} from "../../emoji";
import {mountHelp, newNotebook} from "../../util/mount";
@@ -281,10 +281,10 @@ export class Files extends Model {
event.stopPropagation();
window.siyuan.menus.menu.remove();
break;
- } else if (isNotCtrl(event) && target.classList.contains('b3-list-item__switch') && target.getAttribute("data-type") == "publish-access") {
+ } else if (isNotCtrl(event) && target.classList.contains("b3-list-item__switch") && target.getAttribute("data-type") == "publish-access") {
event.preventDefault();
event.stopPropagation();
- let targetId = target.parentElement.getAttribute("data-node-id") || target.parentElement.parentElement.getAttribute("data-url");
+ const targetId = target.parentElement.getAttribute("data-node-id") || target.parentElement.parentElement.getAttribute("data-url");
const rect = target.getBoundingClientRect();
openPublishAccessDialog(targetId, {
x: rect.left,
@@ -870,8 +870,8 @@ export class Files extends Model {
private genNotebook(item: INotebook) {
const editingPublishAccess = this.element.classList.contains("file-tree__publish-access--active");
- const emojiHTML = `<span class="b3-list-item__icon b3-tooltips b3-tooltips__e${editingPublishAccess ? ' fn__none' : ''}" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || window.siyuan.storage[Constants.LOCAL_IMAGES].note)}</span>`;
- const switchHTML = `<span class="b3-list-item__switch b3-tooltips b3-tooltips__e${editingPublishAccess ? '' : ' fn__none'}" data-type="publish-access" aria-label="${window.siyuan.languages.publishAccess}">${getPublishAccessOptionByLevel("public").iconHTML}</span>`
+ const emojiHTML = `<span class="b3-list-item__icon b3-tooltips b3-tooltips__e${editingPublishAccess ? " fn__none" : ""}" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || window.siyuan.storage[Constants.LOCAL_IMAGES].note)}</span>`;
+ const switchHTML = `<span class="b3-list-item__switch b3-tooltips b3-tooltips__e${editingPublishAccess ? "" : " fn__none"}" data-type="publish-access" aria-label="${window.siyuan.languages.publishAccess}">${getPublishAccessOptionByLevel("public").iconHTML}</span>`;
if (item.closed) {
return `<li data-url="${item.id}" class="b3-list-item b3-list-item--hide-action">
<span class="b3-list-item__toggle fn__hidden">
@@ -1348,8 +1348,8 @@ class="b3-list-item b3-list-item--hide-action" data-path="${item.path}">
<span style="padding-left: ${paddingLeft}px" class="b3-list-item__toggle b3-list-item__toggle--hl${item.subFileCount === 0 ? " fn__hidden" : ""}">
<svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg>
</span>
- <span class="b3-list-item__icon b3-tooltips b3-tooltips__n popover__block${editingPublishAccess ? ' fn__none' : ''}" data-id="${item.id}" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || (item.subFileCount === 0 ? window.siyuan.storage[Constants.LOCAL_IMAGES].file : window.siyuan.storage[Constants.LOCAL_IMAGES].folder))}</span>
- <span class="b3-list-item__switch b3-tooltips b3-tooltips__n${editingPublishAccess ? '' : ' fn__none'}" data-type="publish-access" aria-label="${window.siyuan.languages.publishAccess}">${getPublishAccessOptionByLevel("public").iconHTML}</span>
+ <span class="b3-list-item__icon b3-tooltips b3-tooltips__n popover__block${editingPublishAccess ? " fn__none" : ""}" data-id="${item.id}" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || (item.subFileCount === 0 ? window.siyuan.storage[Constants.LOCAL_IMAGES].file : window.siyuan.storage[Constants.LOCAL_IMAGES].folder))}</span>
+ <span class="b3-list-item__switch b3-tooltips b3-tooltips__n${editingPublishAccess ? "" : " fn__none"}" data-type="publish-access" aria-label="${window.siyuan.languages.publishAccess}">${getPublishAccessOptionByLevel("public").iconHTML}</span>
<span class="b3-list-item__text ariaLabel" data-position="parentE"
aria-label="${ariaLabel}">${getDisplayName(item.name, true, true)}</span>
<span data-type="more-file" class="b3-list-item__action b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.more}">
@@ -1434,19 +1434,19 @@ aria-label="${ariaLabel}">${getDisplayName(item.name, true, true)}</span>
return;
}
- let ids: string[] = [];
- this.element.querySelectorAll("[data-url]").forEach((element: HTMLElement) => ids.push(element.getAttribute("data-url")))
- this.element.querySelectorAll("[data-node-id]").forEach((element: HTMLElement) => ids.push(element.getAttribute("data-node-id")))
+ const ids: string[] = [];
+ this.element.querySelectorAll("[data-url]").forEach((element: HTMLElement) => ids.push(element.getAttribute("data-url")));
+ this.element.querySelectorAll("[data-node-id]").forEach((element: HTMLElement) => ids.push(element.getAttribute("data-node-id")));
fetchPost("/api/filetree/getPublishAccess", {
ids: ids
}, response => {
response.data.publishAccess.forEach((item : { id: string, visible: boolean, password: string, disable: boolean }) => {
- const element = this.element.querySelector(`[data-url="${item.id}"]`) || this.element.querySelector(`[data-node-id="${item.id}"]`)
+ const element = this.element.querySelector(`[data-url="${item.id}"]`) || this.element.querySelector(`[data-node-id="${item.id}"]`);
if (element) {
- const publishAccessElement = element.querySelector(`[data-type="publish-access"]`) as HTMLElement;
+ const publishAccessElement = element.querySelector("[data-type=\"publish-access\"]") as HTMLElement;
publishAccessElement.innerHTML = getPublishAccessOption(item.visible, item.password, item.disable).iconHTML;
}
});
- })
+ });
}
}
diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.ts
index b996ba7aa7..f263ee884d 100644
--- a/app/src/layout/dock/Outline.ts
+++ b/app/src/layout/dock/Outline.ts
@@ -1320,27 +1320,4 @@ export class Outline extends Model {
}
};
}
-
- public reload(blockId?: string) {
- if (!blockId) {
- blockId = this.blockId;
- }
- fetchPost("/api/outline/getDocOutline", {
- id: blockId,
- preview: this.isPreview
- }, response => {
- // 文档切换后不再更新原有推送 https://github.com/siyuan-note/siyuan/issues/13409
- if (blockId !== this.blockId) {
- return;
- }
- this.update(response);
- // https://github.com/siyuan-note/siyuan/issues/8372
- if (getSelection().rangeCount > 0) {
- const blockElement = hasClosestBlock(getSelection().getRangeAt(0).startContainer);
- if (blockElement && blockElement.getAttribute("data-type") === "NodeHeading") {
- this.setCurrent(blockElement);
- }
- }
- });
- }
}
diff --git a/app/src/mobile/dock/MobileFiles.ts b/app/src/mobile/dock/MobileFiles.ts
index efafe512f0..2ff781b294 100644
--- a/app/src/mobile/dock/MobileFiles.ts
+++ b/app/src/mobile/dock/MobileFiles.ts
@@ -4,7 +4,7 @@ import {Model} from "../../layout/Model";
import {Constants} from "../../constants";
import {getDisplayName, pathPosix, setNoteBook} from "../../util/pathName";
import {initFileMenu, initNavigationMenu, sortMenu} from "../../menus/navigation";
-import {getPublishAccessOption, getPublishAccessOptionByLevel, openPublishAccessDialog} from "../../dialog/publishAccessDialog";
+import {getPublishAccessOption, getPublishAccessOptionByLevel, openPublishAccessDialog} from "../../protyle/util/publishAccess";
import {fetchPost, fetchSyncPost} from "../../util/fetch";
import {genUUID} from "../../util/genID";
import {openMobileFileById} from "../editor";
@@ -153,7 +153,7 @@ export class MobileFiles extends Model {
} else if (type === "publish-access") {
if (target.classList.contains("b3-list-item__switch")) {
// 文档/笔记本前的按钮
- let targetId = target.parentElement.getAttribute("data-node-id") || target.parentElement.parentElement.getAttribute("data-url");
+ const targetId = target.parentElement.getAttribute("data-node-id") || target.parentElement.parentElement.getAttribute("data-url");
const rect = target.getBoundingClientRect();
openPublishAccessDialog(targetId, {
x: rect.left,
@@ -171,7 +171,7 @@ export class MobileFiles extends Model {
});
} else {
// 顶部栏中的按钮
- target.classList.toggle("block__icon--active")
+ target.classList.toggle("block__icon--active");
const editingPublishAccess = target.classList.contains("block__icon--active");
this.element.querySelectorAll(".b3-list-item__icon").forEach(item => {
item.classList.toggle("fn__none", editingPublishAccess);
@@ -334,8 +334,8 @@ export class MobileFiles extends Model {
private genNotebook(item: INotebook) {
const editingPublishAccess = this.actionsElement.querySelector('[data-type="publish-access"]').classList.contains("block__icon--active");
- const emojiHTML = `<span class="b3-list-item__icon b3-tooltips b3-tooltips__e${editingPublishAccess ? ' fn__none' : ''}" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || window.siyuan.storage[Constants.LOCAL_IMAGES].note)}</span>`;
- const switchHTML = `<span class="b3-list-item__switch b3-tooltips b3-tooltips__e${editingPublishAccess ? '' : ' fn__none'}" data-type="publish-access" aria-label="${window.siyuan.languages.publishAccess}">${getPublishAccessOptionByLevel("public").iconHTML}</span>`;
+ const emojiHTML = `<span class="b3-list-item__icon b3-tooltips b3-tooltips__e${editingPublishAccess ? " fn__none" : ""}" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || window.siyuan.storage[Constants.LOCAL_IMAGES].note)}</span>`;
+ const switchHTML = `<span class="b3-list-item__switch b3-tooltips b3-tooltips__e${editingPublishAccess ? "" : " fn__none"}" data-type="publish-access" aria-label="${window.siyuan.languages.publishAccess}">${getPublishAccessOptionByLevel("public").iconHTML}</span>`;
if (item.closed) {
return `<li data-url="${item.id}" class="b3-list-item">
<span class="b3-list-item__toggle fn__hidden">
@@ -797,8 +797,8 @@ class="b3-list-item" data-path="${item.path}">
<span style="padding-left: ${(item.path.split("/").length - 1) * 20}px" class="b3-list-item__toggle${item.subFileCount === 0 ? " fn__hidden" : ""}">
<svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg>
</span>
- <span class="b3-list-item__icon"${editingPublishAccess ? ' fn__none' : ''}>${unicode2Emoji(item.icon || (item.subFileCount === 0 ? window.siyuan.storage[Constants.LOCAL_IMAGES].file : window.siyuan.storage[Constants.LOCAL_IMAGES].folder))}</span>
- <span class="b3-list-item__switch${editingPublishAccess ? '' : ' fn__none'}" data-type="publish-access">${getPublishAccessOptionByLevel("public").iconHTML}</span>
+ <span class="b3-list-item__icon"${editingPublishAccess ? " fn__none" : ""}>${unicode2Emoji(item.icon || (item.subFileCount === 0 ? window.siyuan.storage[Constants.LOCAL_IMAGES].file : window.siyuan.storage[Constants.LOCAL_IMAGES].folder))}</span>
+ <span class="b3-list-item__switch${editingPublishAccess ? "" : " fn__none"}" data-type="publish-access">${getPublishAccessOptionByLevel("public").iconHTML}</span>
<span class="b3-list-item__text">${getDisplayName(item.name, true, true)}</span>
<span data-type="more-file" class="b3-list-item__action b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.more}">
<svg><use xlink:href="#iconMore"></use></svg>
@@ -815,19 +815,19 @@ class="b3-list-item" data-path="${item.path}">
return;
}
- let ids: string[] = [];
- this.element.querySelectorAll("[data-url]").forEach((element: HTMLElement) => ids.push(element.getAttribute("data-url")))
- this.element.querySelectorAll("[data-node-id]").forEach((element: HTMLElement) => ids.push(element.getAttribute("data-node-id")))
+ const ids: string[] = [];
+ this.element.querySelectorAll("[data-url]").forEach((element: HTMLElement) => ids.push(element.getAttribute("data-url")));
+ this.element.querySelectorAll("[data-node-id]").forEach((element: HTMLElement) => ids.push(element.getAttribute("data-node-id")));
fetchPost("/api/filetree/getPublishAccess", {
ids: ids
}, response => {
response.data.publishAccess.forEach((item : { id: string, visible: boolean, password: string, disable: boolean }) => {
- const element = this.element.querySelector(`[data-url="${item.id}"]`) || this.element.querySelector(`[data-node-id="${item.id}"]`)
+ const element = this.element.querySelector(`[data-url="${item.id}"]`) || this.element.querySelector(`[data-node-id="${item.id}"]`);
if (element) {
- const publishAccessElement = element.querySelector(`[data-type="publish-access"]`) as HTMLElement;
+ const publishAccessElement = element.querySelector("[data-type=\"publish-access\"]") as HTMLElement;
publishAccessElement.innerHTML = getPublishAccessOption(item.visible, item.password, item.disable).iconHTML;
}
});
- })
+ });
}
}
diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts
index f935c659b0..8ff3fc99c1 100644
--- a/app/src/protyle/util/editorCommonEvent.ts
+++ b/app/src/protyle/util/editorCommonEvent.ts
@@ -32,8 +32,6 @@ import {webUtils} from "electron";
import {dragUpload} from "../render/av/asset";
/// #else
import {uploadFiles} from "../upload";
-import {updateAssetCell} from "../render/av/asset";
-import {pathPosix} from "../../util/pathName";
/// #endif
import {addDragFill, getTypeByCellElement} from "../render/av/cell";
import {processClonePHElement} from "../render/util";
@@ -1185,7 +1183,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {
}
dragUpload(files, protyle, cellElement);
/// #else
- focusBlock(hasClosestBlock(cellElement));
+ focusBlock(hasClosestBlock(cellElement) as HTMLElement);
uploadFiles(protyle, event.dataTransfer.files, undefined);
/// #endif
}
diff --git a/app/src/dialog/publishAccessDialog.ts b/app/src/protyle/util/publishAccess.ts
similarity index 93%
rename from app/src/dialog/publishAccessDialog.ts
rename to app/src/protyle/util/publishAccess.ts
index 606e38fbed..8b5e6edf3c 100644
--- a/app/src/dialog/publishAccessDialog.ts
+++ b/app/src/protyle/util/publishAccess.ts
@@ -1,52 +1,52 @@
-import {isMobile} from "../util/functions";
-import {Dialog} from "../dialog";
-import {fetchPost} from "../util/fetch";
-import {setPosition} from "../util/setPosition";
+import {Dialog} from "../../dialog";
+import {isMobile} from "../../util/functions";
+import {setPosition} from "../../util/setPosition";
+import {fetchPost} from "../../util/fetch";
type PublishAccessLevel = "public" | "protected" | "hidden" | "private" | "forbidden";
export const getPublishAccessOptionByLevel = (level: PublishAccessLevel) => {
if (level == "protected") {
return {
- iconHTML: `🔒`,
- comment: window.siyuan.languages.publishAccessProtectedComment,
+ iconHTML: "🔒",
+ comment: window.siyuan.languages.publishAccessProtectedComment,
visible: true,
hasPassword: true,
disable: false,
- }
+ };
} else if (level == "hidden") {
return {
- iconHTML: `👻`,
+ iconHTML: "👻",
comment: window.siyuan.languages.publishAccessHiddenComment,
visible: false,
hasPassword: false,
disable: false,
- }
+ };
} else if (level == "private") {
return {
- iconHTML: `🤫`,
+ iconHTML: "🤫",
comment: window.siyuan.languages.publishAccessPrivateComment,
visible: false,
hasPassword: true,
disable: false,
- }
+ };
} else if (level == "forbidden") {
return {
- iconHTML: `🚫`,
+ iconHTML: "🚫",
comment: window.siyuan.languages.publishAccessForbiddenComment,
visible: false,
hasPassword: false,
disable: true,
- }
+ };
} else {
return {
- iconHTML: `🌐`,
+ iconHTML: "🌐",
comment: window.siyuan.languages.publishAccessPublicComment,
visible: true,
hasPassword: false,
disable: false,
- }
+ };
}
-}
+};
export const getPublishAccessLevel = (visible: boolean, password: string, disable: boolean): PublishAccessLevel => {
if (disable) {
@@ -65,11 +65,11 @@ export const getPublishAccessLevel = (visible: boolean, password: string, disabl
return "hidden";
}
}
-}
+};
export const getPublishAccessOption = (visible: boolean, password: string, disable: boolean) => {
return getPublishAccessOptionByLevel(getPublishAccessLevel(visible, password, disable));
-}
+};
export const openPublishAccessDialog = (id: string, position: IPosition, callback: (access: { id: string, visible: boolean, password: string, disable: boolean, iconHTML: string }) => void) => {
const dialog = new Dialog({
@@ -107,17 +107,17 @@ export const openPublishAccessDialog = (id: string, position: IPosition, callbac
dialogElement.style.justifyContent = "inherit";
dialogElement.style.alignItems = "flex-start";
setPosition(dialog.element.querySelector(".b3-dialog__container"), position.x, position.y, position.h, position.w);
-
+
fetchPost("/api/filetree/getPublishAccess", {
ids: [id],
}, (response) => {
- response.data.publishAccess.forEach((item: { id: string, visible: boolean, password: string, disable: boolean }) => {
+ response.data.publishAccess.forEach((item: { id: string, visible: boolean, password: string, disable: boolean }) => {
if (id == item.id) {
setPublishAccessInDialog(dialog.element, {
visible: item.visible,
password: item.password,
disable: item.disable,
- })
+ });
}
});
});
@@ -126,15 +126,15 @@ export const openPublishAccessDialog = (id: string, position: IPosition, callbac
element.addEventListener("click", () => {
setPublishAccessLevelInDialog(dialog.element, (element.getAttribute("data-level") as PublishAccessLevel));
});
- })
- dialog.element.querySelector(".publish-access-dialog__confirm").addEventListener("click", () => {
+ });
+ dialog.element.querySelector(".publish-access-dialog__confirm").addEventListener("click", () => {
const element = dialog.element.querySelector(".publish-access-dialog__selector-item.emojis__item--current");
if (!element) {
return;
}
const password = (dialog.element.querySelector(".publish-access-dialog__password input") as HTMLInputElement).value.trim();
let accessOption = getPublishAccessOptionByLevel(element.getAttribute("data-level") as PublishAccessLevel);
- accessOption = getPublishAccessOption(accessOption.visible, accessOption.hasPassword ? password : "", accessOption.disable)
+ accessOption = getPublishAccessOption(accessOption.visible, accessOption.hasPassword ? password : "", accessOption.disable);
callback({
id,
visible: accessOption.visible,
@@ -159,4 +159,4 @@ const setPublishAccessInDialog = (dialogElement: HTMLElement, access: { visible:
const accessLevel = getPublishAccessLevel(access.visible, access.password, access.disable);
setPublishAccessLevelInDialog(dialogElement, accessLevel);
(dialogElement.querySelector(".publish-access-dialog__password input") as HTMLInputElement).value = access.password;
-};
\ No newline at end of file
+};
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index ffc44981ed..67ef9688aa 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -2854,23 +2854,31 @@ export class WYSIWYG {
return;
}
- if (window.siyuan.config.readonly) {
- const publishAccessPasswordButtonElement = hasClosestByClassName(event.target, "publish-access-block--password-button");
- if (publishAccessPasswordButtonElement) {
- const passwordID = publishAccessPasswordButtonElement.parentElement.parentElement.getAttribute("data-node-id");
- const password = publishAccessPasswordButtonElement.parentElement.querySelector("input").value;
+ if (window.siyuan.isPublish) {
+ const passwordButtonElement = hasClosestByClassName(event.target, "protyle-password__button");
+ if (passwordButtonElement) {
fetchPost("/api/filetree/authFilePublishAccess", {
- id: passwordID,
- password: password
+ id: passwordButtonElement.parentElement.parentElement.getAttribute("data-node-id"),
+ password: passwordButtonElement.parentElement.querySelector("input").value
}, (response) => {
if (response.msg) {
showMessage(response.msg);
} else {
reloadProtyle(protyle, true);
- getAllModels().outline.forEach(item => { item.reload(); });
+ /// #if !MOBILE
+ getAllModels().outline.forEach(item => {
+ if (item.blockId === protyle.block.rootID) {
+ fetchPost("/api/outline/getDocOutline", {
+ id: item.blockId,
+ preview: item.isPreview
+ }, response => {
+ item.update(response);
+ });
+ }
+ });
+ /// #endif
}
});
-
event.stopPropagation();
return;
}
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index 4be8b5fab6..f66ef0fb82 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -382,6 +382,9 @@ const updateBlock = (updateElements: Element[], protyle: IProtyle, operation: IO
// 用于推送和撤销
export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo: boolean) => {
+ if (protyle.wysiwyg.element.firstElementChild?.classList.contains("protyle-password")) {
+ return;
+ }
const updateElements: Element[] = [];
Array.from(protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${operation.id}"]`)).forEach(item => {
if (!isInEmbedBlock(item)) {
@@ -785,7 +788,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
}
return;
}
- if (operation.action === "insert" && !window.siyuan.config.readonly) {
+ if (operation.action === "insert") {
if (operation.context?.ignoreProcess === "true") {
return;
}
diff --git a/kernel/model/publish_access.go b/kernel/model/publish_access.go
index 7bc7cd0b75..cc44736ca9 100644
--- a/kernel/model/publish_access.go
+++ b/kernel/model/publish_access.go
@@ -476,17 +476,17 @@ func FilterContentByPublishAccess(c *gin.Context, publishAccess PublishAccess, b
if password != "" {
if !CheckPublishAuthCookie(c, passwordID, password) {
if onlyIcon {
- passwordHTML := `<div class="publish-access-block--alert fn__flex-column fn__flex-center" data-node-id="%s" style="text-align:center;">
- <span style="font-size:100px;">🔒</span>
+ passwordHTML := `<div class="protyle-password protyle-password--alert" data-node-id="%s">
+ <span class="protyle-password__logo">🔒</span>
</div>`
ret = fmt.Sprintf(passwordHTML, passwordID)
} else {
- passwordHTML := `<div class="publish-access-block--password fn__flex-column fn__flex-center" data-node-id="%s" style="text-align:center;">
- <span style="font-size:100px;">🔒</span>
- <label class="b3-form__icon fn__flex-1" style="overflow:initial; display:block; justify-content:center; margin: 0 auto 0 auto; max-width:230px;">
- <svg class="b3-form__icon-icon" style="align-self:center"><use xlink:href="#iconKey"></use></svg>
- <input class="b3-form__icon-input b3-text-field fn__block" placeholder="%s" style="padding-right:25px !important;">
- <svg class="publish-access-block--password-button b3-form__icon-icon" style="align-self:center; left:unset; right:5px;"><use xlink:href="#iconForward"></use></svg>
+ passwordHTML := `<div class="protyle-password" data-node-id="%s">
+ <span class="protyle-password__logo">🔒</span>
+ <label class="b3-form__icon protyle-password__content">
+ <svg class="b3-form__icon-icon"><use xlink:href="#iconKey"></use></svg>
+ <input type="text" class="b3-form__icon-input b3-text-field b3-form__icona-input" placeholder="%s"/>
+ <svg class="protyle-password__button b3-form__icona-icon"><use xlink:href="#iconForward"></use></svg>
</label>
</div>`
ret = fmt.Sprintf(passwordHTML, passwordID, Conf.Language(283))
@@ -502,14 +502,14 @@ func FilterContentByPublishAccess(c *gin.Context, publishAccess PublishAccess, b
publishIgnore := GetDisablePublishAccess(publishAccess)
if !CheckPathAccessableByPublishIgnore(box, docPath, publishIgnore) {
if onlyIcon {
- forbiddenHTML := `<div class="publish-access-block--alert fn__flex-column fn__flex-center" data-node-id="%s" style="text-align:center;">
- <span style="font-size:100px;">🚫</span>
+ forbiddenHTML := `<div class="protyle-password protyle-password--alert" data-node-id="%s">
+ <span class="protyle-password__logo">🚫</span>
</div>`
ret = fmt.Sprintf(forbiddenHTML, ID)
} else {
- forbiddenHTML := `<div class="publish-access-block--forbidden fn__flex-column fn__flex-center" data-node-id="%s" style="text-align:center;">
- <span style="font-size:100px; line-height:1.2;">🚫</span>
- <span style="font-size:2em;">%s</span>
+ forbiddenHTML := `<div class="protyle-password protyle-password--forbidden" data-node-id="%s">
+ <span class="protyle-password__logo">🚫</span>
+ <div class="protyle-password__tip">%s</div>
</div>`
ret = fmt.Sprintf(forbiddenHTML, ID, Conf.Language(284))
}