@tiptap/react 2.0.0-beta.19 → 2.0.0-beta.194

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.
Files changed (34) hide show
  1. package/README.md +2 -2
  2. package/dist/packages/react/src/BubbleMenu.d.ts +6 -3
  3. package/dist/packages/react/src/Editor.d.ts +1 -1
  4. package/dist/packages/react/src/EditorContent.d.ts +2 -2
  5. package/dist/packages/react/src/FloatingMenu.d.ts +6 -3
  6. package/dist/packages/react/src/NodeViewContent.d.ts +1 -1
  7. package/dist/packages/react/src/NodeViewWrapper.d.ts +1 -1
  8. package/dist/packages/react/src/ReactNodeViewRenderer.d.ts +12 -6
  9. package/dist/packages/react/src/ReactRenderer.d.ts +12 -9
  10. package/dist/packages/react/src/index.d.ts +6 -6
  11. package/dist/packages/react/src/useEditor.d.ts +2 -1
  12. package/dist/packages/react/src/useReactNodeView.d.ts +1 -0
  13. package/dist/tiptap-react.cjs.js +225 -154
  14. package/dist/tiptap-react.cjs.js.map +1 -1
  15. package/dist/tiptap-react.esm.js +225 -152
  16. package/dist/tiptap-react.esm.js.map +1 -1
  17. package/dist/tiptap-react.umd.js +227 -156
  18. package/dist/tiptap-react.umd.js.map +1 -1
  19. package/package.json +18 -12
  20. package/src/BubbleMenu.tsx +37 -15
  21. package/src/Editor.ts +2 -1
  22. package/src/EditorContent.tsx +9 -7
  23. package/src/FloatingMenu.tsx +37 -14
  24. package/src/NodeViewContent.tsx +10 -3
  25. package/src/NodeViewWrapper.tsx +11 -8
  26. package/src/ReactNodeViewRenderer.tsx +76 -32
  27. package/src/ReactRenderer.tsx +56 -27
  28. package/src/index.ts +6 -6
  29. package/src/useEditor.ts +16 -4
  30. package/src/useReactNodeView.ts +1 -0
  31. package/CHANGELOG.md +0 -170
  32. package/LICENSE.md +0 -21
  33. package/dist/tiptap-react.bundle.umd.min.js +0 -54
  34. package/dist/tiptap-react.bundle.umd.min.js.map +0 -1
package/README.md CHANGED
@@ -7,8 +7,8 @@
7
7
  ## Introduction
8
8
  tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as *New York Times*, *The Guardian* or *Atlassian*.
9
9
 
10
- ## Offical Documentation
10
+ ## Official Documentation
11
11
  Documentation can be found on the [tiptap website](https://tiptap.dev).
12
12
 
13
13
  ## License
14
- tiptap is open-sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap-next/blob/main/LICENSE.md).
14
+ tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
@@ -1,6 +1,9 @@
1
- import React from 'react';
2
1
  import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
3
- export declare type BubbleMenuProps = Omit<BubbleMenuPluginProps, 'element'> & {
2
+ import React from 'react';
3
+ declare type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
4
+ export declare type BubbleMenuProps = Omit<Optional<BubbleMenuPluginProps, 'pluginKey'>, 'element'> & {
4
5
  className?: string;
6
+ children: React.ReactNode;
5
7
  };
6
- export declare const BubbleMenu: React.FC<BubbleMenuProps>;
8
+ export declare const BubbleMenu: (props: BubbleMenuProps) => JSX.Element;
9
+ export {};
@@ -1,5 +1,5 @@
1
- import React from 'react';
2
1
  import { Editor as CoreEditor } from '@tiptap/core';
2
+ import React from 'react';
3
3
  import { EditorContentProps, EditorContentState } from './EditorContent';
4
4
  export declare class Editor extends CoreEditor {
5
5
  contentComponent: React.Component<EditorContentProps, EditorContentState> | null;
@@ -1,7 +1,7 @@
1
- import React from 'react';
1
+ import React, { HTMLProps } from 'react';
2
2
  import { Editor } from './Editor';
3
3
  import { ReactRenderer } from './ReactRenderer';
4
- export interface EditorContentProps {
4
+ export interface EditorContentProps extends HTMLProps<HTMLDivElement> {
5
5
  editor: Editor | null;
6
6
  }
7
7
  export interface EditorContentState {
@@ -1,6 +1,9 @@
1
- import React from 'react';
2
1
  import { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu';
3
- export declare type FloatingMenuProps = Omit<FloatingMenuPluginProps, 'element'> & {
2
+ import React from 'react';
3
+ declare type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
4
+ export declare type FloatingMenuProps = Omit<Optional<FloatingMenuPluginProps, 'pluginKey'>, 'element'> & {
4
5
  className?: string;
6
+ children: React.ReactNode;
5
7
  };
6
- export declare const FloatingMenu: React.FC<FloatingMenuProps>;
8
+ export declare const FloatingMenu: (props: FloatingMenuProps) => JSX.Element;
9
+ export {};
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  export interface NodeViewContentProps {
3
- className?: string;
3
+ [key: string]: any;
4
4
  as?: React.ElementType;
5
5
  }
6
6
  export declare const NodeViewContent: React.FC<NodeViewContentProps>;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  export interface NodeViewWrapperProps {
3
- className?: string;
3
+ [key: string]: any;
4
4
  as?: React.ElementType;
5
5
  }
6
6
  export declare const NodeViewWrapper: React.FC<NodeViewWrapperProps>;
@@ -1,9 +1,15 @@
1
- import { NodeViewRenderer } from '@tiptap/core';
2
- import { Decoration } from 'prosemirror-view';
1
+ import { NodeViewRenderer, NodeViewRendererOptions } from '@tiptap/core';
3
2
  import { Node as ProseMirrorNode } from 'prosemirror-model';
4
- interface ReactNodeViewRendererOptions {
5
- stopEvent: ((event: Event) => boolean) | null;
6
- update: ((node: ProseMirrorNode, decorations: Decoration[]) => boolean) | null;
3
+ import { Decoration } from 'prosemirror-view';
4
+ export interface ReactNodeViewRendererOptions extends NodeViewRendererOptions {
5
+ update: ((props: {
6
+ oldNode: ProseMirrorNode;
7
+ oldDecorations: Decoration[];
8
+ newNode: ProseMirrorNode;
9
+ newDecorations: Decoration[];
10
+ updateProps: () => void;
11
+ }) => boolean) | null;
12
+ as?: string;
13
+ className?: string;
7
14
  }
8
15
  export declare function ReactNodeViewRenderer(component: any, options?: Partial<ReactNodeViewRendererOptions>): NodeViewRenderer;
9
- export {};
@@ -1,21 +1,24 @@
1
+ import { Editor } from '@tiptap/core';
1
2
  import React from 'react';
2
- import { AnyObject } from '@tiptap/core';
3
- import { Editor } from './Editor';
3
+ import { Editor as ExtendedEditor } from './Editor';
4
4
  export interface ReactRendererOptions {
5
5
  editor: Editor;
6
- props?: AnyObject;
6
+ props?: Record<string, any>;
7
7
  as?: string;
8
+ className?: string;
8
9
  }
9
- export declare class ReactRenderer {
10
+ declare type ComponentType<R, P> = React.ComponentClass<P> | React.FunctionComponent<P> | React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<R>>;
11
+ export declare class ReactRenderer<R = unknown, P = unknown> {
10
12
  id: string;
11
- editor: Editor;
13
+ editor: ExtendedEditor;
12
14
  component: any;
13
15
  element: Element;
14
- props: AnyObject;
16
+ props: Record<string, any>;
15
17
  reactElement: React.ReactNode;
16
- ref: React.Component | null;
17
- constructor(component: React.Component | React.FunctionComponent, { editor, props, as }: ReactRendererOptions);
18
+ ref: R | null;
19
+ constructor(component: ComponentType<R, P>, { editor, props, as, className, }: ReactRendererOptions);
18
20
  render(): void;
19
- updateProps(props?: AnyObject): void;
21
+ updateProps(props?: Record<string, any>): void;
20
22
  destroy(): void;
21
23
  }
24
+ export {};
@@ -1,10 +1,10 @@
1
- export * from '@tiptap/core';
2
1
  export * from './BubbleMenu';
3
2
  export { Editor } from './Editor';
4
- export * from './FloatingMenu';
5
- export * from './useEditor';
6
- export * from './ReactRenderer';
7
- export * from './ReactNodeViewRenderer';
8
3
  export * from './EditorContent';
9
- export * from './NodeViewWrapper';
4
+ export * from './FloatingMenu';
10
5
  export * from './NodeViewContent';
6
+ export * from './NodeViewWrapper';
7
+ export * from './ReactNodeViewRenderer';
8
+ export * from './ReactRenderer';
9
+ export * from './useEditor';
10
+ export * from '@tiptap/core';
@@ -1,3 +1,4 @@
1
1
  import { EditorOptions } from '@tiptap/core';
2
+ import { DependencyList } from 'react';
2
3
  import { Editor } from './Editor';
3
- export declare const useEditor: (options?: Partial<EditorOptions>) => Editor | null;
4
+ export declare const useEditor: (options?: Partial<EditorOptions>, deps?: DependencyList) => Editor | null;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export interface ReactNodeViewContextProps {
3
3
  onDragStart: (event: DragEvent) => void;
4
+ nodeViewContentRef: (element: HTMLElement | null) => void;
4
5
  }
5
6
  export declare const ReactNodeViewContext: import("react").Context<Partial<ReactNodeViewContextProps>>;
6
7
  export declare const useReactNodeView: () => Partial<ReactNodeViewContextProps>;