diff --git a/packages/tiptap/src/utils/ExtensionManager.js b/packages/tiptap/src/utils/ExtensionManager.js index 9128738d..b1733a54 100644 --- a/packages/tiptap/src/utils/ExtensionManager.js +++ b/packages/tiptap/src/utils/ExtensionManager.js @@ -61,15 +61,6 @@ export default class ExtensionManager { ...extensionKeymaps, ...nodeMarkKeymaps, ].map(keys => keymap(keys)) - - // return this.extensions - // .filter(extension => ['node', 'mark'].includes(extension.type)) - // .filter(extension => extension.keys) - // .map(extension => extension.keys({ - // type: schema[`${extension.type}s`][extension.name], - // schema, - // })) - // .map(keys => keymap(keys)) } inputRules({ schema }) { diff --git a/packages/tiptap/src/utils/buildMenuActions.js b/packages/tiptap/src/utils/buildMenuActions.js index 6153aa9b..c179060b 100644 --- a/packages/tiptap/src/utils/buildMenuActions.js +++ b/packages/tiptap/src/utils/buildMenuActions.js @@ -8,19 +8,13 @@ export default function ({ schema, state, commands }) { const command = commands[name] ? commands[name] : () => {} return { name, active, command } }) - .reduce((actions, { name, active, command }) => Object.assign({}, actions, { + .reduce((actions, { name, active, command }) => ({ + ...actions, [name]: { active, command, }, }), {}) - // .reduce((actions, { name, active, command }) => ({ - // ...actions, - // [name]: { - // active, - // command, - // }, - // }), {}) const marks = Object.entries(schema.marks) .map(([name]) => { @@ -34,21 +28,14 @@ export default function ({ schema, state, commands }) { command, } }) - .reduce((actions, { name, active, attrs, command }) => Object.assign({}, actions, { + .reduce((actions, { name, active, attrs, command }) => ({ + ...actions, [name]: { active, attrs, command, }, }), {}) - // .reduce((actions, { name, active, attrs, command }) => ({ - // ...actions, - // [name]: { - // active, - // attrs, - // command, - // }, - // }), {}) return { nodes, diff --git a/packages/tiptap/src/utils/initNodeViews.js b/packages/tiptap/src/utils/initNodeViews.js index 031c639e..3942150e 100644 --- a/packages/tiptap/src/utils/initNodeViews.js +++ b/packages/tiptap/src/utils/initNodeViews.js @@ -2,9 +2,11 @@ import ComponentView from './ComponentView' export default function initNodeViews({ nodes, editable }) { const nodeViews = {} + Object.keys(nodes).forEach(nodeName => { nodeViews[nodeName] = (node, view, getPos, decorations) => { const component = nodes[nodeName] + return new ComponentView(component, { node, view, @@ -14,5 +16,6 @@ export default function initNodeViews({ nodes, editable }) { }) } }) + return nodeViews } diff --git a/packages/tiptap/src/utils/menuBubble.js b/packages/tiptap/src/utils/menuBubble.js index d6af95e4..929f7fa0 100644 --- a/packages/tiptap/src/utils/menuBubble.js +++ b/packages/tiptap/src/utils/menuBubble.js @@ -26,7 +26,6 @@ class Toolbar { return } - // Otherwise, reposition it and update its content this.show() const { from, to } = state.selection @@ -54,6 +53,7 @@ class Toolbar { if (event && event.relatedTarget) { return } + this.element.style.visibility = 'hidden' this.element.style.opacity = 0 }