+
${window.siyuan.languages.userGuide}
diff --git a/app/src/layout/topBar.ts b/app/src/layout/topBar.ts
index 152e28d4f..a77c53e74 100644
--- a/app/src/layout/topBar.ts
+++ b/app/src/layout/topBar.ts
@@ -301,17 +301,15 @@ export const setZoom = (type: "zoomIn" | "zoomOut" | "restore") => {
const openPlugin = (app: App, target: Element) => {
const menu = new Menu("topBarPlugin");
- if (!isHuawei()) {
- menu.addItem({
- icon: "iconSettings",
- label: window.siyuan.languages.manage,
- disabled: window.siyuan.config.readonly,
- click() {
- openSetting(app).element.querySelector('.b3-tab-bar [data-name="bazaar"]').dispatchEvent(new CustomEvent("click"));
- }
- });
- menu.addSeparator();
- }
+ menu.addItem({
+ icon: "iconSettings",
+ label: window.siyuan.languages.manage,
+ ignore: isHuawei() || window.siyuan.config.readonly,
+ click() {
+ openSetting(app).element.querySelector('.b3-tab-bar [data-name="bazaar"]').dispatchEvent(new CustomEvent("click"));
+ }
+ });
+ menu.addSeparator(undefined, isHuawei() || window.siyuan.config.readonly);
let hasPlugin = false;
app.plugins.forEach((plugin) => {
// @ts-ignore
diff --git a/app/src/menus/Menu.ts b/app/src/menus/Menu.ts
index c0ec5fe69..fc5b6cba9 100644
--- a/app/src/menus/Menu.ts
+++ b/app/src/menus/Menu.ts
@@ -165,6 +165,9 @@ export class MenuItem {
public element: HTMLElement;
constructor(options: IMenu) {
+ if (options.ignore) {
+ return;
+ }
if (options.type === "empty") {
this.element = document.createElement("div");
this.element.innerHTML = options.label;
diff --git a/app/src/menus/commonMenuItem.ts b/app/src/menus/commonMenuItem.ts
index e571f3498..0c45f0272 100644
--- a/app/src/menus/commonMenuItem.ts
+++ b/app/src/menus/commonMenuItem.ts
@@ -448,7 +448,6 @@ export const exportMd = (id: string) => {
label: window.siyuan.languages.template,
iconClass: "ft__error",
icon: "iconMarkdown",
- disabled: window.siyuan.config.readonly,
click: async () => {
const result = await fetchSyncPost("/api/block/getRefText", {id: id});
@@ -508,9 +507,8 @@ export const exportMd = (id: string) => {
});
});
return;
- } else if (response.code === 0) {
- showMessage(window.siyuan.languages.exportTplSucc);
}
+ showMessage(window.siyuan.languages.exportTplSucc);
});
dialog.destroy();
});
diff --git a/app/src/menus/navigation.ts b/app/src/menus/navigation.ts
index afcf178dd..3e3a65c3c 100644
--- a/app/src/menus/navigation.ts
+++ b/app/src/menus/navigation.ts
@@ -73,51 +73,53 @@ const initMultiMenu = (selectItemElements: NodeListOf
, app: App) => {
return window.siyuan.menus.menu;
}
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
- const riffCardMenu = [{
- iconHTML: "",
- accelerator: window.siyuan.config.keymap.editor.general.quickMakeCard.custom,
- label: window.siyuan.languages.quickMakeCard,
- click: () => {
- transaction(undefined, [{
- action: "addFlashcards",
- deckID: Constants.QUICK_DECK_ID,
- blockIDs,
- }], [{
- action: "removeFlashcards",
- deckID: Constants.QUICK_DECK_ID,
- blockIDs,
- }]);
- }
- }, {
- iconHTML: "",
- label: window.siyuan.languages.removeCard,
- click: () => {
- transaction(undefined, [{
- action: "removeFlashcards",
- deckID: Constants.QUICK_DECK_ID,
- blockIDs,
- }], [{
- action: "addFlashcards",
- deckID: Constants.QUICK_DECK_ID,
- blockIDs,
- }]);
- }
- }];
- if (window.siyuan.config.flashcard.deck) {
- riffCardMenu.push({
+ if (!window.siyuan.config.readonly) {
+ const riffCardMenu = [{
iconHTML: "",
- label: window.siyuan.languages.addToDeck,
+ accelerator: window.siyuan.config.keymap.editor.general.quickMakeCard.custom,
+ label: window.siyuan.languages.quickMakeCard,
click: () => {
- makeCard(app, blockIDs);
+ transaction(undefined, [{
+ action: "addFlashcards",
+ deckID: Constants.QUICK_DECK_ID,
+ blockIDs,
+ }], [{
+ action: "removeFlashcards",
+ deckID: Constants.QUICK_DECK_ID,
+ blockIDs,
+ }]);
}
- });
+ }, {
+ iconHTML: "",
+ label: window.siyuan.languages.removeCard,
+ click: () => {
+ transaction(undefined, [{
+ action: "removeFlashcards",
+ deckID: Constants.QUICK_DECK_ID,
+ blockIDs,
+ }], [{
+ action: "addFlashcards",
+ deckID: Constants.QUICK_DECK_ID,
+ blockIDs,
+ }]);
+ }
+ }];
+ if (window.siyuan.config.flashcard.deck) {
+ riffCardMenu.push({
+ iconHTML: "",
+ label: window.siyuan.languages.addToDeck,
+ click: () => {
+ makeCard(app, blockIDs);
+ }
+ });
+ }
+ window.siyuan.menus.menu.append(new MenuItem({
+ label: window.siyuan.languages.riffCard,
+ icon: "iconRiffCard",
+ submenu: riffCardMenu,
+ }).element);
+ window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
}
- window.siyuan.menus.menu.append(new MenuItem({
- label: window.siyuan.languages.riffCard,
- icon: "iconRiffCard",
- submenu: riffCardMenu,
- }).element);
- window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
openEditorTab(app, blockIDs);
if (app.plugins) {
emitOpenMenu({
@@ -201,33 +203,35 @@ export const initNavigationMenu = (app: App, liElement: HTMLElement) => {
submenu: subMenu,
}).element);
}
- window.siyuan.menus.menu.append(new MenuItem({
- label: window.siyuan.languages.riffCard,
- type: "submenu",
- icon: "iconRiffCard",
- submenu: [{
- iconHTML: "",
- label: window.siyuan.languages.spaceRepetition,
- accelerator: window.siyuan.config.keymap.editor.general.spaceRepetition.custom,
- click: () => {
- fetchPost("/api/riff/getNotebookRiffDueCards", {notebook: notebookId}, (response) => {
- openCardByData(app, response.data, "notebook", notebookId, name);
- });
- /// #if MOBILE
- closePanel();
- /// #endif
- }
- }, {
- iconHTML: "",
- label: window.siyuan.languages.manage,
- click: () => {
- viewCards(app, notebookId, name, "Notebook");
- /// #if MOBILE
- closePanel();
- /// #endif
- }
- }],
- }).element);
+ if (!window.siyuan.config.readonly) {
+ window.siyuan.menus.menu.append(new MenuItem({
+ label: window.siyuan.languages.riffCard,
+ type: "submenu",
+ icon: "iconRiffCard",
+ submenu: [{
+ iconHTML: "",
+ label: window.siyuan.languages.spaceRepetition,
+ accelerator: window.siyuan.config.keymap.editor.general.spaceRepetition.custom,
+ click: () => {
+ fetchPost("/api/riff/getNotebookRiffDueCards", {notebook: notebookId}, (response) => {
+ openCardByData(app, response.data, "notebook", notebookId, name);
+ });
+ /// #if MOBILE
+ closePanel();
+ /// #endif
+ }
+ }, {
+ iconHTML: "",
+ label: window.siyuan.languages.manage,
+ click: () => {
+ viewCards(app, notebookId, name, "Notebook");
+ /// #if MOBILE
+ closePanel();
+ /// #endif
+ }
+ }],
+ }).element);
+ }
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.search,
accelerator: window.siyuan.config.keymap.general.search.custom,
@@ -471,76 +475,78 @@ export const initFileMenu = (app: App, notebookId: string, pathString: string, l
});
}
}).element);
- const riffCardMenu = [{
- iconHTML: "",
- label: window.siyuan.languages.spaceRepetition,
- accelerator: window.siyuan.config.keymap.editor.general.spaceRepetition.custom,
- click: () => {
- fetchPost("/api/riff/getTreeRiffDueCards", {rootID: id}, (response) => {
- openCardByData(app, response.data, "doc", id, name);
- });
- /// #if MOBILE
- closePanel();
- /// #endif
- }
- }, {
- iconHTML: "",
- label: window.siyuan.languages.manage,
- click: () => {
- fetchPost("/api/filetree/getHPathByID", {
- id
- }, (response) => {
- viewCards(app, id, pathPosix().join(getNotebookName(notebookId), response.data), "Tree");
- });
- /// #if MOBILE
- closePanel();
- /// #endif
- }
- }, {
- iconHTML: "",
- accelerator: window.siyuan.config.keymap.editor.general.quickMakeCard.custom,
- label: window.siyuan.languages.quickMakeCard,
- click: () => {
- transaction(undefined, [{
- action: "addFlashcards",
- deckID: Constants.QUICK_DECK_ID,
- blockIDs: [id]
- }], [{
- action: "removeFlashcards",
- deckID: Constants.QUICK_DECK_ID,
- blockIDs: [id]
- }]);
- }
- }, {
- iconHTML: "",
- label: window.siyuan.languages.removeCard,
- click: () => {
- transaction(undefined, [{
- action: "removeFlashcards",
- deckID: Constants.QUICK_DECK_ID,
- blockIDs: [id]
- }], [{
- action: "addFlashcards",
- deckID: Constants.QUICK_DECK_ID,
- blockIDs: [id]
- }]);
- }
- }];
- if (window.siyuan.config.flashcard.deck) {
- riffCardMenu.push({
+ if (!window.siyuan.config.readonly) {
+ const riffCardMenu = [{
iconHTML: "",
- label: window.siyuan.languages.addToDeck,
+ label: window.siyuan.languages.spaceRepetition,
+ accelerator: window.siyuan.config.keymap.editor.general.spaceRepetition.custom,
click: () => {
- makeCard(app, [id]);
+ fetchPost("/api/riff/getTreeRiffDueCards", {rootID: id}, (response) => {
+ openCardByData(app, response.data, "doc", id, name);
+ });
+ /// #if MOBILE
+ closePanel();
+ /// #endif
}
- });
+ }, {
+ iconHTML: "",
+ label: window.siyuan.languages.manage,
+ click: () => {
+ fetchPost("/api/filetree/getHPathByID", {
+ id
+ }, (response) => {
+ viewCards(app, id, pathPosix().join(getNotebookName(notebookId), response.data), "Tree");
+ });
+ /// #if MOBILE
+ closePanel();
+ /// #endif
+ }
+ }, {
+ iconHTML: "",
+ accelerator: window.siyuan.config.keymap.editor.general.quickMakeCard.custom,
+ label: window.siyuan.languages.quickMakeCard,
+ click: () => {
+ transaction(undefined, [{
+ action: "addFlashcards",
+ deckID: Constants.QUICK_DECK_ID,
+ blockIDs: [id]
+ }], [{
+ action: "removeFlashcards",
+ deckID: Constants.QUICK_DECK_ID,
+ blockIDs: [id]
+ }]);
+ }
+ }, {
+ iconHTML: "",
+ label: window.siyuan.languages.removeCard,
+ click: () => {
+ transaction(undefined, [{
+ action: "removeFlashcards",
+ deckID: Constants.QUICK_DECK_ID,
+ blockIDs: [id]
+ }], [{
+ action: "addFlashcards",
+ deckID: Constants.QUICK_DECK_ID,
+ blockIDs: [id]
+ }]);
+ }
+ }];
+ if (window.siyuan.config.flashcard.deck) {
+ riffCardMenu.push({
+ iconHTML: "",
+ label: window.siyuan.languages.addToDeck,
+ click: () => {
+ makeCard(app, [id]);
+ }
+ });
+ }
+ window.siyuan.menus.menu.append(new MenuItem({
+ label: window.siyuan.languages.riffCard,
+ type: "submenu",
+ icon: "iconRiffCard",
+ submenu: riffCardMenu,
+ }).element);
}
- window.siyuan.menus.menu.append(new MenuItem({
- label: window.siyuan.languages.riffCard,
- type: "submenu",
- icon: "iconRiffCard",
- submenu: riffCardMenu,
- }).element);
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.search,
icon: "iconSearch",
diff --git a/app/src/menus/workspace.ts b/app/src/menus/workspace.ts
index 88f6d2017..f8e972d38 100644
--- a/app/src/menus/workspace.ts
+++ b/app/src/menus/workspace.ts
@@ -391,25 +391,27 @@ export const workspaceMenu = (app: App, rect: DOMRect) => {
submenu
}).element);
}
- window.siyuan.menus.menu.append(new MenuItem({
- label: window.siyuan.languages.riffCard,
- type: "submenu",
- icon: "iconRiffCard",
- submenu: [{
- iconHTML: "",
- label: window.siyuan.languages.spaceRepetition,
- accelerator: window.siyuan.config.keymap.general.riffCard.custom,
- click: () => {
- openCard(app);
- }
- }, {
- iconHTML: "",
- label: window.siyuan.languages.manage,
- click: () => {
- viewCards(app, "", window.siyuan.languages.all, "");
- }
- }],
- }).element);
+ if (!window.siyuan.config.readonly) {
+ window.siyuan.menus.menu.append(new MenuItem({
+ label: window.siyuan.languages.riffCard,
+ type: "submenu",
+ icon: "iconRiffCard",
+ submenu: [{
+ iconHTML: "",
+ label: window.siyuan.languages.spaceRepetition,
+ accelerator: window.siyuan.config.keymap.general.riffCard.custom,
+ click: () => {
+ openCard(app);
+ }
+ }, {
+ iconHTML: "",
+ label: window.siyuan.languages.manage,
+ click: () => {
+ viewCards(app, "", window.siyuan.languages.all, "");
+ }
+ }],
+ }).element);
+ }
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.recentDocs,
icon: "iconFile",
@@ -436,16 +438,14 @@ export const workspaceMenu = (app: App, rect: DOMRect) => {
}).element);
window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element);
}
- if (!isIPad()) {
- window.siyuan.menus.menu.append(new MenuItem({
- label: window.siyuan.languages.userGuide,
- icon: "iconHelp",
- disabled: window.siyuan.config.readonly,
- click: () => {
- mountHelp();
- }
- }).element);
- }
+ window.siyuan.menus.menu.append(new MenuItem({
+ label: window.siyuan.languages.userGuide,
+ icon: "iconHelp",
+ ignore: isIPad() || window.siyuan.config.readonly,
+ click: () => {
+ mountHelp();
+ }
+ }).element);
window.siyuan.menus.menu.append(new MenuItem({
label: window.siyuan.languages.feedback,
icon: "iconFeedback",
diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.ts
index f04daf707..3e5c01dd3 100644
--- a/app/src/mobile/index.ts
+++ b/app/src/mobile/index.ts
@@ -38,9 +38,6 @@ class App {
registerServiceWorker(`${Constants.SERVICE_WORKER_PATH}?v=${Constants.SIYUAN_VERSION}`);
}
addBaseURL();
- addScriptSync(`${Constants.PROTYLE_CDN}/js/lute/lute.min.js?v=${Constants.SIYUAN_VERSION}`, "protyleLuteScript");
- addScript(`${Constants.PROTYLE_CDN}/js/protyle-html.js?v=${Constants.SIYUAN_VERSION}`, "protyleWcHtmlScript");
-
this.appId = Constants.SIYUAN_APPID;
window.siyuan = {
zIndex: 10,
@@ -88,9 +85,34 @@ class App {
updateCardHV();
});
fetchPost("/api/system/getConf", {}, async (confResponse) => {
+ addScriptSync(`${Constants.PROTYLE_CDN}/js/lute/lute.min.js?v=${Constants.SIYUAN_VERSION}`, "protyleLuteScript");
+ addScript(`${Constants.PROTYLE_CDN}/js/protyle-html.js?v=${Constants.SIYUAN_VERSION}`, "protyleWcHtmlScript");
window.siyuan.config = confResponse.data.conf;
correctHotkey(siyuanApp);
-
+ await loadPlugins(this);
+ getLocalStorage(() => {
+ fetchGet(`/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`, (lauguages: IObject) => {
+ window.siyuan.languages = lauguages;
+ window.siyuan.menus = new Menus(this);
+ document.title = window.siyuan.languages.siyuanNote;
+ bootSync();
+ loadAssets(confResponse.data.conf.appearance);
+ initMessage();
+ initAssets();
+ fetchPost("/api/setting/getCloudUser", {}, userResponse => {
+ window.siyuan.user = userResponse.data;
+ fetchPost("/api/system/getEmojiConf", {}, emojiResponse => {
+ window.siyuan.emojis = emojiResponse.data as IEmoji[];
+ setNoteBook(() => {
+ initFramework(this, confResponse.data.start);
+ initRightMenu(this);
+ openChangelog();
+ });
+ });
+ });
+ addGA();
+ });
+ });
document.addEventListener("touchstart", handleTouchStart, false);
document.addEventListener("touchmove", handleTouchMove, false);
document.addEventListener("touchend", (event) => {
@@ -118,51 +140,6 @@ class App {
}
}
});
-
- const promises = [
- loadPlugins(this),
- new Promise(resolve => getLocalStorage(resolve)),
- new Promise(resolve => fetchGet(
- `/appearance/langs/${window.siyuan.config.appearance.lang}.json?v=${Constants.SIYUAN_VERSION}`,
- (lauguages: IObject) => {
- window.siyuan.languages = lauguages;
- resolve();
- },
- )),
- new Promise(resolve => {
- fetchPost("/api/setting/getEmojiConf", {}, emojiResponse => {
- window.siyuan.emojis = emojiResponse.data as IEmoji[];
- resolve();
- });
- }),
- ];
-
- if (!window.siyuan.config.readonly) {
- promises.push(new Promise(resolve => {
- fetchPost("/api/setting/getCloudUser", {}, userResponse => {
- window.siyuan.user = userResponse.data;
- resolve();
- });
- }));
- }
-
- await Promise.all(promises);
-
- if (!window.siyuan.config.readonly) {
- bootSync();
- }
-
- window.siyuan.menus = new Menus(this);
- document.title = window.siyuan.languages.siyuanNote;
- loadAssets(confResponse.data.conf.appearance);
- initMessage();
- initAssets();
- setNoteBook(() => {
- initFramework(this, confResponse.data.start);
- initRightMenu(this);
- openChangelog();
- });
- addGA();
});
}
}
diff --git a/app/src/mobile/menu/index.ts b/app/src/mobile/menu/index.ts
index 33175a132..0a9092e45 100644
--- a/app/src/mobile/menu/index.ts
+++ b/app/src/mobile/menu/index.ts
@@ -112,7 +112,7 @@ export const initRightMenu = (app: App) => {
-