@tiptap/core 2.7.1 → 2.7.2

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.
@@ -66,14 +66,16 @@ export declare class Editor extends EventEmitter<EditorEvents> {
66
66
  *
67
67
  * @param plugin A ProseMirror plugin
68
68
  * @param handlePlugins Control how to merge the plugin into the existing plugins.
69
+ * @returns The new editor state
69
70
  */
70
- registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): void;
71
+ registerPlugin(plugin: Plugin, handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[]): EditorState;
71
72
  /**
72
73
  * Unregister a ProseMirror plugin.
73
74
  *
74
75
  * @param nameOrPluginKey The plugins name
76
+ * @returns The new editor state or undefined if the editor is destroyed
75
77
  */
76
- unregisterPlugin(nameOrPluginKey: string | PluginKey): void;
78
+ unregisterPlugin(nameOrPluginKey: string | PluginKey): EditorState | undefined;
77
79
  /**
78
80
  * Creates an extension manager.
79
81
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/core",
3
3
  "description": "headless rich text editor",
4
- "version": "2.7.1",
4
+ "version": "2.7.2",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -32,7 +32,7 @@
32
32
  "dist"
33
33
  ],
34
34
  "devDependencies": {
35
- "@tiptap/pm": "^2.7.1"
35
+ "@tiptap/pm": "^2.7.2"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@tiptap/pm": "^2.7.0"
package/src/Editor.ts CHANGED
@@ -224,11 +224,12 @@ export class Editor extends EventEmitter<EditorEvents> {
224
224
  *
225
225
  * @param plugin A ProseMirror plugin
226
226
  * @param handlePlugins Control how to merge the plugin into the existing plugins.
227
+ * @returns The new editor state
227
228
  */
228
229
  public registerPlugin(
229
230
  plugin: Plugin,
230
231
  handlePlugins?: (newPlugin: Plugin, plugins: Plugin[]) => Plugin[],
231
- ): void {
232
+ ): EditorState {
232
233
  const plugins = isFunction(handlePlugins)
233
234
  ? handlePlugins(plugin, [...this.state.plugins])
234
235
  : [...this.state.plugins, plugin]
@@ -236,16 +237,19 @@ export class Editor extends EventEmitter<EditorEvents> {
236
237
  const state = this.state.reconfigure({ plugins })
237
238
 
238
239
  this.view.updateState(state)
240
+
241
+ return state
239
242
  }
240
243
 
241
244
  /**
242
245
  * Unregister a ProseMirror plugin.
243
246
  *
244
247
  * @param nameOrPluginKey The plugins name
248
+ * @returns The new editor state or undefined if the editor is destroyed
245
249
  */
246
- public unregisterPlugin(nameOrPluginKey: string | PluginKey): void {
250
+ public unregisterPlugin(nameOrPluginKey: string | PluginKey): EditorState | undefined {
247
251
  if (this.isDestroyed) {
248
- return
252
+ return undefined
249
253
  }
250
254
 
251
255
  // @ts-ignore
@@ -257,6 +261,8 @@ export class Editor extends EventEmitter<EditorEvents> {
257
261
  })
258
262
 
259
263
  this.view.updateState(state)
264
+
265
+ return state
260
266
  }
261
267
 
262
268
  /**