@tiptap/core 2.7.1 → 2.7.3
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.cjs +6 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +6 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/packages/core/src/Editor.d.ts +4 -2
- package/dist/packages/core/src/ExtensionManager.d.ts +2 -1
- package/dist/packages/core/src/types.d.ts +4 -7
- package/package.json +2 -2
- package/src/Editor.ts +9 -3
- package/src/ExtensionManager.ts +1 -1
- package/src/helpers/getRenderedAttributes.ts +3 -0
- package/src/types.ts +24 -16
package/dist/index.cjs
CHANGED
|
@@ -344,6 +344,7 @@ function mergeAttributes(...objects) {
|
|
|
344
344
|
|
|
345
345
|
function getRenderedAttributes(nodeOrMark, extensionAttributes) {
|
|
346
346
|
return extensionAttributes
|
|
347
|
+
.filter(attribute => attribute.type === nodeOrMark.type.name)
|
|
347
348
|
.filter(item => item.attribute.rendered)
|
|
348
349
|
.map(item => {
|
|
349
350
|
if (!item.attribute.renderHTML) {
|
|
@@ -4173,6 +4174,7 @@ class Editor extends EventEmitter {
|
|
|
4173
4174
|
*
|
|
4174
4175
|
* @param plugin A ProseMirror plugin
|
|
4175
4176
|
* @param handlePlugins Control how to merge the plugin into the existing plugins.
|
|
4177
|
+
* @returns The new editor state
|
|
4176
4178
|
*/
|
|
4177
4179
|
registerPlugin(plugin, handlePlugins) {
|
|
4178
4180
|
const plugins = isFunction(handlePlugins)
|
|
@@ -4180,15 +4182,17 @@ class Editor extends EventEmitter {
|
|
|
4180
4182
|
: [...this.state.plugins, plugin];
|
|
4181
4183
|
const state = this.state.reconfigure({ plugins });
|
|
4182
4184
|
this.view.updateState(state);
|
|
4185
|
+
return state;
|
|
4183
4186
|
}
|
|
4184
4187
|
/**
|
|
4185
4188
|
* Unregister a ProseMirror plugin.
|
|
4186
4189
|
*
|
|
4187
4190
|
* @param nameOrPluginKey The plugins name
|
|
4191
|
+
* @returns The new editor state or undefined if the editor is destroyed
|
|
4188
4192
|
*/
|
|
4189
4193
|
unregisterPlugin(nameOrPluginKey) {
|
|
4190
4194
|
if (this.isDestroyed) {
|
|
4191
|
-
return;
|
|
4195
|
+
return undefined;
|
|
4192
4196
|
}
|
|
4193
4197
|
// @ts-ignore
|
|
4194
4198
|
const name = typeof nameOrPluginKey === 'string' ? `${nameOrPluginKey}$` : nameOrPluginKey.key;
|
|
@@ -4197,6 +4201,7 @@ class Editor extends EventEmitter {
|
|
|
4197
4201
|
plugins: this.state.plugins.filter(plugin => !plugin.key.startsWith(name)),
|
|
4198
4202
|
});
|
|
4199
4203
|
this.view.updateState(state);
|
|
4204
|
+
return state;
|
|
4200
4205
|
}
|
|
4201
4206
|
/**
|
|
4202
4207
|
* Creates an extension manager.
|