mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 19:12:27 +08:00
refactor(client): use common method for checking if launch bar config
This commit is contained in:
parent
cfeb4eb51f
commit
c2315a9341
@ -7,6 +7,7 @@ import cssClassManager from "../services/css_class_manager.js";
|
|||||||
import { Froca } from '../services/froca-interface.js';
|
import { Froca } from '../services/froca-interface.js';
|
||||||
import FAttachment from './fattachment.js';
|
import FAttachment from './fattachment.js';
|
||||||
import FAttribute, { AttributeType } from './fattribute.js';
|
import FAttribute, { AttributeType } from './fattribute.js';
|
||||||
|
import utils from '../services/utils.js';
|
||||||
|
|
||||||
const LABEL = 'label';
|
const LABEL = 'label';
|
||||||
const RELATION = 'relation';
|
const RELATION = 'relation';
|
||||||
@ -983,7 +984,7 @@ class FNote {
|
|||||||
}
|
}
|
||||||
|
|
||||||
isLaunchBarConfig() {
|
isLaunchBarConfig() {
|
||||||
return this.type === 'launcher' || ['_lbRoot', '_lbAvailableLaunchers', '_lbVisibleLaunchers', "_lbMobileRoot", "_lbMobileAvailableLaunchers", "_lbMobileVisibleLaunchers" ].includes(this.noteId);
|
return this.type === 'launcher' || utils.isLaunchBarConfig(this.noteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
isOptions() {
|
isOptions() {
|
||||||
|
@ -24,7 +24,7 @@ async function moveBeforeBranch(branchIdsToMove: string[], beforeBranchId: strin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (['root', '_lbRoot', '_lbAvailableLaunchers', '_lbVisibleLaunchers', "_lbMobileRoot", "_lbMobileAvailableLaunchers", "_lbMobileVisibleLaunchers" ].includes(beforeBranch.noteId)) {
|
if (beforeBranch.noteId === "root" || utils.isLaunchBarConfig(beforeBranch.noteId)) {
|
||||||
toastService.showError(t("branches.cannot-move-notes-here"));
|
toastService.showError(t("branches.cannot-move-notes-here"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -590,6 +590,13 @@ function isUpdateAvailable(latestVersion: string, currentVersion: string): boole
|
|||||||
return compareVersions(latestVersion, currentVersion) > 0;
|
return compareVersions(latestVersion, currentVersion) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isLaunchBarConfig(noteId: string) {
|
||||||
|
return [
|
||||||
|
"_lbRoot", "_lbAvailableLaunchers", "_lbVisibleLaunchers",
|
||||||
|
"_lbMobileRoot", "_lbMobileAvailableLaunchers", "_lbMobileVisibleLaunchers"
|
||||||
|
].includes(noteId);
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
reloadFrontendApp,
|
reloadFrontendApp,
|
||||||
parseDate,
|
parseDate,
|
||||||
@ -632,5 +639,6 @@ export default {
|
|||||||
createImageSrcUrl,
|
createImageSrcUrl,
|
||||||
downloadSvg,
|
downloadSvg,
|
||||||
compareVersions,
|
compareVersions,
|
||||||
isUpdateAvailable
|
isUpdateAvailable,
|
||||||
|
isLaunchBarConfig
|
||||||
};
|
};
|
||||||
|
@ -6,6 +6,7 @@ import SpacedUpdate from "../services/spaced_update.js";
|
|||||||
import appContext from "../components/app_context.js";
|
import appContext from "../components/app_context.js";
|
||||||
import branchService from "../services/branches.js";
|
import branchService from "../services/branches.js";
|
||||||
import shortcutService from "../services/shortcuts.js";
|
import shortcutService from "../services/shortcuts.js";
|
||||||
|
import utils from "../services/utils.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="note-title-widget">
|
<div class="note-title-widget">
|
||||||
@ -73,7 +74,7 @@ export default class NoteTitleWidget extends NoteContextAwareWidget {
|
|||||||
|
|
||||||
async refreshWithNote(note) {
|
async refreshWithNote(note) {
|
||||||
const isReadOnly = (note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable())
|
const isReadOnly = (note.isProtected && !protectedSessionHolder.isProtectedSessionAvailable())
|
||||||
|| ['_lbRoot', '_lbAvailableLaunchers', '_lbVisibleLaunchers', "_lbMobileRoot", "_lbMobileAvailableLaunchers", "_lbMobileVisibleLaunchers" ].includes(note.noteId)
|
|| utils.isLaunchBarConfig(note.noteId)
|
||||||
|| this.noteContext.viewScope.viewMode !== 'default';
|
|| this.noteContext.viewScope.viewMode !== 'default';
|
||||||
|
|
||||||
this.$noteTitle.val(
|
this.$noteTitle.val(
|
||||||
|
@ -392,7 +392,8 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
|||||||
autoExpandMS: 600,
|
autoExpandMS: 600,
|
||||||
preventLazyParents: false,
|
preventLazyParents: false,
|
||||||
dragStart: (node, data) => {
|
dragStart: (node, data) => {
|
||||||
if (['root', '_hidden', '_lbRoot', '_lbAvailableLaunchers', '_lbVisibleLaunchers', "_lbMobileRoot", "_lbMobileAvailableLaunchers", "_lbMobileVisibleLaunchers" ].includes(node.data.noteId)
|
if (node.data.noteId === "root"
|
||||||
|
|| utils.isLaunchBarConfig(node.data.noteId)
|
||||||
|| node.data.noteId.startsWith("_options")) {
|
|| node.data.noteId.startsWith("_options")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user