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,
|
||||
SettingsItem,
|
||||
ToolbarConfig,
|
||||
TrashCleanupInterval
|
||||
TrashCleanupInterval,
|
||||
isDeleted
|
||||
} from "../types";
|
||||
import { ICollection } from "./collection";
|
||||
import { TimeFormat } from "../utils/date";
|
||||
@@ -58,18 +59,25 @@ class Settings implements ICollection {
|
||||
|
||||
async merge(remoteItem: SettingsItem, lastSynced: number) {
|
||||
if (this.settings.dateModified > lastSynced) {
|
||||
this.settings.id = remoteItem.id;
|
||||
this.settings.groupOptions = {
|
||||
this.settings = {
|
||||
...this.settings,
|
||||
...(isDeleted(remoteItem)
|
||||
? {}
|
||||
: {
|
||||
...remoteItem,
|
||||
groupOptions: {
|
||||
...this.settings.groupOptions,
|
||||
...remoteItem.groupOptions
|
||||
};
|
||||
this.settings.toolbarConfig = {
|
||||
},
|
||||
toolbarConfig: {
|
||||
...this.settings.toolbarConfig,
|
||||
...remoteItem.toolbarConfig
|
||||
};
|
||||
this.settings.aliases = {
|
||||
},
|
||||
aliases: {
|
||||
...this.settings.aliases,
|
||||
...remoteItem.aliases
|
||||
}
|
||||
})
|
||||
};
|
||||
this.settings.dateModified = Date.now();
|
||||
} else {
|
||||
|
||||
@@ -76,6 +76,7 @@ export type GroupableItem = ValueOf<
|
||||
| "relation"
|
||||
| "tiny"
|
||||
| "tiptap"
|
||||
| "content"
|
||||
| "session"
|
||||
| "sessioncontent"
|
||||
| "settings"
|
||||
@@ -290,13 +291,16 @@ export type DefaultNotebook = { id: string; topic?: string };
|
||||
export interface SettingsItem extends BaseItem<"settings"> {
|
||||
groupOptions?: Partial<Record<GroupingKey, GroupOptions>>;
|
||||
toolbarConfig?: Record<string, ToolbarConfig>;
|
||||
aliases?: Record<string, string>;
|
||||
trashCleanupInterval?: TrashCleanupInterval;
|
||||
titleFormat?: string;
|
||||
timeFormat?: TimeFormat;
|
||||
dateFormat?: string;
|
||||
defaultNotebook?: DefaultNotebook;
|
||||
|
||||
/**
|
||||
* @deprecated only kept here for migration purposes.
|
||||
*/
|
||||
aliases?: Record<string, string>;
|
||||
/**
|
||||
* @deprecated only kept here for migration purposes.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user