ckeditor5-phoenix 1.25.0 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/hooks/editor/editor.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +234 -238
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -13
- package/src/hooks/editor/editor.ts +25 -34
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ckeditor5-phoenix",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
4
4
|
"description": "CKEditor 5 integration for Phoenix Framework",
|
|
5
5
|
"author": "Mateusz Bagiński <cziken58@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,18 +23,9 @@
|
|
|
23
23
|
"src",
|
|
24
24
|
"test-utils"
|
|
25
25
|
],
|
|
26
|
-
"scripts": {
|
|
27
|
-
"clean": "rm -rf dist",
|
|
28
|
-
"build": "npm run clean && vite build && node ./scripts/check-dist-imports.mjs",
|
|
29
|
-
"watch": "vite build --watch",
|
|
30
|
-
"dev": "vite build --watch",
|
|
31
|
-
"typecheck": "tsc --noEmit --pretty",
|
|
32
|
-
"test": "vitest --coverage",
|
|
33
|
-
"test:watch": "vitest --watch --coverage"
|
|
34
|
-
},
|
|
35
26
|
"dependencies": {
|
|
36
|
-
"ckeditor5": "^
|
|
37
|
-
"ckeditor5-premium-features": "^
|
|
27
|
+
"ckeditor5": "^48.1.0",
|
|
28
|
+
"ckeditor5-premium-features": "^48.1.0",
|
|
38
29
|
"phoenix_live_view": "^1.0.17"
|
|
39
30
|
},
|
|
40
31
|
"devDependencies": {
|
|
@@ -46,5 +37,14 @@
|
|
|
46
37
|
"vite-plugin-dts": "^4.5.4",
|
|
47
38
|
"vite-tsconfig-paths": "^5.1.4",
|
|
48
39
|
"vitest": "^3.2.3"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"clean": "rm -rf dist",
|
|
43
|
+
"build": "npm run clean && vite build && node ./scripts/check-dist-imports.mjs",
|
|
44
|
+
"watch": "vite build --watch",
|
|
45
|
+
"dev": "vite build --watch",
|
|
46
|
+
"typecheck": "tsc --noEmit --pretty",
|
|
47
|
+
"test": "vitest --coverage",
|
|
48
|
+
"test:watch": "vitest --watch --coverage"
|
|
49
49
|
}
|
|
50
|
-
}
|
|
50
|
+
}
|
|
@@ -121,7 +121,29 @@ class EditorHookImpl extends ClassHook {
|
|
|
121
121
|
};
|
|
122
122
|
});
|
|
123
123
|
|
|
124
|
-
this.onBeforeDestroy(
|
|
124
|
+
this.onBeforeDestroy(async () => {
|
|
125
|
+
// If for some reason editor not fired `destroy`, enforce deregistration.
|
|
126
|
+
EditorsRegistry.the.unregister(editorId);
|
|
127
|
+
unmountEffect();
|
|
128
|
+
|
|
129
|
+
const editorContext = unwrapEditorContext(editor);
|
|
130
|
+
const watchdog = unwrapEditorWatchdog(editor);
|
|
131
|
+
|
|
132
|
+
if (editorContext) {
|
|
133
|
+
// If context is present, make sure it's not in unmounting phase, as it'll kill the editors.
|
|
134
|
+
// If it's being destroyed, don't do anything, as the context will take care of it.
|
|
135
|
+
if (editorContext.state !== 'unavailable') {
|
|
136
|
+
await editorContext.context.remove(editorContext.editorContextId);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else if (watchdog) {
|
|
140
|
+
await watchdog.destroy();
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
await editor.destroy();
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
125
147
|
EditorsRegistry.the.register(editorId, editor);
|
|
126
148
|
}
|
|
127
149
|
catch (error: any) {
|
|
@@ -140,41 +162,10 @@ class EditorHookImpl extends ClassHook {
|
|
|
140
162
|
}
|
|
141
163
|
|
|
142
164
|
/**
|
|
143
|
-
* Destroys
|
|
144
|
-
* This is important to prevent memory leaks and ensure that the editor is properly cleaned up.
|
|
165
|
+
* Destroys editor component.
|
|
145
166
|
*/
|
|
146
167
|
override async destroyed() {
|
|
147
|
-
const { editorId } = this.attrs;
|
|
148
|
-
|
|
149
|
-
// Let's hide the element during destruction to prevent flickering.
|
|
150
168
|
this.el.style.display = 'none';
|
|
151
|
-
|
|
152
|
-
// Let's wait for the mounted promise to resolve before proceeding with destruction.
|
|
153
|
-
const editor = await EditorsRegistry.the.waitFor(editorId);
|
|
154
|
-
|
|
155
|
-
/* v8 ignore next 3 */
|
|
156
|
-
if (!editor) {
|
|
157
|
-
return;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
EditorsRegistry.the.unregister(editorId);
|
|
161
|
-
|
|
162
|
-
const editorContext = unwrapEditorContext(editor);
|
|
163
|
-
const watchdog = unwrapEditorWatchdog(editor);
|
|
164
|
-
|
|
165
|
-
if (editorContext) {
|
|
166
|
-
// If context is present, make sure it's not in unmounting phase, as it'll kill the editors.
|
|
167
|
-
// If it's being destroyed, don't do anything, as the context will take care of it.
|
|
168
|
-
if (editorContext.state !== 'unavailable') {
|
|
169
|
-
await editorContext.context.remove(editorContext.editorContextId);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
else if (watchdog) {
|
|
173
|
-
await watchdog.destroy();
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
await editor.destroy();
|
|
177
|
-
}
|
|
178
169
|
}
|
|
179
170
|
|
|
180
171
|
/**
|
|
@@ -290,7 +281,7 @@ class EditorHookImpl extends ClassHook {
|
|
|
290
281
|
|
|
291
282
|
const editor = await (async () => {
|
|
292
283
|
if (!context || !(sourceElements instanceof HTMLElement)) {
|
|
293
|
-
return Constructor.create
|
|
284
|
+
return (Constructor.create as any)(sourceElements, parsedConfig);
|
|
294
285
|
}
|
|
295
286
|
|
|
296
287
|
const result = await createEditorInContext({
|