Skip to content

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

:bug: Unify the mobile slash menu switch https://github.com/siyuan-note/siyuan/issues/19842

Daniel14c8de41fef0
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy
index ef2243ce4a..8924f51729 100644
--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy
+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20200924100950-9op5xi1.sy
@@ -7,7 +7,7 @@
"id": "20200924100950-9op5xi1",
"title": "Shortcuts",
"type": "doc",
- "updated": "20260928091747"
+ "updated": "20260928164213"
},
"Children": [
{
@@ -16,7 +16,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20260928091747-wub2unw",
- "updated": "20260928091747"
+ "updated": "20260928164213"
},
"Children": [
{
@@ -10007,7 +10007,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260927164841-n9zgr7r",
- "updated": "20260928091724"
+ "updated": "20260928164213"
},
"Children": [
{
@@ -10039,7 +10039,7 @@
},
{
"Type": "NodeText",
- "Data": " and view or edit a profile, then select the slash menu category. The mobile slash menu switch is off by default; changing it takes effect immediately and preserves your existing preference. When both this switch and the profile’s slash menu switch are enabled, type / to search for content blocks and select a result to insert at the original cursor position."
+ "Data": " and view or edit a profile, then select the slash menu category. The slash menu has one total switch on mobile. It is off by default, takes effect immediately, and preserves your existing mobile preference. When enabled, type / to search for content blocks and select a result to insert at the original cursor position. This switch applies to this device; candidate visibility and order are configured separately in each profile."
}
]
},
@@ -10048,12 +10048,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260927164841-clwu05c",
- "updated": "20260928091724"
+ "updated": "20260928164213"
},
"Children": [
{
"Type": "NodeText",
- "Data": "In custom profiles, use the category selector to switch between the toolbar and slash menu. Drag the six-dot handle on the left of an item to change its order, or use its switch to change visibility. Drag near the list edge to scroll. Clear the search before sorting, and confirm to save the profile. Built-in profiles are read-only; duplicate one to customize it, then activate the saved profile. Profiles are stored on this device and are not synced across devices."
+ "Data": "In custom profiles, use the category selector to switch between the toolbar and slash menu. Drag the six-dot handle on the left of an item to change its order, or use its switch to change visibility. Drag near the list edge to scroll. Clear the search before sorting, and confirm to save the profile. Candidate settings in built-in profiles are read-only; duplicate one to customize it, then activate the saved profile. Profiles are stored on this device and are not synced across devices."
}
]
},
diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy
index dcc34e4068..56dcc49b01 100644
--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy
+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20200813004551-gm0pbn1.sy
@@ -7,7 +7,7 @@
"id": "20200813004551-gm0pbn1",
"title": "快捷键",
"type": "doc",
- "updated": "20260928091747"
+ "updated": "20260928164213"
},
"Children": [
{
@@ -16,7 +16,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20260928091747-w9nonqj",
- "updated": "20260928091747"
+ "updated": "20260928164213"
},
"Children": [
{
@@ -10007,7 +10007,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260927164841-yjk81pw",
- "updated": "20260928091724"
+ "updated": "20260928164213"
},
"Children": [
{
@@ -10039,7 +10039,7 @@
},
{
"Type": "NodeText",
- "Data": ",查看或编辑方案后选择斜杠菜单分类。移动端斜杠菜单开关默认关闭,修改后立即生效,并保留已有设置。该开关与方案中的斜杠菜单开关均开启时,输入 / 可搜索内容块,选择候选后在原光标处插入。"
+ "Data": ",查看或编辑方案后选择斜杠菜单分类。移动端斜杠菜单只有一个总开关,默认关闭,修改后立即生效,并保留已有移动端设置。开启后输入 / 可搜索内容块,选择候选后在原光标处插入。总开关作用于本设备,候选项的显隐与排序分别保存在各方案中。"
}
]
},
@@ -10048,12 +10048,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260927164841-y6wu08m",
- "updated": "20260928091724"
+ "updated": "20260928164213"
},
"Children": [
{
"Type": "NodeText",
- "Data": "编辑自定义方案时,可通过分类选择框切换工具栏与斜杠菜单。拖动项目左侧的六点手柄调整顺序,使用项目开关调整显隐;拖至列表边缘可滚动。排序前需清空搜索,修改后确认保存方案。内置方案只读,可复制后自定义,再启用保存的方案。方案保存在本设备,不跨设备同步。"
+ "Data": "编辑自定义方案时,可通过分类选择框切换工具栏与斜杠菜单。拖动项目左侧的六点手柄调整顺序,使用项目开关调整显隐;拖至列表边缘可滚动。排序前需清空搜索,修改后确认保存方案。内置方案中的候选配置只读,可复制后自定义,再启用保存的方案。方案保存在本设备,不跨设备同步。"
}
]
},
diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy
index 35d39e9ad9..34c5535c23 100644
--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy
+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20211226122549-jktxego.sy
@@ -7,7 +7,7 @@
"id": "20211226122549-jktxego",
"title": "快捷鍵",
"type": "doc",
- "updated": "20260928091747"
+ "updated": "20260928164213"
},
"Children": [
{
@@ -16,7 +16,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20260928091747-a3qlogr",
- "updated": "20260928091747"
+ "updated": "20260928164213"
},
"Children": [
{
@@ -9996,7 +9996,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260927164841-m2ossua",
- "updated": "20260928091724"
+ "updated": "20260928164213"
},
"Children": [
{
@@ -10028,7 +10028,7 @@
},
{
"Type": "NodeText",
- "Data": ",檢視或編輯方案後選擇斜線選單分類。行動端斜線選單開關預設關閉,修改後立即生效,並保留既有設定。此開關與方案中的斜線選單開關皆開啟時,輸入 / 可搜尋內容區塊,選擇候選項目後在原游標處插入。"
+ "Data": ",檢視或編輯方案後選擇斜線選單分類。行動端斜線選單只有一個總開關,預設關閉,修改後立即生效,並保留既有行動端設定。開啟後輸入 / 可搜尋內容區塊,選擇候選項目後在原游標處插入。總開關作用於本裝置,候選項目的顯隱與排序分別儲存在各方案中。"
}
]
},
@@ -10037,12 +10037,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260927164841-7yj0cwc",
- "updated": "20260928091724"
+ "updated": "20260928164213"
},
"Children": [
{
"Type": "NodeText",
- "Data": "編輯自訂方案時,可透過分類選擇框切換工具列與斜線選單。拖曳項目左側的六點把手調整順序,使用項目開關調整顯隱;拖至清單邊緣可捲動。排序前需清空搜尋,修改後確認儲存方案。內建方案唯讀,可複製後自訂,再啟用儲存的方案。方案儲存在本裝置,不跨裝置同步。"
+ "Data": "編輯自訂方案時,可透過分類選擇框切換工具列與斜線選單。拖曳項目左側的六點把手調整順序,使用項目開關調整顯隱;拖至清單邊緣可捲動。排序前需清空搜尋,修改後確認儲存方案。內建方案中的候選設定唯讀,可複製後自訂,再啟用儲存的方案。方案儲存在本裝置,不跨裝置同步。"
}
]
},
diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy
index 9765a527dd..16ae7aaf6c 100644
--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy
+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-xsbxokr.sy
@@ -9,7 +9,7 @@
"id": "20240530101000-xsbxokr",
"title": "ショートカット",
"type": "doc",
- "updated": "20260928091747"
+ "updated": "20260928164213"
},
"Children": [
{
@@ -18,7 +18,7 @@
"HeadingLevel": 2,
"Properties": {
"id": "20260928091747-t67pljp",
- "updated": "20260928091747"
+ "updated": "20260928164213"
},
"Children": [
{
@@ -9932,7 +9932,7 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260927164841-exxixvw",
- "updated": "20260928091724"
+ "updated": "20260928164213"
},
"Children": [
{
@@ -9964,7 +9964,7 @@
},
{
"Type": "NodeText",
- "Data": " を開き、プロファイルを表示または編集して、スラッシュメニューの分類を選択します。モバイルのスラッシュメニューは初期設定では無効です。スイッチの変更は即座に反映され、既存の設定は保持されます。このスイッチとプロファイル内のスラッシュメニューのスイッチが両方有効な場合、/ を入力してコンテンツブロックを検索でき、候補を選択すると元のカーソル位置に挿入されます。"
+ "Data": " を開き、プロファイルを表示または編集して、スラッシュメニューの分類を選択します。モバイルのスラッシュメニューには有効・無効を切り替えるスイッチが1つあり、初期設定では無効です。変更は即座に反映され、既存のモバイル設定は保持されます。有効にすると、/ を入力してコンテンツブロックを検索でき、候補を選択すると元のカーソル位置に挿入されます。このスイッチは端末全体に適用され、候補の表示・非表示と順序はプロファイルごとに保存されます。"
}
]
},
@@ -9973,12 +9973,12 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20260927164841-2wtv9yz",
- "updated": "20260928091724"
+ "updated": "20260928164213"
},
"Children": [
{
"Type": "NodeText",
- "Data": "カスタムプロファイルでは、分類の選択欄でツールバーとスラッシュメニューを切り替えます。項目の左側にある6つの点のハンドルをドラッグして順序を変更し、スイッチで表示・非表示を設定します。リストの端までドラッグするとスクロールします。並べ替える前に検索欄を空にし、変更後は確認してプロファイルを保存します。組み込みプロファイルは読み取り専用です。複製してカスタマイズし、保存したプロファイルを有効にしてください。プロファイルはこの端末に保存され、端末間では同期されません。"
+ "Data": "カスタムプロファイルでは、分類の選択欄でツールバーとスラッシュメニューを切り替えます。項目の左側にある6つの点のハンドルをドラッグして順序を変更し、スイッチで表示・非表示を設定します。リストの端までドラッグするとスクロールします。並べ替える前に検索欄を空にし、変更後は確認してプロファイルを保存します。組み込みプロファイルの候補設定は読み取り専用です。複製してカスタマイズし、保存したプロファイルを有効にしてください。プロファイルはこの端末に保存され、端末間では同期されません。"
}
]
},
diff --git a/app/src/config/entryVisibility/mobileSlash.test.ts b/app/src/config/entryVisibility/mobileSlash.test.ts
new file mode 100644
index 0000000000..4a83316f91
--- /dev/null
+++ b/app/src/config/entryVisibility/mobileSlash.test.ts
@@ -0,0 +1,54 @@
+import * as assert from "node:assert/strict";
+import {readFileSync} from "node:fs";
+import {test} from "node:test";
+import {runInNewContext} from "node:vm";
+import {ModuleKind, transpileModule} from "typescript";
+import * as catalog from "./catalog";
+import * as profile from "./profile";
+
+test("mobile slash total switch reuses existing preferences and respects candidate visibility", () => {
+ const root = catalog.SLASH_MENU_ROOT_PATH;
+ const storageKey = "local-mobile-slash-menu";
+ const custom = {id: "custom", entries: {[root]: false, [`${root}.heading1`]: false}, orders: {}};
+ const config = {active: "custom", profiles: [custom]};
+ const storage: Record<string, {enabled: boolean}> = {};
+ let mobile = true;
+ const api = {} as typeof import("./runtime");
+ runInNewContext(transpileModule(readFileSync("src/config/entryVisibility/runtime.ts", "utf8"), {
+ compilerOptions: {module: ModuleKind.CommonJS},
+ }).outputText, {
+ exports: api,
+ window: {siyuan: {config: {appearance: {entryVisibility: config}}, storage}},
+ require: () => ({
+ ...catalog, ...profile,
+ Constants: {LOCAL_MOBILE_SLASH_MENU: storageKey},
+ isMobile: () => mobile,
+ TOOLBAR_ENTRY_ROOT_PATH: "editor.toolbar",
+ }),
+ });
+ assert.equal(api.isEntryVisible(root), false);
+ for (const active of ["simple", "full", "custom"]) {
+ config.active = active;
+ for (const enabled of [false, true]) {
+ storage[storageKey] = {enabled};
+ assert.equal(api.isEntryVisible(root), enabled);
+ assert.equal(api.getConfiguredEntryVisibility(root), enabled);
+ assert.equal(api.getConfiguredEntryVisibility(root, true), true);
+ }
+ }
+ config.active = "custom";
+ assert.equal(api.isEntryVisible(`${root}.heading1`), false);
+ assert.equal(api.isEntryVisible(`${root}.heading2`), true);
+ storage[storageKey].enabled = false;
+ assert.equal(api.isEntryVisible(`${root}.heading2`), false);
+ assert.equal(api.getConfiguredEntryVisibility(`${root}.heading2`, true), true);
+ assert.equal(api.getConfiguredEntryVisibility(`${root}.heading1`, true), false);
+ mobile = false;
+ storage[storageKey].enabled = true;
+ assert.equal(api.getConfiguredEntryVisibility(root), false);
+ assert.equal(api.getConfiguredEntryVisibility(root, true), false);
+ config.active = "full";
+ storage[storageKey].enabled = false;
+ assert.equal(api.getConfiguredEntryVisibility(root), true);
+ assert.equal(custom.entries[root], false);
+});
diff --git a/app/src/config/entryVisibility/mobileUi.test.ts b/app/src/config/entryVisibility/mobileUi.test.ts
index bc7ff6b257..6ee1d9e31e 100644
--- a/app/src/config/entryVisibility/mobileUi.test.ts
+++ b/app/src/config/entryVisibility/mobileUi.test.ts
@@ -29,7 +29,8 @@ const browserCases = async (sources: Record<string, string>, languages: Record<s
return {
ENTRY_PROFILE_FULL: "full", ENTRY_PROFILE_SIMPLE: "simple", ENTRY_VISIBILITY_VERSION: 1,
createEntryProfileSnapshot: () => ({}), createEntryOrderSnapshot: () => ({}),
- getConfiguredEntryVisibility: () => true,
+ getConfiguredEntryVisibility: (entryPath: string) => entryPath !== "editor.slash.menu" || !mobile ||
+ window.siyuan.storage[storageKey]?.enabled === true,
saveEntryVisibility: (config: Config.IEntryVisibility) => {
window.siyuan.config.appearance.entryVisibility = config;
},
@@ -83,6 +84,7 @@ const browserCases = async (sources: Record<string, string>, languages: Record<s
select.dispatchEvent(new Event("change", {bubbles: true}));
};
if (narrow) {
+ window.siyuan.storage[storageKey] = {enabled: true};
for (const id of ["", "custom"]) {
view = open(id);
check(Boolean(view.querySelector("[data-profile-field='template']")) === !id,
@@ -102,7 +104,9 @@ const browserCases = async (sources: Record<string, string>, languages: Record<s
check(document.elementFromPoint(rect.left + rect.width / 2, rect.top + rect.height / 2) === control,
`${selector} must be reachable by scrolling the form`);
}
- check(header.scrollHeight > header.clientHeight, "Upper form must scroll independently");
+ if (!id) {
+ check(header.scrollHeight > header.clientHeight, "New profile form must scroll independently");
+ }
const candidate = list.querySelector<HTMLInputElement>("input[data-entry-path]");
candidate.scrollIntoView({block: "nearest"});
const rect = candidate.getBoundingClientRect();
@@ -122,7 +126,8 @@ const browserCases = async (sources: Record<string, string>, languages: Record<s
check(!enabled.checked, "Mobile slash defaults to off");
enabled.click();
check(window.siyuan.storage[storageKey].enabled && writes.length === 1, "Device switch must persist immediately");
- check(view.querySelector("[data-entry-path='editor.slash.menu']"), "Profile root switch must be reachable");
+ check(!view.querySelector("[data-entry-path='editor.slash.menu']"), "Mobile must not show a second profile root switch");
+ check(view.querySelectorAll("[data-type='entry-mobile-options'] input").length === 1, "Only one total switch is shown");
check(!view.querySelector("[data-entry-move]"), "No arrow sort controls");
const browser = view.querySelector<HTMLElement>("[data-type='entry-browser']");
// 合成指针不属于浏览器的活动指针,仅替换捕获状态,命中测试和事件分发仍使用真实 DOM。
@@ -185,19 +190,20 @@ const browserCases = async (sources: Record<string, string>, languages: Record<s
check(!view.querySelector(".config-entry-visibility__drag"), "Search results must not permit partial-list sorting");
search.value = "";
search.dispatchEvent(new Event("input", {bubbles: true}));
- const rootSwitch = view.querySelector<HTMLInputElement>("[data-entry-path='editor.slash.menu']");
+ const rootSwitch = view.querySelector<HTMLInputElement>("[data-type='mobile-slash-menu']");
rootSwitch.click();
check(!view.querySelector(".config-entry-visibility__drag"), "Disabled menu must not be draggable");
check(view.querySelector<HTMLInputElement>("[data-entry-path='editor.slash.menu.heading1']").disabled,
"Disabled menu must disable candidate controls");
view.querySelector<HTMLElement>("[data-action='cancel']").click();
- check(config().profiles[0].entries["editor.slash.menu"] !== false, "Cancelling must discard profile changes");
+ check(config().profiles[0].entries["editor.slash.menu"] !== false, "Device switch must not overwrite profile data");
+ check(window.siyuan.storage[storageKey].enabled === false, "Device switch remains effective after closing");
view = open("full");
selectSlash();
check(!view.querySelector(".config-entry-visibility__drag"), "Built-in profiles must remain read-only");
enabled = view.querySelector<HTMLInputElement>("[data-type='mobile-slash-menu']");
enabled.click();
- check(window.siyuan.storage[storageKey].enabled === false, "Device preference is editable while viewing built-in profiles");
+ check(window.siyuan.storage[storageKey].enabled === true, "Total switch is editable while viewing built-in profiles");
view.querySelector<HTMLElement>("[data-action='cancel']").click();
mobile = false;
view = open();
diff --git a/app/src/config/entryVisibility/runtime.ts b/app/src/config/entryVisibility/runtime.ts
index 8697b77887..81d5334adb 100644
--- a/app/src/config/entryVisibility/runtime.ts
+++ b/app/src/config/entryVisibility/runtime.ts
@@ -15,6 +15,7 @@ import {
TOP_BAR_ROOT_PATH,
STATUS_BAR_ROOT_PATH,
WINDOW_TOP_BAR_ROOT_PATH,
+ SLASH_MENU_ROOT_PATH,
} from "./catalog";
import {
mergeEntryOrderPreservingUnknown,
@@ -28,6 +29,7 @@ import {TOOLBAR_ENTRY_ROOT_PATH} from "../../protyle/toolbar/defaults";
import {resolveToolbarItems} from "../../protyle/toolbar/entryVisibility";
import {syncDockBarVisibility} from "../../layout/dock/barVisibility";
import {genUUID} from "../../util/genID";
+import {isMobile} from "../../util/functions";
import {
applyDockEntryOrderSnapshot,
getCurrentDockEntryOrderSnapshot,
@@ -62,14 +64,19 @@ const getTemplateVisibility = (path: string, template: TEntryVisibilityTemplate)
export const isEntryVisible = (path: string): boolean => {
/// #if MOBILE
- if (!path.startsWith(`${TOOLBAR_ENTRY_ROOT_PATH}.`)) {
+ if (!path.startsWith(`${TOOLBAR_ENTRY_ROOT_PATH}.`) &&
+ path !== SLASH_MENU_ROOT_PATH && !path.startsWith(`${SLASH_MENU_ROOT_PATH}.`)) {
return true;
}
/// #endif
return getConfiguredEntryVisibility(path);
};
-export const getConfiguredEntryVisibility = (path: string): boolean => {
+export const getConfiguredEntryVisibility = (path: string, ignoreMobileSlashSwitch = false): boolean => {
+ // 移动端总开关沿用本机偏好,方案中的候选显隐与排序仍独立保存。
+ if (path === SLASH_MENU_ROOT_PATH && isMobile()) {
+ return ignoreMobileSlashSwitch || window.siyuan.storage[Constants.LOCAL_MOBILE_SLASH_MENU]?.enabled === true;
+ }
const config = getConfig();
const active = config.active;
let visible: boolean;
@@ -85,7 +92,7 @@ export const getConfiguredEntryVisibility = (path: string): boolean => {
}
const parentPath = getEntryParentPath(path);
if (parentPath && getEntryCatalogNode(parentPath)) {
- return getConfiguredEntryVisibility(parentPath);
+ return getConfiguredEntryVisibility(parentPath, ignoreMobileSlashSwitch);
}
return true;
};
diff --git a/app/src/config/entryVisibility/ui.ts b/app/src/config/entryVisibility/ui.ts
index 3ef8be541f..1c816b71a1 100644
--- a/app/src/config/entryVisibility/ui.ts
+++ b/app/src/config/entryVisibility/ui.ts
@@ -17,6 +17,7 @@ import {
refreshTopBarCatalog,
TOP_BAR_ROOT_PATH,
STATUS_BAR_ROOT_PATH,
+ SLASH_MENU_ROOT_PATH,
} from "./catalog";
import {
createEntryProfileSnapshot,
@@ -456,7 +457,9 @@ const renderEntryColumns = (profile: Config.IEntryVisibilityProfile, sectionKey:
let nodes = directDisplayRoot?.children || section.children;
let prefix = directDisplayRoot ? directDisplayRootPath : section.key;
let title = directDisplayRoot?.label() || section.label();
- let parentEnabled = directDisplayRoot
+ let parentEnabled = isMobile() && directDisplayRootPath === SLASH_MENU_ROOT_PATH
+ ? isEntryVisible(SLASH_MENU_ROOT_PATH)
+ : directDisplayRoot
? getProfileEntryVisibility(profile, directDisplayRootPath,
getEntryCatalogCustomDefaultVisibility(directDisplayRootPath))
: true;
@@ -642,11 +645,6 @@ const openProfileEditor = (root: HTMLElement, profileID?: string) => {
view.querySelector("[data-type='entry-mobile-options']").innerHTML = directRoot ? `
<label class="fn__flex b3-label config-item">
<div class="fn__flex-1"><div class="config-name">${escapeHtml(directRoot.label())}</div></div>
- ${renderEntrySwitch(draft, `${section.key}.${directRoot.key}`, directRoot, true, builtin)}
- </label>
- <label class="fn__flex b3-label config-item">
- <div class="fn__flex-1"><div class="config-name">${window.siyuan.languages.mobileSlashMenu}</div>
- <div class="b3-label__text">${window.siyuan.languages.mobileSlashMenuTip}</div></div>
<span class="fn__space"></span>
<input class="b3-switch" type="checkbox" data-type="mobile-slash-menu"
${window.siyuan.storage[Constants.LOCAL_MOBILE_SLASH_MENU]?.enabled === true ? " checked" : ""}>
@@ -852,6 +850,7 @@ const openProfileEditor = (root: HTMLElement, profileID?: string) => {
const config = {enabled: (control as HTMLInputElement).checked};
window.siyuan.storage[Constants.LOCAL_MOBILE_SLASH_MENU] = config;
setStorageVal(Constants.LOCAL_MOBILE_SLASH_MENU, config);
+ renderBrowser();
return;
}
if (builtin) {
diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.ts
index c9838c8e47..b24a424e50 100644
--- a/app/src/protyle/hint/extend.ts
+++ b/app/src/protyle/hint/extend.ts
@@ -35,7 +35,7 @@ import {
refreshSlashMenuCatalog,
SLASH_MENU_ROOT_PATH,
} from "../../config/entryVisibility/catalog";
-import {getEntryOrder, isEntryVisible} from "../../config/entryVisibility/runtime";
+import {getConfiguredEntryVisibility, getEntryOrder} from "../../config/entryVisibility/runtime";
import {resolveSlashMenuItems, TSlashMenuItem} from "./slashMenu";
import {
getBuiltinInlineStylePropertyValue,
@@ -441,7 +441,7 @@ export const getBuiltinSlashMenuItems = (protyle: IProtyle): IHintData[] => {
};
export const hintSlash = registerBuiltinSlashHint((key: string, protyle: IProtyle, sourceOrHideConfiguredCreate: THintSource | boolean = false) => {
- const enabled = isEntryVisible(SLASH_MENU_ROOT_PATH);
+ const enabled = getConfiguredEntryVisibility(SLASH_MENU_ROOT_PATH, protyle.lite);
if (!enabled) {
return [];
}
@@ -489,7 +489,7 @@ export const hintSlash = registerBuiltinSlashHint((key: string, protyle: IProtyl
canUpload: !!(protyle.options.upload.handler || (protyle.options.upload.url && protyle.upload)),
key,
order: getEntryOrder(SLASH_MENU_ROOT_PATH),
- visible: (entryKey) => isEntryVisible(getSlashMenuEntryPath(entryKey)),
+ visible: (entryKey) => getConfiguredEntryVisibility(getSlashMenuEntryPath(entryKey), protyle.lite),
});
});
diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts
index b8bf9361a5..1e50609bd4 100644
--- a/app/src/protyle/hint/index.ts
+++ b/app/src/protyle/hint/index.ts
@@ -336,8 +336,7 @@ export class Hint {
if (!this.enableSlash || !blockElement || isInEmbedBlock(blockElement)) {
return;
}
- if (!protyle.lite && isMobile() &&
- (this.splitChar !== "/" || window.siyuan.storage[Constants.LOCAL_MOBILE_SLASH_MENU]?.enabled !== true)) {
+ if (!protyle.lite && isMobile() && this.splitChar !== "/") {
this.element.classList.add("fn__none");
return;
}