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