zs_library 0.6.21 → 0.7.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.
- package/dist/components/desktop/config.d.ts +1 -1
- package/dist/components/desktop/context/config/hooks.d.ts +2 -0
- package/dist/components/desktop/context-menu/content.d.ts +1 -2
- package/dist/components/desktop/context-menu/sub-menu-item.d.ts +1 -1
- package/dist/components/desktop/items/item-content.d.ts +9 -0
- package/dist/components/desktop/sortable.d.ts +4 -0
- package/dist/components/desktop/types.d.ts +7 -7
- package/dist/components/index.d.ts +1 -1
- package/dist/components/tiptap-editor/simple/components/tiptap-extension/node-background-extension.d.ts +23 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-icons/arrow-left-icon.d.ts +3 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-icons/blockquote-icon.d.ts +3 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-icons/chevron-down-icon.d.ts +3 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-icons/close-icon.d.ts +3 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-icons/code-block-icon.d.ts +3 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-icons/corner-down-left-icon.d.ts +3 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-icons/external-link-icon.d.ts +3 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-icons/trash-icon.d.ts +3 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.d.ts +2 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-node/image-node/image-node-extension.d.ts +21 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-node/image-node/image-node.d.ts +3 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-node/image-upload-node/image-upload-node-extension.d.ts +64 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-node/image-upload-node/image-upload-node.d.ts +68 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-node/image-upload-node/index.d.ts +1 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/ai-button/ai-button.d.ts +9 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/ai-button/index.d.ts +2 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/ai-button/use-ai.d.ts +38 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/blockquote-button/blockquote-button.d.ts +22 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/blockquote-button/index.d.ts +2 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/blockquote-button/use-blockquote.d.ts +80 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/code-block-button/code-block-button.d.ts +22 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/code-block-button/index.d.ts +2 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/code-block-button/use-code-block.d.ts +87 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/color-highlight-button/color-highlight-button.d.ts +45 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/color-highlight-button/index.d.ts +2 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/color-highlight-button/use-color-highlight.d.ts +82 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/color-highlight-popover/color-highlight-popover.d.ts +25 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/color-highlight-popover/index.d.ts +1 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/heading-button/heading-button.d.ts +23 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/heading-button/index.d.ts +2 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/heading-button/use-heading.d.ts +108 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.d.ts +20 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/heading-dropdown-menu/index.d.ts +2 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.d.ts +73 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/image-upload-button/image-upload-button.d.ts +29 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/image-upload-button/index.d.ts +2 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/image-upload-button/use-image-upload.d.ts +84 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/link-popover/index.d.ts +2 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/link-popover/link-popover.d.ts +57 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/link-popover/use-link-popover.d.ts +117 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/list-button/index.d.ts +2 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/list-button/list-button.d.ts +23 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/list-button/use-list.d.ts +97 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/list-dropdown-menu/index.d.ts +1 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/list-dropdown-menu/list-dropdown-menu.d.ts +29 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.d.ts +94 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/mark-button/index.d.ts +2 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/mark-button/mark-button.d.ts +23 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/mark-button/use-mark.d.ts +104 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/text-align-button/index.d.ts +2 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/text-align-button/text-align-button.d.ts +30 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/text-align-button/use-text-align.d.ts +101 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/undo-redo-button/index.d.ts +2 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/undo-redo-button/undo-redo-button.d.ts +23 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui/undo-redo-button/use-undo-redo.d.ts +90 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/badge/badge.d.ts +8 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/badge/index.d.ts +1 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/button/button.d.ts +14 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/button/index.d.ts +1 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/card/card.d.ts +9 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/card/index.d.ts +1 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/dropdown-menu/dropdown-menu.d.ts +16 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/dropdown-menu/index.d.ts +1 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/input/index.d.ts +1 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/input/input.d.ts +3 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/popover/index.d.ts +1 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/popover/popover.d.ts +6 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/separator/index.d.ts +1 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/separator/separator.d.ts +6 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/spacer/index.d.ts +1 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/spacer/spacer.d.ts +6 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/toolbar/index.d.ts +1 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/toolbar/toolbar.d.ts +8 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/tooltip/index.d.ts +1 -0
- package/dist/components/tiptap-editor/simple/components/tiptap-ui-primitive/tooltip/tooltip.d.ts +28 -0
- package/dist/components/tiptap-editor/simple/hooks/use-composed-ref.d.ts +3 -0
- package/dist/components/tiptap-editor/simple/hooks/use-cursor-visibility.d.ts +20 -0
- package/dist/components/tiptap-editor/simple/hooks/use-element-rect.d.ts +35 -0
- package/dist/components/tiptap-editor/simple/hooks/use-is-breakpoint.d.ts +9 -0
- package/dist/components/tiptap-editor/simple/hooks/use-menu-navigation.d.ts +52 -0
- package/dist/components/tiptap-editor/simple/hooks/use-scrolling.d.ts +8 -0
- package/dist/components/tiptap-editor/simple/hooks/use-throttled-callback.d.ts +18 -0
- package/dist/components/tiptap-editor/simple/hooks/use-tiptap-editor.d.ts +17 -0
- package/dist/components/tiptap-editor/simple/hooks/use-unmount.d.ts +7 -0
- package/dist/components/tiptap-editor/simple/hooks/use-window-size.d.ts +35 -0
- package/dist/components/tiptap-editor/simple/i18n/en-US.json.d.ts +107 -0
- package/dist/components/tiptap-editor/simple/i18n/zh-CN.json.d.ts +107 -0
- package/dist/components/tiptap-editor/simple/index.d.ts +28 -0
- package/dist/components/tiptap-editor/simple/lib/ai-service.d.ts +15 -0
- package/dist/components/tiptap-editor/simple/lib/feature-utils.d.ts +124 -0
- package/dist/components/tiptap-editor/simple/lib/image-upload-handler.d.ts +44 -0
- package/dist/components/tiptap-editor/simple/lib/tiptap-utils.d.ts +167 -0
- package/dist/components/tiptap-editor/simple/simple-editor.d.ts +10 -0
- package/dist/components/tiptap-editor/simple/theme-toggle.d.ts +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7688 -4797
- package/package.json +20 -6
- package/dist/components/editor/editor.d.ts +0 -3
- package/dist/components/editor/extensions/drag-handle/clipboard-serializer.d.ts +0 -3
- package/dist/components/editor/extensions/drag-handle/index.d.ts +0 -26
- package/dist/components/editor/generative/ai-completion-command.d.ts +0 -5
- package/dist/components/editor/generative/ai-selector-commands.d.ts +0 -5
- package/dist/components/editor/generative/ai-selector.d.ts +0 -8
- package/dist/components/editor/generative/drag-handle.d.ts +0 -2
- package/dist/components/editor/generative/generative-dropdown-menu.d.ts +0 -4
- package/dist/components/editor/generative/generative-menu-switch.d.ts +0 -11
- package/dist/components/editor/image-upload.d.ts +0 -1
- package/dist/components/editor/index.d.ts +0 -13
- package/dist/components/editor/lib/colors.d.ts +0 -6
- package/dist/components/editor/lib/content.d.ts +0 -4
- package/dist/components/editor/lib/nodes.d.ts +0 -9
- package/dist/components/editor/lib/url-utils.d.ts +0 -2
- package/dist/components/editor/preview.d.ts +0 -7
- package/dist/components/editor/selectors/color-selector.d.ts +0 -6
- package/dist/components/editor/selectors/link-selector.d.ts +0 -6
- package/dist/components/editor/selectors/math-selector.d.ts +0 -1
- package/dist/components/editor/selectors/node-selector.d.ts +0 -6
- package/dist/components/editor/selectors/text-buttons.d.ts +0 -1
- package/dist/components/editor/slash-command.d.ts +0 -8
- package/dist/components/editor/type.d.ts +0 -90
- package/dist/components/editor/ui/button.d.ts +0 -13
- package/dist/components/editor/ui/command.d.ts +0 -81
- package/dist/components/editor/ui/dialog.d.ts +0 -19
- package/dist/components/editor/ui/dropdown-menu.d.ts +0 -17
- package/dist/components/editor/ui/icons/crazy-spinner.d.ts +0 -2
- package/dist/components/editor/ui/icons/font-default.d.ts +0 -3
- package/dist/components/editor/ui/icons/font-mono.d.ts +0 -3
- package/dist/components/editor/ui/icons/font-serif.d.ts +0 -3
- package/dist/components/editor/ui/icons/index.d.ts +0 -3
- package/dist/components/editor/ui/icons/loading-circle.d.ts +0 -3
- package/dist/components/editor/ui/menu.d.ts +0 -1
- package/dist/components/editor/ui/popover.d.ts +0 -6
- package/dist/components/editor/ui/scroll-area.d.ts +0 -5
- package/dist/components/editor/ui/separator.d.ts +0 -4
- package/dist/components/editor/ui/tooltip.d.ts +0 -3
|
@@ -54,7 +54,7 @@ export declare function getDefaultConfig(type: string, customConfigMap?: TypeCon
|
|
|
54
54
|
* @param defaultSizeId 默认尺寸配置ID
|
|
55
55
|
* @returns 尺寸配置对象
|
|
56
56
|
*/
|
|
57
|
-
export declare function getSizeConfig(sizeId: string | undefined, sizeConfigs
|
|
57
|
+
export declare function getSizeConfig(sizeId: string | undefined, sizeConfigs?: SizeConfig[], defaultSizeId?: string | number): SizeConfig;
|
|
58
58
|
/**
|
|
59
59
|
* 获取项目的实际尺寸(col和row)
|
|
60
60
|
* @param type 项目类型
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Theme } from '../../themes';
|
|
2
2
|
export declare const useSortableConfig: () => {
|
|
3
3
|
theme: Theme;
|
|
4
|
+
computeGap: (iconSize: number) => number;
|
|
5
|
+
computeCellSize: (iconSize: number) => number;
|
|
4
6
|
noLetters?: boolean;
|
|
5
7
|
typeConfigMap?: import('../..').TypeConfigMap;
|
|
6
8
|
dataTypeMenuConfigMap?: import('../..').DataTypeMenuConfigMap;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { motion } from 'motion/react';
|
|
2
2
|
import { FC } from 'react';
|
|
3
|
-
export
|
|
4
|
-
}
|
|
3
|
+
export type ContentMenuContextProps = React.ComponentProps<typeof motion.div>;
|
|
5
4
|
declare const ContextMenuContent: FC<ContentMenuContextProps>;
|
|
6
5
|
export default ContextMenuContent;
|
|
@@ -6,4 +6,4 @@ export interface SubMenuItemProps {
|
|
|
6
6
|
color?: string;
|
|
7
7
|
textColor?: string;
|
|
8
8
|
}
|
|
9
|
-
export declare const SubMenuItem: ({ text,
|
|
9
|
+
export declare const SubMenuItem: ({ text, index, children, color, textColor, ...props }: SubMenuItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { motion } from 'motion/react';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
import { SortItem } from '../types';
|
|
4
|
+
interface ItemContentProps<D, C> extends ComponentProps<typeof motion.div> {
|
|
5
|
+
data: SortItem<D, C>;
|
|
6
|
+
iconSize?: number;
|
|
7
|
+
}
|
|
8
|
+
declare const ItemContent: <D, C>({ className, data, children, iconSize, ...rest }: ItemContentProps<D, C>) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default ItemContent;
|
|
@@ -32,19 +32,19 @@ export type DataTypeMenuConfigMap = Record<string, MenuItemConfig[]>;
|
|
|
32
32
|
/** 系统默认配置(不会存储到用户数据中,防止篡改) */
|
|
33
33
|
export interface SortItemDefaultConfig {
|
|
34
34
|
/** 可用的尺寸配置列表 */
|
|
35
|
-
sizeConfigs
|
|
35
|
+
sizeConfigs?: SizeConfig[];
|
|
36
36
|
/** 默认尺寸配置ID */
|
|
37
|
-
defaultSizeId
|
|
37
|
+
defaultSizeId?: string;
|
|
38
38
|
/** 允许设置大小 */
|
|
39
|
-
allowResize
|
|
39
|
+
allowResize?: boolean;
|
|
40
40
|
/** 允许打开右键菜单 */
|
|
41
|
-
allowContextMenu
|
|
41
|
+
allowContextMenu?: boolean;
|
|
42
42
|
/** 允许显示分享按钮 */
|
|
43
|
-
allowShare
|
|
43
|
+
allowShare?: boolean;
|
|
44
44
|
/** 允许显示删除按钮 */
|
|
45
|
-
allowDelete
|
|
45
|
+
allowDelete?: boolean;
|
|
46
46
|
/** 允许显示信息按钮 */
|
|
47
|
-
allowInfo
|
|
47
|
+
allowInfo?: boolean;
|
|
48
48
|
}
|
|
49
49
|
/** 完整的配置接口(用户配置 + 系统默认配置) */
|
|
50
50
|
export interface SortItemBaseConfig extends SortItemUserConfig, SortItemDefaultConfig {
|
|
@@ -29,6 +29,6 @@ export { default as DockMobile, MobileIconContainer as DockMobileItem } from './
|
|
|
29
29
|
export { useMotionValue as useDockDesktopMouseX } from 'motion/react';
|
|
30
30
|
export type { DesktopIconContainerProps as DockDesktopItemProps } from './dock/dock-desktop';
|
|
31
31
|
export type { MobileIconContainerProps as DockMobileItemProps } from './dock/dock-mobile';
|
|
32
|
-
export { default as Editor } from './editor';
|
|
33
32
|
export { default as GeoMap } from './map-view';
|
|
34
33
|
export type { GeoMapProps } from './map-view';
|
|
34
|
+
export { default as SimpleEditor } from './tiptap-editor/simple';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
declare module "@tiptap/core" {
|
|
3
|
+
interface Commands<ReturnType> {
|
|
4
|
+
nodeBackground: {
|
|
5
|
+
setNodeBackgroundColor: (backgroundColor: string) => ReturnType;
|
|
6
|
+
unsetNodeBackgroundColor: () => ReturnType;
|
|
7
|
+
toggleNodeBackgroundColor: (backgroundColor: string) => ReturnType;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export interface NodeBackgroundOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Node types that should support background colors
|
|
14
|
+
* @default ["paragraph", "heading", "blockquote", "taskList", "bulletList", "orderedList", "tableCell", "tableHeader"]
|
|
15
|
+
*/
|
|
16
|
+
types: string[];
|
|
17
|
+
/**
|
|
18
|
+
* Use inline style instead of data attribute
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
useStyle?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare const NodeBackground: Extension<NodeBackgroundOptions, any>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ImageNodeOptions {
|
|
2
|
+
inline: boolean;
|
|
3
|
+
allowBase64: boolean;
|
|
4
|
+
HTMLAttributes: Record<string, any>;
|
|
5
|
+
}
|
|
6
|
+
declare module "@tiptap/core" {
|
|
7
|
+
interface Commands<ReturnType> {
|
|
8
|
+
imageNode: {
|
|
9
|
+
/**
|
|
10
|
+
* Set the image alignment
|
|
11
|
+
*/
|
|
12
|
+
setImageAlign: (align: "left" | "center" | "right") => ReturnType;
|
|
13
|
+
/**
|
|
14
|
+
* Set the image width
|
|
15
|
+
*/
|
|
16
|
+
setImageWidth: (width: string | number) => ReturnType;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export declare const ImageNode: import('@tiptap/core').Node<ImageNodeOptions, any>;
|
|
21
|
+
export default ImageNode;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Node } from '@tiptap/react';
|
|
2
|
+
import { NodeType } from '@tiptap/pm/model';
|
|
3
|
+
export type UploadFunction = (file: File, onProgress?: (event: {
|
|
4
|
+
progress: number;
|
|
5
|
+
}) => void, abortSignal?: AbortSignal) => Promise<string>;
|
|
6
|
+
export interface ImageUploadNodeOptions {
|
|
7
|
+
/**
|
|
8
|
+
* The type of the node.
|
|
9
|
+
* @default 'image'
|
|
10
|
+
*/
|
|
11
|
+
type?: string | NodeType | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Acceptable file types for upload.
|
|
14
|
+
* @default 'image/*'
|
|
15
|
+
*/
|
|
16
|
+
accept?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Maximum number of files that can be uploaded.
|
|
19
|
+
* @default 1
|
|
20
|
+
*/
|
|
21
|
+
limit?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Maximum file size in bytes (0 for unlimited).
|
|
24
|
+
* @default 0
|
|
25
|
+
*/
|
|
26
|
+
maxSize?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Function to handle the upload process.
|
|
29
|
+
*/
|
|
30
|
+
upload?: UploadFunction;
|
|
31
|
+
/**
|
|
32
|
+
* Callback for upload errors.
|
|
33
|
+
*/
|
|
34
|
+
onError?: (error: Error) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Callback for successful uploads.
|
|
37
|
+
*/
|
|
38
|
+
onSuccess?: (url: string) => void;
|
|
39
|
+
/**
|
|
40
|
+
* HTML attributes to add to the image element.
|
|
41
|
+
* @default {}
|
|
42
|
+
* @example { class: 'foo' }
|
|
43
|
+
*/
|
|
44
|
+
HTMLAttributes: Record<string, any>;
|
|
45
|
+
}
|
|
46
|
+
export interface ImageUploadNodeStorage {
|
|
47
|
+
pendingFiles: Map<string, File[]>;
|
|
48
|
+
}
|
|
49
|
+
declare module "@tiptap/core" {
|
|
50
|
+
interface Commands<ReturnType> {
|
|
51
|
+
imageUpload: {
|
|
52
|
+
setImageUploadNode: (options?: ImageUploadNodeOptions) => ReturnType;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
interface Storage {
|
|
56
|
+
imageUpload: ImageUploadNodeStorage;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A Tiptap node extension that creates an image upload component.
|
|
61
|
+
* @see registry/tiptap-node/image-upload-node/image-upload-node
|
|
62
|
+
*/
|
|
63
|
+
export declare const ImageUploadNode: Node<ImageUploadNodeOptions, ImageUploadNodeStorage>;
|
|
64
|
+
export default ImageUploadNode;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { NodeViewProps } from '@tiptap/react';
|
|
2
|
+
export interface FileItem {
|
|
3
|
+
/**
|
|
4
|
+
* Unique identifier for the file item
|
|
5
|
+
*/
|
|
6
|
+
id: string;
|
|
7
|
+
/**
|
|
8
|
+
* The actual File object being uploaded
|
|
9
|
+
*/
|
|
10
|
+
file: File;
|
|
11
|
+
/**
|
|
12
|
+
* Current upload progress as a percentage (0-100)
|
|
13
|
+
*/
|
|
14
|
+
progress: number;
|
|
15
|
+
/**
|
|
16
|
+
* Current status of the file upload process
|
|
17
|
+
* @default "uploading"
|
|
18
|
+
*/
|
|
19
|
+
status: "uploading" | "success" | "error";
|
|
20
|
+
/**
|
|
21
|
+
* URL to the uploaded file, available after successful upload
|
|
22
|
+
* @optional
|
|
23
|
+
*/
|
|
24
|
+
url?: string;
|
|
25
|
+
/**
|
|
26
|
+
* Controller that can be used to abort the upload process
|
|
27
|
+
* @optional
|
|
28
|
+
*/
|
|
29
|
+
abortController?: AbortController;
|
|
30
|
+
}
|
|
31
|
+
export interface UploadOptions {
|
|
32
|
+
/**
|
|
33
|
+
* Maximum allowed file size in bytes
|
|
34
|
+
*/
|
|
35
|
+
maxSize: number;
|
|
36
|
+
/**
|
|
37
|
+
* Maximum number of files that can be uploaded
|
|
38
|
+
*/
|
|
39
|
+
limit: number;
|
|
40
|
+
/**
|
|
41
|
+
* String specifying acceptable file types (MIME types or extensions)
|
|
42
|
+
* @example ".jpg,.png,image/jpeg" or "image/*"
|
|
43
|
+
*/
|
|
44
|
+
accept: string;
|
|
45
|
+
/**
|
|
46
|
+
* Function that handles the actual file upload process
|
|
47
|
+
* @param {File} file - The file to be uploaded
|
|
48
|
+
* @param {Function} onProgress - Callback function to report upload progress
|
|
49
|
+
* @param {AbortSignal} signal - Signal that can be used to abort the upload
|
|
50
|
+
* @returns {Promise<string>} Promise resolving to the URL of the uploaded file
|
|
51
|
+
*/
|
|
52
|
+
upload: (file: File, onProgress: (event: {
|
|
53
|
+
progress: number;
|
|
54
|
+
}) => void, signal: AbortSignal) => Promise<string>;
|
|
55
|
+
/**
|
|
56
|
+
* Callback triggered when a file is uploaded successfully
|
|
57
|
+
* @param {string} url - URL of the successfully uploaded file
|
|
58
|
+
* @optional
|
|
59
|
+
*/
|
|
60
|
+
onSuccess?: (url: string) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Callback triggered when an error occurs during upload
|
|
63
|
+
* @param {Error} error - The error that occurred
|
|
64
|
+
* @optional
|
|
65
|
+
*/
|
|
66
|
+
onError?: (error: Error) => void;
|
|
67
|
+
}
|
|
68
|
+
export declare const ImageUploadNode: React.FC<NodeViewProps>;
|
package/dist/components/tiptap-editor/simple/components/tiptap-node/image-upload-node/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './image-upload-node-extension';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { UseAiConfig } from './use-ai';
|
|
2
|
+
import { ButtonProps } from '../../tiptap-ui-primitive/button';
|
|
3
|
+
import { AiPreset } from '../../../lib/feature-utils';
|
|
4
|
+
export interface AiButtonProps extends Omit<ButtonProps, "type" | "onError">, UseAiConfig {
|
|
5
|
+
showShortcut?: boolean;
|
|
6
|
+
hideWhenUnavailable?: boolean;
|
|
7
|
+
presets?: AiPreset[];
|
|
8
|
+
}
|
|
9
|
+
export declare const AiButton: import('react').ForwardRefExoticComponent<AiButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
import { AiCompletionOptions } from '../../../lib/ai-service';
|
|
3
|
+
export interface UseAiConfig {
|
|
4
|
+
editor: Editor | null;
|
|
5
|
+
defaultPrompt?: string;
|
|
6
|
+
defaultModel?: string;
|
|
7
|
+
systemPrompt?: string;
|
|
8
|
+
apiKey?: string;
|
|
9
|
+
baseUrl?: string;
|
|
10
|
+
model?: string;
|
|
11
|
+
headers?: Record<string, string>;
|
|
12
|
+
params?: Record<string, string>;
|
|
13
|
+
body?: Record<string, unknown>;
|
|
14
|
+
request?: (options: AiCompletionOptions) => Promise<string>;
|
|
15
|
+
onStart?: () => void;
|
|
16
|
+
onSuccess?: (content: string) => void;
|
|
17
|
+
onError?: (error: Error) => void;
|
|
18
|
+
}
|
|
19
|
+
export type AiStatus = "idle" | "generating" | "reviewing";
|
|
20
|
+
export declare function useAi({ editor, defaultPrompt, defaultModel, systemPrompt, apiKey: propApiKey, baseUrl, model: propModel, headers, params, body, request, onStart, onSuccess, onError, }: UseAiConfig): {
|
|
21
|
+
isOpen: boolean;
|
|
22
|
+
setIsOpen: (open: boolean) => void;
|
|
23
|
+
prompt: string;
|
|
24
|
+
setPrompt: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
25
|
+
status: AiStatus;
|
|
26
|
+
apiKey: string;
|
|
27
|
+
setApiKey: import('react').Dispatch<import('react').SetStateAction<string>>;
|
|
28
|
+
error: string | null;
|
|
29
|
+
handleGenerate: (promptOverride?: string) => Promise<void>;
|
|
30
|
+
handleStop: () => void;
|
|
31
|
+
handleDiscard: () => void;
|
|
32
|
+
handleApply: () => void;
|
|
33
|
+
handleRefine: () => void;
|
|
34
|
+
handleTryAgain: () => void;
|
|
35
|
+
selectionText: string;
|
|
36
|
+
hasSelection: boolean;
|
|
37
|
+
lastPrompt: string;
|
|
38
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { UseBlockquoteConfig } from './use-blockquote';
|
|
2
|
+
import { ButtonProps } from '../../tiptap-ui-primitive/button';
|
|
3
|
+
export interface BlockquoteButtonProps extends Omit<ButtonProps, "type">, UseBlockquoteConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Optional text to display alongside the icon.
|
|
6
|
+
*/
|
|
7
|
+
text?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Optional show shortcut keys in the button.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
showShortcut?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function BlockquoteShortcutBadge({ shortcutKeys }: {
|
|
15
|
+
shortcutKeys?: string;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* Button component for toggling blockquote in a Tiptap editor.
|
|
19
|
+
*
|
|
20
|
+
* For custom button implementations, use the `useBlockquote` hook instead.
|
|
21
|
+
*/
|
|
22
|
+
export declare const BlockquoteButton: import('react').ForwardRefExoticComponent<BlockquoteButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
export declare const BLOCKQUOTE_SHORTCUT_KEY = "mod+shift+b";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for the blockquote functionality
|
|
5
|
+
*/
|
|
6
|
+
export interface UseBlockquoteConfig {
|
|
7
|
+
/**
|
|
8
|
+
* The Tiptap editor instance.
|
|
9
|
+
*/
|
|
10
|
+
editor?: Editor | null;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the button should hide when blockquote is not available.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
hideWhenUnavailable?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Callback function called after a successful toggle.
|
|
18
|
+
*/
|
|
19
|
+
onToggled?: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Checks if blockquote can be toggled in the current editor state
|
|
23
|
+
*/
|
|
24
|
+
export declare function canToggleBlockquote(editor: Editor | null, turnInto?: boolean): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Toggles blockquote formatting for a specific node or the current selection
|
|
27
|
+
*/
|
|
28
|
+
export declare function toggleBlockquote(editor: Editor | null): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Determines if the blockquote button should be shown
|
|
31
|
+
*/
|
|
32
|
+
export declare function shouldShowButton(props: {
|
|
33
|
+
editor: Editor | null;
|
|
34
|
+
hideWhenUnavailable: boolean;
|
|
35
|
+
}): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Custom hook that provides blockquote functionality for Tiptap editor
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* // Simple usage - no params needed
|
|
42
|
+
* function MySimpleBlockquoteButton() {
|
|
43
|
+
* const { isVisible, handleToggle, isActive } = useBlockquote()
|
|
44
|
+
*
|
|
45
|
+
* if (!isVisible) return null
|
|
46
|
+
*
|
|
47
|
+
* return <button onClick={handleToggle}>Blockquote</button>
|
|
48
|
+
* }
|
|
49
|
+
*
|
|
50
|
+
* // Advanced usage with configuration
|
|
51
|
+
* function MyAdvancedBlockquoteButton() {
|
|
52
|
+
* const { isVisible, handleToggle, label, isActive } = useBlockquote({
|
|
53
|
+
* editor: myEditor,
|
|
54
|
+
* hideWhenUnavailable: true,
|
|
55
|
+
* onToggled: () => console.log('Blockquote toggled!')
|
|
56
|
+
* })
|
|
57
|
+
*
|
|
58
|
+
* if (!isVisible) return null
|
|
59
|
+
*
|
|
60
|
+
* return (
|
|
61
|
+
* <MyButton
|
|
62
|
+
* onClick={handleToggle}
|
|
63
|
+
* aria-label={label}
|
|
64
|
+
* aria-pressed={isActive}
|
|
65
|
+
* >
|
|
66
|
+
* Toggle Blockquote
|
|
67
|
+
* </MyButton>
|
|
68
|
+
* )
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
export declare function useBlockquote(config?: UseBlockquoteConfig): {
|
|
73
|
+
isVisible: boolean;
|
|
74
|
+
isActive: boolean;
|
|
75
|
+
handleToggle: () => boolean;
|
|
76
|
+
canToggle: boolean;
|
|
77
|
+
label: string;
|
|
78
|
+
shortcutKeys: string;
|
|
79
|
+
Icon: import('react').MemoExoticComponent<({ className, ...props }: Omit<import('react').SVGProps<SVGSVGElement>, "ref">) => import("react/jsx-runtime").JSX.Element>;
|
|
80
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { UseCodeBlockConfig } from './use-code-block';
|
|
2
|
+
import { ButtonProps } from '../../tiptap-ui-primitive/button';
|
|
3
|
+
export interface CodeBlockButtonProps extends Omit<ButtonProps, "type">, UseCodeBlockConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Optional text to display alongside the icon.
|
|
6
|
+
*/
|
|
7
|
+
text?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Optional show shortcut keys in the button.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
showShortcut?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function CodeBlockShortcutBadge({ shortcutKeys }: {
|
|
15
|
+
shortcutKeys?: string;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* Button component for toggling code block in a Tiptap editor.
|
|
19
|
+
*
|
|
20
|
+
* For custom button implementations, use the `useCodeBlock` hook instead.
|
|
21
|
+
*/
|
|
22
|
+
export declare const CodeBlockButton: import('react').ForwardRefExoticComponent<CodeBlockButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/react';
|
|
2
|
+
export declare const CODE_BLOCK_SHORTCUT_KEY = "mod+alt+c";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for the code block functionality
|
|
5
|
+
*/
|
|
6
|
+
export interface UseCodeBlockConfig {
|
|
7
|
+
/**
|
|
8
|
+
* The Tiptap editor instance.
|
|
9
|
+
*/
|
|
10
|
+
editor?: Editor | null;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the button should hide when code block is not available.
|
|
13
|
+
* @default false
|
|
14
|
+
*/
|
|
15
|
+
hideWhenUnavailable?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Callback function called after a successful code block toggle.
|
|
18
|
+
*/
|
|
19
|
+
onToggled?: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Checks if code block can be toggled in the current editor state
|
|
23
|
+
*/
|
|
24
|
+
export declare function canToggle(editor: Editor | null, turnInto?: boolean): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Toggles code block in the editor
|
|
27
|
+
*/
|
|
28
|
+
export declare function toggleCodeBlock(editor: Editor | null): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Determines if the code block button should be shown
|
|
31
|
+
*/
|
|
32
|
+
export declare function shouldShowButton(props: {
|
|
33
|
+
editor: Editor | null;
|
|
34
|
+
hideWhenUnavailable: boolean;
|
|
35
|
+
}): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Custom hook that provides code block functionality for Tiptap editor
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* // Simple usage - no params needed
|
|
42
|
+
* function MySimpleCodeBlockButton() {
|
|
43
|
+
* const { isVisible, isActive, handleToggle } = useCodeBlock()
|
|
44
|
+
*
|
|
45
|
+
* if (!isVisible) return null
|
|
46
|
+
*
|
|
47
|
+
* return (
|
|
48
|
+
* <button
|
|
49
|
+
* onClick={handleToggle}
|
|
50
|
+
* aria-pressed={isActive}
|
|
51
|
+
* >
|
|
52
|
+
* Code Block
|
|
53
|
+
* </button>
|
|
54
|
+
* )
|
|
55
|
+
* }
|
|
56
|
+
*
|
|
57
|
+
* // Advanced usage with configuration
|
|
58
|
+
* function MyAdvancedCodeBlockButton() {
|
|
59
|
+
* const { isVisible, isActive, handleToggle, label } = useCodeBlock({
|
|
60
|
+
* editor: myEditor,
|
|
61
|
+
* hideWhenUnavailable: true,
|
|
62
|
+
* onToggled: (isActive) => console.log('Code block toggled:', isActive)
|
|
63
|
+
* })
|
|
64
|
+
*
|
|
65
|
+
* if (!isVisible) return null
|
|
66
|
+
*
|
|
67
|
+
* return (
|
|
68
|
+
* <MyButton
|
|
69
|
+
* onClick={handleToggle}
|
|
70
|
+
* aria-label={label}
|
|
71
|
+
* aria-pressed={isActive}
|
|
72
|
+
* >
|
|
73
|
+
* Toggle Code Block
|
|
74
|
+
* </MyButton>
|
|
75
|
+
* )
|
|
76
|
+
* }
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
export declare function useCodeBlock(config?: UseCodeBlockConfig): {
|
|
80
|
+
isVisible: boolean;
|
|
81
|
+
isActive: boolean;
|
|
82
|
+
handleToggle: () => boolean;
|
|
83
|
+
canToggle: boolean;
|
|
84
|
+
label: string;
|
|
85
|
+
shortcutKeys: string;
|
|
86
|
+
Icon: import('react').MemoExoticComponent<({ className, ...props }: Omit<import('react').SVGProps<SVGSVGElement>, "ref">) => import("react/jsx-runtime").JSX.Element>;
|
|
87
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { UseColorHighlightConfig } from './use-color-highlight';
|
|
2
|
+
import { ButtonProps } from '../../tiptap-ui-primitive/button';
|
|
3
|
+
export interface ColorHighlightButtonProps extends Omit<ButtonProps, "type">, UseColorHighlightConfig {
|
|
4
|
+
/**
|
|
5
|
+
* Optional text to display alongside the icon.
|
|
6
|
+
*/
|
|
7
|
+
text?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Optional show shortcut keys in the button.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
showShortcut?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function ColorHighlightShortcutBadge({ shortcutKeys, }: {
|
|
15
|
+
shortcutKeys?: string;
|
|
16
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* Button component for applying color highlights in a Tiptap editor.
|
|
19
|
+
*
|
|
20
|
+
* Supports two highlighting modes:
|
|
21
|
+
* - "mark": Uses the highlight mark extension (default)
|
|
22
|
+
* - "node": Uses the node background extension
|
|
23
|
+
*
|
|
24
|
+
* For custom button implementations, use the `useColorHighlight` hook instead.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* // Mark-based highlighting (default)
|
|
29
|
+
* <ColorHighlightButton highlightColor="yellow" />
|
|
30
|
+
*
|
|
31
|
+
* // Node-based background coloring
|
|
32
|
+
* <ColorHighlightButton
|
|
33
|
+
* highlightColor="var(--tt-color-highlight-blue)"
|
|
34
|
+
* mode="node"
|
|
35
|
+
* />
|
|
36
|
+
*
|
|
37
|
+
* // With custom callback
|
|
38
|
+
* <ColorHighlightButton
|
|
39
|
+
* highlightColor="red"
|
|
40
|
+
* mode="mark"
|
|
41
|
+
* onApplied={({ color, mode }) => console.log(`Applied ${color} in ${mode} mode`)}
|
|
42
|
+
* />
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export declare const ColorHighlightButton: import('react').ForwardRefExoticComponent<ColorHighlightButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
|