From 062bd8247dc42deb953aabfe00451b28749d1e71 Mon Sep 17 00:00:00 2001 From: Omotayo Obafemi Date: Sat, 21 Dec 2024 00:34:07 +0000 Subject: [PATCH 1/7] Added fix for memory leak issue --- src/components/utils/shortcuts.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/utils/shortcuts.ts b/src/components/utils/shortcuts.ts index 12adf10c1..8bddffc9f 100644 --- a/src/components/utils/shortcuts.ts +++ b/src/components/utils/shortcuts.ts @@ -86,7 +86,15 @@ class Shortcuts { const shortcuts = this.registeredShortcuts.get(element); - this.registeredShortcuts.set(element, shortcuts.filter(el => el !== shortcut)); + const filteredShortcuts = shortcuts.filter(el => el !== shortcut); + + if (filteredShortcuts.length === 0) { + this.registeredShortcuts.delete(element); + + return; + } + + this.registeredShortcuts.set(element, filteredShortcuts); } /** From b1819759824fe41983c4d3607ba613d0d85f6341 Mon Sep 17 00:00:00 2001 From: Omotayo Obafemi Date: Sat, 21 Dec 2024 14:41:07 +0000 Subject: [PATCH 2/7] Documented the fix in docs/CHANGELOG.md --- docs/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 5e7bffe1f..652e4bb22 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +### 2.31.1 + +- `Fix` - Fix the memory leak issue in `Shortcuts` class + ### 2.31.0 - `New` - Inline tools (those with `isReadOnlySupported` specified) can now be used in read-only mode From 90c64a66bdaf1ad0381c9da2947579f2acfd9e7d Mon Sep 17 00:00:00 2001 From: Omotayo Obafemi Date: Sat, 21 Dec 2024 14:47:51 +0000 Subject: [PATCH 3/7] v2.31.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ef7b5f7d3..f35d226e4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@editorjs/editorjs", - "version": "2.31.0-rc.6", + "version": "2.31.0", "description": "Editor.js — open source block-style WYSIWYG editor with JSON output", "main": "dist/editorjs.umd.js", "module": "dist/editorjs.mjs", From ca32afdb27a14fa4921f64815de94cace715e709 Mon Sep 17 00:00:00 2001 From: Omotayo Obafemi Date: Sat, 21 Dec 2024 14:50:37 +0000 Subject: [PATCH 4/7] Documented the fix in docs/CHANGELOG.md --- docs/CHANGELOG.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 652e4bb22..9d60fbaa2 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,9 +1,5 @@ # Changelog -### 2.31.1 - -- `Fix` - Fix the memory leak issue in `Shortcuts` class - ### 2.31.0 - `New` - Inline tools (those with `isReadOnlySupported` specified) can now be used in read-only mode @@ -14,6 +10,7 @@ - `Fix` - Several toolbox items exported by the one tool have the same shortcut displayed in toolbox - `Improvement` - The current block reference will be updated in read-only mode when blocks are clicked - `Fix` - codex-notifier and codex-tooltip moved from devDependencies to dependencies in package.json to solve type errors +- `Fix` - Fix the memory leak issue in `Shortcuts` class ### 2.30.7 From abb009eaf828f2260950ab9cb1af9315d30acc55 Mon Sep 17 00:00:00 2001 From: Omotayo Obafemi Date: Sat, 21 Dec 2024 14:51:43 +0000 Subject: [PATCH 5/7] Documented the fix in docs/CHANGELOG.md --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f35d226e4..ef7b5f7d3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@editorjs/editorjs", - "version": "2.31.0", + "version": "2.31.0-rc.6", "description": "Editor.js — open source block-style WYSIWYG editor with JSON output", "main": "dist/editorjs.umd.js", "module": "dist/editorjs.mjs", From 3d7ef96d899110909b8f4b6e67692084cb61c9a0 Mon Sep 17 00:00:00 2001 From: Omotayo Obafemi Date: Sat, 21 Dec 2024 14:52:39 +0000 Subject: [PATCH 6/7] Documented the fix in docs/CHANGELOG.md --- docs/CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 9d60fbaa2..652e4bb22 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +### 2.31.1 + +- `Fix` - Fix the memory leak issue in `Shortcuts` class + ### 2.31.0 - `New` - Inline tools (those with `isReadOnlySupported` specified) can now be used in read-only mode @@ -10,7 +14,6 @@ - `Fix` - Several toolbox items exported by the one tool have the same shortcut displayed in toolbox - `Improvement` - The current block reference will be updated in read-only mode when blocks are clicked - `Fix` - codex-notifier and codex-tooltip moved from devDependencies to dependencies in package.json to solve type errors -- `Fix` - Fix the memory leak issue in `Shortcuts` class ### 2.30.7 From ed1261dfc0fd28c974e9628921b2fa61613d3e34 Mon Sep 17 00:00:00 2001 From: Omotayo Obafemi Date: Sat, 21 Dec 2024 15:00:42 +0000 Subject: [PATCH 7/7] Documented the fix in docs/CHANGELOG.md --- docs/CHANGELOG.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d9c944c24..c5f88a3db 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,9 +1,5 @@ # Changelog -### 2.31.1 - -- `Fix` - Fix the memory leak issue in `Shortcuts` class - ### 2.31.0 - `New` - Inline tools (those with `isReadOnlySupported` specified) can now be used in read-only mode @@ -15,6 +11,7 @@ - `Improvement` - The current block reference will be updated in read-only mode when blocks are clicked - `Fix` - codex-notifier and codex-tooltip moved from devDependencies to dependencies in package.json to solve type errors - `Fix` - Handle whitespace input in empty placeholder elements to prevent caret from moving unexpectedly to the end of the placeholder +- `Fix` - Fix the memory leak issue in `Shortcuts` class ### 2.30.7