mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-10 06:32:33 +01:00
This commit is contained in:
parent
ff45ebcdaf
commit
2659052bb9
40 changed files with 164 additions and 151 deletions
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue