tiptop-editor 1.0.4 → 1.0.5
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/App.d.ts +2 -0
- package/dist/components/ColorButton.d.ts +11 -0
- package/dist/components/ColorButtonMenu.d.ts +5 -0
- package/dist/components/ColorIcon.d.ts +6 -0
- package/dist/components/DragHandleColorList.d.ts +6 -0
- package/dist/components/EditorButton.d.ts +3 -0
- package/dist/components/Icon.d.ts +8 -0
- package/dist/components/LinkButtonMenu.d.ts +5 -0
- package/dist/components/MoreOptionsButtonMenu.d.ts +5 -0
- package/dist/components/TextSelectionMenu.d.ts +7 -0
- package/dist/components/TiptopDragHandle.d.ts +5 -0
- package/dist/components/TiptopEditor.d.ts +7 -0
- package/dist/components/TransformIntoButtonMenu.d.ts +5 -0
- package/dist/components/TransformIntoIcon.d.ts +2 -0
- package/dist/constants.d.ts +26 -0
- package/dist/extensions/CodeBlock.d.ts +1 -0
- package/dist/extensions/HorizontalRule.d.ts +2 -0
- package/dist/extensions/slashCommand/SlashCommand.d.ts +3 -0
- package/dist/extensions/slashCommand/SlashCommandList.d.ts +11 -0
- package/dist/extensions/slashCommand/SlashCommandSuggestion.d.ts +29 -0
- package/dist/helpers.d.ts +14 -0
- package/dist/hero.d.ts +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/main.d.ts +0 -0
- package/dist/types.d.ts +34 -0
- package/package.json +4 -4
package/dist/App.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
declare const ColorButton: ({ editor, buttonType, hsl, color, bgColor, tooltipText, tooltipDisabled }: {
|
|
3
|
+
editor: Editor;
|
|
4
|
+
buttonType: string;
|
|
5
|
+
hsl: string;
|
|
6
|
+
color: string;
|
|
7
|
+
bgColor: string;
|
|
8
|
+
tooltipText?: string;
|
|
9
|
+
tooltipDisabled?: boolean;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export default ColorButton;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { icons } from 'lucide-react';
|
|
2
|
+
export type IconProps = {
|
|
3
|
+
name: keyof typeof icons;
|
|
4
|
+
className?: string;
|
|
5
|
+
strokeWidth?: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const Icon: import('react').MemoExoticComponent<({ name, className, strokeWidth }: IconProps) => import("react/jsx-runtime").JSX.Element | null>;
|
|
8
|
+
export default Icon;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
declare const TextSelectionMenu: ({ editor, prepend, append }: {
|
|
3
|
+
editor: Editor;
|
|
4
|
+
prepend?: React.ReactNode;
|
|
5
|
+
append?: React.ReactNode;
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
7
|
+
export default TextSelectionMenu;
|
|
@@ -0,0 +1,7 @@
|
|
|
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;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Editor, Range } from '@tiptap/react';
|
|
2
|
+
export declare const colorSections: {
|
|
3
|
+
key: string;
|
|
4
|
+
buttonType: string;
|
|
5
|
+
title: string;
|
|
6
|
+
colors: {
|
|
7
|
+
hsl: string;
|
|
8
|
+
color: string;
|
|
9
|
+
bgColor: string;
|
|
10
|
+
tooltipText: string;
|
|
11
|
+
}[];
|
|
12
|
+
}[];
|
|
13
|
+
export declare const commandGroups: {
|
|
14
|
+
key: string;
|
|
15
|
+
title: string;
|
|
16
|
+
commands: {
|
|
17
|
+
key: string;
|
|
18
|
+
title: string;
|
|
19
|
+
icon: string;
|
|
20
|
+
description: string;
|
|
21
|
+
command: ({ editor, range }: {
|
|
22
|
+
editor: Editor;
|
|
23
|
+
range: Range;
|
|
24
|
+
}) => void;
|
|
25
|
+
}[];
|
|
26
|
+
}[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CodeBlock: import('@tiptap/core').Node<import('@tiptap/extension-code-block-lowlight').CodeBlockLowlightOptions, any>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SlashCommandGroupProps, SlashCommandGroupCommandsProps } from '../../types';
|
|
2
|
+
export interface SlashCommandListRef {
|
|
3
|
+
onKeyDown: (props: {
|
|
4
|
+
event: KeyboardEvent;
|
|
5
|
+
}) => boolean;
|
|
6
|
+
}
|
|
7
|
+
declare const SlashCommandList: import('react').ForwardRefExoticComponent<{
|
|
8
|
+
items: SlashCommandGroupProps[];
|
|
9
|
+
command: (item: SlashCommandGroupCommandsProps) => void;
|
|
10
|
+
} & import('react').RefAttributes<SlashCommandListRef>>;
|
|
11
|
+
export default SlashCommandList;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
import { PluginKey } from '@tiptap/pm/state';
|
|
3
|
+
import { SuggestionKeyDownProps, SuggestionProps } from '@tiptap/suggestion';
|
|
4
|
+
declare const _default: {
|
|
5
|
+
pluginKey: PluginKey<any>;
|
|
6
|
+
items: ({ query }: {
|
|
7
|
+
query: string;
|
|
8
|
+
}) => {
|
|
9
|
+
commands: {
|
|
10
|
+
key: string;
|
|
11
|
+
title: string;
|
|
12
|
+
icon: string;
|
|
13
|
+
description: string;
|
|
14
|
+
command: ({ editor, range }: {
|
|
15
|
+
editor: Editor;
|
|
16
|
+
range: import('@tiptap/core').Range;
|
|
17
|
+
}) => void;
|
|
18
|
+
}[];
|
|
19
|
+
key: string;
|
|
20
|
+
title: string;
|
|
21
|
+
}[];
|
|
22
|
+
render: () => {
|
|
23
|
+
onStart: (props: SuggestionProps) => void;
|
|
24
|
+
onUpdate(props: SuggestionProps): void;
|
|
25
|
+
onKeyDown(props: SuggestionKeyDownProps): boolean | undefined;
|
|
26
|
+
onExit(): void;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { SlashCommandGroupCommandsProps } from './types';
|
|
3
|
+
export declare const isTextSelected: (editor: Editor) => boolean;
|
|
4
|
+
export declare const hasTextNodeInSelection: (editor: Editor) => boolean;
|
|
5
|
+
export declare const isForbiddenNodeSelected: (editor: Editor) => boolean;
|
|
6
|
+
export declare const canShowColorTransform: (editor: Editor) => string | false | undefined;
|
|
7
|
+
export declare const canShowNodeTransform: (editor: Editor) => boolean | undefined;
|
|
8
|
+
export declare const hasAtLeastOneMark: (editor: Editor) => boolean | undefined;
|
|
9
|
+
export declare const nodeHasTextContent: (editor: Editor) => boolean | undefined;
|
|
10
|
+
export declare const duplicateNode: (editor: Editor) => void;
|
|
11
|
+
export declare const copyNodeTextContent: (editor: Editor) => void;
|
|
12
|
+
export declare const deleteNode: (editor: Editor) => void;
|
|
13
|
+
export declare const removeAllFormatting: (editor: Editor) => void;
|
|
14
|
+
export declare const transformNodeToAlternative: (editor: Editor, targetOption: SlashCommandGroupCommandsProps) => void;
|
package/dist/hero.d.ts
ADDED
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export {}
|
|
1
|
+
export { default as TiptopEditor } from './components/TiptopEditor';
|
|
2
|
+
export * from './types';
|
package/dist/main.d.ts
ADDED
|
File without changes
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Editor, EditorContentProps, EditorOptions, Range } from '@tiptap/react';
|
|
2
|
+
import { icons } from 'lucide-react';
|
|
3
|
+
export type EditorButtonProps = {
|
|
4
|
+
tooltipText?: React.ReactNode;
|
|
5
|
+
isIconOnly?: boolean;
|
|
6
|
+
isDisabled?: boolean;
|
|
7
|
+
withActive?: boolean;
|
|
8
|
+
buttonKey: string | object;
|
|
9
|
+
text?: string;
|
|
10
|
+
editor: Editor;
|
|
11
|
+
iconClass?: string;
|
|
12
|
+
icon?: keyof typeof icons;
|
|
13
|
+
variant?: "flat" | "shadow" | "solid" | "bordered" | "light" | "faded" | "ghost";
|
|
14
|
+
color?: "default" | "primary" | "secondary" | "success" | "warning" | "danger";
|
|
15
|
+
onPressed?: () => void;
|
|
16
|
+
};
|
|
17
|
+
export type SlashCommandGroupCommandsProps = {
|
|
18
|
+
key: string;
|
|
19
|
+
title: string;
|
|
20
|
+
icon: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
command: ({ editor, range }: {
|
|
23
|
+
editor: Editor;
|
|
24
|
+
range: Range;
|
|
25
|
+
}) => void;
|
|
26
|
+
};
|
|
27
|
+
export type SlashCommandGroupProps = {
|
|
28
|
+
key: string;
|
|
29
|
+
title: string;
|
|
30
|
+
commands: SlashCommandGroupCommandsProps[];
|
|
31
|
+
};
|
|
32
|
+
export type TiptopEditorProps = Omit<EditorContentProps, 'editor'> & {
|
|
33
|
+
editorOptions?: Partial<EditorOptions>;
|
|
34
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiptop-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Notion-like editor built with Tiptap v3 and HeroUI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/tiptop-editor.umd.js",
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@floating-ui/dom": "^1.7.3",
|
|
43
43
|
"@heroui/react": "^2.8.2",
|
|
44
|
-
"@tailwindcss/vite": "^4.1.11",
|
|
45
44
|
"@tiptap/extension-bubble-menu": "^3.0.9",
|
|
46
45
|
"@tiptap/extension-code-block-lowlight": "^3.0.9",
|
|
47
46
|
"@tiptap/extension-drag-handle": "^3.0.9",
|
|
@@ -60,8 +59,7 @@
|
|
|
60
59
|
"@tiptap/suggestion": "^3.0.9",
|
|
61
60
|
"framer-motion": "^12.23.12",
|
|
62
61
|
"lowlight": "^3.3.0",
|
|
63
|
-
"lucide-react": "^0.536.0"
|
|
64
|
-
"tailwindcss": "^4.1.11"
|
|
62
|
+
"lucide-react": "^0.536.0"
|
|
65
63
|
},
|
|
66
64
|
"devDependencies": {
|
|
67
65
|
"@eslint/js": "^9.30.1",
|
|
@@ -74,6 +72,8 @@
|
|
|
74
72
|
"eslint-plugin-react-refresh": "^0.4.20",
|
|
75
73
|
"globals": "^16.3.0",
|
|
76
74
|
"typescript": "~5.8.3",
|
|
75
|
+
"tailwindcss": "^4.1.11",
|
|
76
|
+
"@tailwindcss/vite": "^4.1.11",
|
|
77
77
|
"typescript-eslint": "^8.35.1",
|
|
78
78
|
"vite": "^7.0.4",
|
|
79
79
|
"vite-plugin-dts": "^4.5.4"
|