${window.siyuan.languages.md12}
diff --git a/app/src/mobile/util/MobileBackFoward.ts b/app/src/mobile/util/MobileBackFoward.ts
index 54bb0d7bd..e5667d474 100644
--- a/app/src/mobile/util/MobileBackFoward.ts
+++ b/app/src/mobile/util/MobileBackFoward.ts
@@ -90,7 +90,14 @@ const focusStack = (backStack: IBackStack) => {
if (getResponse.data.isSyncing) {
disabledForeverProtyle(protyle);
} else {
- if (protyle.disabled) {
+ let readOnly = window.siyuan.config.readonly ? "true" : "false";
+ if (readOnly === "false") {
+ readOnly = protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_READONLY);
+ if (!readOnly) {
+ readOnly = window.siyuan.config.editor.readOnly ? "true" : "false";
+ }
+ }
+ if (readOnly === "true") {
disabledProtyle(protyle);
} else {
enableProtyle(protyle);
diff --git a/app/src/mobile/util/initFramework.ts b/app/src/mobile/util/initFramework.ts
index 4354d37cd..470e49554 100644
--- a/app/src/mobile/util/initFramework.ts
+++ b/app/src/mobile/util/initFramework.ts
@@ -105,35 +105,9 @@ export const initFramework = (app: App) => {
document.getElementById("toolbarMore").addEventListener("click", () => {
popMenu();
});
- const editElement = document.getElementById("toolbarEdit");
- if (window.siyuan.config.readonly) {
- editElement.classList.add("fn__none");
- }
- const inputElement = document.getElementById("toolbarName") as HTMLInputElement;
- const editIconElement = editElement.querySelector("use");
- if (window.siyuan.config.readonly || window.siyuan.config.editor.readOnly) {
- inputElement.readOnly = true;
- editIconElement.setAttribute("xlink:href", "#iconPreview");
- } else {
- inputElement.readOnly = false;
- editIconElement.setAttribute("xlink:href", "#iconEdit");
- }
- editElement.addEventListener(getEventName(), () => {
- window.siyuan.config.editor.readOnly = !window.siyuan.config.editor.readOnly;
- fetchPost("/api/setting/setEditor", window.siyuan.config.editor);
- });
document.getElementById("toolbarSync").addEventListener(getEventName(), () => {
syncGuide(app);
});
- if (isIPhone() && !window.siyuan.config.readonly && !window.siyuan.config.editor.readOnly) {
- // 不知道为什么 iPhone 中如果是编辑状态,点击文档后无法点击标题
- setTimeout(() => {
- editElement.dispatchEvent(new CustomEvent(getEventName()));
- setTimeout(() => {
- editElement.dispatchEvent(new CustomEvent(getEventName()));
- }, Constants.TIMEOUT_INPUT);
- }, Constants.TIMEOUT_INPUT);
- }
document.getElementById("modelClose").addEventListener("click", () => {
closeModel();
});
@@ -171,7 +145,7 @@ const initEditorName = () => {
const inputElement = document.getElementById("toolbarName") as HTMLInputElement;
inputElement.setAttribute("placeholder", window.siyuan.languages._kernel[16]);
inputElement.addEventListener("blur", () => {
- if (window.siyuan.config.readonly || window.siyuan.config.editor.readOnly || window.siyuan.mobile.editor.protyle.disabled) {
+ if (inputElement.getAttribute("readonly") === "readonly") {
return;
}
if (!validateName(inputElement.value)) {
diff --git a/app/src/mobile/util/keyboardToolbar.ts b/app/src/mobile/util/keyboardToolbar.ts
index 5b8afb8db..d4a29684a 100644
--- a/app/src/mobile/util/keyboardToolbar.ts
+++ b/app/src/mobile/util/keyboardToolbar.ts
@@ -291,8 +291,8 @@ const renderKeyboardToolbar = () => {
clearTimeout(renderKeyboardToolbarTimeout);
renderKeyboardToolbarTimeout = window.setTimeout(() => {
if (getSelection().rangeCount === 0 ||
- window.siyuan.config.editor.readOnly ||
window.siyuan.config.readonly ||
+ document.getElementById("toolbarName").getAttribute("readonly") === "readonly" ||
window.screen.height - window.innerHeight < 160 || // reloadSync 会导致 selectionchange,从而导致键盘没有弹起的情况下出现工具栏
!document.activeElement || (
document.activeElement &&
@@ -492,7 +492,7 @@ export const initKeyboardToolbar = () => {
toolbarElement.addEventListener("click", (event) => {
const target = event.target as HTMLElement;
const slashBtnElement = hasClosestByClassName(event.target as HTMLElement, "keyboard__slash-item");
- const protyle = getCurrentEditor().protyle;
+ const protyle = getCurrentEditor()?.protyle;
if (slashBtnElement && !slashBtnElement.getAttribute("data-type")) {
const dataValue = decodeURIComponent(slashBtnElement.getAttribute("data-value"));
protyle.hint.fill(dataValue, protyle, false); // 点击后 range 会改变
@@ -544,7 +544,7 @@ export const initKeyboardToolbar = () => {
}
return;
}
- if (window.siyuan.config.readonly || window.siyuan.config.editor.readOnly || !getCurrentEditor()) {
+ if (window.siyuan.config.readonly || !protyle || protyle.disabled) {
return;
}
if (type === "undo") {
diff --git a/app/src/mobile/util/onMessage.ts b/app/src/mobile/util/onMessage.ts
index cf8681ff0..bda2ee437 100644
--- a/app/src/mobile/util/onMessage.ts
+++ b/app/src/mobile/util/onMessage.ts
@@ -3,18 +3,6 @@ import {processSync, progressLoading, progressStatus, reloadSync, transactionErr
import {Constants} from "../../constants";
import {App} from "../../index";
-const processReadonly = () => {
- const inputElement = document.getElementById("toolbarName") as HTMLInputElement;
- const editIconElement = document.querySelector("#toolbarEdit use");
- if (!window.siyuan.config.editor.readOnly) {
- inputElement.readOnly = false;
- editIconElement.setAttribute("xlink:href", "#iconEdit");
- } else {
- inputElement.readOnly = true;
- editIconElement.setAttribute("xlink:href", "#iconPreview");
- }
-};
-
export const onMessage = (app: App, data: IWebSocketData) => {
if (data) {
switch (data.cmd) {
@@ -23,7 +11,6 @@ export const onMessage = (app: App, data: IWebSocketData) => {
break;
case "readonly":
window.siyuan.config.editor.readOnly = data.data;
- processReadonly();
break;
case"progress":
progressLoading(data);
diff --git a/app/src/mobile/util/setEmpty.ts b/app/src/mobile/util/setEmpty.ts
index e49108fc8..f4f1c63b3 100644
--- a/app/src/mobile/util/setEmpty.ts
+++ b/app/src/mobile/util/setEmpty.ts
@@ -8,7 +8,6 @@ import {App} from "../../index";
export const setEmpty = (app: App) => {
document.getElementById("toolbarName").classList.add("fn__hidden");
- document.getElementById("toolbarEdit").classList.add("fn__hidden");
document.getElementById("editor").classList.add("fn__none");
const emptyElement = document.getElementById("empty");
emptyElement.classList.remove("fn__none");
@@ -83,7 +82,6 @@ export const setEmpty = (app: App) => {
export const setEditor = () => {
document.getElementById("toolbarName").classList.remove("fn__hidden");
- document.getElementById("toolbarEdit").classList.remove("fn__hidden");
document.getElementById("editor").classList.remove("fn__none");
document.getElementById("empty").classList.add("fn__none");
};
diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.ts
index dcf30fcda..3eefad09c 100644
--- a/app/src/protyle/breadcrumb/index.ts
+++ b/app/src/protyle/breadcrumb/index.ts
@@ -46,6 +46,8 @@ export class Breadcrumb {
'
'}
+
+
@@ -104,6 +106,14 @@ export class Breadcrumb {
event.stopPropagation();
event.preventDefault();
break;
+ } else if (type === "readonly") {
+ fetchPost("/api/attr/setBlockAttrs", {
+ id: protyle.block.rootID,
+ attrs: {[Constants.CUSTOM_SY_READONLY]: target.querySelector("use").getAttribute("xlink:href") === "#iconUnlock" ? "true" : "false"}
+ });
+ event.stopPropagation();
+ event.preventDefault();
+ break;
} else if (type === "exit-focus") {
zoomOut({protyle, id: protyle.block.rootID, focusId: protyle.block.id});
event.stopPropagation();
@@ -364,7 +374,7 @@ export class Breadcrumb {
}
}).element);
}
- if (window.siyuan.menus.menu.element.childElementCount > 0) {
+ if (window.siyuan.menus.menu.element.lastElementChild.childElementCount > 0) {
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
}
window.siyuan.menus.menu.append(new MenuItem({
@@ -423,9 +433,46 @@ export class Breadcrumb {
type: "submenu",
submenu: editSubmenu
}).element);
+ const isCustomReadonly = protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_READONLY);
+ window.siyuan.menus.menu.append(new MenuItem({
+ label: window.siyuan.languages.editReadonly,
+ icon: "iconLock",
+ type: "submenu",
+ submenu: [{
+ iconHTML: "",
+ current: isCustomReadonly === "true",
+ label: window.siyuan.languages.enable,
+ click() {
+ fetchPost("/api/attr/setBlockAttrs", {
+ id: protyle.block.rootID,
+ attrs: {[Constants.CUSTOM_SY_READONLY]: "true"}
+ });
+ }
+ }, {
+ iconHTML: "",
+ current: isCustomReadonly === "false",
+ label: window.siyuan.languages.disable,
+ click() {
+ fetchPost("/api/attr/setBlockAttrs", {
+ id: protyle.block.rootID,
+ attrs: {[Constants.CUSTOM_SY_READONLY]: "false"}
+ });
+ }
+ }, {
+ iconHTML: "",
+ current: !isCustomReadonly,
+ label: window.siyuan.languages.default,
+ click() {
+ fetchPost("/api/attr/setBlockAttrs", {
+ id: protyle.block.rootID,
+ attrs: {[Constants.CUSTOM_SY_READONLY]: ""}
+ });
+ }
+ }]
+ }).element);
/// #if !MOBILE
if (!protyle.disabled) {
- const isCustomFullWidth = protyle.wysiwyg.element.getAttribute("custom-sy-fullwidth");
+ const isCustomFullWidth = protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_FULLWIDTH);
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.fullWidth,
type: "submenu",
@@ -436,7 +483,7 @@ export class Breadcrumb {
click() {
fetchPost("/api/attr/setBlockAttrs", {
id: protyle.block.rootID,
- attrs: {"custom-sy-fullwidth": "true"}
+ attrs: {[Constants.CUSTOM_SY_FULLWIDTH]: "true"}
});
}
}, {
@@ -446,7 +493,7 @@ export class Breadcrumb {
click() {
fetchPost("/api/attr/setBlockAttrs", {
id: protyle.block.rootID,
- attrs: {"custom-sy-fullwidth": "false"}
+ attrs: {[Constants.CUSTOM_SY_FULLWIDTH]: "false"}
});
}
}, {
@@ -456,7 +503,7 @@ export class Breadcrumb {
click() {
fetchPost("/api/attr/setBlockAttrs", {
id: protyle.block.rootID,
- attrs: {"custom-sy-fullwidth": ""}
+ attrs: {[Constants.CUSTOM_SY_FULLWIDTH]: ""}
});
}
}]
diff --git a/app/src/protyle/header/Title.ts b/app/src/protyle/header/Title.ts
index bc3eaeb76..b559b4346 100644
--- a/app/src/protyle/header/Title.ts
+++ b/app/src/protyle/header/Title.ts
@@ -299,8 +299,8 @@ export class Title {
return false;
}
this.element.setAttribute("data-node-id", protyle.block.rootID);
- if (response.data.ial["custom-riff-decks"]) {
- this.element.setAttribute("custom-riff-decks", response.data.ial["custom-riff-decks"]);
+ if (response.data.ial[Constants.CUSTOM_RIFF_DECKS]) {
+ this.element.setAttribute(Constants.CUSTOM_RIFF_DECKS, response.data.ial[Constants.CUSTOM_RIFF_DECKS]);
}
protyle.background?.render(response.data.ial, protyle.block.rootID);
protyle.wysiwyg.renderCustom(response.data.ial);
diff --git a/app/src/protyle/header/openTitleMenu.ts b/app/src/protyle/header/openTitleMenu.ts
index d2d6c7d37..84d8e15bc 100644
--- a/app/src/protyle/header/openTitleMenu.ts
+++ b/app/src/protyle/header/openTitleMenu.ts
@@ -122,7 +122,7 @@ export const openTitleMenu = (protyle: IProtyle, position: {
if (!titleElement) {
titleElement = document.createElement("div");
titleElement.setAttribute("data-node-id", protyle.block.rootID);
- titleElement.setAttribute("custom-riff-decks", response.data.ial["custom-riff-decks"]);
+ titleElement.setAttribute(Constants.CUSTOM_RIFF_DECKS, response.data.ial[Constants.CUSTOM_RIFF_DECKS]);
}
quickMakeCard(protyle, [titleElement]);
}
diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.ts
index 3307f58e6..ae6d656fa 100644
--- a/app/src/protyle/index.ts
+++ b/app/src/protyle/index.ts
@@ -117,10 +117,12 @@ export class Protyle {
});
break;
case "readonly":
- if (data.data) {
- disabledProtyle(this.protyle);
- } else {
- enableProtyle(this.protyle);
+ if (!this.protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_READONLY)) {
+ if (data.data) {
+ disabledProtyle(this.protyle);
+ } else {
+ enableProtyle(this.protyle);
+ }
}
break;
case "heading2doc":
diff --git a/app/src/protyle/scroll/saveScroll.ts b/app/src/protyle/scroll/saveScroll.ts
index 3c197b044..0188c78d3 100644
--- a/app/src/protyle/scroll/saveScroll.ts
+++ b/app/src/protyle/scroll/saveScroll.ts
@@ -72,10 +72,8 @@ export const getDocByScroll = (options: {
protyle: options.protyle,
action: actions,
scrollAttr: options.scrollAttr,
+ afterCB: options.cb
});
- if (options.cb) {
- options.cb();
- }
});
return;
}
@@ -89,9 +87,7 @@ export const getDocByScroll = (options: {
protyle: options.protyle,
action: actions,
scrollAttr: options.scrollAttr,
+ afterCB: options.cb
});
- if (options.cb) {
- options.cb();
- }
});
};
diff --git a/app/src/protyle/ui/initUI.ts b/app/src/protyle/ui/initUI.ts
index 2ee354760..ecbd5c113 100644
--- a/app/src/protyle/ui/initUI.ts
+++ b/app/src/protyle/ui/initUI.ts
@@ -124,7 +124,7 @@ export const setPadding = (protyle: IProtyle) => {
let min24 = 24;
if (!isMobile()) {
let padding = (protyle.element.clientWidth - Constants.SIZE_EDITOR_WIDTH) / 2;
- let isFullWidth = protyle.wysiwyg.element.getAttribute("custom-sy-fullwidth");
+ let isFullWidth = protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_FULLWIDTH);
if (!isFullWidth) {
isFullWidth = window.siyuan.config.editor.fullWidth ? "true" : "false";
}
diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts
index b8fedc003..aadb82b7f 100644
--- a/app/src/protyle/util/onGet.ts
+++ b/app/src/protyle/util/onGet.ts
@@ -232,7 +232,14 @@ const setHTML = (options: {
protyle.breadcrumb.element.nextElementSibling.textContent = "";
}
protyle.element.removeAttribute("disabled-forever");
- if (window.siyuan.config.readonly || window.siyuan.config.editor.readOnly) {
+ let readOnly = window.siyuan.config.readonly ? "true" : "false";
+ if (readOnly === "false") {
+ readOnly = protyle.wysiwyg.element.getAttribute(Constants.CUSTOM_SY_READONLY);
+ if (!readOnly) {
+ readOnly = window.siyuan.config.editor.readOnly ? "true" : "false";
+ }
+ }
+ if (readOnly === "true") {
disabledProtyle(protyle);
} else {
enableProtyle(protyle);
@@ -305,6 +312,9 @@ export const disabledProtyle = (protyle: IProtyle) => {
titleElement.setAttribute("contenteditable", "false");
titleElement.style.userSelect = "text";
}
+ /// #if MOBILE
+ document.getElementById("toolbarName").setAttribute("readonly", "readonly");
+ /// #endif
if (protyle.background) {
protyle.background.element.classList.remove("protyle-background--enable");
protyle.background.element.classList.remove("protyle-background--mobileshow");
@@ -317,6 +327,7 @@ export const disabledProtyle = (protyle: IProtyle) => {
protyle.wysiwyg.element.querySelectorAll('[contenteditable="true"][spellcheck]').forEach(item => {
item.setAttribute("contenteditable", "false");
});
+ protyle.breadcrumb.element.parentElement.querySelector('[data-type="readonly"] use').setAttribute("xlink:href", "#iconLock");
};
/** 解除编辑器禁用 */
@@ -328,6 +339,7 @@ export const enableProtyle = (protyle: IProtyle) => {
if (isMobile()) {
// Android 端空块输入法弹出会收起 https://ld246.com/article/1689713888289
// iPhone,iPad 端 protyle.wysiwyg.element contenteditable 为 true 时,输入会在块中间插入 span 导致保存失败 https://ld246.com/article/1643473862873/comment/1643813765839#comments
+ document.getElementById("toolbarName").removeAttribute("readonly");
} else {
protyle.wysiwyg.element.setAttribute("contenteditable", "true");
protyle.wysiwyg.element.style.userSelect = "";
@@ -345,6 +357,7 @@ export const enableProtyle = (protyle: IProtyle) => {
item.setAttribute("contenteditable", "true");
}
});
+ protyle.breadcrumb.element.parentElement.querySelector('[data-type="readonly"] use').setAttribute("xlink:href", "#iconUnlock");
};
diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts
index c2907042e..d77586966 100644
--- a/app/src/protyle/util/paste.ts
+++ b/app/src/protyle/util/paste.ts
@@ -224,7 +224,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven
tempElement.querySelectorAll("[data-node-id]").forEach((e) => {
const newId = Lute.NewNodeID();
e.setAttribute("data-node-id", newId);
- e.removeAttribute("custom-riff-decks");
+ e.removeAttribute(Constants.CUSTOM_RIFF_DECKS);
e.classList.remove("protyle-wysiwyg--select", "protyle-wysiwyg--hl");
e.setAttribute("updated", newId.split("-")[0]);
isBlock = true;
diff --git a/app/src/protyle/util/reload.ts b/app/src/protyle/util/reload.ts
index f1c3e4378..1f7ff8635 100644
--- a/app/src/protyle/util/reload.ts
+++ b/app/src/protyle/util/reload.ts
@@ -32,8 +32,8 @@ export const reloadProtyle = (protyle: IProtyle, focus: boolean) => {
refTreeID: protyle.block.rootID,
keyword: isMention ? inputsElement[1].value : inputsElement[0].value
}, response => {
- protyle.options.backlinkData = isMention ? response.data.backmentions : response.data.backlinks,
- renderBacklink(protyle, protyle.options.backlinkData);
+ protyle.options.backlinkData = isMention ? response.data.backmentions : response.data.backlinks;
+ renderBacklink(protyle, protyle.options.backlinkData);
});
}
} else {
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 766a171e2..64b7a537d 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -108,7 +108,7 @@ export class WYSIWYG {
}
public renderCustom(ial: IObject) {
- let isFullWidth = ial["custom-sy-fullwidth"];
+ let isFullWidth = ial[Constants.CUSTOM_SY_FULLWIDTH];
if (!isFullWidth) {
isFullWidth = window.siyuan.config.editor.fullWidth ? "true" : "false";
}
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index f83a64ab6..cf0401642 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -1064,7 +1064,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
event.stopPropagation();
return true;
}
- if (matchHotKey(window.siyuan.config.keymap.editor.general.rename.custom, event)) {
+ if (matchHotKey(window.siyuan.config.keymap.editor.general.rename.custom, event) && !protyle.disabled) {
if (selectText === "") {
fetchPost("/api/block/getDocInfo", {
id: protyle.block.rootID
diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts
index 1b9c9b4b0..109f805ac 100644
--- a/app/src/protyle/wysiwyg/transaction.ts
+++ b/app/src/protyle/wysiwyg/transaction.ts
@@ -7,7 +7,7 @@ import {processRender} from "../util/processCode";
import {highlightRender} from "../render/highlightRender";
import {hasClosestBlock, hasClosestByAttribute} from "../util/hasClosest";
import {setFold, zoomOut} from "../../menus/protyle";
-import {onGet} from "../util/onGet";
+import {disabledProtyle, enableProtyle, onGet} from "../util/onGet";
/// #if !MOBILE
import {getAllModels} from "../../layout/getAll";
/// #endif
@@ -492,21 +492,32 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
if (refElement) {
nodeAttrHTML += refElement.outerHTML;
}
- if (data.new["custom-riff-decks"] && data.new["custom-riff-decks"] !== data.old["custom-riff-decks"]) {
+ if (data.new[Constants.CUSTOM_RIFF_DECKS] && data.new[Constants.CUSTOM_RIFF_DECKS] !== data.old[Constants.CUSTOM_RIFF_DECKS]) {
protyle.title.element.style.animation = "addCard 450ms linear";
- protyle.title.element.setAttribute("custom-riff-decks", data.new["custom-riff-decks"]);
+ protyle.title.element.setAttribute(Constants.CUSTOM_RIFF_DECKS, data.new[Constants.CUSTOM_RIFF_DECKS]);
setTimeout(() => {
protyle.title.element.style.animation = "";
}, 450);
- } else if (!data.new["custom-riff-decks"]) {
- protyle.title.element.removeAttribute("custom-riff-decks");
+ } else if (!data.new[Constants.CUSTOM_RIFF_DECKS]) {
+ protyle.title.element.removeAttribute(Constants.CUSTOM_RIFF_DECKS);
}
protyle.title.element.querySelector(".protyle-attr").innerHTML = nodeAttrHTML;
}
protyle.wysiwyg.renderCustom(attrsResult);
- if (data.new["custom-sy-fullwidth"] !== data.old["custom-sy-fullwidth"]) {
+ if (data.new[Constants.CUSTOM_SY_FULLWIDTH] !== data.old[Constants.CUSTOM_SY_FULLWIDTH]) {
setPadding(protyle);
}
+ if (data.new[Constants.CUSTOM_SY_READONLY] !== data.old[Constants.CUSTOM_SY_READONLY]) {
+ let customReadOnly = data.new[Constants.CUSTOM_SY_READONLY];
+ if (!customReadOnly) {
+ customReadOnly = window.siyuan.config.editor.readOnly ? "true" : "false";
+ }
+ if (customReadOnly === "true") {
+ disabledProtyle(protyle);
+ } else {
+ enableProtyle(protyle);
+ }
+ }
if (data.new.icon !== data.old.icon) {
/// #if MOBILE
if (window.siyuan.mobile.editor.protyle.background.ial.icon !== data.new.icon) {
@@ -530,12 +541,12 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, isUndo:
Object.keys(data.old).forEach(key => {
item.removeAttribute(key);
});
- if (data.new.style && data.new["custom-riff-decks"] && data.new["custom-riff-decks"] !== data.old["custom-riff-decks"]) {
+ if (data.new.style && data.new[Constants.CUSTOM_RIFF_DECKS] && data.new[Constants.CUSTOM_RIFF_DECKS] !== data.old[Constants.CUSTOM_RIFF_DECKS]) {
data.new.style += ";animation:addCard 450ms linear";
}
Object.keys(data.new).forEach(key => {
item.setAttribute(key, data.new[key]);
- if (key === "custom-riff-decks" && data.new["custom-riff-decks"] !== data.old["custom-riff-decks"]) {
+ if (key === Constants.CUSTOM_RIFF_DECKS && data.new[Constants.CUSTOM_RIFF_DECKS] !== data.old[Constants.CUSTOM_RIFF_DECKS]) {
item.style.animation = "addCard 450ms linear";
setTimeout(() => {
item.style.animation = "";
diff --git a/app/src/search/util.ts b/app/src/search/util.ts
index 9e9d44400..92acfea45 100644
--- a/app/src/search/util.ts
+++ b/app/src/search/util.ts
@@ -255,9 +255,6 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo
breadcrumbDocName: true
},
});
- if (window.siyuan.config.editor.readOnly) {
- disabledProtyle(edit.protyle);
- }
if (closeCB) {
if (data.layout === 1) {
if (data.col) {
diff --git a/app/src/util/escape.ts b/app/src/util/escape.ts
index f9e71c556..b1a413ebb 100644
--- a/app/src/util/escape.ts
+++ b/app/src/util/escape.ts
@@ -12,5 +12,5 @@ export const escapeAttr = (html: string) => {
export const escapeAriaLabel = (html: string) => {
return html.replace(/"/g, """).replace(/'/g, "'")
- .replace(/