@tiptap/core 2.7.0 → 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.
package/dist/index.js CHANGED
@@ -4171,6 +4171,7 @@ class Editor extends EventEmitter {
4171
4171
  *
4172
4172
  * @param plugin A ProseMirror plugin
4173
4173
  * @param handlePlugins Control how to merge the plugin into the existing plugins.
4174
+ * @returns The new editor state
4174
4175
  */
4175
4176
  registerPlugin(plugin, handlePlugins) {
4176
4177
  const plugins = isFunction(handlePlugins)
@@ -4178,15 +4179,17 @@ class Editor extends EventEmitter {
4178
4179
  : [...this.state.plugins, plugin];
4179
4180
  const state = this.state.reconfigure({ plugins });
4180
4181
  this.view.updateState(state);
4182
+ return state;
4181
4183
  }
4182
4184
  /**
4183
4185
  * Unregister a ProseMirror plugin.
4184
4186
  *
4185
4187
  * @param nameOrPluginKey The plugins name
4188
+ * @returns The new editor state or undefined if the editor is destroyed
4186
4189
  */
4187
4190
  unregisterPlugin(nameOrPluginKey) {
4188
4191
  if (this.isDestroyed) {
4189
- return;
4192
+ return undefined;
4190
4193
  }
4191
4194
  // @ts-ignore
4192
4195
  const name = typeof nameOrPluginKey === 'string' ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
@@ -4195,6 +4198,7 @@ class Editor extends EventEmitter {
4195
4198
  plugins: this.state.plugins.filter(plugin => !plugin.key.startsWith(name)),
4196
4199
  });
4197
4200
  this.view.updateState(state);
4201
+ return state;
4198
4202
  }
4199
4203
  /**
4200
4204
  * Creates an extension manager.