diff --git a/packages/core/collections/shortcuts.js b/packages/core/collections/shortcuts.js index 81212bbeb..4bf581031 100644 --- a/packages/core/collections/shortcuts.js +++ b/packages/core/collections/shortcuts.js @@ -18,7 +18,6 @@ along with this program. If not, see . */ import Collection from "./collection"; -import { EV, EVENTS } from "../common"; /** * @typedef {{ @@ -45,11 +44,6 @@ export default class Shortcuts extends Collection { await this._collection.addItem(shortcut); } - async init() { - await super.init(); - await this.dedupe(); - } - /** * * @param {Partial} shortcut @@ -156,20 +150,4 @@ export default class Shortcuts extends Collection { await this._collection.removeItem(id); } } - - async dedupe() { - const oldShortcuts = this.all.filter( - (shortcut) => shortcut.id !== shortcut.item.id - ); - - for (const shortcut of oldShortcuts) { - await this._collection.addItem({ ...shortcut, id: shortcut.item.id }); - } - - for (const shortcut of oldShortcuts) { - await this._collection.removeItem(shortcut.id); - } - - if (oldShortcuts.length > 0) EV.publish(EVENTS.appRefreshRequested); - } } diff --git a/packages/core/migrations.js b/packages/core/migrations.js index 6ce471891..26cf858d7 100644 --- a/packages/core/migrations.js +++ b/packages/core/migrations.js @@ -110,7 +110,12 @@ const migrations = [ if (!item.data || item.data.iv) return item; item.type = "tiptap"; return item; - }, + }, + shortcut: (item) => { + if (item.id === item.item.id) return item; + item.id = item.item.id; + return item; + }, tiptap: (item) => { return changeSessionContentType(item); },