mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
core: fix typing errors
This commit is contained in:
@@ -26,7 +26,8 @@ import {
|
|||||||
GroupingKey,
|
GroupingKey,
|
||||||
SettingsItem,
|
SettingsItem,
|
||||||
ToolbarConfig,
|
ToolbarConfig,
|
||||||
TrashCleanupInterval
|
TrashCleanupInterval,
|
||||||
|
isDeleted
|
||||||
} from "../types";
|
} from "../types";
|
||||||
import { ICollection } from "./collection";
|
import { ICollection } from "./collection";
|
||||||
import { TimeFormat } from "../utils/date";
|
import { TimeFormat } from "../utils/date";
|
||||||
@@ -58,18 +59,25 @@ class Settings implements ICollection {
|
|||||||
|
|
||||||
async merge(remoteItem: SettingsItem, lastSynced: number) {
|
async merge(remoteItem: SettingsItem, lastSynced: number) {
|
||||||
if (this.settings.dateModified > lastSynced) {
|
if (this.settings.dateModified > lastSynced) {
|
||||||
this.settings.id = remoteItem.id;
|
this.settings = {
|
||||||
this.settings.groupOptions = {
|
...this.settings,
|
||||||
...this.settings.groupOptions,
|
...(isDeleted(remoteItem)
|
||||||
...remoteItem.groupOptions
|
? {}
|
||||||
};
|
: {
|
||||||
this.settings.toolbarConfig = {
|
...remoteItem,
|
||||||
...this.settings.toolbarConfig,
|
groupOptions: {
|
||||||
...remoteItem.toolbarConfig
|
...this.settings.groupOptions,
|
||||||
};
|
...remoteItem.groupOptions
|
||||||
this.settings.aliases = {
|
},
|
||||||
...this.settings.aliases,
|
toolbarConfig: {
|
||||||
...remoteItem.aliases
|
...this.settings.toolbarConfig,
|
||||||
|
...remoteItem.toolbarConfig
|
||||||
|
},
|
||||||
|
aliases: {
|
||||||
|
...this.settings.aliases,
|
||||||
|
...remoteItem.aliases
|
||||||
|
}
|
||||||
|
})
|
||||||
};
|
};
|
||||||
this.settings.dateModified = Date.now();
|
this.settings.dateModified = Date.now();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ export type GroupableItem = ValueOf<
|
|||||||
| "relation"
|
| "relation"
|
||||||
| "tiny"
|
| "tiny"
|
||||||
| "tiptap"
|
| "tiptap"
|
||||||
|
| "content"
|
||||||
| "session"
|
| "session"
|
||||||
| "sessioncontent"
|
| "sessioncontent"
|
||||||
| "settings"
|
| "settings"
|
||||||
@@ -290,13 +291,16 @@ export type DefaultNotebook = { id: string; topic?: string };
|
|||||||
export interface SettingsItem extends BaseItem<"settings"> {
|
export interface SettingsItem extends BaseItem<"settings"> {
|
||||||
groupOptions?: Partial<Record<GroupingKey, GroupOptions>>;
|
groupOptions?: Partial<Record<GroupingKey, GroupOptions>>;
|
||||||
toolbarConfig?: Record<string, ToolbarConfig>;
|
toolbarConfig?: Record<string, ToolbarConfig>;
|
||||||
aliases?: Record<string, string>;
|
|
||||||
trashCleanupInterval?: TrashCleanupInterval;
|
trashCleanupInterval?: TrashCleanupInterval;
|
||||||
titleFormat?: string;
|
titleFormat?: string;
|
||||||
timeFormat?: TimeFormat;
|
timeFormat?: TimeFormat;
|
||||||
dateFormat?: string;
|
dateFormat?: string;
|
||||||
defaultNotebook?: DefaultNotebook;
|
defaultNotebook?: DefaultNotebook;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated only kept here for migration purposes.
|
||||||
|
*/
|
||||||
|
aliases?: Record<string, string>;
|
||||||
/**
|
/**
|
||||||
* @deprecated only kept here for migration purposes.
|
* @deprecated only kept here for migration purposes.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user