@tiptap/react 2.1.9 → 2.1.11

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 CHANGED
@@ -482,11 +482,13 @@ class ReactNodeView extends core.NodeView {
482
482
  this.renderer.updateProps({
483
483
  selected: true,
484
484
  });
485
+ this.renderer.element.classList.add('ProseMirror-selectednode');
485
486
  }
486
487
  deselectNode() {
487
488
  this.renderer.updateProps({
488
489
  selected: false,
489
490
  });
491
+ this.renderer.element.classList.remove('ProseMirror-selectednode');
490
492
  }
491
493
  destroy() {
492
494
  this.renderer.destroy();
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/EditorContent.tsx","../src/Editor.ts","../src/useEditor.ts","../src/Context.tsx","../src/BubbleMenu.tsx","../src/FloatingMenu.tsx","../src/useReactNodeView.ts","../src/NodeViewContent.tsx","../src/NodeViewWrapper.tsx","../src/ReactRenderer.tsx","../src/ReactNodeViewRenderer.tsx"],"sourcesContent":["import React, { HTMLProps } from 'react'\nimport ReactDOM, { flushSync } from 'react-dom'\n\nimport { Editor } from './Editor.js'\nimport { ReactRenderer } from './ReactRenderer.js'\n\nconst Portals: React.FC<{ renderers: Record<string, ReactRenderer> }> = ({ renderers }) => {\n return (\n <>\n {Object.entries(renderers).map(([key, renderer]) => {\n return ReactDOM.createPortal(renderer.reactElement, renderer.element, key)\n })}\n </>\n )\n}\n\nexport interface EditorContentProps extends HTMLProps<HTMLDivElement> {\n editor: Editor | null;\n}\n\nexport interface EditorContentState {\n renderers: Record<string, ReactRenderer>;\n}\n\nexport class PureEditorContent extends React.Component<EditorContentProps, EditorContentState> {\n editorContentRef: React.RefObject<any>\n\n initialized: boolean\n\n constructor(props: EditorContentProps) {\n super(props)\n this.editorContentRef = React.createRef()\n this.initialized = false\n\n this.state = {\n renderers: {},\n }\n }\n\n componentDidMount() {\n this.init()\n }\n\n componentDidUpdate() {\n this.init()\n }\n\n init() {\n const { editor } = this.props\n\n if (editor && editor.options.element) {\n if (editor.contentComponent) {\n return\n }\n\n const element = this.editorContentRef.current\n\n element.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element,\n })\n\n editor.contentComponent = this\n\n editor.createNodeViews()\n\n this.initialized = true\n }\n }\n\n maybeFlushSync(fn: () => void) {\n // Avoid calling flushSync until the editor is initialized.\n // Initialization happens during the componentDidMount or componentDidUpdate\n // lifecycle methods, and React doesn't allow calling flushSync from inside\n // a lifecycle method.\n if (this.initialized) {\n flushSync(fn)\n } else {\n fn()\n }\n }\n\n setRenderer(id: string, renderer: ReactRenderer) {\n this.maybeFlushSync(() => {\n this.setState(({ renderers }) => ({\n renderers: {\n ...renderers,\n [id]: renderer,\n },\n }))\n })\n }\n\n removeRenderer(id: string) {\n this.maybeFlushSync(() => {\n this.setState(({ renderers }) => {\n const nextRenderers = { ...renderers }\n\n delete nextRenderers[id]\n\n return { renderers: nextRenderers }\n })\n })\n }\n\n componentWillUnmount() {\n const { editor } = this.props\n\n if (!editor) {\n return\n }\n\n this.initialized = false\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n }\n\n render() {\n const { editor, ...rest } = this.props\n\n return (\n <>\n <div ref={this.editorContentRef} {...rest} />\n {/* @ts-ignore */}\n <Portals renderers={this.state.renderers} />\n </>\n )\n }\n}\n\n// EditorContent should be re-created whenever the Editor instance changes\nconst EditorContentWithKey = (props: EditorContentProps) => {\n const key = React.useMemo(() => {\n return Math.floor(Math.random() * 0xFFFFFFFF).toString()\n }, [props.editor])\n\n // Can't use JSX here because it conflicts with the type definition of Vue's JSX, so use createElement\n return React.createElement(PureEditorContent, { key, ...props })\n}\n\nexport const EditorContent = React.memo(EditorContentWithKey)\n","import { Editor as CoreEditor } from '@tiptap/core'\nimport React from 'react'\n\nimport { EditorContentProps, EditorContentState } from './EditorContent.js'\nimport { ReactRenderer } from './ReactRenderer.js'\n\ntype ContentComponent = React.Component<EditorContentProps, EditorContentState> & {\n setRenderer(id: string, renderer: ReactRenderer): void;\n removeRenderer(id: string): void;\n}\n\nexport class Editor extends CoreEditor {\n public contentComponent: ContentComponent | null = null\n}\n","import { EditorOptions } from '@tiptap/core'\nimport {\n DependencyList,\n useEffect,\n useRef,\n useState,\n} from 'react'\n\nimport { Editor } from './Editor.js'\n\nfunction useForceUpdate() {\n const [, setValue] = useState(0)\n\n return () => setValue(value => value + 1)\n}\n\nexport const useEditor = (options: Partial<EditorOptions> = {}, deps: DependencyList = []) => {\n const [editor, setEditor] = useState<Editor | null>(null)\n\n const forceUpdate = useForceUpdate()\n\n const {\n onBeforeCreate,\n onBlur,\n onCreate,\n onDestroy,\n onFocus,\n onSelectionUpdate,\n onTransaction,\n onUpdate,\n } = options\n\n const onBeforeCreateRef = useRef(onBeforeCreate)\n const onBlurRef = useRef(onBlur)\n const onCreateRef = useRef(onCreate)\n const onDestroyRef = useRef(onDestroy)\n const onFocusRef = useRef(onFocus)\n const onSelectionUpdateRef = useRef(onSelectionUpdate)\n const onTransactionRef = useRef(onTransaction)\n const onUpdateRef = useRef(onUpdate)\n\n // This effect will handle updating the editor instance\n // when the event handlers change.\n useEffect(() => {\n if (!editor) {\n return\n }\n\n if (onBeforeCreate) {\n editor.off('beforeCreate', onBeforeCreateRef.current)\n editor.on('beforeCreate', onBeforeCreate)\n onBeforeCreateRef.current = onBeforeCreate\n }\n\n if (onBlur) {\n editor.off('blur', onBlurRef.current)\n editor.on('blur', onBlur)\n onBlurRef.current = onBlur\n }\n\n if (onCreate) {\n editor.off('create', onCreateRef.current)\n editor.on('create', onCreate)\n onCreateRef.current = onCreate\n }\n\n if (onDestroy) {\n editor.off('destroy', onDestroyRef.current)\n editor.on('destroy', onDestroy)\n onDestroyRef.current = onDestroy\n }\n\n if (onFocus) {\n editor.off('focus', onFocusRef.current)\n editor.on('focus', onFocus)\n onFocusRef.current = onFocus\n }\n\n if (onSelectionUpdate) {\n editor.off('selectionUpdate', onSelectionUpdateRef.current)\n editor.on('selectionUpdate', onSelectionUpdate)\n onSelectionUpdateRef.current = onSelectionUpdate\n }\n\n if (onTransaction) {\n editor.off('transaction', onTransactionRef.current)\n editor.on('transaction', onTransaction)\n onTransactionRef.current = onTransaction\n }\n\n if (onUpdate) {\n editor.off('update', onUpdateRef.current)\n editor.on('update', onUpdate)\n onUpdateRef.current = onUpdate\n }\n }, [onBeforeCreate, onBlur, onCreate, onDestroy, onFocus, onSelectionUpdate, onTransaction, onUpdate, editor])\n\n useEffect(() => {\n let isMounted = true\n\n const instance = new Editor(options)\n\n setEditor(instance)\n\n instance.on('transaction', () => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (isMounted) {\n forceUpdate()\n }\n })\n })\n })\n\n return () => {\n isMounted = false\n }\n }, deps)\n\n useEffect(() => {\n return () => {\n editor?.destroy()\n }\n }, [editor])\n\n return editor\n}\n","import { EditorOptions } from '@tiptap/core'\nimport React, { createContext, ReactNode, useContext } from 'react'\n\nimport { Editor } from './Editor.js'\nimport { EditorContent } from './EditorContent.js'\nimport { useEditor } from './useEditor.js'\n\nexport type EditorContextValue = {\n editor: Editor | null;\n}\n\nexport const EditorContext = createContext<EditorContextValue>({\n editor: null,\n})\n\nexport const EditorConsumer = EditorContext.Consumer\n\nexport const useCurrentEditor = () => useContext(EditorContext)\n\nexport type EditorProviderProps = {\n children: ReactNode;\n slotBefore?: ReactNode;\n slotAfter?: ReactNode;\n} & Partial<EditorOptions>\n\nexport const EditorProvider = ({\n children, slotAfter, slotBefore, ...editorOptions\n}: EditorProviderProps) => {\n const editor = useEditor(editorOptions)\n\n if (!editor) {\n return null\n }\n\n return (\n <EditorContext.Provider value={{ editor }}>\n {slotBefore}\n <EditorConsumer>\n {({ editor: currentEditor }) => (\n <EditorContent editor={currentEditor} />\n )}\n </EditorConsumer>\n {children}\n {slotAfter}\n </EditorContext.Provider>\n )\n}\n","import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport React, { useEffect, useState } from 'react'\n\nimport { useCurrentEditor } from './Context.js'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport type BubbleMenuProps = Omit<Optional<BubbleMenuPluginProps, 'pluginKey' | 'editor'>, 'element'> & {\n className?: string;\n children: React.ReactNode;\n updateDelay?: number;\n};\n\nexport const BubbleMenu = (props: BubbleMenuProps) => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n const { editor: currentEditor } = useCurrentEditor()\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor?.isDestroyed || currentEditor?.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'bubbleMenu', editor, tippyOptions = {}, updateDelay, shouldShow = null,\n } = props\n\n const menuEditor = editor || currentEditor\n\n if (!menuEditor) {\n console.warn('BubbleMenu component is not rendered inside of an editor component or does not have editor prop.')\n return\n }\n\n const plugin = BubbleMenuPlugin({\n updateDelay,\n editor: menuEditor,\n element,\n pluginKey,\n shouldShow,\n tippyOptions,\n })\n\n menuEditor.registerPlugin(plugin)\n return () => menuEditor.unregisterPlugin(pluginKey)\n }, [props.editor, currentEditor, element])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport React, {\n useEffect, useState,\n} from 'react'\n\nimport { useCurrentEditor } from './Context.js'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>\n\nexport type FloatingMenuProps = Omit<Optional<FloatingMenuPluginProps, 'pluginKey' | 'editor'>, 'element'> & {\n className?: string,\n children: React.ReactNode\n}\n\nexport const FloatingMenu = (props: FloatingMenuProps) => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n const { editor: currentEditor } = useCurrentEditor()\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor?.isDestroyed || currentEditor?.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'floatingMenu',\n editor,\n tippyOptions = {},\n shouldShow = null,\n } = props\n\n const menuEditor = editor || currentEditor\n\n if (!menuEditor) {\n console.warn('FloatingMenu component is not rendered inside of an editor component or does not have editor prop.')\n return\n }\n\n const plugin = FloatingMenuPlugin({\n pluginKey,\n editor: menuEditor,\n element,\n tippyOptions,\n shouldShow,\n })\n\n menuEditor.registerPlugin(plugin)\n return () => menuEditor.unregisterPlugin(pluginKey)\n }, [\n props.editor,\n currentEditor,\n element,\n ])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { createContext, useContext } from 'react'\n\nexport interface ReactNodeViewContextProps {\n onDragStart: (event: DragEvent) => void,\n nodeViewContentRef: (element: HTMLElement | null) => void,\n}\n\nexport const ReactNodeViewContext = createContext<Partial<ReactNodeViewContextProps>>({\n onDragStart: undefined,\n})\n\nexport const useReactNodeView = () => useContext(ReactNodeViewContext)\n","import React from 'react'\n\nimport { useReactNodeView } from './useReactNodeView.js'\n\nexport interface NodeViewContentProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewContent: React.FC<NodeViewContentProps> = props => {\n const Tag = props.as || 'div'\n const { nodeViewContentRef } = useReactNodeView()\n\n return (\n <Tag\n {...props}\n ref={nodeViewContentRef}\n data-node-view-content=\"\"\n style={{\n whiteSpace: 'pre-wrap',\n ...props.style,\n }}\n />\n )\n}\n","import React from 'react'\n\nimport { useReactNodeView } from './useReactNodeView.js'\n\nexport interface NodeViewWrapperProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewWrapper: React.FC<NodeViewWrapperProps> = React.forwardRef((props, ref) => {\n const { onDragStart } = useReactNodeView()\n const Tag = props.as || 'div'\n\n return (\n <Tag\n {...props}\n ref={ref}\n data-node-view-wrapper=\"\"\n onDragStart={onDragStart}\n style={{\n whiteSpace: 'normal',\n ...props.style,\n }}\n />\n )\n})\n","import { Editor } from '@tiptap/core'\nimport React from 'react'\n\nimport { Editor as ExtendedEditor } from './Editor.js'\n\nfunction isClassComponent(Component: any) {\n return !!(\n typeof Component === 'function'\n && Component.prototype\n && Component.prototype.isReactComponent\n )\n}\n\nfunction isForwardRefComponent(Component: any) {\n return !!(\n typeof Component === 'object'\n && Component.$$typeof?.toString() === 'Symbol(react.forward_ref)'\n )\n}\n\nexport interface ReactRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n as?: string,\n className?: string,\n attrs?: Record<string, string>,\n}\n\ntype ComponentType<R, P> =\n React.ComponentClass<P> |\n React.FunctionComponent<P> |\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<R>>;\n\nexport class ReactRenderer<R = unknown, P = unknown> {\n id: string\n\n editor: ExtendedEditor\n\n component: any\n\n element: Element\n\n props: Record<string, any>\n\n reactElement: React.ReactNode\n\n ref: R | null = null\n\n constructor(component: ComponentType<R, P>, {\n editor,\n props = {},\n as = 'div',\n className = '',\n attrs,\n }: ReactRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.component = component\n this.editor = editor as ExtendedEditor\n this.props = props\n this.element = document.createElement(as)\n this.element.classList.add('react-renderer')\n\n if (className) {\n this.element.classList.add(...className.split(' '))\n }\n\n if (attrs) {\n Object.keys(attrs).forEach(key => {\n this.element.setAttribute(key, attrs[key])\n })\n }\n\n this.render()\n }\n\n render(): void {\n const Component = this.component\n const props = this.props\n\n if (isClassComponent(Component) || isForwardRefComponent(Component)) {\n props.ref = (ref: R) => {\n this.ref = ref\n }\n }\n\n this.reactElement = <Component {...props } />\n\n this.editor?.contentComponent?.setRenderer(this.id, this)\n }\n\n updateProps(props: Record<string, any> = {}): void {\n this.props = {\n ...this.props,\n ...props,\n }\n\n this.render()\n }\n\n destroy(): void {\n this.editor?.contentComponent?.removeRenderer(this.id)\n }\n}\n","import {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport React from 'react'\n\nimport { Editor } from './Editor.js'\nimport { ReactRenderer } from './ReactRenderer.js'\nimport { ReactNodeViewContext, ReactNodeViewContextProps } from './useReactNodeView.js'\n\nexport interface ReactNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode\n oldDecorations: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\n updateProps: () => void\n }) => boolean)\n | null\n as?: string\n className?: string\n attrs?: Record<string, string>\n}\n\nclass ReactNodeView extends NodeView<\n React.FunctionComponent,\n Editor,\n ReactNodeViewRendererOptions\n> {\n renderer!: ReactRenderer\n\n contentDOMElement!: HTMLElement | null\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n if (!(this.component as any).displayName) {\n const capitalizeFirstChar = (string: string): string => {\n return string.charAt(0).toUpperCase() + string.substring(1)\n }\n\n this.component.displayName = capitalizeFirstChar(this.extension.name)\n }\n\n const ReactNodeViewProvider: React.FunctionComponent = componentProps => {\n const Component = this.component\n const onDragStart = this.onDragStart.bind(this)\n const nodeViewContentRef: ReactNodeViewContextProps['nodeViewContentRef'] = element => {\n if (element && this.contentDOMElement && element.firstChild !== this.contentDOMElement) {\n element.appendChild(this.contentDOMElement)\n }\n }\n\n return (\n <>\n {/* @ts-ignore */}\n <ReactNodeViewContext.Provider value={{ onDragStart, nodeViewContentRef }}>\n {/* @ts-ignore */}\n <Component {...componentProps} />\n </ReactNodeViewContext.Provider>\n </>\n )\n }\n\n ReactNodeViewProvider.displayName = 'ReactNodeView'\n\n this.contentDOMElement = this.node.isLeaf\n ? null\n : document.createElement(this.node.isInline ? 'span' : 'div')\n\n if (this.contentDOMElement) {\n // For some reason the whiteSpace prop is not inherited properly in Chrome and Safari\n // With this fix it seems to work fine\n // See: https://github.com/ueberdosis/tiptap/issues/1197\n this.contentDOMElement.style.whiteSpace = 'inherit'\n }\n\n let as = this.node.isInline ? 'span' : 'div'\n\n if (this.options.as) {\n as = this.options.as\n }\n\n const { className = '' } = this.options\n\n this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)\n this.editor.on('selectionUpdate', this.handleSelectionUpdate)\n\n this.renderer = new ReactRenderer(ReactNodeViewProvider, {\n editor: this.editor,\n props,\n as,\n className: `node-${this.node.type.name} ${className}`.trim(),\n attrs: this.options.attrs,\n })\n }\n\n get dom() {\n if (\n this.renderer.element.firstElementChild\n && !this.renderer.element.firstElementChild?.hasAttribute('data-node-view-wrapper')\n ) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n return this.contentDOMElement\n }\n\n handleSelectionUpdate() {\n const { from, to } = this.editor.state.selection\n\n if (from <= this.getPos() && to >= this.getPos() + this.node.nodeSize) {\n this.selectNode()\n } else {\n this.deselectNode()\n }\n }\n\n update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.renderer.updateProps(props)\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n destroy() {\n this.renderer.destroy()\n this.editor.off('selectionUpdate', this.handleSelectionUpdate)\n this.contentDOMElement = null\n }\n}\n\nexport function ReactNodeViewRenderer(\n component: any,\n options?: Partial<ReactNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new ReactNodeView(component, props, options) as unknown as ProseMirrorNodeView\n }\n}\n"],"names":["React","ReactDOM","flushSync","CoreEditor","useState","useRef","useEffect","createContext","useContext","BubbleMenuPlugin","FloatingMenuPlugin","NodeView"],"mappings":";;;;;;;;;;;;;;;AAMA,MAAM,OAAO,GAA2D,CAAC,EAAE,SAAS,EAAE,KAAI;AACxF,IAAA,QACEA,yBACG,CAAA,aAAA,CAAAA,yBAAA,CAAA,QAAA,EAAA,IAAA,EAAA,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAI;AACjD,QAAA,OAAOC,4BAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;KAC3E,CAAC,CACD,EACJ;AACH,CAAC,CAAA;AAUY,MAAA,iBAAkB,SAAQD,yBAAK,CAAC,SAAiD,CAAA;AAK5F,IAAA,WAAA,CAAY,KAAyB,EAAA;QACnC,KAAK,CAAC,KAAK,CAAC,CAAA;AACZ,QAAA,IAAI,CAAC,gBAAgB,GAAGA,yBAAK,CAAC,SAAS,EAAE,CAAA;AACzC,QAAA,IAAI,CAAC,WAAW,GAAG,KAAK,CAAA;QAExB,IAAI,CAAC,K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KAA4B,KAAI;;;;AAItC,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;AAC9C,YAAA,OAAO,EAAE,CAAA;AACV,SAAA;QAED,OAAO,IAAI,aAAa,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAmC,CAAA;AACvF,KAAC,CAAA;AACH;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/EditorContent.tsx","../src/Editor.ts","../src/useEditor.ts","../src/Context.tsx","../src/BubbleMenu.tsx","../src/FloatingMenu.tsx","../src/useReactNodeView.ts","../src/NodeViewContent.tsx","../src/NodeViewWrapper.tsx","../src/ReactRenderer.tsx","../src/ReactNodeViewRenderer.tsx"],"sourcesContent":["import React, { HTMLProps } from 'react'\nimport ReactDOM, { flushSync } from 'react-dom'\n\nimport { Editor } from './Editor.js'\nimport { ReactRenderer } from './ReactRenderer.js'\n\nconst Portals: React.FC<{ renderers: Record<string, ReactRenderer> }> = ({ renderers }) => {\n return (\n <>\n {Object.entries(renderers).map(([key, renderer]) => {\n return ReactDOM.createPortal(renderer.reactElement, renderer.element, key)\n })}\n </>\n )\n}\n\nexport interface EditorContentProps extends HTMLProps<HTMLDivElement> {\n editor: Editor | null;\n}\n\nexport interface EditorContentState {\n renderers: Record<string, ReactRenderer>;\n}\n\nexport class PureEditorContent extends React.Component<EditorContentProps, EditorContentState> {\n editorContentRef: React.RefObject<any>\n\n initialized: boolean\n\n constructor(props: EditorContentProps) {\n super(props)\n this.editorContentRef = React.createRef()\n this.initialized = false\n\n this.state = {\n renderers: {},\n }\n }\n\n componentDidMount() {\n this.init()\n }\n\n componentDidUpdate() {\n this.init()\n }\n\n init() {\n const { editor } = this.props\n\n if (editor && editor.options.element) {\n if (editor.contentComponent) {\n return\n }\n\n const element = this.editorContentRef.current\n\n element.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element,\n })\n\n editor.contentComponent = this\n\n editor.createNodeViews()\n\n this.initialized = true\n }\n }\n\n maybeFlushSync(fn: () => void) {\n // Avoid calling flushSync until the editor is initialized.\n // Initialization happens during the componentDidMount or componentDidUpdate\n // lifecycle methods, and React doesn't allow calling flushSync from inside\n // a lifecycle method.\n if (this.initialized) {\n flushSync(fn)\n } else {\n fn()\n }\n }\n\n setRenderer(id: string, renderer: ReactRenderer) {\n this.maybeFlushSync(() => {\n this.setState(({ renderers }) => ({\n renderers: {\n ...renderers,\n [id]: renderer,\n },\n }))\n })\n }\n\n removeRenderer(id: string) {\n this.maybeFlushSync(() => {\n this.setState(({ renderers }) => {\n const nextRenderers = { ...renderers }\n\n delete nextRenderers[id]\n\n return { renderers: nextRenderers }\n })\n })\n }\n\n componentWillUnmount() {\n const { editor } = this.props\n\n if (!editor) {\n return\n }\n\n this.initialized = false\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n }\n\n render() {\n const { editor, ...rest } = this.props\n\n return (\n <>\n <div ref={this.editorContentRef} {...rest} />\n {/* @ts-ignore */}\n <Portals renderers={this.state.renderers} />\n </>\n )\n }\n}\n\n// EditorContent should be re-created whenever the Editor instance changes\nconst EditorContentWithKey = (props: EditorContentProps) => {\n const key = React.useMemo(() => {\n return Math.floor(Math.random() * 0xFFFFFFFF).toString()\n }, [props.editor])\n\n // Can't use JSX here because it conflicts with the type definition of Vue's JSX, so use createElement\n return React.createElement(PureEditorContent, { key, ...props })\n}\n\nexport const EditorContent = React.memo(EditorContentWithKey)\n","import { Editor as CoreEditor } from '@tiptap/core'\nimport React from 'react'\n\nimport { EditorContentProps, EditorContentState } from './EditorContent.js'\nimport { ReactRenderer } from './ReactRenderer.js'\n\ntype ContentComponent = React.Component<EditorContentProps, EditorContentState> & {\n setRenderer(id: string, renderer: ReactRenderer): void;\n removeRenderer(id: string): void;\n}\n\nexport class Editor extends CoreEditor {\n public contentComponent: ContentComponent | null = null\n}\n","import { EditorOptions } from '@tiptap/core'\nimport {\n DependencyList,\n useEffect,\n useRef,\n useState,\n} from 'react'\n\nimport { Editor } from './Editor.js'\n\nfunction useForceUpdate() {\n const [, setValue] = useState(0)\n\n return () => setValue(value => value + 1)\n}\n\nexport const useEditor = (options: Partial<EditorOptions> = {}, deps: DependencyList = []) => {\n const [editor, setEditor] = useState<Editor | null>(null)\n\n const forceUpdate = useForceUpdate()\n\n const {\n onBeforeCreate,\n onBlur,\n onCreate,\n onDestroy,\n onFocus,\n onSelectionUpdate,\n onTransaction,\n onUpdate,\n } = options\n\n const onBeforeCreateRef = useRef(onBeforeCreate)\n const onBlurRef = useRef(onBlur)\n const onCreateRef = useRef(onCreate)\n const onDestroyRef = useRef(onDestroy)\n const onFocusRef = useRef(onFocus)\n const onSelectionUpdateRef = useRef(onSelectionUpdate)\n const onTransactionRef = useRef(onTransaction)\n const onUpdateRef = useRef(onUpdate)\n\n // This effect will handle updating the editor instance\n // when the event handlers change.\n useEffect(() => {\n if (!editor) {\n return\n }\n\n if (onBeforeCreate) {\n editor.off('beforeCreate', onBeforeCreateRef.current)\n editor.on('beforeCreate', onBeforeCreate)\n onBeforeCreateRef.current = onBeforeCreate\n }\n\n if (onBlur) {\n editor.off('blur', onBlurRef.current)\n editor.on('blur', onBlur)\n onBlurRef.current = onBlur\n }\n\n if (onCreate) {\n editor.off('create', onCreateRef.current)\n editor.on('create', onCreate)\n onCreateRef.current = onCreate\n }\n\n if (onDestroy) {\n editor.off('destroy', onDestroyRef.current)\n editor.on('destroy', onDestroy)\n onDestroyRef.current = onDestroy\n }\n\n if (onFocus) {\n editor.off('focus', onFocusRef.current)\n editor.on('focus', onFocus)\n onFocusRef.current = onFocus\n }\n\n if (onSelectionUpdate) {\n editor.off('selectionUpdate', onSelectionUpdateRef.current)\n editor.on('selectionUpdate', onSelectionUpdate)\n onSelectionUpdateRef.current = onSelectionUpdate\n }\n\n if (onTransaction) {\n editor.off('transaction', onTransactionRef.current)\n editor.on('transaction', onTransaction)\n onTransactionRef.current = onTransaction\n }\n\n if (onUpdate) {\n editor.off('update', onUpdateRef.current)\n editor.on('update', onUpdate)\n onUpdateRef.current = onUpdate\n }\n }, [onBeforeCreate, onBlur, onCreate, onDestroy, onFocus, onSelectionUpdate, onTransaction, onUpdate, editor])\n\n useEffect(() => {\n let isMounted = true\n\n const instance = new Editor(options)\n\n setEditor(instance)\n\n instance.on('transaction', () => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (isMounted) {\n forceUpdate()\n }\n })\n })\n })\n\n return () => {\n isMounted = false\n }\n }, deps)\n\n useEffect(() => {\n return () => {\n editor?.destroy()\n }\n }, [editor])\n\n return editor\n}\n","import { EditorOptions } from '@tiptap/core'\nimport React, { createContext, ReactNode, useContext } from 'react'\n\nimport { Editor } from './Editor.js'\nimport { EditorContent } from './EditorContent.js'\nimport { useEditor } from './useEditor.js'\n\nexport type EditorContextValue = {\n editor: Editor | null;\n}\n\nexport const EditorContext = createContext<EditorContextValue>({\n editor: null,\n})\n\nexport const EditorConsumer = EditorContext.Consumer\n\nexport const useCurrentEditor = () => useContext(EditorContext)\n\nexport type EditorProviderProps = {\n children: ReactNode;\n slotBefore?: ReactNode;\n slotAfter?: ReactNode;\n} & Partial<EditorOptions>\n\nexport const EditorProvider = ({\n children, slotAfter, slotBefore, ...editorOptions\n}: EditorProviderProps) => {\n const editor = useEditor(editorOptions)\n\n if (!editor) {\n return null\n }\n\n return (\n <EditorContext.Provider value={{ editor }}>\n {slotBefore}\n <EditorConsumer>\n {({ editor: currentEditor }) => (\n <EditorContent editor={currentEditor} />\n )}\n </EditorConsumer>\n {children}\n {slotAfter}\n </EditorContext.Provider>\n )\n}\n","import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport React, { useEffect, useState } from 'react'\n\nimport { useCurrentEditor } from './Context.js'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport type BubbleMenuProps = Omit<Optional<BubbleMenuPluginProps, 'pluginKey' | 'editor'>, 'element'> & {\n className?: string;\n children: React.ReactNode;\n updateDelay?: number;\n};\n\nexport const BubbleMenu = (props: BubbleMenuProps) => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n const { editor: currentEditor } = useCurrentEditor()\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor?.isDestroyed || currentEditor?.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'bubbleMenu', editor, tippyOptions = {}, updateDelay, shouldShow = null,\n } = props\n\n const menuEditor = editor || currentEditor\n\n if (!menuEditor) {\n console.warn('BubbleMenu component is not rendered inside of an editor component or does not have editor prop.')\n return\n }\n\n const plugin = BubbleMenuPlugin({\n updateDelay,\n editor: menuEditor,\n element,\n pluginKey,\n shouldShow,\n tippyOptions,\n })\n\n menuEditor.registerPlugin(plugin)\n return () => menuEditor.unregisterPlugin(pluginKey)\n }, [props.editor, currentEditor, element])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport React, {\n useEffect, useState,\n} from 'react'\n\nimport { useCurrentEditor } from './Context.js'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>\n\nexport type FloatingMenuProps = Omit<Optional<FloatingMenuPluginProps, 'pluginKey' | 'editor'>, 'element'> & {\n className?: string,\n children: React.ReactNode\n}\n\nexport const FloatingMenu = (props: FloatingMenuProps) => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n const { editor: currentEditor } = useCurrentEditor()\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor?.isDestroyed || currentEditor?.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'floatingMenu',\n editor,\n tippyOptions = {},\n shouldShow = null,\n } = props\n\n const menuEditor = editor || currentEditor\n\n if (!menuEditor) {\n console.warn('FloatingMenu component is not rendered inside of an editor component or does not have editor prop.')\n return\n }\n\n const plugin = FloatingMenuPlugin({\n pluginKey,\n editor: menuEditor,\n element,\n tippyOptions,\n shouldShow,\n })\n\n menuEditor.registerPlugin(plugin)\n return () => menuEditor.unregisterPlugin(pluginKey)\n }, [\n props.editor,\n currentEditor,\n element,\n ])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { createContext, useContext } from 'react'\n\nexport interface ReactNodeViewContextProps {\n onDragStart: (event: DragEvent) => void,\n nodeViewContentRef: (element: HTMLElement | null) => void,\n}\n\nexport const ReactNodeViewContext = createContext<Partial<ReactNodeViewContextProps>>({\n onDragStart: undefined,\n})\n\nexport const useReactNodeView = () => useContext(ReactNodeViewContext)\n","import React from 'react'\n\nimport { useReactNodeView } from './useReactNodeView.js'\n\nexport interface NodeViewContentProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewContent: React.FC<NodeViewContentProps> = props => {\n const Tag = props.as || 'div'\n const { nodeViewContentRef } = useReactNodeView()\n\n return (\n <Tag\n {...props}\n ref={nodeViewContentRef}\n data-node-view-content=\"\"\n style={{\n whiteSpace: 'pre-wrap',\n ...props.style,\n }}\n />\n )\n}\n","import React from 'react'\n\nimport { useReactNodeView } from './useReactNodeView.js'\n\nexport interface NodeViewWrapperProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewWrapper: React.FC<NodeViewWrapperProps> = React.forwardRef((props, ref) => {\n const { onDragStart } = useReactNodeView()\n const Tag = props.as || 'div'\n\n return (\n <Tag\n {...props}\n ref={ref}\n data-node-view-wrapper=\"\"\n onDragStart={onDragStart}\n style={{\n whiteSpace: 'normal',\n ...props.style,\n }}\n />\n )\n})\n","import { Editor } from '@tiptap/core'\nimport React from 'react'\n\nimport { Editor as ExtendedEditor } from './Editor.js'\n\nfunction isClassComponent(Component: any) {\n return !!(\n typeof Component === 'function'\n && Component.prototype\n && Component.prototype.isReactComponent\n )\n}\n\nfunction isForwardRefComponent(Component: any) {\n return !!(\n typeof Component === 'object'\n && Component.$$typeof?.toString() === 'Symbol(react.forward_ref)'\n )\n}\n\nexport interface ReactRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n as?: string,\n className?: string,\n attrs?: Record<string, string>,\n}\n\ntype ComponentType<R, P> =\n React.ComponentClass<P> |\n React.FunctionComponent<P> |\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<R>>;\n\nexport class ReactRenderer<R = unknown, P = unknown> {\n id: string\n\n editor: ExtendedEditor\n\n component: any\n\n element: Element\n\n props: Record<string, any>\n\n reactElement: React.ReactNode\n\n ref: R | null = null\n\n constructor(component: ComponentType<R, P>, {\n editor,\n props = {},\n as = 'div',\n className = '',\n attrs,\n }: ReactRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.component = component\n this.editor = editor as ExtendedEditor\n this.props = props\n this.element = document.createElement(as)\n this.element.classList.add('react-renderer')\n\n if (className) {\n this.element.classList.add(...className.split(' '))\n }\n\n if (attrs) {\n Object.keys(attrs).forEach(key => {\n this.element.setAttribute(key, attrs[key])\n })\n }\n\n this.render()\n }\n\n render(): void {\n const Component = this.component\n const props = this.props\n\n if (isClassComponent(Component) || isForwardRefComponent(Component)) {\n props.ref = (ref: R) => {\n this.ref = ref\n }\n }\n\n this.reactElement = <Component {...props } />\n\n this.editor?.contentComponent?.setRenderer(this.id, this)\n }\n\n updateProps(props: Record<string, any> = {}): void {\n this.props = {\n ...this.props,\n ...props,\n }\n\n this.render()\n }\n\n destroy(): void {\n this.editor?.contentComponent?.removeRenderer(this.id)\n }\n}\n","import {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport React from 'react'\n\nimport { Editor } from './Editor.js'\nimport { ReactRenderer } from './ReactRenderer.js'\nimport { ReactNodeViewContext, ReactNodeViewContextProps } from './useReactNodeView.js'\n\nexport interface ReactNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode\n oldDecorations: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\n updateProps: () => void\n }) => boolean)\n | null\n as?: string\n className?: string\n attrs?: Record<string, string>\n}\n\nclass ReactNodeView extends NodeView<\n React.FunctionComponent,\n Editor,\n ReactNodeViewRendererOptions\n> {\n renderer!: ReactRenderer\n\n contentDOMElement!: HTMLElement | null\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n if (!(this.component as any).displayName) {\n const capitalizeFirstChar = (string: string): string => {\n return string.charAt(0).toUpperCase() + string.substring(1)\n }\n\n this.component.displayName = capitalizeFirstChar(this.extension.name)\n }\n\n const ReactNodeViewProvider: React.FunctionComponent = componentProps => {\n const Component = this.component\n const onDragStart = this.onDragStart.bind(this)\n const nodeViewContentRef: ReactNodeViewContextProps['nodeViewContentRef'] = element => {\n if (element && this.contentDOMElement && element.firstChild !== this.contentDOMElement) {\n element.appendChild(this.contentDOMElement)\n }\n }\n\n return (\n <>\n {/* @ts-ignore */}\n <ReactNodeViewContext.Provider value={{ onDragStart, nodeViewContentRef }}>\n {/* @ts-ignore */}\n <Component {...componentProps} />\n </ReactNodeViewContext.Provider>\n </>\n )\n }\n\n ReactNodeViewProvider.displayName = 'ReactNodeView'\n\n this.contentDOMElement = this.node.isLeaf\n ? null\n : document.createElement(this.node.isInline ? 'span' : 'div')\n\n if (this.contentDOMElement) {\n // For some reason the whiteSpace prop is not inherited properly in Chrome and Safari\n // With this fix it seems to work fine\n // See: https://github.com/ueberdosis/tiptap/issues/1197\n this.contentDOMElement.style.whiteSpace = 'inherit'\n }\n\n let as = this.node.isInline ? 'span' : 'div'\n\n if (this.options.as) {\n as = this.options.as\n }\n\n const { className = '' } = this.options\n\n this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)\n this.editor.on('selectionUpdate', this.handleSelectionUpdate)\n\n this.renderer = new ReactRenderer(ReactNodeViewProvider, {\n editor: this.editor,\n props,\n as,\n className: `node-${this.node.type.name} ${className}`.trim(),\n attrs: this.options.attrs,\n })\n }\n\n get dom() {\n if (\n this.renderer.element.firstElementChild\n && !this.renderer.element.firstElementChild?.hasAttribute('data-node-view-wrapper')\n ) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n return this.contentDOMElement\n }\n\n handleSelectionUpdate() {\n const { from, to } = this.editor.state.selection\n\n if (from <= this.getPos() && to >= this.getPos() + this.node.nodeSize) {\n this.selectNode()\n } else {\n this.deselectNode()\n }\n }\n\n update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.renderer.updateProps(props)\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n this.renderer.element.classList.remove('ProseMirror-selectednode')\n }\n\n destroy() {\n this.renderer.destroy()\n this.editor.off('selectionUpdate', this.handleSelectionUpdate)\n this.contentDOMElement = null\n }\n}\n\nexport function ReactNodeViewRenderer(\n component: any,\n options?: Partial<ReactNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new ReactNodeView(component, props, options) as unknown as ProseMirrorNodeView\n }\n}\n"],"names":["React","ReactDOM","flushSync","CoreEditor","useState","useRef","useEffect","createContext","useContext","BubbleMenuPlugin","FloatingMenuPlugin","NodeView"],"mappings":";;;;;;;;;;;;;;;AAMA,MAAM,OAAO,GAA2D,CAAC,EAAE,SAAS,EAAE,KAAI;AACxF,IAAA,QACEA,yBACG,CAAA,aAAA,CAAAA,yBAAA,CAAA,QAAA,EAAA,IAAA,EAAA,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAI;AACjD,QAAA,OAAOC,4BAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;KAC3E,CAAC,CACD,EACJ;AACH,CAAC,CAAA;AAUY,MAAA,iBAAkB,SAAQD,yBAAK,CAAC,SAAiD,CAAA;AAK5F,IAAA,WAAA,CAAY,KAAyB,EAAA;QACnC,KAAK,CAAC,KAAK,CAAC,CAAA;AACZ,QAAA,IAAI,CAAC,gBAAgB,GAAGA,yBAAK,CAAC,SAAS,EAAE,CAAA;AACzC,QAAA,IAAI,CAAC,WAAW,GAAG,KAAK,CAAA;QAExB,IAAI,CAAC,KAAK,GAAG;AACX,YAAA,SAAS,EAAE,EAAE;SACd,CAAA;KACF;IAED,iBAAiB,GAAA;QACf,IAAI,CAAC,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9B;AACF,CAAA;AAEe,SAAA,qBAAqB,CACnC,SAAc,EACd,OAA+C,EAAA;IAE/C,OAAO,CAAC,KAA4B,KAAI;;;;AAItC,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;AAC9C,YAAA,OAAO,EAAE,CAAA;AACV,SAAA;QAED,OAAO,IAAI,aAAa,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAmC,CAAA;AACvF,KAAC,CAAA;AACH;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.js CHANGED
@@ -474,11 +474,13 @@ class ReactNodeView extends NodeView {
474
474
  this.renderer.updateProps({
475
475
  selected: true,
476
476
  });
477
+ this.renderer.element.classList.add('ProseMirror-selectednode');
477
478
  }
478
479
  deselectNode() {
479
480
  this.renderer.updateProps({
480
481
  selected: false,
481
482
  });
483
+ this.renderer.element.classList.remove('ProseMirror-selectednode');
482
484
  }
483
485
  destroy() {
484
486
  this.renderer.destroy();
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/EditorContent.tsx","../src/Editor.ts","../src/useEditor.ts","../src/Context.tsx","../src/BubbleMenu.tsx","../src/FloatingMenu.tsx","../src/useReactNodeView.ts","../src/NodeViewContent.tsx","../src/NodeViewWrapper.tsx","../src/ReactRenderer.tsx","../src/ReactNodeViewRenderer.tsx"],"sourcesContent":["import React, { HTMLProps } from 'react'\nimport ReactDOM, { flushSync } from 'react-dom'\n\nimport { Editor } from './Editor.js'\nimport { ReactRenderer } from './ReactRenderer.js'\n\nconst Portals: React.FC<{ renderers: Record<string, ReactRenderer> }> = ({ renderers }) => {\n return (\n <>\n {Object.entries(renderers).map(([key, renderer]) => {\n return ReactDOM.createPortal(renderer.reactElement, renderer.element, key)\n })}\n </>\n )\n}\n\nexport interface EditorContentProps extends HTMLProps<HTMLDivElement> {\n editor: Editor | null;\n}\n\nexport interface EditorContentState {\n renderers: Record<string, ReactRenderer>;\n}\n\nexport class PureEditorContent extends React.Component<EditorContentProps, EditorContentState> {\n editorContentRef: React.RefObject<any>\n\n initialized: boolean\n\n constructor(props: EditorContentProps) {\n super(props)\n this.editorContentRef = React.createRef()\n this.initialized = false\n\n this.state = {\n renderers: {},\n }\n }\n\n componentDidMount() {\n this.init()\n }\n\n componentDidUpdate() {\n this.init()\n }\n\n init() {\n const { editor } = this.props\n\n if (editor && editor.options.element) {\n if (editor.contentComponent) {\n return\n }\n\n const element = this.editorContentRef.current\n\n element.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element,\n })\n\n editor.contentComponent = this\n\n editor.createNodeViews()\n\n this.initialized = true\n }\n }\n\n maybeFlushSync(fn: () => void) {\n // Avoid calling flushSync until the editor is initialized.\n // Initialization happens during the componentDidMount or componentDidUpdate\n // lifecycle methods, and React doesn't allow calling flushSync from inside\n // a lifecycle method.\n if (this.initialized) {\n flushSync(fn)\n } else {\n fn()\n }\n }\n\n setRenderer(id: string, renderer: ReactRenderer) {\n this.maybeFlushSync(() => {\n this.setState(({ renderers }) => ({\n renderers: {\n ...renderers,\n [id]: renderer,\n },\n }))\n })\n }\n\n removeRenderer(id: string) {\n this.maybeFlushSync(() => {\n this.setState(({ renderers }) => {\n const nextRenderers = { ...renderers }\n\n delete nextRenderers[id]\n\n return { renderers: nextRenderers }\n })\n })\n }\n\n componentWillUnmount() {\n const { editor } = this.props\n\n if (!editor) {\n return\n }\n\n this.initialized = false\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n }\n\n render() {\n const { editor, ...rest } = this.props\n\n return (\n <>\n <div ref={this.editorContentRef} {...rest} />\n {/* @ts-ignore */}\n <Portals renderers={this.state.renderers} />\n </>\n )\n }\n}\n\n// EditorContent should be re-created whenever the Editor instance changes\nconst EditorContentWithKey = (props: EditorContentProps) => {\n const key = React.useMemo(() => {\n return Math.floor(Math.random() * 0xFFFFFFFF).toString()\n }, [props.editor])\n\n // Can't use JSX here because it conflicts with the type definition of Vue's JSX, so use createElement\n return React.createElement(PureEditorContent, { key, ...props })\n}\n\nexport const EditorContent = React.memo(EditorContentWithKey)\n","import { Editor as CoreEditor } from '@tiptap/core'\nimport React from 'react'\n\nimport { EditorContentProps, EditorContentState } from './EditorContent.js'\nimport { ReactRenderer } from './ReactRenderer.js'\n\ntype ContentComponent = React.Component<EditorContentProps, EditorContentState> & {\n setRenderer(id: string, renderer: ReactRenderer): void;\n removeRenderer(id: string): void;\n}\n\nexport class Editor extends CoreEditor {\n public contentComponent: ContentComponent | null = null\n}\n","import { EditorOptions } from '@tiptap/core'\nimport {\n DependencyList,\n useEffect,\n useRef,\n useState,\n} from 'react'\n\nimport { Editor } from './Editor.js'\n\nfunction useForceUpdate() {\n const [, setValue] = useState(0)\n\n return () => setValue(value => value + 1)\n}\n\nexport const useEditor = (options: Partial<EditorOptions> = {}, deps: DependencyList = []) => {\n const [editor, setEditor] = useState<Editor | null>(null)\n\n const forceUpdate = useForceUpdate()\n\n const {\n onBeforeCreate,\n onBlur,\n onCreate,\n onDestroy,\n onFocus,\n onSelectionUpdate,\n onTransaction,\n onUpdate,\n } = options\n\n const onBeforeCreateRef = useRef(onBeforeCreate)\n const onBlurRef = useRef(onBlur)\n const onCreateRef = useRef(onCreate)\n const onDestroyRef = useRef(onDestroy)\n const onFocusRef = useRef(onFocus)\n const onSelectionUpdateRef = useRef(onSelectionUpdate)\n const onTransactionRef = useRef(onTransaction)\n const onUpdateRef = useRef(onUpdate)\n\n // This effect will handle updating the editor instance\n // when the event handlers change.\n useEffect(() => {\n if (!editor) {\n return\n }\n\n if (onBeforeCreate) {\n editor.off('beforeCreate', onBeforeCreateRef.current)\n editor.on('beforeCreate', onBeforeCreate)\n onBeforeCreateRef.current = onBeforeCreate\n }\n\n if (onBlur) {\n editor.off('blur', onBlurRef.current)\n editor.on('blur', onBlur)\n onBlurRef.current = onBlur\n }\n\n if (onCreate) {\n editor.off('create', onCreateRef.current)\n editor.on('create', onCreate)\n onCreateRef.current = onCreate\n }\n\n if (onDestroy) {\n editor.off('destroy', onDestroyRef.current)\n editor.on('destroy', onDestroy)\n onDestroyRef.current = onDestroy\n }\n\n if (onFocus) {\n editor.off('focus', onFocusRef.current)\n editor.on('focus', onFocus)\n onFocusRef.current = onFocus\n }\n\n if (onSelectionUpdate) {\n editor.off('selectionUpdate', onSelectionUpdateRef.current)\n editor.on('selectionUpdate', onSelectionUpdate)\n onSelectionUpdateRef.current = onSelectionUpdate\n }\n\n if (onTransaction) {\n editor.off('transaction', onTransactionRef.current)\n editor.on('transaction', onTransaction)\n onTransactionRef.current = onTransaction\n }\n\n if (onUpdate) {\n editor.off('update', onUpdateRef.current)\n editor.on('update', onUpdate)\n onUpdateRef.current = onUpdate\n }\n }, [onBeforeCreate, onBlur, onCreate, onDestroy, onFocus, onSelectionUpdate, onTransaction, onUpdate, editor])\n\n useEffect(() => {\n let isMounted = true\n\n const instance = new Editor(options)\n\n setEditor(instance)\n\n instance.on('transaction', () => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (isMounted) {\n forceUpdate()\n }\n })\n })\n })\n\n return () => {\n isMounted = false\n }\n }, deps)\n\n useEffect(() => {\n return () => {\n editor?.destroy()\n }\n }, [editor])\n\n return editor\n}\n","import { EditorOptions } from '@tiptap/core'\nimport React, { createContext, ReactNode, useContext } from 'react'\n\nimport { Editor } from './Editor.js'\nimport { EditorContent } from './EditorContent.js'\nimport { useEditor } from './useEditor.js'\n\nexport type EditorContextValue = {\n editor: Editor | null;\n}\n\nexport const EditorContext = createContext<EditorContextValue>({\n editor: null,\n})\n\nexport const EditorConsumer = EditorContext.Consumer\n\nexport const useCurrentEditor = () => useContext(EditorContext)\n\nexport type EditorProviderProps = {\n children: ReactNode;\n slotBefore?: ReactNode;\n slotAfter?: ReactNode;\n} & Partial<EditorOptions>\n\nexport const EditorProvider = ({\n children, slotAfter, slotBefore, ...editorOptions\n}: EditorProviderProps) => {\n const editor = useEditor(editorOptions)\n\n if (!editor) {\n return null\n }\n\n return (\n <EditorContext.Provider value={{ editor }}>\n {slotBefore}\n <EditorConsumer>\n {({ editor: currentEditor }) => (\n <EditorContent editor={currentEditor} />\n )}\n </EditorConsumer>\n {children}\n {slotAfter}\n </EditorContext.Provider>\n )\n}\n","import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport React, { useEffect, useState } from 'react'\n\nimport { useCurrentEditor } from './Context.js'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport type BubbleMenuProps = Omit<Optional<BubbleMenuPluginProps, 'pluginKey' | 'editor'>, 'element'> & {\n className?: string;\n children: React.ReactNode;\n updateDelay?: number;\n};\n\nexport const BubbleMenu = (props: BubbleMenuProps) => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n const { editor: currentEditor } = useCurrentEditor()\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor?.isDestroyed || currentEditor?.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'bubbleMenu', editor, tippyOptions = {}, updateDelay, shouldShow = null,\n } = props\n\n const menuEditor = editor || currentEditor\n\n if (!menuEditor) {\n console.warn('BubbleMenu component is not rendered inside of an editor component or does not have editor prop.')\n return\n }\n\n const plugin = BubbleMenuPlugin({\n updateDelay,\n editor: menuEditor,\n element,\n pluginKey,\n shouldShow,\n tippyOptions,\n })\n\n menuEditor.registerPlugin(plugin)\n return () => menuEditor.unregisterPlugin(pluginKey)\n }, [props.editor, currentEditor, element])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport React, {\n useEffect, useState,\n} from 'react'\n\nimport { useCurrentEditor } from './Context.js'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>\n\nexport type FloatingMenuProps = Omit<Optional<FloatingMenuPluginProps, 'pluginKey' | 'editor'>, 'element'> & {\n className?: string,\n children: React.ReactNode\n}\n\nexport const FloatingMenu = (props: FloatingMenuProps) => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n const { editor: currentEditor } = useCurrentEditor()\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor?.isDestroyed || currentEditor?.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'floatingMenu',\n editor,\n tippyOptions = {},\n shouldShow = null,\n } = props\n\n const menuEditor = editor || currentEditor\n\n if (!menuEditor) {\n console.warn('FloatingMenu component is not rendered inside of an editor component or does not have editor prop.')\n return\n }\n\n const plugin = FloatingMenuPlugin({\n pluginKey,\n editor: menuEditor,\n element,\n tippyOptions,\n shouldShow,\n })\n\n menuEditor.registerPlugin(plugin)\n return () => menuEditor.unregisterPlugin(pluginKey)\n }, [\n props.editor,\n currentEditor,\n element,\n ])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { createContext, useContext } from 'react'\n\nexport interface ReactNodeViewContextProps {\n onDragStart: (event: DragEvent) => void,\n nodeViewContentRef: (element: HTMLElement | null) => void,\n}\n\nexport const ReactNodeViewContext = createContext<Partial<ReactNodeViewContextProps>>({\n onDragStart: undefined,\n})\n\nexport const useReactNodeView = () => useContext(ReactNodeViewContext)\n","import React from 'react'\n\nimport { useReactNodeView } from './useReactNodeView.js'\n\nexport interface NodeViewContentProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewContent: React.FC<NodeViewContentProps> = props => {\n const Tag = props.as || 'div'\n const { nodeViewContentRef } = useReactNodeView()\n\n return (\n <Tag\n {...props}\n ref={nodeViewContentRef}\n data-node-view-content=\"\"\n style={{\n whiteSpace: 'pre-wrap',\n ...props.style,\n }}\n />\n )\n}\n","import React from 'react'\n\nimport { useReactNodeView } from './useReactNodeView.js'\n\nexport interface NodeViewWrapperProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewWrapper: React.FC<NodeViewWrapperProps> = React.forwardRef((props, ref) => {\n const { onDragStart } = useReactNodeView()\n const Tag = props.as || 'div'\n\n return (\n <Tag\n {...props}\n ref={ref}\n data-node-view-wrapper=\"\"\n onDragStart={onDragStart}\n style={{\n whiteSpace: 'normal',\n ...props.style,\n }}\n />\n )\n})\n","import { Editor } from '@tiptap/core'\nimport React from 'react'\n\nimport { Editor as ExtendedEditor } from './Editor.js'\n\nfunction isClassComponent(Component: any) {\n return !!(\n typeof Component === 'function'\n && Component.prototype\n && Component.prototype.isReactComponent\n )\n}\n\nfunction isForwardRefComponent(Component: any) {\n return !!(\n typeof Component === 'object'\n && Component.$$typeof?.toString() === 'Symbol(react.forward_ref)'\n )\n}\n\nexport interface ReactRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n as?: string,\n className?: string,\n attrs?: Record<string, string>,\n}\n\ntype ComponentType<R, P> =\n React.ComponentClass<P> |\n React.FunctionComponent<P> |\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<R>>;\n\nexport class ReactRenderer<R = unknown, P = unknown> {\n id: string\n\n editor: ExtendedEditor\n\n component: any\n\n element: Element\n\n props: Record<string, any>\n\n reactElement: React.ReactNode\n\n ref: R | null = null\n\n constructor(component: ComponentType<R, P>, {\n editor,\n props = {},\n as = 'div',\n className = '',\n attrs,\n }: ReactRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.component = component\n this.editor = editor as ExtendedEditor\n this.props = props\n this.element = document.createElement(as)\n this.element.classList.add('react-renderer')\n\n if (className) {\n this.element.classList.add(...className.split(' '))\n }\n\n if (attrs) {\n Object.keys(attrs).forEach(key => {\n this.element.setAttribute(key, attrs[key])\n })\n }\n\n this.render()\n }\n\n render(): void {\n const Component = this.component\n const props = this.props\n\n if (isClassComponent(Component) || isForwardRefComponent(Component)) {\n props.ref = (ref: R) => {\n this.ref = ref\n }\n }\n\n this.reactElement = <Component {...props } />\n\n this.editor?.contentComponent?.setRenderer(this.id, this)\n }\n\n updateProps(props: Record<string, any> = {}): void {\n this.props = {\n ...this.props,\n ...props,\n }\n\n this.render()\n }\n\n destroy(): void {\n this.editor?.contentComponent?.removeRenderer(this.id)\n }\n}\n","import {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport React from 'react'\n\nimport { Editor } from './Editor.js'\nimport { ReactRenderer } from './ReactRenderer.js'\nimport { ReactNodeViewContext, ReactNodeViewContextProps } from './useReactNodeView.js'\n\nexport interface ReactNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode\n oldDecorations: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\n updateProps: () => void\n }) => boolean)\n | null\n as?: string\n className?: string\n attrs?: Record<string, string>\n}\n\nclass ReactNodeView extends NodeView<\n React.FunctionComponent,\n Editor,\n ReactNodeViewRendererOptions\n> {\n renderer!: ReactRenderer\n\n contentDOMElement!: HTMLElement | null\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n if (!(this.component as any).displayName) {\n const capitalizeFirstChar = (string: string): string => {\n return string.charAt(0).toUpperCase() + string.substring(1)\n }\n\n this.component.displayName = capitalizeFirstChar(this.extension.name)\n }\n\n const ReactNodeViewProvider: React.FunctionComponent = componentProps => {\n const Component = this.component\n const onDragStart = this.onDragStart.bind(this)\n const nodeViewContentRef: ReactNodeViewContextProps['nodeViewContentRef'] = element => {\n if (element && this.contentDOMElement && element.firstChild !== this.contentDOMElement) {\n element.appendChild(this.contentDOMElement)\n }\n }\n\n return (\n <>\n {/* @ts-ignore */}\n <ReactNodeViewContext.Provider value={{ onDragStart, nodeViewContentRef }}>\n {/* @ts-ignore */}\n <Component {...componentProps} />\n </ReactNodeViewContext.Provider>\n </>\n )\n }\n\n ReactNodeViewProvider.displayName = 'ReactNodeView'\n\n this.contentDOMElement = this.node.isLeaf\n ? null\n : document.createElement(this.node.isInline ? 'span' : 'div')\n\n if (this.contentDOMElement) {\n // For some reason the whiteSpace prop is not inherited properly in Chrome and Safari\n // With this fix it seems to work fine\n // See: https://github.com/ueberdosis/tiptap/issues/1197\n this.contentDOMElement.style.whiteSpace = 'inherit'\n }\n\n let as = this.node.isInline ? 'span' : 'div'\n\n if (this.options.as) {\n as = this.options.as\n }\n\n const { className = '' } = this.options\n\n this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)\n this.editor.on('selectionUpdate', this.handleSelectionUpdate)\n\n this.renderer = new ReactRenderer(ReactNodeViewProvider, {\n editor: this.editor,\n props,\n as,\n className: `node-${this.node.type.name} ${className}`.trim(),\n attrs: this.options.attrs,\n })\n }\n\n get dom() {\n if (\n this.renderer.element.firstElementChild\n && !this.renderer.element.firstElementChild?.hasAttribute('data-node-view-wrapper')\n ) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n return this.contentDOMElement\n }\n\n handleSelectionUpdate() {\n const { from, to } = this.editor.state.selection\n\n if (from <= this.getPos() && to >= this.getPos() + this.node.nodeSize) {\n this.selectNode()\n } else {\n this.deselectNode()\n }\n }\n\n update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.renderer.updateProps(props)\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n destroy() {\n this.renderer.destroy()\n this.editor.off('selectionUpdate', this.handleSelectionUpdate)\n this.contentDOMElement = null\n }\n}\n\nexport function ReactNodeViewRenderer(\n component: any,\n options?: Partial<ReactNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new ReactNodeView(component, props, options) as unknown as ProseMirrorNodeView\n }\n}\n"],"names":["CoreEditor"],"mappings":";;;;;;;AAMA,MAAM,OAAO,GAA2D,CAAC,EAAE,SAAS,EAAE,KAAI;AACxF,IAAA,QACE,KACG,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAA,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAI;AACjD,QAAA,OAAO,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;KAC3E,CAAC,CACD,EACJ;AACH,CAAC,CAAA;AAUY,MAAA,iBAAkB,SAAQ,KAAK,CAAC,SAAiD,CAAA;AAK5F,IAAA,WAAA,CAAY,KAAyB,EAAA;QACnC,KAAK,CAAC,KAAK,CAAC,CAA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,qBAAqB,CACnC,SAAc,EACd,OAA+C,EAAA;IAE/C,OAAO,CAAC,KAA4B,KAAI;;;;AAItC,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;AAC9C,YAAA,OAAO,EAAE,CAAA;AACV,SAAA;QAED,OAAO,IAAI,aAAa,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAmC,CAAA;AACvF,KAAC,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/EditorContent.tsx","../src/Editor.ts","../src/useEditor.ts","../src/Context.tsx","../src/BubbleMenu.tsx","../src/FloatingMenu.tsx","../src/useReactNodeView.ts","../src/NodeViewContent.tsx","../src/NodeViewWrapper.tsx","../src/ReactRenderer.tsx","../src/ReactNodeViewRenderer.tsx"],"sourcesContent":["import React, { HTMLProps } from 'react'\nimport ReactDOM, { flushSync } from 'react-dom'\n\nimport { Editor } from './Editor.js'\nimport { ReactRenderer } from './ReactRenderer.js'\n\nconst Portals: React.FC<{ renderers: Record<string, ReactRenderer> }> = ({ renderers }) => {\n return (\n <>\n {Object.entries(renderers).map(([key, renderer]) => {\n return ReactDOM.createPortal(renderer.reactElement, renderer.element, key)\n })}\n </>\n )\n}\n\nexport interface EditorContentProps extends HTMLProps<HTMLDivElement> {\n editor: Editor | null;\n}\n\nexport interface EditorContentState {\n renderers: Record<string, ReactRenderer>;\n}\n\nexport class PureEditorContent extends React.Component<EditorContentProps, EditorContentState> {\n editorContentRef: React.RefObject<any>\n\n initialized: boolean\n\n constructor(props: EditorContentProps) {\n super(props)\n this.editorContentRef = React.createRef()\n this.initialized = false\n\n this.state = {\n renderers: {},\n }\n }\n\n componentDidMount() {\n this.init()\n }\n\n componentDidUpdate() {\n this.init()\n }\n\n init() {\n const { editor } = this.props\n\n if (editor && editor.options.element) {\n if (editor.contentComponent) {\n return\n }\n\n const element = this.editorContentRef.current\n\n element.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element,\n })\n\n editor.contentComponent = this\n\n editor.createNodeViews()\n\n this.initialized = true\n }\n }\n\n maybeFlushSync(fn: () => void) {\n // Avoid calling flushSync until the editor is initialized.\n // Initialization happens during the componentDidMount or componentDidUpdate\n // lifecycle methods, and React doesn't allow calling flushSync from inside\n // a lifecycle method.\n if (this.initialized) {\n flushSync(fn)\n } else {\n fn()\n }\n }\n\n setRenderer(id: string, renderer: ReactRenderer) {\n this.maybeFlushSync(() => {\n this.setState(({ renderers }) => ({\n renderers: {\n ...renderers,\n [id]: renderer,\n },\n }))\n })\n }\n\n removeRenderer(id: string) {\n this.maybeFlushSync(() => {\n this.setState(({ renderers }) => {\n const nextRenderers = { ...renderers }\n\n delete nextRenderers[id]\n\n return { renderers: nextRenderers }\n })\n })\n }\n\n componentWillUnmount() {\n const { editor } = this.props\n\n if (!editor) {\n return\n }\n\n this.initialized = false\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n }\n\n render() {\n const { editor, ...rest } = this.props\n\n return (\n <>\n <div ref={this.editorContentRef} {...rest} />\n {/* @ts-ignore */}\n <Portals renderers={this.state.renderers} />\n </>\n )\n }\n}\n\n// EditorContent should be re-created whenever the Editor instance changes\nconst EditorContentWithKey = (props: EditorContentProps) => {\n const key = React.useMemo(() => {\n return Math.floor(Math.random() * 0xFFFFFFFF).toString()\n }, [props.editor])\n\n // Can't use JSX here because it conflicts with the type definition of Vue's JSX, so use createElement\n return React.createElement(PureEditorContent, { key, ...props })\n}\n\nexport const EditorContent = React.memo(EditorContentWithKey)\n","import { Editor as CoreEditor } from '@tiptap/core'\nimport React from 'react'\n\nimport { EditorContentProps, EditorContentState } from './EditorContent.js'\nimport { ReactRenderer } from './ReactRenderer.js'\n\ntype ContentComponent = React.Component<EditorContentProps, EditorContentState> & {\n setRenderer(id: string, renderer: ReactRenderer): void;\n removeRenderer(id: string): void;\n}\n\nexport class Editor extends CoreEditor {\n public contentComponent: ContentComponent | null = null\n}\n","import { EditorOptions } from '@tiptap/core'\nimport {\n DependencyList,\n useEffect,\n useRef,\n useState,\n} from 'react'\n\nimport { Editor } from './Editor.js'\n\nfunction useForceUpdate() {\n const [, setValue] = useState(0)\n\n return () => setValue(value => value + 1)\n}\n\nexport const useEditor = (options: Partial<EditorOptions> = {}, deps: DependencyList = []) => {\n const [editor, setEditor] = useState<Editor | null>(null)\n\n const forceUpdate = useForceUpdate()\n\n const {\n onBeforeCreate,\n onBlur,\n onCreate,\n onDestroy,\n onFocus,\n onSelectionUpdate,\n onTransaction,\n onUpdate,\n } = options\n\n const onBeforeCreateRef = useRef(onBeforeCreate)\n const onBlurRef = useRef(onBlur)\n const onCreateRef = useRef(onCreate)\n const onDestroyRef = useRef(onDestroy)\n const onFocusRef = useRef(onFocus)\n const onSelectionUpdateRef = useRef(onSelectionUpdate)\n const onTransactionRef = useRef(onTransaction)\n const onUpdateRef = useRef(onUpdate)\n\n // This effect will handle updating the editor instance\n // when the event handlers change.\n useEffect(() => {\n if (!editor) {\n return\n }\n\n if (onBeforeCreate) {\n editor.off('beforeCreate', onBeforeCreateRef.current)\n editor.on('beforeCreate', onBeforeCreate)\n onBeforeCreateRef.current = onBeforeCreate\n }\n\n if (onBlur) {\n editor.off('blur', onBlurRef.current)\n editor.on('blur', onBlur)\n onBlurRef.current = onBlur\n }\n\n if (onCreate) {\n editor.off('create', onCreateRef.current)\n editor.on('create', onCreate)\n onCreateRef.current = onCreate\n }\n\n if (onDestroy) {\n editor.off('destroy', onDestroyRef.current)\n editor.on('destroy', onDestroy)\n onDestroyRef.current = onDestroy\n }\n\n if (onFocus) {\n editor.off('focus', onFocusRef.current)\n editor.on('focus', onFocus)\n onFocusRef.current = onFocus\n }\n\n if (onSelectionUpdate) {\n editor.off('selectionUpdate', onSelectionUpdateRef.current)\n editor.on('selectionUpdate', onSelectionUpdate)\n onSelectionUpdateRef.current = onSelectionUpdate\n }\n\n if (onTransaction) {\n editor.off('transaction', onTransactionRef.current)\n editor.on('transaction', onTransaction)\n onTransactionRef.current = onTransaction\n }\n\n if (onUpdate) {\n editor.off('update', onUpdateRef.current)\n editor.on('update', onUpdate)\n onUpdateRef.current = onUpdate\n }\n }, [onBeforeCreate, onBlur, onCreate, onDestroy, onFocus, onSelectionUpdate, onTransaction, onUpdate, editor])\n\n useEffect(() => {\n let isMounted = true\n\n const instance = new Editor(options)\n\n setEditor(instance)\n\n instance.on('transaction', () => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (isMounted) {\n forceUpdate()\n }\n })\n })\n })\n\n return () => {\n isMounted = false\n }\n }, deps)\n\n useEffect(() => {\n return () => {\n editor?.destroy()\n }\n }, [editor])\n\n return editor\n}\n","import { EditorOptions } from '@tiptap/core'\nimport React, { createContext, ReactNode, useContext } from 'react'\n\nimport { Editor } from './Editor.js'\nimport { EditorContent } from './EditorContent.js'\nimport { useEditor } from './useEditor.js'\n\nexport type EditorContextValue = {\n editor: Editor | null;\n}\n\nexport const EditorContext = createContext<EditorContextValue>({\n editor: null,\n})\n\nexport const EditorConsumer = EditorContext.Consumer\n\nexport const useCurrentEditor = () => useContext(EditorContext)\n\nexport type EditorProviderProps = {\n children: ReactNode;\n slotBefore?: ReactNode;\n slotAfter?: ReactNode;\n} & Partial<EditorOptions>\n\nexport const EditorProvider = ({\n children, slotAfter, slotBefore, ...editorOptions\n}: EditorProviderProps) => {\n const editor = useEditor(editorOptions)\n\n if (!editor) {\n return null\n }\n\n return (\n <EditorContext.Provider value={{ editor }}>\n {slotBefore}\n <EditorConsumer>\n {({ editor: currentEditor }) => (\n <EditorContent editor={currentEditor} />\n )}\n </EditorConsumer>\n {children}\n {slotAfter}\n </EditorContext.Provider>\n )\n}\n","import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport React, { useEffect, useState } from 'react'\n\nimport { useCurrentEditor } from './Context.js'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport type BubbleMenuProps = Omit<Optional<BubbleMenuPluginProps, 'pluginKey' | 'editor'>, 'element'> & {\n className?: string;\n children: React.ReactNode;\n updateDelay?: number;\n};\n\nexport const BubbleMenu = (props: BubbleMenuProps) => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n const { editor: currentEditor } = useCurrentEditor()\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor?.isDestroyed || currentEditor?.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'bubbleMenu', editor, tippyOptions = {}, updateDelay, shouldShow = null,\n } = props\n\n const menuEditor = editor || currentEditor\n\n if (!menuEditor) {\n console.warn('BubbleMenu component is not rendered inside of an editor component or does not have editor prop.')\n return\n }\n\n const plugin = BubbleMenuPlugin({\n updateDelay,\n editor: menuEditor,\n element,\n pluginKey,\n shouldShow,\n tippyOptions,\n })\n\n menuEditor.registerPlugin(plugin)\n return () => menuEditor.unregisterPlugin(pluginKey)\n }, [props.editor, currentEditor, element])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport React, {\n useEffect, useState,\n} from 'react'\n\nimport { useCurrentEditor } from './Context.js'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>\n\nexport type FloatingMenuProps = Omit<Optional<FloatingMenuPluginProps, 'pluginKey' | 'editor'>, 'element'> & {\n className?: string,\n children: React.ReactNode\n}\n\nexport const FloatingMenu = (props: FloatingMenuProps) => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n const { editor: currentEditor } = useCurrentEditor()\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor?.isDestroyed || currentEditor?.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'floatingMenu',\n editor,\n tippyOptions = {},\n shouldShow = null,\n } = props\n\n const menuEditor = editor || currentEditor\n\n if (!menuEditor) {\n console.warn('FloatingMenu component is not rendered inside of an editor component or does not have editor prop.')\n return\n }\n\n const plugin = FloatingMenuPlugin({\n pluginKey,\n editor: menuEditor,\n element,\n tippyOptions,\n shouldShow,\n })\n\n menuEditor.registerPlugin(plugin)\n return () => menuEditor.unregisterPlugin(pluginKey)\n }, [\n props.editor,\n currentEditor,\n element,\n ])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { createContext, useContext } from 'react'\n\nexport interface ReactNodeViewContextProps {\n onDragStart: (event: DragEvent) => void,\n nodeViewContentRef: (element: HTMLElement | null) => void,\n}\n\nexport const ReactNodeViewContext = createContext<Partial<ReactNodeViewContextProps>>({\n onDragStart: undefined,\n})\n\nexport const useReactNodeView = () => useContext(ReactNodeViewContext)\n","import React from 'react'\n\nimport { useReactNodeView } from './useReactNodeView.js'\n\nexport interface NodeViewContentProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewContent: React.FC<NodeViewContentProps> = props => {\n const Tag = props.as || 'div'\n const { nodeViewContentRef } = useReactNodeView()\n\n return (\n <Tag\n {...props}\n ref={nodeViewContentRef}\n data-node-view-content=\"\"\n style={{\n whiteSpace: 'pre-wrap',\n ...props.style,\n }}\n />\n )\n}\n","import React from 'react'\n\nimport { useReactNodeView } from './useReactNodeView.js'\n\nexport interface NodeViewWrapperProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewWrapper: React.FC<NodeViewWrapperProps> = React.forwardRef((props, ref) => {\n const { onDragStart } = useReactNodeView()\n const Tag = props.as || 'div'\n\n return (\n <Tag\n {...props}\n ref={ref}\n data-node-view-wrapper=\"\"\n onDragStart={onDragStart}\n style={{\n whiteSpace: 'normal',\n ...props.style,\n }}\n />\n )\n})\n","import { Editor } from '@tiptap/core'\nimport React from 'react'\n\nimport { Editor as ExtendedEditor } from './Editor.js'\n\nfunction isClassComponent(Component: any) {\n return !!(\n typeof Component === 'function'\n && Component.prototype\n && Component.prototype.isReactComponent\n )\n}\n\nfunction isForwardRefComponent(Component: any) {\n return !!(\n typeof Component === 'object'\n && Component.$$typeof?.toString() === 'Symbol(react.forward_ref)'\n )\n}\n\nexport interface ReactRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n as?: string,\n className?: string,\n attrs?: Record<string, string>,\n}\n\ntype ComponentType<R, P> =\n React.ComponentClass<P> |\n React.FunctionComponent<P> |\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<R>>;\n\nexport class ReactRenderer<R = unknown, P = unknown> {\n id: string\n\n editor: ExtendedEditor\n\n component: any\n\n element: Element\n\n props: Record<string, any>\n\n reactElement: React.ReactNode\n\n ref: R | null = null\n\n constructor(component: ComponentType<R, P>, {\n editor,\n props = {},\n as = 'div',\n className = '',\n attrs,\n }: ReactRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.component = component\n this.editor = editor as ExtendedEditor\n this.props = props\n this.element = document.createElement(as)\n this.element.classList.add('react-renderer')\n\n if (className) {\n this.element.classList.add(...className.split(' '))\n }\n\n if (attrs) {\n Object.keys(attrs).forEach(key => {\n this.element.setAttribute(key, attrs[key])\n })\n }\n\n this.render()\n }\n\n render(): void {\n const Component = this.component\n const props = this.props\n\n if (isClassComponent(Component) || isForwardRefComponent(Component)) {\n props.ref = (ref: R) => {\n this.ref = ref\n }\n }\n\n this.reactElement = <Component {...props } />\n\n this.editor?.contentComponent?.setRenderer(this.id, this)\n }\n\n updateProps(props: Record<string, any> = {}): void {\n this.props = {\n ...this.props,\n ...props,\n }\n\n this.render()\n }\n\n destroy(): void {\n this.editor?.contentComponent?.removeRenderer(this.id)\n }\n}\n","import {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport React from 'react'\n\nimport { Editor } from './Editor.js'\nimport { ReactRenderer } from './ReactRenderer.js'\nimport { ReactNodeViewContext, ReactNodeViewContextProps } from './useReactNodeView.js'\n\nexport interface ReactNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode\n oldDecorations: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\n updateProps: () => void\n }) => boolean)\n | null\n as?: string\n className?: string\n attrs?: Record<string, string>\n}\n\nclass ReactNodeView extends NodeView<\n React.FunctionComponent,\n Editor,\n ReactNodeViewRendererOptions\n> {\n renderer!: ReactRenderer\n\n contentDOMElement!: HTMLElement | null\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n if (!(this.component as any).displayName) {\n const capitalizeFirstChar = (string: string): string => {\n return string.charAt(0).toUpperCase() + string.substring(1)\n }\n\n this.component.displayName = capitalizeFirstChar(this.extension.name)\n }\n\n const ReactNodeViewProvider: React.FunctionComponent = componentProps => {\n const Component = this.component\n const onDragStart = this.onDragStart.bind(this)\n const nodeViewContentRef: ReactNodeViewContextProps['nodeViewContentRef'] = element => {\n if (element && this.contentDOMElement && element.firstChild !== this.contentDOMElement) {\n element.appendChild(this.contentDOMElement)\n }\n }\n\n return (\n <>\n {/* @ts-ignore */}\n <ReactNodeViewContext.Provider value={{ onDragStart, nodeViewContentRef }}>\n {/* @ts-ignore */}\n <Component {...componentProps} />\n </ReactNodeViewContext.Provider>\n </>\n )\n }\n\n ReactNodeViewProvider.displayName = 'ReactNodeView'\n\n this.contentDOMElement = this.node.isLeaf\n ? null\n : document.createElement(this.node.isInline ? 'span' : 'div')\n\n if (this.contentDOMElement) {\n // For some reason the whiteSpace prop is not inherited properly in Chrome and Safari\n // With this fix it seems to work fine\n // See: https://github.com/ueberdosis/tiptap/issues/1197\n this.contentDOMElement.style.whiteSpace = 'inherit'\n }\n\n let as = this.node.isInline ? 'span' : 'div'\n\n if (this.options.as) {\n as = this.options.as\n }\n\n const { className = '' } = this.options\n\n this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)\n this.editor.on('selectionUpdate', this.handleSelectionUpdate)\n\n this.renderer = new ReactRenderer(ReactNodeViewProvider, {\n editor: this.editor,\n props,\n as,\n className: `node-${this.node.type.name} ${className}`.trim(),\n attrs: this.options.attrs,\n })\n }\n\n get dom() {\n if (\n this.renderer.element.firstElementChild\n && !this.renderer.element.firstElementChild?.hasAttribute('data-node-view-wrapper')\n ) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n return this.contentDOMElement\n }\n\n handleSelectionUpdate() {\n const { from, to } = this.editor.state.selection\n\n if (from <= this.getPos() && to >= this.getPos() + this.node.nodeSize) {\n this.selectNode()\n } else {\n this.deselectNode()\n }\n }\n\n update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.renderer.updateProps(props)\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n this.renderer.element.classList.remove('ProseMirror-selectednode')\n }\n\n destroy() {\n this.renderer.destroy()\n this.editor.off('selectionUpdate', this.handleSelectionUpdate)\n this.contentDOMElement = null\n }\n}\n\nexport function ReactNodeViewRenderer(\n component: any,\n options?: Partial<ReactNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new ReactNodeView(component, props, options) as unknown as ProseMirrorNodeView\n }\n}\n"],"names":["CoreEditor"],"mappings":";;;;;;;AAMA,MAAM,OAAO,GAA2D,CAAC,EAAE,SAAS,EAAE,KAAI;AACxF,IAAA,QACE,KACG,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAA,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAI;AACjD,QAAA,OAAO,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;KAC3E,CAAC,CACD,EACJ;AACH,CAAC,CAAA;AAUY,MAAA,iBAAkB,SAAQ,KAAK,CAAC,SAAiD,CAAA;AAK5F,IAAA,WAAA,CAAY,KAAyB,EAAA;QACnC,KAAK,CAAC,KAAK,CAAC,CAAA;AACZ,QAAA,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC,SAAS,EAAE,CAAA;AACzC,QAAA,IAAI,CAAC,WAAW,GAAG,KAAK,CAAA;QAExB,IAAI,CAAC,KAAK,GAAG;AACX,YAAA,SAAS,EAAE,EAAE;SACd,CAAA;KACF;IAED,iBAAiB,GAAA;QACf,IAAI,CAAC,IAAI,EAAE,CAAA;KACZ;IAED,kBAAkB,GAAA;QAChB,IAAI,CAAC,I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B,CAAC,gBAAgB,EAAE;AAC9C,YAAA,OAAO,EAAE,CAAA;AACV,SAAA;QAED,OAAO,IAAI,aAAa,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAmC,CAAA;AACvF,KAAC,CAAA;AACH;;;;"}
package/dist/index.umd.js CHANGED
@@ -478,11 +478,13 @@
478
478
  this.renderer.updateProps({
479
479
  selected: true,
480
480
  });
481
+ this.renderer.element.classList.add('ProseMirror-selectednode');
481
482
  }
482
483
  deselectNode() {
483
484
  this.renderer.updateProps({
484
485
  selected: false,
485
486
  });
487
+ this.renderer.element.classList.remove('ProseMirror-selectednode');
486
488
  }
487
489
  destroy() {
488
490
  this.renderer.destroy();
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../src/EditorContent.tsx","../src/Editor.ts","../src/useEditor.ts","../src/Context.tsx","../src/BubbleMenu.tsx","../src/FloatingMenu.tsx","../src/useReactNodeView.ts","../src/NodeViewContent.tsx","../src/NodeViewWrapper.tsx","../src/ReactRenderer.tsx","../src/ReactNodeViewRenderer.tsx"],"sourcesContent":["import React, { HTMLProps } from 'react'\nimport ReactDOM, { flushSync } from 'react-dom'\n\nimport { Editor } from './Editor.js'\nimport { ReactRenderer } from './ReactRenderer.js'\n\nconst Portals: React.FC<{ renderers: Record<string, ReactRenderer> }> = ({ renderers }) => {\n return (\n <>\n {Object.entries(renderers).map(([key, renderer]) => {\n return ReactDOM.createPortal(renderer.reactElement, renderer.element, key)\n })}\n </>\n )\n}\n\nexport interface EditorContentProps extends HTMLProps<HTMLDivElement> {\n editor: Editor | null;\n}\n\nexport interface EditorContentState {\n renderers: Record<string, ReactRenderer>;\n}\n\nexport class PureEditorContent extends React.Component<EditorContentProps, EditorContentState> {\n editorContentRef: React.RefObject<any>\n\n initialized: boolean\n\n constructor(props: EditorContentProps) {\n super(props)\n this.editorContentRef = React.createRef()\n this.initialized = false\n\n this.state = {\n renderers: {},\n }\n }\n\n componentDidMount() {\n this.init()\n }\n\n componentDidUpdate() {\n this.init()\n }\n\n init() {\n const { editor } = this.props\n\n if (editor && editor.options.element) {\n if (editor.contentComponent) {\n return\n }\n\n const element = this.editorContentRef.current\n\n element.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element,\n })\n\n editor.contentComponent = this\n\n editor.createNodeViews()\n\n this.initialized = true\n }\n }\n\n maybeFlushSync(fn: () => void) {\n // Avoid calling flushSync until the editor is initialized.\n // Initialization happens during the componentDidMount or componentDidUpdate\n // lifecycle methods, and React doesn't allow calling flushSync from inside\n // a lifecycle method.\n if (this.initialized) {\n flushSync(fn)\n } else {\n fn()\n }\n }\n\n setRenderer(id: string, renderer: ReactRenderer) {\n this.maybeFlushSync(() => {\n this.setState(({ renderers }) => ({\n renderers: {\n ...renderers,\n [id]: renderer,\n },\n }))\n })\n }\n\n removeRenderer(id: string) {\n this.maybeFlushSync(() => {\n this.setState(({ renderers }) => {\n const nextRenderers = { ...renderers }\n\n delete nextRenderers[id]\n\n return { renderers: nextRenderers }\n })\n })\n }\n\n componentWillUnmount() {\n const { editor } = this.props\n\n if (!editor) {\n return\n }\n\n this.initialized = false\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n }\n\n render() {\n const { editor, ...rest } = this.props\n\n return (\n <>\n <div ref={this.editorContentRef} {...rest} />\n {/* @ts-ignore */}\n <Portals renderers={this.state.renderers} />\n </>\n )\n }\n}\n\n// EditorContent should be re-created whenever the Editor instance changes\nconst EditorContentWithKey = (props: EditorContentProps) => {\n const key = React.useMemo(() => {\n return Math.floor(Math.random() * 0xFFFFFFFF).toString()\n }, [props.editor])\n\n // Can't use JSX here because it conflicts with the type definition of Vue's JSX, so use createElement\n return React.createElement(PureEditorContent, { key, ...props })\n}\n\nexport const EditorContent = React.memo(EditorContentWithKey)\n","import { Editor as CoreEditor } from '@tiptap/core'\nimport React from 'react'\n\nimport { EditorContentProps, EditorContentState } from './EditorContent.js'\nimport { ReactRenderer } from './ReactRenderer.js'\n\ntype ContentComponent = React.Component<EditorContentProps, EditorContentState> & {\n setRenderer(id: string, renderer: ReactRenderer): void;\n removeRenderer(id: string): void;\n}\n\nexport class Editor extends CoreEditor {\n public contentComponent: ContentComponent | null = null\n}\n","import { EditorOptions } from '@tiptap/core'\nimport {\n DependencyList,\n useEffect,\n useRef,\n useState,\n} from 'react'\n\nimport { Editor } from './Editor.js'\n\nfunction useForceUpdate() {\n const [, setValue] = useState(0)\n\n return () => setValue(value => value + 1)\n}\n\nexport const useEditor = (options: Partial<EditorOptions> = {}, deps: DependencyList = []) => {\n const [editor, setEditor] = useState<Editor | null>(null)\n\n const forceUpdate = useForceUpdate()\n\n const {\n onBeforeCreate,\n onBlur,\n onCreate,\n onDestroy,\n onFocus,\n onSelectionUpdate,\n onTransaction,\n onUpdate,\n } = options\n\n const onBeforeCreateRef = useRef(onBeforeCreate)\n const onBlurRef = useRef(onBlur)\n const onCreateRef = useRef(onCreate)\n const onDestroyRef = useRef(onDestroy)\n const onFocusRef = useRef(onFocus)\n const onSelectionUpdateRef = useRef(onSelectionUpdate)\n const onTransactionRef = useRef(onTransaction)\n const onUpdateRef = useRef(onUpdate)\n\n // This effect will handle updating the editor instance\n // when the event handlers change.\n useEffect(() => {\n if (!editor) {\n return\n }\n\n if (onBeforeCreate) {\n editor.off('beforeCreate', onBeforeCreateRef.current)\n editor.on('beforeCreate', onBeforeCreate)\n onBeforeCreateRef.current = onBeforeCreate\n }\n\n if (onBlur) {\n editor.off('blur', onBlurRef.current)\n editor.on('blur', onBlur)\n onBlurRef.current = onBlur\n }\n\n if (onCreate) {\n editor.off('create', onCreateRef.current)\n editor.on('create', onCreate)\n onCreateRef.current = onCreate\n }\n\n if (onDestroy) {\n editor.off('destroy', onDestroyRef.current)\n editor.on('destroy', onDestroy)\n onDestroyRef.current = onDestroy\n }\n\n if (onFocus) {\n editor.off('focus', onFocusRef.current)\n editor.on('focus', onFocus)\n onFocusRef.current = onFocus\n }\n\n if (onSelectionUpdate) {\n editor.off('selectionUpdate', onSelectionUpdateRef.current)\n editor.on('selectionUpdate', onSelectionUpdate)\n onSelectionUpdateRef.current = onSelectionUpdate\n }\n\n if (onTransaction) {\n editor.off('transaction', onTransactionRef.current)\n editor.on('transaction', onTransaction)\n onTransactionRef.current = onTransaction\n }\n\n if (onUpdate) {\n editor.off('update', onUpdateRef.current)\n editor.on('update', onUpdate)\n onUpdateRef.current = onUpdate\n }\n }, [onBeforeCreate, onBlur, onCreate, onDestroy, onFocus, onSelectionUpdate, onTransaction, onUpdate, editor])\n\n useEffect(() => {\n let isMounted = true\n\n const instance = new Editor(options)\n\n setEditor(instance)\n\n instance.on('transaction', () => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (isMounted) {\n forceUpdate()\n }\n })\n })\n })\n\n return () => {\n isMounted = false\n }\n }, deps)\n\n useEffect(() => {\n return () => {\n editor?.destroy()\n }\n }, [editor])\n\n return editor\n}\n","import { EditorOptions } from '@tiptap/core'\nimport React, { createContext, ReactNode, useContext } from 'react'\n\nimport { Editor } from './Editor.js'\nimport { EditorContent } from './EditorContent.js'\nimport { useEditor } from './useEditor.js'\n\nexport type EditorContextValue = {\n editor: Editor | null;\n}\n\nexport const EditorContext = createContext<EditorContextValue>({\n editor: null,\n})\n\nexport const EditorConsumer = EditorContext.Consumer\n\nexport const useCurrentEditor = () => useContext(EditorContext)\n\nexport type EditorProviderProps = {\n children: ReactNode;\n slotBefore?: ReactNode;\n slotAfter?: ReactNode;\n} & Partial<EditorOptions>\n\nexport const EditorProvider = ({\n children, slotAfter, slotBefore, ...editorOptions\n}: EditorProviderProps) => {\n const editor = useEditor(editorOptions)\n\n if (!editor) {\n return null\n }\n\n return (\n <EditorContext.Provider value={{ editor }}>\n {slotBefore}\n <EditorConsumer>\n {({ editor: currentEditor }) => (\n <EditorContent editor={currentEditor} />\n )}\n </EditorConsumer>\n {children}\n {slotAfter}\n </EditorContext.Provider>\n )\n}\n","import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport React, { useEffect, useState } from 'react'\n\nimport { useCurrentEditor } from './Context.js'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport type BubbleMenuProps = Omit<Optional<BubbleMenuPluginProps, 'pluginKey' | 'editor'>, 'element'> & {\n className?: string;\n children: React.ReactNode;\n updateDelay?: number;\n};\n\nexport const BubbleMenu = (props: BubbleMenuProps) => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n const { editor: currentEditor } = useCurrentEditor()\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor?.isDestroyed || currentEditor?.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'bubbleMenu', editor, tippyOptions = {}, updateDelay, shouldShow = null,\n } = props\n\n const menuEditor = editor || currentEditor\n\n if (!menuEditor) {\n console.warn('BubbleMenu component is not rendered inside of an editor component or does not have editor prop.')\n return\n }\n\n const plugin = BubbleMenuPlugin({\n updateDelay,\n editor: menuEditor,\n element,\n pluginKey,\n shouldShow,\n tippyOptions,\n })\n\n menuEditor.registerPlugin(plugin)\n return () => menuEditor.unregisterPlugin(pluginKey)\n }, [props.editor, currentEditor, element])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport React, {\n useEffect, useState,\n} from 'react'\n\nimport { useCurrentEditor } from './Context.js'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>\n\nexport type FloatingMenuProps = Omit<Optional<FloatingMenuPluginProps, 'pluginKey' | 'editor'>, 'element'> & {\n className?: string,\n children: React.ReactNode\n}\n\nexport const FloatingMenu = (props: FloatingMenuProps) => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n const { editor: currentEditor } = useCurrentEditor()\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor?.isDestroyed || currentEditor?.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'floatingMenu',\n editor,\n tippyOptions = {},\n shouldShow = null,\n } = props\n\n const menuEditor = editor || currentEditor\n\n if (!menuEditor) {\n console.warn('FloatingMenu component is not rendered inside of an editor component or does not have editor prop.')\n return\n }\n\n const plugin = FloatingMenuPlugin({\n pluginKey,\n editor: menuEditor,\n element,\n tippyOptions,\n shouldShow,\n })\n\n menuEditor.registerPlugin(plugin)\n return () => menuEditor.unregisterPlugin(pluginKey)\n }, [\n props.editor,\n currentEditor,\n element,\n ])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { createContext, useContext } from 'react'\n\nexport interface ReactNodeViewContextProps {\n onDragStart: (event: DragEvent) => void,\n nodeViewContentRef: (element: HTMLElement | null) => void,\n}\n\nexport const ReactNodeViewContext = createContext<Partial<ReactNodeViewContextProps>>({\n onDragStart: undefined,\n})\n\nexport const useReactNodeView = () => useContext(ReactNodeViewContext)\n","import React from 'react'\n\nimport { useReactNodeView } from './useReactNodeView.js'\n\nexport interface NodeViewContentProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewContent: React.FC<NodeViewContentProps> = props => {\n const Tag = props.as || 'div'\n const { nodeViewContentRef } = useReactNodeView()\n\n return (\n <Tag\n {...props}\n ref={nodeViewContentRef}\n data-node-view-content=\"\"\n style={{\n whiteSpace: 'pre-wrap',\n ...props.style,\n }}\n />\n )\n}\n","import React from 'react'\n\nimport { useReactNodeView } from './useReactNodeView.js'\n\nexport interface NodeViewWrapperProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewWrapper: React.FC<NodeViewWrapperProps> = React.forwardRef((props, ref) => {\n const { onDragStart } = useReactNodeView()\n const Tag = props.as || 'div'\n\n return (\n <Tag\n {...props}\n ref={ref}\n data-node-view-wrapper=\"\"\n onDragStart={onDragStart}\n style={{\n whiteSpace: 'normal',\n ...props.style,\n }}\n />\n )\n})\n","import { Editor } from '@tiptap/core'\nimport React from 'react'\n\nimport { Editor as ExtendedEditor } from './Editor.js'\n\nfunction isClassComponent(Component: any) {\n return !!(\n typeof Component === 'function'\n && Component.prototype\n && Component.prototype.isReactComponent\n )\n}\n\nfunction isForwardRefComponent(Component: any) {\n return !!(\n typeof Component === 'object'\n && Component.$$typeof?.toString() === 'Symbol(react.forward_ref)'\n )\n}\n\nexport interface ReactRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n as?: string,\n className?: string,\n attrs?: Record<string, string>,\n}\n\ntype ComponentType<R, P> =\n React.ComponentClass<P> |\n React.FunctionComponent<P> |\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<R>>;\n\nexport class ReactRenderer<R = unknown, P = unknown> {\n id: string\n\n editor: ExtendedEditor\n\n component: any\n\n element: Element\n\n props: Record<string, any>\n\n reactElement: React.ReactNode\n\n ref: R | null = null\n\n constructor(component: ComponentType<R, P>, {\n editor,\n props = {},\n as = 'div',\n className = '',\n attrs,\n }: ReactRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.component = component\n this.editor = editor as ExtendedEditor\n this.props = props\n this.element = document.createElement(as)\n this.element.classList.add('react-renderer')\n\n if (className) {\n this.element.classList.add(...className.split(' '))\n }\n\n if (attrs) {\n Object.keys(attrs).forEach(key => {\n this.element.setAttribute(key, attrs[key])\n })\n }\n\n this.render()\n }\n\n render(): void {\n const Component = this.component\n const props = this.props\n\n if (isClassComponent(Component) || isForwardRefComponent(Component)) {\n props.ref = (ref: R) => {\n this.ref = ref\n }\n }\n\n this.reactElement = <Component {...props } />\n\n this.editor?.contentComponent?.setRenderer(this.id, this)\n }\n\n updateProps(props: Record<string, any> = {}): void {\n this.props = {\n ...this.props,\n ...props,\n }\n\n this.render()\n }\n\n destroy(): void {\n this.editor?.contentComponent?.removeRenderer(this.id)\n }\n}\n","import {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport React from 'react'\n\nimport { Editor } from './Editor.js'\nimport { ReactRenderer } from './ReactRenderer.js'\nimport { ReactNodeViewContext, ReactNodeViewContextProps } from './useReactNodeView.js'\n\nexport interface ReactNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode\n oldDecorations: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\n updateProps: () => void\n }) => boolean)\n | null\n as?: string\n className?: string\n attrs?: Record<string, string>\n}\n\nclass ReactNodeView extends NodeView<\n React.FunctionComponent,\n Editor,\n ReactNodeViewRendererOptions\n> {\n renderer!: ReactRenderer\n\n contentDOMElement!: HTMLElement | null\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n if (!(this.component as any).displayName) {\n const capitalizeFirstChar = (string: string): string => {\n return string.charAt(0).toUpperCase() + string.substring(1)\n }\n\n this.component.displayName = capitalizeFirstChar(this.extension.name)\n }\n\n const ReactNodeViewProvider: React.FunctionComponent = componentProps => {\n const Component = this.component\n const onDragStart = this.onDragStart.bind(this)\n const nodeViewContentRef: ReactNodeViewContextProps['nodeViewContentRef'] = element => {\n if (element && this.contentDOMElement && element.firstChild !== this.contentDOMElement) {\n element.appendChild(this.contentDOMElement)\n }\n }\n\n return (\n <>\n {/* @ts-ignore */}\n <ReactNodeViewContext.Provider value={{ onDragStart, nodeViewContentRef }}>\n {/* @ts-ignore */}\n <Component {...componentProps} />\n </ReactNodeViewContext.Provider>\n </>\n )\n }\n\n ReactNodeViewProvider.displayName = 'ReactNodeView'\n\n this.contentDOMElement = this.node.isLeaf\n ? null\n : document.createElement(this.node.isInline ? 'span' : 'div')\n\n if (this.contentDOMElement) {\n // For some reason the whiteSpace prop is not inherited properly in Chrome and Safari\n // With this fix it seems to work fine\n // See: https://github.com/ueberdosis/tiptap/issues/1197\n this.contentDOMElement.style.whiteSpace = 'inherit'\n }\n\n let as = this.node.isInline ? 'span' : 'div'\n\n if (this.options.as) {\n as = this.options.as\n }\n\n const { className = '' } = this.options\n\n this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)\n this.editor.on('selectionUpdate', this.handleSelectionUpdate)\n\n this.renderer = new ReactRenderer(ReactNodeViewProvider, {\n editor: this.editor,\n props,\n as,\n className: `node-${this.node.type.name} ${className}`.trim(),\n attrs: this.options.attrs,\n })\n }\n\n get dom() {\n if (\n this.renderer.element.firstElementChild\n && !this.renderer.element.firstElementChild?.hasAttribute('data-node-view-wrapper')\n ) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n return this.contentDOMElement\n }\n\n handleSelectionUpdate() {\n const { from, to } = this.editor.state.selection\n\n if (from <= this.getPos() && to >= this.getPos() + this.node.nodeSize) {\n this.selectNode()\n } else {\n this.deselectNode()\n }\n }\n\n update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.renderer.updateProps(props)\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n }\n\n destroy() {\n this.renderer.destroy()\n this.editor.off('selectionUpdate', this.handleSelectionUpdate)\n this.contentDOMElement = null\n }\n}\n\nexport function ReactNodeViewRenderer(\n component: any,\n options?: Partial<ReactNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new ReactNodeView(component, props, options) as unknown as ProseMirrorNodeView\n }\n}\n"],"names":["React","ReactDOM","flushSync","CoreEditor","useState","useRef","useEffect","createContext","useContext","BubbleMenuPlugin","FloatingMenuPlugin","NodeView"],"mappings":";;;;;;;;;;;EAMA,MAAM,OAAO,GAA2D,CAAC,EAAE,SAAS,EAAE,KAAI;EACxF,IAAA,QACEA,yBACG,CAAA,aAAA,CAAAA,yBAAA,CAAA,QAAA,EAAA,IAAA,EAAA,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAI;EACjD,QAAA,OAAOC,4BAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;OAC3E,CAAC,CACD,EACJ;EACH,CAAC,CAAA;EAUY,MAAA,iBAAkB,SAAQD,yBAAK,CAAC,SAAiD,CAAA;EAK5F,IAAA,WAAA,CAAY,KAAyB,EAAA;UACnC,KAAK,CAAC,KAAK,CAAC,CAAA;EACZ,QAAA,IAAI,CAAC,gBAAgB,GAAGA,yBAAK,CAAC,SAAS,EAAE,CAAA;EACzC,QAAA,IAAI,CAAC,WAAW,GAA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,OAA+C,EAAA;MAE/C,OAAO,CAAC,KAA4B,KAAI;;;;EAItC,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;EAC9C,YAAA,OAAO,EAAE,CAAA;EACV,SAAA;UAED,OAAO,IAAI,aAAa,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAmC,CAAA;EACvF,KAAC,CAAA;EACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.umd.js","sources":["../src/EditorContent.tsx","../src/Editor.ts","../src/useEditor.ts","../src/Context.tsx","../src/BubbleMenu.tsx","../src/FloatingMenu.tsx","../src/useReactNodeView.ts","../src/NodeViewContent.tsx","../src/NodeViewWrapper.tsx","../src/ReactRenderer.tsx","../src/ReactNodeViewRenderer.tsx"],"sourcesContent":["import React, { HTMLProps } from 'react'\nimport ReactDOM, { flushSync } from 'react-dom'\n\nimport { Editor } from './Editor.js'\nimport { ReactRenderer } from './ReactRenderer.js'\n\nconst Portals: React.FC<{ renderers: Record<string, ReactRenderer> }> = ({ renderers }) => {\n return (\n <>\n {Object.entries(renderers).map(([key, renderer]) => {\n return ReactDOM.createPortal(renderer.reactElement, renderer.element, key)\n })}\n </>\n )\n}\n\nexport interface EditorContentProps extends HTMLProps<HTMLDivElement> {\n editor: Editor | null;\n}\n\nexport interface EditorContentState {\n renderers: Record<string, ReactRenderer>;\n}\n\nexport class PureEditorContent extends React.Component<EditorContentProps, EditorContentState> {\n editorContentRef: React.RefObject<any>\n\n initialized: boolean\n\n constructor(props: EditorContentProps) {\n super(props)\n this.editorContentRef = React.createRef()\n this.initialized = false\n\n this.state = {\n renderers: {},\n }\n }\n\n componentDidMount() {\n this.init()\n }\n\n componentDidUpdate() {\n this.init()\n }\n\n init() {\n const { editor } = this.props\n\n if (editor && editor.options.element) {\n if (editor.contentComponent) {\n return\n }\n\n const element = this.editorContentRef.current\n\n element.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element,\n })\n\n editor.contentComponent = this\n\n editor.createNodeViews()\n\n this.initialized = true\n }\n }\n\n maybeFlushSync(fn: () => void) {\n // Avoid calling flushSync until the editor is initialized.\n // Initialization happens during the componentDidMount or componentDidUpdate\n // lifecycle methods, and React doesn't allow calling flushSync from inside\n // a lifecycle method.\n if (this.initialized) {\n flushSync(fn)\n } else {\n fn()\n }\n }\n\n setRenderer(id: string, renderer: ReactRenderer) {\n this.maybeFlushSync(() => {\n this.setState(({ renderers }) => ({\n renderers: {\n ...renderers,\n [id]: renderer,\n },\n }))\n })\n }\n\n removeRenderer(id: string) {\n this.maybeFlushSync(() => {\n this.setState(({ renderers }) => {\n const nextRenderers = { ...renderers }\n\n delete nextRenderers[id]\n\n return { renderers: nextRenderers }\n })\n })\n }\n\n componentWillUnmount() {\n const { editor } = this.props\n\n if (!editor) {\n return\n }\n\n this.initialized = false\n\n if (!editor.isDestroyed) {\n editor.view.setProps({\n nodeViews: {},\n })\n }\n\n editor.contentComponent = null\n\n if (!editor.options.element.firstChild) {\n return\n }\n\n const newElement = document.createElement('div')\n\n newElement.append(...editor.options.element.childNodes)\n\n editor.setOptions({\n element: newElement,\n })\n }\n\n render() {\n const { editor, ...rest } = this.props\n\n return (\n <>\n <div ref={this.editorContentRef} {...rest} />\n {/* @ts-ignore */}\n <Portals renderers={this.state.renderers} />\n </>\n )\n }\n}\n\n// EditorContent should be re-created whenever the Editor instance changes\nconst EditorContentWithKey = (props: EditorContentProps) => {\n const key = React.useMemo(() => {\n return Math.floor(Math.random() * 0xFFFFFFFF).toString()\n }, [props.editor])\n\n // Can't use JSX here because it conflicts with the type definition of Vue's JSX, so use createElement\n return React.createElement(PureEditorContent, { key, ...props })\n}\n\nexport const EditorContent = React.memo(EditorContentWithKey)\n","import { Editor as CoreEditor } from '@tiptap/core'\nimport React from 'react'\n\nimport { EditorContentProps, EditorContentState } from './EditorContent.js'\nimport { ReactRenderer } from './ReactRenderer.js'\n\ntype ContentComponent = React.Component<EditorContentProps, EditorContentState> & {\n setRenderer(id: string, renderer: ReactRenderer): void;\n removeRenderer(id: string): void;\n}\n\nexport class Editor extends CoreEditor {\n public contentComponent: ContentComponent | null = null\n}\n","import { EditorOptions } from '@tiptap/core'\nimport {\n DependencyList,\n useEffect,\n useRef,\n useState,\n} from 'react'\n\nimport { Editor } from './Editor.js'\n\nfunction useForceUpdate() {\n const [, setValue] = useState(0)\n\n return () => setValue(value => value + 1)\n}\n\nexport const useEditor = (options: Partial<EditorOptions> = {}, deps: DependencyList = []) => {\n const [editor, setEditor] = useState<Editor | null>(null)\n\n const forceUpdate = useForceUpdate()\n\n const {\n onBeforeCreate,\n onBlur,\n onCreate,\n onDestroy,\n onFocus,\n onSelectionUpdate,\n onTransaction,\n onUpdate,\n } = options\n\n const onBeforeCreateRef = useRef(onBeforeCreate)\n const onBlurRef = useRef(onBlur)\n const onCreateRef = useRef(onCreate)\n const onDestroyRef = useRef(onDestroy)\n const onFocusRef = useRef(onFocus)\n const onSelectionUpdateRef = useRef(onSelectionUpdate)\n const onTransactionRef = useRef(onTransaction)\n const onUpdateRef = useRef(onUpdate)\n\n // This effect will handle updating the editor instance\n // when the event handlers change.\n useEffect(() => {\n if (!editor) {\n return\n }\n\n if (onBeforeCreate) {\n editor.off('beforeCreate', onBeforeCreateRef.current)\n editor.on('beforeCreate', onBeforeCreate)\n onBeforeCreateRef.current = onBeforeCreate\n }\n\n if (onBlur) {\n editor.off('blur', onBlurRef.current)\n editor.on('blur', onBlur)\n onBlurRef.current = onBlur\n }\n\n if (onCreate) {\n editor.off('create', onCreateRef.current)\n editor.on('create', onCreate)\n onCreateRef.current = onCreate\n }\n\n if (onDestroy) {\n editor.off('destroy', onDestroyRef.current)\n editor.on('destroy', onDestroy)\n onDestroyRef.current = onDestroy\n }\n\n if (onFocus) {\n editor.off('focus', onFocusRef.current)\n editor.on('focus', onFocus)\n onFocusRef.current = onFocus\n }\n\n if (onSelectionUpdate) {\n editor.off('selectionUpdate', onSelectionUpdateRef.current)\n editor.on('selectionUpdate', onSelectionUpdate)\n onSelectionUpdateRef.current = onSelectionUpdate\n }\n\n if (onTransaction) {\n editor.off('transaction', onTransactionRef.current)\n editor.on('transaction', onTransaction)\n onTransactionRef.current = onTransaction\n }\n\n if (onUpdate) {\n editor.off('update', onUpdateRef.current)\n editor.on('update', onUpdate)\n onUpdateRef.current = onUpdate\n }\n }, [onBeforeCreate, onBlur, onCreate, onDestroy, onFocus, onSelectionUpdate, onTransaction, onUpdate, editor])\n\n useEffect(() => {\n let isMounted = true\n\n const instance = new Editor(options)\n\n setEditor(instance)\n\n instance.on('transaction', () => {\n requestAnimationFrame(() => {\n requestAnimationFrame(() => {\n if (isMounted) {\n forceUpdate()\n }\n })\n })\n })\n\n return () => {\n isMounted = false\n }\n }, deps)\n\n useEffect(() => {\n return () => {\n editor?.destroy()\n }\n }, [editor])\n\n return editor\n}\n","import { EditorOptions } from '@tiptap/core'\nimport React, { createContext, ReactNode, useContext } from 'react'\n\nimport { Editor } from './Editor.js'\nimport { EditorContent } from './EditorContent.js'\nimport { useEditor } from './useEditor.js'\n\nexport type EditorContextValue = {\n editor: Editor | null;\n}\n\nexport const EditorContext = createContext<EditorContextValue>({\n editor: null,\n})\n\nexport const EditorConsumer = EditorContext.Consumer\n\nexport const useCurrentEditor = () => useContext(EditorContext)\n\nexport type EditorProviderProps = {\n children: ReactNode;\n slotBefore?: ReactNode;\n slotAfter?: ReactNode;\n} & Partial<EditorOptions>\n\nexport const EditorProvider = ({\n children, slotAfter, slotBefore, ...editorOptions\n}: EditorProviderProps) => {\n const editor = useEditor(editorOptions)\n\n if (!editor) {\n return null\n }\n\n return (\n <EditorContext.Provider value={{ editor }}>\n {slotBefore}\n <EditorConsumer>\n {({ editor: currentEditor }) => (\n <EditorContent editor={currentEditor} />\n )}\n </EditorConsumer>\n {children}\n {slotAfter}\n </EditorContext.Provider>\n )\n}\n","import { BubbleMenuPlugin, BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu'\nimport React, { useEffect, useState } from 'react'\n\nimport { useCurrentEditor } from './Context.js'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;\n\nexport type BubbleMenuProps = Omit<Optional<BubbleMenuPluginProps, 'pluginKey' | 'editor'>, 'element'> & {\n className?: string;\n children: React.ReactNode;\n updateDelay?: number;\n};\n\nexport const BubbleMenu = (props: BubbleMenuProps) => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n const { editor: currentEditor } = useCurrentEditor()\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor?.isDestroyed || currentEditor?.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'bubbleMenu', editor, tippyOptions = {}, updateDelay, shouldShow = null,\n } = props\n\n const menuEditor = editor || currentEditor\n\n if (!menuEditor) {\n console.warn('BubbleMenu component is not rendered inside of an editor component or does not have editor prop.')\n return\n }\n\n const plugin = BubbleMenuPlugin({\n updateDelay,\n editor: menuEditor,\n element,\n pluginKey,\n shouldShow,\n tippyOptions,\n })\n\n menuEditor.registerPlugin(plugin)\n return () => menuEditor.unregisterPlugin(pluginKey)\n }, [props.editor, currentEditor, element])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { FloatingMenuPlugin, FloatingMenuPluginProps } from '@tiptap/extension-floating-menu'\nimport React, {\n useEffect, useState,\n} from 'react'\n\nimport { useCurrentEditor } from './Context.js'\n\ntype Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>\n\nexport type FloatingMenuProps = Omit<Optional<FloatingMenuPluginProps, 'pluginKey' | 'editor'>, 'element'> & {\n className?: string,\n children: React.ReactNode\n}\n\nexport const FloatingMenu = (props: FloatingMenuProps) => {\n const [element, setElement] = useState<HTMLDivElement | null>(null)\n const { editor: currentEditor } = useCurrentEditor()\n\n useEffect(() => {\n if (!element) {\n return\n }\n\n if (props.editor?.isDestroyed || currentEditor?.isDestroyed) {\n return\n }\n\n const {\n pluginKey = 'floatingMenu',\n editor,\n tippyOptions = {},\n shouldShow = null,\n } = props\n\n const menuEditor = editor || currentEditor\n\n if (!menuEditor) {\n console.warn('FloatingMenu component is not rendered inside of an editor component or does not have editor prop.')\n return\n }\n\n const plugin = FloatingMenuPlugin({\n pluginKey,\n editor: menuEditor,\n element,\n tippyOptions,\n shouldShow,\n })\n\n menuEditor.registerPlugin(plugin)\n return () => menuEditor.unregisterPlugin(pluginKey)\n }, [\n props.editor,\n currentEditor,\n element,\n ])\n\n return (\n <div ref={setElement} className={props.className} style={{ visibility: 'hidden' }}>\n {props.children}\n </div>\n )\n}\n","import { createContext, useContext } from 'react'\n\nexport interface ReactNodeViewContextProps {\n onDragStart: (event: DragEvent) => void,\n nodeViewContentRef: (element: HTMLElement | null) => void,\n}\n\nexport const ReactNodeViewContext = createContext<Partial<ReactNodeViewContextProps>>({\n onDragStart: undefined,\n})\n\nexport const useReactNodeView = () => useContext(ReactNodeViewContext)\n","import React from 'react'\n\nimport { useReactNodeView } from './useReactNodeView.js'\n\nexport interface NodeViewContentProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewContent: React.FC<NodeViewContentProps> = props => {\n const Tag = props.as || 'div'\n const { nodeViewContentRef } = useReactNodeView()\n\n return (\n <Tag\n {...props}\n ref={nodeViewContentRef}\n data-node-view-content=\"\"\n style={{\n whiteSpace: 'pre-wrap',\n ...props.style,\n }}\n />\n )\n}\n","import React from 'react'\n\nimport { useReactNodeView } from './useReactNodeView.js'\n\nexport interface NodeViewWrapperProps {\n [key: string]: any,\n as?: React.ElementType,\n}\n\nexport const NodeViewWrapper: React.FC<NodeViewWrapperProps> = React.forwardRef((props, ref) => {\n const { onDragStart } = useReactNodeView()\n const Tag = props.as || 'div'\n\n return (\n <Tag\n {...props}\n ref={ref}\n data-node-view-wrapper=\"\"\n onDragStart={onDragStart}\n style={{\n whiteSpace: 'normal',\n ...props.style,\n }}\n />\n )\n})\n","import { Editor } from '@tiptap/core'\nimport React from 'react'\n\nimport { Editor as ExtendedEditor } from './Editor.js'\n\nfunction isClassComponent(Component: any) {\n return !!(\n typeof Component === 'function'\n && Component.prototype\n && Component.prototype.isReactComponent\n )\n}\n\nfunction isForwardRefComponent(Component: any) {\n return !!(\n typeof Component === 'object'\n && Component.$$typeof?.toString() === 'Symbol(react.forward_ref)'\n )\n}\n\nexport interface ReactRendererOptions {\n editor: Editor,\n props?: Record<string, any>,\n as?: string,\n className?: string,\n attrs?: Record<string, string>,\n}\n\ntype ComponentType<R, P> =\n React.ComponentClass<P> |\n React.FunctionComponent<P> |\n React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<R>>;\n\nexport class ReactRenderer<R = unknown, P = unknown> {\n id: string\n\n editor: ExtendedEditor\n\n component: any\n\n element: Element\n\n props: Record<string, any>\n\n reactElement: React.ReactNode\n\n ref: R | null = null\n\n constructor(component: ComponentType<R, P>, {\n editor,\n props = {},\n as = 'div',\n className = '',\n attrs,\n }: ReactRendererOptions) {\n this.id = Math.floor(Math.random() * 0xFFFFFFFF).toString()\n this.component = component\n this.editor = editor as ExtendedEditor\n this.props = props\n this.element = document.createElement(as)\n this.element.classList.add('react-renderer')\n\n if (className) {\n this.element.classList.add(...className.split(' '))\n }\n\n if (attrs) {\n Object.keys(attrs).forEach(key => {\n this.element.setAttribute(key, attrs[key])\n })\n }\n\n this.render()\n }\n\n render(): void {\n const Component = this.component\n const props = this.props\n\n if (isClassComponent(Component) || isForwardRefComponent(Component)) {\n props.ref = (ref: R) => {\n this.ref = ref\n }\n }\n\n this.reactElement = <Component {...props } />\n\n this.editor?.contentComponent?.setRenderer(this.id, this)\n }\n\n updateProps(props: Record<string, any> = {}): void {\n this.props = {\n ...this.props,\n ...props,\n }\n\n this.render()\n }\n\n destroy(): void {\n this.editor?.contentComponent?.removeRenderer(this.id)\n }\n}\n","import {\n DecorationWithType,\n NodeView,\n NodeViewProps,\n NodeViewRenderer,\n NodeViewRendererOptions,\n NodeViewRendererProps,\n} from '@tiptap/core'\nimport { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Decoration, NodeView as ProseMirrorNodeView } from '@tiptap/pm/view'\nimport React from 'react'\n\nimport { Editor } from './Editor.js'\nimport { ReactRenderer } from './ReactRenderer.js'\nimport { ReactNodeViewContext, ReactNodeViewContextProps } from './useReactNodeView.js'\n\nexport interface ReactNodeViewRendererOptions extends NodeViewRendererOptions {\n update:\n | ((props: {\n oldNode: ProseMirrorNode\n oldDecorations: Decoration[]\n newNode: ProseMirrorNode\n newDecorations: Decoration[]\n updateProps: () => void\n }) => boolean)\n | null\n as?: string\n className?: string\n attrs?: Record<string, string>\n}\n\nclass ReactNodeView extends NodeView<\n React.FunctionComponent,\n Editor,\n ReactNodeViewRendererOptions\n> {\n renderer!: ReactRenderer\n\n contentDOMElement!: HTMLElement | null\n\n mount() {\n const props: NodeViewProps = {\n editor: this.editor,\n node: this.node,\n decorations: this.decorations,\n selected: false,\n extension: this.extension,\n getPos: () => this.getPos(),\n updateAttributes: (attributes = {}) => this.updateAttributes(attributes),\n deleteNode: () => this.deleteNode(),\n }\n\n if (!(this.component as any).displayName) {\n const capitalizeFirstChar = (string: string): string => {\n return string.charAt(0).toUpperCase() + string.substring(1)\n }\n\n this.component.displayName = capitalizeFirstChar(this.extension.name)\n }\n\n const ReactNodeViewProvider: React.FunctionComponent = componentProps => {\n const Component = this.component\n const onDragStart = this.onDragStart.bind(this)\n const nodeViewContentRef: ReactNodeViewContextProps['nodeViewContentRef'] = element => {\n if (element && this.contentDOMElement && element.firstChild !== this.contentDOMElement) {\n element.appendChild(this.contentDOMElement)\n }\n }\n\n return (\n <>\n {/* @ts-ignore */}\n <ReactNodeViewContext.Provider value={{ onDragStart, nodeViewContentRef }}>\n {/* @ts-ignore */}\n <Component {...componentProps} />\n </ReactNodeViewContext.Provider>\n </>\n )\n }\n\n ReactNodeViewProvider.displayName = 'ReactNodeView'\n\n this.contentDOMElement = this.node.isLeaf\n ? null\n : document.createElement(this.node.isInline ? 'span' : 'div')\n\n if (this.contentDOMElement) {\n // For some reason the whiteSpace prop is not inherited properly in Chrome and Safari\n // With this fix it seems to work fine\n // See: https://github.com/ueberdosis/tiptap/issues/1197\n this.contentDOMElement.style.whiteSpace = 'inherit'\n }\n\n let as = this.node.isInline ? 'span' : 'div'\n\n if (this.options.as) {\n as = this.options.as\n }\n\n const { className = '' } = this.options\n\n this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)\n this.editor.on('selectionUpdate', this.handleSelectionUpdate)\n\n this.renderer = new ReactRenderer(ReactNodeViewProvider, {\n editor: this.editor,\n props,\n as,\n className: `node-${this.node.type.name} ${className}`.trim(),\n attrs: this.options.attrs,\n })\n }\n\n get dom() {\n if (\n this.renderer.element.firstElementChild\n && !this.renderer.element.firstElementChild?.hasAttribute('data-node-view-wrapper')\n ) {\n throw Error('Please use the NodeViewWrapper component for your node view.')\n }\n\n return this.renderer.element as HTMLElement\n }\n\n get contentDOM() {\n if (this.node.isLeaf) {\n return null\n }\n\n return this.contentDOMElement\n }\n\n handleSelectionUpdate() {\n const { from, to } = this.editor.state.selection\n\n if (from <= this.getPos() && to >= this.getPos() + this.node.nodeSize) {\n this.selectNode()\n } else {\n this.deselectNode()\n }\n }\n\n update(node: ProseMirrorNode, decorations: DecorationWithType[]) {\n const updateProps = (props?: Record<string, any>) => {\n this.renderer.updateProps(props)\n }\n\n if (node.type !== this.node.type) {\n return false\n }\n\n if (typeof this.options.update === 'function') {\n const oldNode = this.node\n const oldDecorations = this.decorations\n\n this.node = node\n this.decorations = decorations\n\n return this.options.update({\n oldNode,\n oldDecorations,\n newNode: node,\n newDecorations: decorations,\n updateProps: () => updateProps({ node, decorations }),\n })\n }\n\n if (node === this.node && this.decorations === decorations) {\n return true\n }\n\n this.node = node\n this.decorations = decorations\n\n updateProps({ node, decorations })\n\n return true\n }\n\n selectNode() {\n this.renderer.updateProps({\n selected: true,\n })\n this.renderer.element.classList.add('ProseMirror-selectednode')\n }\n\n deselectNode() {\n this.renderer.updateProps({\n selected: false,\n })\n this.renderer.element.classList.remove('ProseMirror-selectednode')\n }\n\n destroy() {\n this.renderer.destroy()\n this.editor.off('selectionUpdate', this.handleSelectionUpdate)\n this.contentDOMElement = null\n }\n}\n\nexport function ReactNodeViewRenderer(\n component: any,\n options?: Partial<ReactNodeViewRendererOptions>,\n): NodeViewRenderer {\n return (props: NodeViewRendererProps) => {\n // try to get the parent component\n // this is important for vue devtools to show the component hierarchy correctly\n // maybe it’s `undefined` because <editor-content> isn’t rendered yet\n if (!(props.editor as Editor).contentComponent) {\n return {}\n }\n\n return new ReactNodeView(component, props, options) as unknown as ProseMirrorNodeView\n }\n}\n"],"names":["React","ReactDOM","flushSync","CoreEditor","useState","useRef","useEffect","createContext","useContext","BubbleMenuPlugin","FloatingMenuPlugin","NodeView"],"mappings":";;;;;;;;;;;EAMA,MAAM,OAAO,GAA2D,CAAC,EAAE,SAAS,EAAE,KAAI;EACxF,IAAA,QACEA,yBACG,CAAA,aAAA,CAAAA,yBAAA,CAAA,QAAA,EAAA,IAAA,EAAA,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,CAAC,KAAI;EACjD,QAAA,OAAOC,4BAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,CAAA;OAC3E,CAAC,CACD,EACJ;EACH,CAAC,CAAA;EAUY,MAAA,iBAAkB,SAAQD,yBAAK,CAAC,SAAiD,CAAA;EAK5F,IAAA,WAAA,CAAY,KAAyB,EAAA;UACnC,KAAK,CAAC,KAAK,CAAC,CAAA;EACZ,QAAA,IAAI,CAAC,gBAAgB,GAAGA,yBAAK,CAAC,SAAS,EAAE,CAAA;EACzC,QAAA,IAAI,CAAC,WAAW,GAAG,KAAK,CAAA;UAExB,IAAI,CAAC,KAAK,GAAG;EACX,YAAA,SAAS,EAAE,EAAE;WACd,CAAA;OACF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,CAAC,iBAAiB,GAAG,IAAI,CAAA;OAC9B;EACF,CAAA;EAEe,SAAA,qBAAqB,CACnC,SAAc,EACd,OAA+C,EAAA;MAE/C,OAAO,CAAC,KAA4B,KAAI;;;;EAItC,QAAA,IAAI,CAAE,KAAK,CAAC,MAAiB,CAAC,gBAAgB,EAAE;EAC9C,YAAA,OAAO,EAAE,CAAA;EACV,SAAA;UAED,OAAO,IAAI,aAAa,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAmC,CAAA;EACvF,KAAC,CAAA;EACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/react",
3
3
  "description": "React components for tiptap",
4
- "version": "2.1.9",
4
+ "version": "2.1.11",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -29,12 +29,12 @@
29
29
  "dist"
30
30
  ],
31
31
  "dependencies": {
32
- "@tiptap/extension-bubble-menu": "^2.1.9",
33
- "@tiptap/extension-floating-menu": "^2.1.9"
32
+ "@tiptap/extension-bubble-menu": "^2.1.11",
33
+ "@tiptap/extension-floating-menu": "^2.1.11"
34
34
  },
35
35
  "devDependencies": {
36
- "@tiptap/core": "^2.1.9",
37
- "@tiptap/pm": "^2.1.9",
36
+ "@tiptap/core": "^2.1.11",
37
+ "@tiptap/pm": "^2.1.11",
38
38
  "@types/react": "^18.2.14",
39
39
  "@types/react-dom": "^18.2.6",
40
40
  "react": "^18.0.0",
@@ -181,12 +181,14 @@ class ReactNodeView extends NodeView<
181
181
  this.renderer.updateProps({
182
182
  selected: true,
183
183
  })
184
+ this.renderer.element.classList.add('ProseMirror-selectednode')
184
185
  }
185
186
 
186
187
  deselectNode() {
187
188
  this.renderer.updateProps({
188
189
  selected: false,
189
190
  })
191
+ this.renderer.element.classList.remove('ProseMirror-selectednode')
190
192
  }
191
193
 
192
194
  destroy() {