tiptop-editor 1.1.0 → 1.3.0

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 (30) hide show
  1. package/README.md +131 -2
  2. package/dist/components/editor/TableSelectionMenu.d.ts +4 -0
  3. package/dist/components/editor/TiptopEditor.d.ts +3 -0
  4. package/dist/components/editor/TiptopEditor.stories.d.ts +17 -0
  5. package/dist/components/editor/TiptopEditorContext.d.ts +3 -0
  6. package/dist/components/editor/createDefaultExtensions.d.ts +8 -0
  7. package/dist/components/editor/renderTiptopSlot.d.ts +4 -0
  8. package/dist/components/editor/useDuplicateExtensionWarnings.d.ts +2 -0
  9. package/dist/components/{ColorButton.d.ts → menus/ColorButton.d.ts} +1 -1
  10. package/dist/components/{TextSelectionMenu.d.ts → menus/TextSelectionMenu.d.ts} +1 -1
  11. package/dist/components/{EditorButton.d.ts → ui/EditorButton.d.ts} +1 -1
  12. package/dist/index.d.ts +2 -1
  13. package/dist/tiptop-editor.css +1 -1
  14. package/dist/tiptop-editor.es.js +2907 -2831
  15. package/dist/tiptop-editor.umd.js +18 -18
  16. package/dist/types.d.ts +26 -0
  17. package/package.json +7 -2
  18. package/dist/components/TableSelectionMenu.d.ts +0 -4
  19. package/dist/components/TiptopEditor.d.ts +0 -7
  20. /package/dist/components/{DragHandleColorList.d.ts → editor/DragHandleColorList.d.ts} +0 -0
  21. /package/dist/components/{TiptopDragHandle.d.ts → editor/TiptopDragHandle.d.ts} +0 -0
  22. /package/dist/components/{TransformIntoIcon.d.ts → editor/TransformIntoIcon.d.ts} +0 -0
  23. /package/dist/components/{ColorButtonMenu.d.ts → menus/ColorButtonMenu.d.ts} +0 -0
  24. /package/dist/components/{LinkButtonMenu.d.ts → menus/LinkButtonMenu.d.ts} +0 -0
  25. /package/dist/components/{MoreOptionsButtonMenu.d.ts → menus/MoreOptionsButtonMenu.d.ts} +0 -0
  26. /package/dist/components/{TableButtonMenu.d.ts → menus/TableButtonMenu.d.ts} +0 -0
  27. /package/dist/components/{TransformIntoButtonMenu.d.ts → menus/TransformIntoButtonMenu.d.ts} +0 -0
  28. /package/dist/components/{CloseIcon.d.ts → ui/CloseIcon.d.ts} +0 -0
  29. /package/dist/components/{ColorIcon.d.ts → ui/ColorIcon.d.ts} +0 -0
  30. /package/dist/components/{Icon.d.ts → ui/Icon.d.ts} +0 -0
package/dist/types.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { Extensions } from '@tiptap/core';
1
2
  import { Editor, EditorContentProps, Range, UseEditorOptions } from '@tiptap/react';
2
3
  import { icons } from 'lucide-react';
3
4
  export type ImageUploadResponseResolver = string | string[] | ((response: Record<string, unknown>) => string | null | undefined);
@@ -27,6 +28,12 @@ export type TiptopEditorOptions = Omit<Partial<UseEditorOptions & {
27
28
  * @default true
28
29
  */
29
30
  showDragHandle?: boolean;
31
+ /**
32
+ * Additional Tiptap extensions to append after the built-in editor set.
33
+ * Use this to add feature-specific extensions like AI commands or collaboration.
34
+ * @default undefined
35
+ */
36
+ extraExtensions?: Extensions;
30
37
  }>, 'extensions'>;
31
38
  export interface EditorButtonProps {
32
39
  tooltipText?: React.ReactNode;
@@ -64,6 +71,7 @@ export type TiptopEditorProps = Omit<EditorContentProps, 'editor'> & {
64
71
  * implementation.
65
72
  */
66
73
  editorOptions?: TiptopEditorOptions;
74
+ slots?: TiptopEditorSlots;
67
75
  };
68
76
  export interface ColorButtonProps {
69
77
  editor: Editor;
@@ -79,6 +87,24 @@ export interface TextSelectionMenuProps {
79
87
  prepend?: React.ReactNode;
80
88
  append?: React.ReactNode;
81
89
  }
90
+ export interface TiptopEditorSlotProps {
91
+ editor: Editor;
92
+ }
93
+ export type TiptopEditorSlot = React.ReactNode | ((props: TiptopEditorSlotProps) => React.ReactNode);
94
+ export interface TiptopEditorSlots {
95
+ editorTop?: TiptopEditorSlot;
96
+ editorBottom?: TiptopEditorSlot;
97
+ selectionMenuPrepend?: TiptopEditorSlot;
98
+ selectionMenuAppend?: TiptopEditorSlot;
99
+ tableMenuPrepend?: TiptopEditorSlot;
100
+ tableMenuAppend?: TiptopEditorSlot;
101
+ }
102
+ export interface TiptopEditorHandle {
103
+ getEditor: () => Editor | null;
104
+ on: Editor['on'];
105
+ off: Editor['off'];
106
+ once: Editor['once'];
107
+ }
82
108
  export interface KeyDownRef {
83
109
  onKeyDown: (props: {
84
110
  event: KeyboardEvent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiptop-editor",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Notion-like editor built with Tiptap v3 and HeroUI",
5
5
  "type": "module",
6
6
  "main": "./dist/tiptop-editor.umd.js",
@@ -30,7 +30,9 @@
30
30
  "dev": "vite",
31
31
  "clean": "rm -rf dist",
32
32
  "preview": "vite preview",
33
- "build": "npm run clean && vite build"
33
+ "build": "npm run clean && vite build",
34
+ "storybook": "storybook dev -p 6006",
35
+ "build-storybook": "storybook build"
34
36
  },
35
37
  "keywords": [
36
38
  "tiptap",
@@ -91,6 +93,8 @@
91
93
  },
92
94
  "devDependencies": {
93
95
  "@eslint/js": "^9.30.1",
96
+ "@storybook/addon-docs": "^10.2.13",
97
+ "@storybook/react-vite": "^10.2.13",
94
98
  "@tailwindcss/vite": "^4.1.11",
95
99
  "@types/node": "^24.1.0",
96
100
  "@types/react": "^19.1.8",
@@ -101,6 +105,7 @@
101
105
  "eslint-plugin-react-refresh": "^0.4.20",
102
106
  "globals": "^16.3.0",
103
107
  "rollup-plugin-visualizer": "^6.0.3",
108
+ "storybook": "^10.2.13",
104
109
  "tailwindcss": "^4.1.11",
105
110
  "typescript": "~5.8.3",
106
111
  "typescript-eslint": "^8.35.1",
@@ -1,4 +0,0 @@
1
- import { default as React } from 'react';
2
- import { TextSelectionMenuProps } from '../types';
3
- declare const _default: React.MemoExoticComponent<({ editor }: TextSelectionMenuProps) => import("react/jsx-runtime").JSX.Element>;
4
- export default _default;
@@ -1,7 +0,0 @@
1
- import { useEditorState } from '@tiptap/react';
2
- import { TiptopEditorProps } from '../types';
3
- export interface TiptopEditorHandle {
4
- getEditor: () => ReturnType<typeof useEditorState> | null;
5
- }
6
- declare const TiptopEditor: import('react').ForwardRefExoticComponent<Omit<TiptopEditorProps, "ref"> & import('react').RefAttributes<TiptopEditorHandle>>;
7
- export default TiptopEditor;
File without changes