chore: upgrade deps

This commit is contained in:
Mo
2022-03-21 14:31:42 -05:00
parent ea0ca7dc18
commit 9f032f13c2
27 changed files with 143 additions and 183 deletions

View File

@@ -78,7 +78,7 @@ export abstract class PureComponent<
);
}
onAppStateEvent(eventName: any, data: any) {
onAppStateEvent(_eventName: any, _data: any) {
/** Optional override */
}

View File

@@ -68,7 +68,7 @@ export const AttachedFilesPopover: FunctionComponent<Props> = observer(
);
setAllFiles(
application
application.items
.getItems(ContentType.File)
.sort((a, b) =>
a.created_at < b.created_at ? 1 : -1

View File

@@ -1,38 +0,0 @@
import { FunctionComponent } from 'preact';
export const CircleProgress: FunctionComponent<{
percent: number;
className?: string;
}> = ({ percent, className = '' }) => {
const size = 16;
const ratioStrokeRadius = 0.25;
const outerRadius = size / 2;
const radius = outerRadius * (1 - ratioStrokeRadius);
const stroke = outerRadius - radius;
const circumference = radius * 2 * Math.PI;
const offset = circumference - (percent / 100) * circumference;
const transition = `transition: 0.35s stroke-dashoffset;`;
const transform = `transform: rotate(-90deg);`;
const transformOrigin = `transform-origin: 50% 50%;`;
const dasharray = `stroke-dasharray: ${circumference} ${circumference};`;
const dashoffset = `stroke-dashoffset: ${offset};`;
const style = `${transition} ${transform} ${transformOrigin} ${dasharray} ${dashoffset}`;
return (
<div className="h-5 w-5 min-w-5 min-h-5">
<svg viewBox={`0 0 ${size} ${size}`}>
<circle
stroke="#086DD6"
stroke-width={stroke}
fill="transparent"
r={radius}
cx="50%"
cy="50%"
style={style}
/>
</svg>
</div>
);
};

View File

@@ -1,27 +0,0 @@
import { FunctionalComponent } from 'preact';
import { useEffect, useState } from 'preact/hooks';
import { CircleProgress } from './CircleProgress';
/**
* Circular progress bar which runs in a specified time interval
* @param time - time interval in ms
*/
export const CircleProgressTime: FunctionalComponent<{ time: number }> = ({
time,
}) => {
const [percent, setPercent] = useState(0);
const interval = time / 100;
useEffect(() => {
const tick = setInterval(() => {
if (percent === 100) {
setPercent(0);
} else {
setPercent(percent + 1);
}
}, interval);
return () => {
clearInterval(tick);
};
});
return <CircleProgress percent={percent} />;
};

View File

@@ -212,7 +212,10 @@ export class Footer extends PureComponent<Props, State> {
}
if (!this.didCheckForOffline) {
this.didCheckForOffline = true;
if (this.state.offline && this.application.getNoteCount() === 0) {
if (
this.state.offline &&
this.application.items.getNoteCount() === 0
) {
this.appState.accountMenu.setShow(true);
}
}
@@ -244,7 +247,7 @@ export class Footer extends PureComponent<Props, State> {
}
streamItems() {
this.application.setDisplayOptions(
this.application.items.setDisplayOptions(
ContentType.Theme,
CollectionSort.Title,
'asc',

View File

@@ -2,7 +2,7 @@ import { WebApplication } from '@/ui_models/application';
import { CollectionSort, PrefKey } from '@standardnotes/snjs';
import { observer } from 'mobx-react-lite';
import { FunctionComponent } from 'preact';
import { useRef, useState } from 'preact/hooks';
import { useState } from 'preact/hooks';
import { Icon } from './Icon';
import { Menu } from './Menu/Menu';
import { MenuItem, MenuItemSeparator, MenuItemType } from './Menu/MenuItem';

View File

@@ -1,4 +1,4 @@
import { useRef, useState } from 'preact/hooks';
import { useRef } from 'preact/hooks';
import {
AlertDialog,
AlertDialogDescription,
@@ -7,7 +7,6 @@ import {
import { WebApplication } from '@/ui_models/application';
import { AppState } from '@/ui_models/app_state';
import { observer } from 'mobx-react-lite';
import { FunctionComponent } from 'preact';
type Props = {
application: WebApplication;

View File

@@ -113,7 +113,7 @@ export class PreferencesMenu {
FeatureIdentifier.CloudLink,
];
this._extensionPanes = (
this.application.getItems([
this.application.items.getItems([
ContentType.ActionsExtension,
ContentType.Component,
ContentType.Theme,

View File

@@ -62,7 +62,7 @@ export const Appearance: FunctionComponent<Props> = observer(
useEffect(() => {
const themesAsItems: DropdownItem[] = (
application.getDisplayableItems(ContentType.Theme) as SNTheme[]
application.items.getDisplayableItems(ContentType.Theme) as SNTheme[]
)
.filter((theme) => !theme.isLayerable())
.sort(sortThemes)

View File

@@ -13,7 +13,7 @@ import { useEffect, useRef, useState } from 'preact/hooks';
import { observer } from 'mobx-react-lite';
const loadExtensions = (application: WebApplication) =>
application.getItems(
application.items.getItems(
[ContentType.ActionsExtension, ContentType.Component, ContentType.Theme],
true
) as SNComponent[];

View File

@@ -104,7 +104,7 @@ export const QuickSettingsMenu: FunctionComponent<MenuProps> = observer(
const reloadThemes = useCallback(() => {
const themes = (
application.getDisplayableItems(ContentType.Theme) as SNTheme[]
application.items.getDisplayableItems(ContentType.Theme) as SNTheme[]
).map((item) => {
return {
name: item.name,
@@ -141,7 +141,9 @@ export const QuickSettingsMenu: FunctionComponent<MenuProps> = observer(
const reloadToggleableComponents = useCallback(() => {
const toggleableComponents = (
application.getDisplayableItems(ContentType.Component) as SNComponent[]
application.items.getDisplayableItems(
ContentType.Component
) as SNComponent[]
).filter(
(component) =>
[ComponentArea.EditorStack, ComponentArea.TagsList].includes(

View File

@@ -139,7 +139,7 @@ export const RevisionHistoryModal: FunctionComponent<RevisionHistoryModalProps>
const restore = () => {
if (selectedRevision) {
const originalNote = application.findItem(
const originalNote = application.items.findItem(
selectedRevision.payload.uuid
) as SNNote;
@@ -171,7 +171,7 @@ export const RevisionHistoryModal: FunctionComponent<RevisionHistoryModalProps>
const restoreAsCopy = async () => {
if (selectedRevision) {
const originalNote = application.findItem(
const originalNote = application.items.findItem(
selectedRevision.payload.uuid
) as SNNote;

View File

@@ -37,7 +37,9 @@ export class RevisionPreviewModal extends PureComponent<Props, State> {
this.props.content
)) as SNNote;
this.originalNote = this.application.findItem(this.props.uuid) as SNNote;
this.originalNote = this.application.items.findItem(
this.props.uuid
) as SNNote;
const component = this.application.componentManager.editorForNote(
this.originalNote

View File

@@ -16,7 +16,9 @@ export const TagsSection: FunctionComponent<Props> = observer(
const [hasMigration, setHasMigration] = useState<boolean>(false);
const checkIfMigrationNeeded = useCallback(() => {
setHasMigration(appState.application.hasTagsNeedingFoldersMigration());
setHasMigration(
appState.application.items.hasTagsNeedingFoldersMigration()
);
}, [appState.application]);
useEffect(() => {

View File

@@ -1,4 +1,4 @@
import { SNAlertService } from "@standardnotes/snjs";
import { SNAlertService } from '@standardnotes/snjs';
const STORE_NAME = 'items';
const READ_WRITE = 'readwrite';
@@ -16,14 +16,13 @@ const DB_DELETION_BLOCKED =
const QUOTE_EXCEEDED_ERROR = 'QuotaExceededError';
export class Database {
private locked = true
private db?: IDBDatabase
private locked = true;
private db?: IDBDatabase;
constructor(
public databaseName: string,
private alertService: SNAlertService) {
}
private alertService: SNAlertService
) {}
public deinit() {
(this.alertService as any) = undefined;
@@ -43,7 +42,9 @@ export class Database {
* as part of the open process. This can happen on new application sessions, or if the
* browser deleted the database without the user being aware.
*/
public async openDatabase(onNewDatabase?: () => void): Promise<IDBDatabase | undefined> {
public async openDatabase(
onNewDatabase?: () => void
): Promise<IDBDatabase | undefined> {
if (this.locked) {
throw Error('Attempting to open locked database');
}
@@ -84,15 +85,10 @@ export class Database {
db.close();
};
/* Create an objectStore for this database */
const objectStore = db.createObjectStore(
STORE_NAME,
{ keyPath: 'uuid' }
);
objectStore.createIndex(
'uuid',
'uuid',
{ unique: true }
);
const objectStore = db.createObjectStore(STORE_NAME, {
keyPath: 'uuid',
});
objectStore.createIndex('uuid', 'uuid', { unique: true });
objectStore.transaction.oncomplete = () => {
/* Ready to store values in the newly created objectStore. */
if (db.version === 1 && onNewDatabase) {
@@ -106,9 +102,7 @@ export class Database {
public async getAllPayloads(): Promise<any[]> {
const db = (await this.openDatabase())!;
return new Promise((resolve) => {
const objectStore =
db.transaction(STORE_NAME).
objectStore(STORE_NAME);
const objectStore = db.transaction(STORE_NAME).objectStore(STORE_NAME);
const payloads: any = [];
const cursorRequest = objectStore.openCursor();
cursorRequest.onsuccess = (event) => {
@@ -136,7 +130,7 @@ export class Database {
const transaction = db.transaction(STORE_NAME, READ_WRITE);
return new Promise((resolve, reject) => {
// eslint-disable-next-line @typescript-eslint/no-empty-function
transaction.oncomplete = () => { };
transaction.oncomplete = () => {};
transaction.onerror = (event) => {
const target = event!.target! as any;
this.showGenericError(target.error);
@@ -156,23 +150,28 @@ export class Database {
});
}
private async putItems(objectStore: IDBObjectStore, items: any[]): Promise<void> {
await Promise.all(items.map((item) => {
return new Promise((resolve) => {
const request = objectStore.put(item);
request.onerror = resolve;
request.onsuccess = resolve;
});
}));
private async putItems(
objectStore: IDBObjectStore,
items: any[]
): Promise<void> {
await Promise.all(
items.map((item) => {
return new Promise((resolve) => {
const request = objectStore.put(item);
request.onerror = resolve;
request.onsuccess = resolve;
});
})
);
}
public async deletePayload(uuid: string): Promise<void> {
const db = (await this.openDatabase())!;
return new Promise((resolve, reject) => {
const request =
db.transaction(STORE_NAME, READ_WRITE)
.objectStore(STORE_NAME)
.delete(uuid);
const request = db
.transaction(STORE_NAME, READ_WRITE)
.objectStore(STORE_NAME)
.delete(uuid);
request.onsuccess = () => {
resolve();
};
@@ -201,7 +200,7 @@ export class Database {
this.alertService!.alert(message);
}
private showGenericError(error: { code: number, name: string }) {
private showGenericError(error: { code: number; name: string }) {
const message =
`Unable to save changes locally due to an unknown system issue. ` +
`Issue Code: ${error.code} Issue Name: ${error.name}.`;
@@ -210,11 +209,11 @@ export class Database {
private displayOfflineAlert() {
const message =
"There was an issue loading your offline database. This could happen for two reasons:" +
'There was an issue loading your offline database. This could happen for two reasons:' +
"\n\n1. You're in a private window in your browser. We can't save your data without " +
"access to the local database. Please use a non-private window." +
"\n\n2. You have two windows of the app open at the same time. " +
"Please close any other app instances and reload the page.";
'access to the local database. Please use a non-private window.' +
'\n\n2. You have two windows of the app open at the same time. ' +
'Please close any other app instances and reload the page.';
this.alertService!.alert(message);
}
}

View File

@@ -132,7 +132,7 @@ export class DesktopManager
componentData: any,
error: any
) {
const component = this.application.findItem(componentData.uuid);
const component = this.application.items.findItem(componentData.uuid);
if (!component) {
return;
}

View File

@@ -40,7 +40,7 @@ export class ThemeManager extends ApplicationService {
const preference = prefersDarkColorScheme
? PrefKey.AutoDarkThemeIdentifier
: PrefKey.AutoLightThemeIdentifier;
const themes = this.application.getDisplayableItems(
const themes = this.application.items.getDisplayableItems(
ContentType.Theme
) as SNTheme[];
@@ -123,7 +123,7 @@ export class ThemeManager extends ApplicationService {
private handleFeaturesUpdated(): void {
let hasChange = false;
for (const themeUuid of this.activeThemes) {
const theme = this.application.findItem(themeUuid) as SNTheme;
const theme = this.application.items.findItem(themeUuid) as SNTheme;
if (!theme) {
this.deactivateTheme(themeUuid);
hasChange = true;
@@ -143,7 +143,7 @@ export class ThemeManager extends ApplicationService {
}
const activeThemes = (
this.application.getItems(ContentType.Theme) as SNTheme[]
this.application.items.getItems(ContentType.Theme) as SNTheme[]
).filter((theme) => theme.active);
for (const theme of activeThemes) {
@@ -248,7 +248,9 @@ export class ThemeManager extends ApplicationService {
}
private async cacheThemeState() {
const themes = this.application.getAll(this.activeThemes) as SNTheme[];
const themes = this.application.items.findItems(
this.activeThemes
) as SNTheme[];
const mapped = await Promise.all(
themes.map(async (theme) => {
const payload = theme.payloadRepresentation();
@@ -275,8 +277,9 @@ export class ThemeManager extends ApplicationService {
if (cachedThemes) {
const themes = [];
for (const cachedTheme of cachedThemes) {
const payload = this.application.createPayloadFromObject(cachedTheme);
const theme = this.application.createItemFromPayload(
const payload =
this.application.items.createPayloadFromObject(cachedTheme);
const theme = this.application.items.createItemFromPayload(
payload
) as SNTheme;
themes.push(theme);

View File

@@ -89,7 +89,7 @@ export class AccountMenuState {
this.appEventListeners.push(
this.application.streamItems([ContentType.Note, ContentType.Tag], () => {
runInAction(() => {
this.notesAndTags = this.application.getItems([
this.notesAndTags = this.application.items.getItems([
ContentType.Note,
ContentType.Tag,
]);

View File

@@ -307,7 +307,7 @@ export class AppState {
return;
}
if (this.application.isTemplateItem(tag)) {
if (this.application.items.isTemplateItem(tag)) {
return;
}
@@ -436,9 +436,11 @@ export class AppState {
/** Returns the tags that are referncing this note */
public getNoteTags(note: SNNote) {
return this.application.referencingForItem(note).filter((ref) => {
return ref.content_type === ContentType.Tag;
}) as SNTag[];
return this.application.items
.itemsReferencingItem(note.uuid)
.filter((ref) => {
return ref.content_type === ContentType.Tag;
}) as SNTag[];
}
panelDidResize(name: string, collapsed: boolean) {

View File

@@ -1,6 +1,6 @@
import { storage, StorageKey } from "@/services/localStorage";
import { SNApplication, ApplicationEvent } from "@standardnotes/snjs";
import { runInAction, makeObservable, observable, action } from "mobx";
import { storage, StorageKey } from '@/services/localStorage';
import { SNApplication, ApplicationEvent } from '@standardnotes/snjs';
import { runInAction, makeObservable, observable, action } from 'mobx';
export class NoAccountWarningState {
show: boolean;
@@ -33,9 +33,9 @@ export class NoAccountWarningState {
hide = (): void => {
this.show = false;
storage.set(StorageKey.ShowNoAccountWarning, false);
}
};
reset = (): void => {
storage.remove(StorageKey.ShowNoAccountWarning);
}
};
}

View File

@@ -170,7 +170,7 @@ export class NoteTagsState {
}
searchActiveNoteAutocompleteTags(): void {
const newResults = this.application.searchTags(
const newResults = this.application.items.searchTags(
this.autocompleteSearchQuery,
this.activeNote
);
@@ -184,7 +184,7 @@ export class NoteTagsState {
reloadTags(): void {
const { activeNote } = this;
if (activeNote) {
const tags = this.application.getSortedTagsForNote(activeNote);
const tags = this.application.items.getSortedTagsForNote(activeNote);
this.setTags(tags);
}
}
@@ -224,7 +224,7 @@ export class NoteTagsState {
}
getSortedTagsForNote(note: SNNote): SNTag[] {
const tags = this.application.getSortedTagsForNote(note);
const tags = this.application.items.getSortedTagsForNote(note);
const sortFunction = (tagA: SNTag, tagB: SNTag): number => {
const a = this.getLongTitle(tagA);
@@ -243,10 +243,10 @@ export class NoteTagsState {
}
getPrefixTitle(tag: SNTag): string | undefined {
return this.application.getTagPrefixTitle(tag);
return this.application.items.getTagPrefixTitle(tag);
}
getLongTitle(tag: SNTag): string {
return this.application.getTagLongTitle(tag);
return this.application.items.getTagLongTitle(tag);
}
}

View File

@@ -81,11 +81,11 @@ export class NotesState {
}
get trashedNotesCount(): number {
return this.application.getTrashedItems().length;
return this.application.items.trashedItems.length;
}
private async selectNotesRange(selectedNote: SNNote): Promise<void> {
const notes = this.application.getDisplayableItems(
const notes = this.application.items.getDisplayableItems(
ContentType.Note
) as SNNote[];
const lastSelectedNoteIndex = notes.findIndex(
@@ -117,7 +117,7 @@ export class NotesState {
}
async selectNote(uuid: UuidString, userTriggered?: boolean): Promise<void> {
const note = this.application.findItem(uuid) as SNNote;
const note = this.application.items.findItem(uuid) as SNNote;
if (!note) {
return;
}
@@ -163,7 +163,9 @@ export class NotesState {
return;
}
const note = this.application.findItem(noteUuid) as SNNote | undefined;
const note = this.application.items.findItem(noteUuid) as
| SNNote
| undefined;
if (!note) {
console.warn('Tried accessing a non-existant note of UUID ' + noteUuid);
return;
@@ -408,7 +410,7 @@ export class NotesState {
async addTagToSelectedNotes(tag: SNTag): Promise<void> {
const selectedNotes = Object.values(this.selectedNotes);
const parentChainTags = this.application.getTagParentChain(tag);
const parentChainTags = this.application.items.getTagParentChain(tag.uuid);
const tagsToAdd = [...parentChainTags, tag];
await Promise.all(
tagsToAdd.map(async (tag) => {

View File

@@ -223,7 +223,7 @@ export class NotesViewState {
if (!tag) {
return;
}
const notes = this.application.getDisplayableItems(
const notes = this.application.items.getDisplayableItems(
ContentType.Note
) as SNNote[];
const renderedNotes = notes.slice(0, this.notesToDisplay);
@@ -264,7 +264,7 @@ export class NotesViewState {
this.appState.searchOptions.includeProtectedContents,
},
});
this.application.setNotesDisplayCriteria(criteria);
this.application.items.setNotesDisplayCriteria(criteria);
};
reloadPreferences = () => {

View File

@@ -1,5 +1,5 @@
import { SyncOpStatus } from "@standardnotes/snjs";
import { action, makeObservable, observable } from "mobx";
import { SyncOpStatus } from '@standardnotes/snjs';
import { action, makeObservable, observable } from 'mobx';
export class SyncState {
inProgress = false;
@@ -32,5 +32,5 @@ export class SyncState {
{ style: 'percent' }
);
}
}
};
}

View File

@@ -29,9 +29,11 @@ import { FeaturesState, SMART_TAGS_FEATURE_NAME } from './features_state';
type AnyTag = SNTag | SmartView;
const rootTags = (application: SNApplication): SNTag[] => {
const hasNoParent = (tag: SNTag) => !application.getTagParent(tag);
const hasNoParent = (tag: SNTag) => !application.items.getTagParent(tag.uuid);
const allTags = application.getDisplayableItems(ContentType.Tag) as SNTag[];
const allTags = application.items.getDisplayableItems(
ContentType.Tag
) as SNTag[];
const rootTags = allTags.filter(hasNoParent);
return rootTags;
@@ -41,11 +43,11 @@ const tagSiblings = (application: SNApplication, tag: SNTag): SNTag[] => {
const withoutCurrentTag = (tags: SNTag[]) =>
tags.filter((other) => other.uuid !== tag.uuid);
const isTemplateTag = application.isTemplateItem(tag);
const parentTag = !isTemplateTag && application.getTagParent(tag);
const isTemplateTag = application.items.isTemplateItem(tag);
const parentTag = !isTemplateTag && application.items.getTagParent(tag.uuid);
if (parentTag) {
const siblingsAndTag = application.getTagChildren(parentTag);
const siblingsAndTag = application.items.getTagChildren(parentTag.uuid);
return withoutCurrentTag(siblingsAndTag);
}
@@ -101,7 +103,7 @@ export class TagsState {
this.editing_ = undefined;
this.addingSubtagTo = undefined;
this.smartViews = this.application.getSmartViews();
this.smartViews = this.application.items.getSmartViews();
this.selected_ = this.smartViews[0];
makeObservable(this, {
@@ -148,10 +150,10 @@ export class TagsState {
[ContentType.Tag, ContentType.SmartView],
(items) => {
runInAction(() => {
this.tags = this.application.getDisplayableItems<SNTag>(
this.tags = this.application.items.getDisplayableItems<SNTag>(
ContentType.Tag
);
this.smartViews = this.application.getSmartViews();
this.smartViews = this.application.items.getSmartViews();
const selectedTag = this.selected_;
if (selectedTag && !isSystemView(selectedTag as SmartView)) {
@@ -174,12 +176,14 @@ export class TagsState {
);
appEventListeners.push(
this.application.addNoteCountChangeObserver((tagUuid) => {
this.application.items.addNoteCountChangeObserver((tagUuid) => {
if (!tagUuid) {
this.setAllNotesCount(this.application.allCountableNotesCount());
this.setAllNotesCount(
this.application.items.allCountableNotesCount()
);
} else {
this.tagsCountsState.update([
this.application.findItem(tagUuid) as SNTag,
this.application.items.findItem(tagUuid) as SNTag,
]);
}
})
@@ -198,7 +202,7 @@ export class TagsState {
title
)) as SNTag;
const futureSiblings = this.application.getTagChildren(parent);
const futureSiblings = this.application.items.getTagChildren(parent.uuid);
if (!isValidFutureSiblings(this.application, futureSiblings, createdTag)) {
this.setAddingSubtagTo(undefined);
@@ -299,7 +303,7 @@ export class TagsState {
public get allLocalRootTags(): SNTag[] {
if (
this.editing_ instanceof SNTag &&
this.application.isTemplateItem(this.editing_)
this.application.items.isTemplateItem(this.editing_)
) {
return [this.editing_, ...this.rootTags];
}
@@ -311,11 +315,11 @@ export class TagsState {
}
getChildren(tag: SNTag): SNTag[] {
if (this.application.isTemplateItem(tag)) {
if (this.application.items.isTemplateItem(tag)) {
return [];
}
const children = this.application.getTagChildren(tag);
const children = this.application.items.getTagChildren(tag.uuid);
const childrenUuids = children.map((childTag) => childTag.uuid);
const childrenTags = this.tags.filter((tag) =>
@@ -325,11 +329,11 @@ export class TagsState {
}
isValidTagParent(parentUuid: UuidString, tagUuid: UuidString): boolean {
return this.application.isValidTagParent(parentUuid, tagUuid);
return this.application.items.isValidTagParent(parentUuid, tagUuid);
}
public hasParent(tagUuid: UuidString): boolean {
const item = this.application.findItem(tagUuid);
const item = this.application.items.findItem(tagUuid);
return !!item && !!(item as SNTag).parentId;
}
@@ -337,9 +341,9 @@ export class TagsState {
tagUuid: string,
futureParentUuid: string | undefined
): Promise<void> {
const tag = this.application.findItem(tagUuid) as SNTag;
const tag = this.application.items.findItem(tagUuid) as SNTag;
const currentParent = this.application.getTagParent(tag);
const currentParent = this.application.items.getTagParent(tag.uuid);
const currentParentUuid = currentParent?.uuid;
if (currentParentUuid === futureParentUuid) {
@@ -348,7 +352,7 @@ export class TagsState {
const futureParent =
futureParentUuid &&
(this.application.findItem(futureParentUuid) as SNTag);
(this.application.items.findItem(futureParentUuid) as SNTag);
if (!futureParent) {
const futureSiblings = rootTags(this.application);
@@ -357,7 +361,9 @@ export class TagsState {
}
await this.application.mutator.unsetTagParent(tag);
} else {
const futureSiblings = this.application.getTagChildren(futureParent);
const futureSiblings = this.application.items.getTagChildren(
futureParent.uuid
);
if (!isValidFutureSiblings(this.application, futureSiblings, tag)) {
return;
}
@@ -368,7 +374,9 @@ export class TagsState {
}
get rootTags(): SNTag[] {
return this.tags.filter((tag) => !this.application.getTagParent(tag));
return this.tags.filter(
(tag) => !this.application.items.getTagParent(tag.uuid)
);
}
get tagsCount(): number {
@@ -432,7 +440,7 @@ export class TagsState {
public async createNewTemplate() {
const isAlreadyEditingATemplate =
this.editing_ && this.application.isTemplateItem(this.editing_);
this.editing_ && this.application.items.isTemplateItem(this.editing_);
if (isAlreadyEditingATemplate) {
return;
@@ -470,7 +478,7 @@ export class TagsState {
public async save(tag: SNTag | SmartView, newTitle: string) {
const hasEmptyTitle = newTitle.length === 0;
const hasNotChangedTitle = newTitle === tag.title;
const isTemplateChange = this.application.isTemplateItem(tag);
const isTemplateChange = this.application.items.isTemplateItem(tag);
const siblings =
tag instanceof SNTag ? tagSiblings(this.application, tag) : [];
@@ -500,7 +508,8 @@ export class TagsState {
}
if (isTemplateChange) {
const isSmartViewTitle = this.application.isSmartViewTitle(newTitle);
const isSmartViewTitle =
this.application.items.isSmartViewTitle(newTitle);
if (isSmartViewTitle) {
if (!this.features.hasSmartViews) {
@@ -541,7 +550,7 @@ export class TagsState {
item.content_type === ContentType.Tag ||
item.content_type === ContentType.SmartView
) {
const matchingTag = this.application.findItem(item.uuid);
const matchingTag = this.application.items.findItem(item.uuid);
if (matchingTag) {
this.selected = matchingTag as AnyTag;
@@ -554,7 +563,9 @@ export class TagsState {
}
public get hasAtLeastOneFolder(): boolean {
return this.tags.some((tag) => !!this.application.getTagParent(tag));
return this.tags.some(
(tag) => !!this.application.items.getTagParent(tag.uuid)
);
}
}
@@ -575,7 +586,7 @@ class TagsCountsState {
);
tags.forEach((tag) => {
newCounts[tag.uuid] = this.application.countableNotesForTag(tag);
newCounts[tag.uuid] = this.application.items.countableNotesForTag(tag);
});
this.counts = newCounts;

View File

@@ -76,7 +76,7 @@
"@standardnotes/filepicker": "1.10.1",
"@standardnotes/settings": "1.13.1",
"@standardnotes/sncrypto-web": "1.8.0",
"@standardnotes/snjs": "2.89.1",
"@standardnotes/snjs": "2.89.3",
"@zip.js/zip.js": "^2.4.7",
"mobx": "^6.5.0",
"mobx-react-lite": "^3.3.0",

View File

@@ -2484,10 +2484,10 @@
buffer "^6.0.3"
libsodium-wrappers "^0.7.9"
"@standardnotes/snjs@2.89.1":
version "2.89.1"
resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.89.1.tgz#73694f24e748d51abf72255c57545006c8882aec"
integrity sha512-KHwxyhCx4W+ba6QgqEEkIxxbm8D7O8BdIZFVbawPhMfvnp0rX7pd7EclqG8rOD2dTzb74cA7IHp2/MJsj3i0vw==
"@standardnotes/snjs@2.89.3":
version "2.89.3"
resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.89.3.tgz#cdf4030772308df0572eb9de21dae3c03a96a906"
integrity sha512-UYiO9cNntlxB/0CkLPvWMNves8TUuANx2jliKlVbHbPjuECh0MDa5ZBPoSKFWrDE51oU41GqjUp05mr6FK7Skw==
dependencies:
"@standardnotes/applications" "^1.2.5"
"@standardnotes/auth" "^3.17.10"