@fileverse-dev/ddoc 1.0.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/README.md +30 -0
- package/dist/App.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +26234 -0
- package/dist/index.umd.js +356 -0
- package/dist/main.d.ts +1 -0
- package/dist/packages/ddoc/color-selector.d.ts +14 -0
- package/dist/packages/ddoc/common/button.d.ts +20 -0
- package/dist/packages/ddoc/common/cutsom-tooltip.d.ts +8 -0
- package/dist/packages/ddoc/common/dropdown.d.ts +12 -0
- package/dist/packages/ddoc/common/icon.d.ts +8 -0
- package/dist/packages/ddoc/common/spinner.d.ts +6 -0
- package/dist/packages/ddoc/common/surface.d.ts +7 -0
- package/dist/packages/ddoc/common/toolbar.d.ts +28 -0
- package/dist/packages/ddoc/common/types.d.ts +19 -0
- package/dist/packages/ddoc/ddoc-editor.d.ts +4 -0
- package/dist/packages/ddoc/editor-bubble-menu.d.ts +12 -0
- package/dist/packages/ddoc/editor-toolbar.d.ts +6 -0
- package/dist/packages/ddoc/editor-utils.d.ts +56 -0
- package/dist/packages/ddoc/extensions/action-button/action-button-node-view.d.ts +3 -0
- package/dist/packages/ddoc/extensions/action-button/action-button.d.ts +16 -0
- package/dist/packages/ddoc/extensions/action-button/index.d.ts +1 -0
- package/dist/packages/ddoc/extensions/action-button/modal.d.ts +8 -0
- package/dist/packages/ddoc/extensions/custom-keymap.d.ts +14 -0
- package/dist/packages/ddoc/extensions/d-block/dblock-node-view.d.ts +4 -0
- package/dist/packages/ddoc/extensions/d-block/dblock.d.ts +19 -0
- package/dist/packages/ddoc/extensions/d-block/index.d.ts +1 -0
- package/dist/packages/ddoc/extensions/default-extension.d.ts +5 -0
- package/dist/packages/ddoc/extensions/doc.d.ts +3 -0
- package/dist/packages/ddoc/extensions/document/document.d.ts +2 -0
- package/dist/packages/ddoc/extensions/document/index.d.ts +1 -0
- package/dist/packages/ddoc/extensions/horizontal-rule.d.ts +2 -0
- package/dist/packages/ddoc/extensions/iframe/iframe.d.ts +27 -0
- package/dist/packages/ddoc/extensions/iframe/index.d.ts +1 -0
- package/dist/packages/ddoc/extensions/multi-column/column-selection.d.ts +17 -0
- package/dist/packages/ddoc/extensions/multi-column/column.d.ts +4 -0
- package/dist/packages/ddoc/extensions/multi-column/columns.d.ts +18 -0
- package/dist/packages/ddoc/extensions/multi-column/index.d.ts +11 -0
- package/dist/packages/ddoc/extensions/multi-column/menus/columns-menu.d.ts +4 -0
- package/dist/packages/ddoc/extensions/multi-column/menus/index.d.ts +1 -0
- package/dist/packages/ddoc/extensions/multi-column/utils.d.ts +22 -0
- package/dist/packages/ddoc/extensions/resizable-media/index.d.ts +1 -0
- package/dist/packages/ddoc/extensions/resizable-media/media-paste-drop-plugin/index.d.ts +1 -0
- package/dist/packages/ddoc/extensions/resizable-media/media-paste-drop-plugin/media-paste-drop-plugin.d.ts +12 -0
- package/dist/packages/ddoc/extensions/resizable-media/resizable-media-node-view.d.ts +3 -0
- package/dist/packages/ddoc/extensions/resizable-media/resizable-media.d.ts +27 -0
- package/dist/packages/ddoc/extensions/supercharged-table/extension-table/index.d.ts +5 -0
- package/dist/packages/ddoc/extensions/supercharged-table/extension-table/table-view.d.ts +18 -0
- package/dist/packages/ddoc/extensions/supercharged-table/extension-table/table.d.ts +56 -0
- package/dist/packages/ddoc/extensions/supercharged-table/extension-table/utilities/create-cell.d.ts +3 -0
- package/dist/packages/ddoc/extensions/supercharged-table/extension-table/utilities/create-table.d.ts +3 -0
- package/dist/packages/ddoc/extensions/supercharged-table/extension-table/utilities/delete-table-when-all-cells-selected.d.ts +3 -0
- package/dist/packages/ddoc/extensions/supercharged-table/extension-table/utilities/get-table-node-types.d.ts +5 -0
- package/dist/packages/ddoc/extensions/supercharged-table/extension-table/utilities/is-cell-selection.d.ts +3 -0
- package/dist/packages/ddoc/extensions/supercharged-table/extension-table-cell/index.d.ts +4 -0
- package/dist/packages/ddoc/extensions/supercharged-table/extension-table-cell/table-cell-node-view.d.ts +4 -0
- package/dist/packages/ddoc/extensions/supercharged-table/extension-table-cell/table-cell.d.ts +6 -0
- package/dist/packages/ddoc/extensions/supercharged-table/extension-table-header/index.d.ts +4 -0
- package/dist/packages/ddoc/extensions/supercharged-table/extension-table-header/table-header.d.ts +6 -0
- package/dist/packages/ddoc/extensions/supercharged-table/extension-table-row/index.d.ts +4 -0
- package/dist/packages/ddoc/extensions/supercharged-table/extension-table-row/table-row-node-view.d.ts +17 -0
- package/dist/packages/ddoc/extensions/supercharged-table/extension-table-row/table-row.d.ts +7 -0
- package/dist/packages/ddoc/extensions/supercharged-table/index.d.ts +5 -0
- package/dist/packages/ddoc/extensions/supercharged-table/supercharged-table-kit.d.ts +3 -0
- package/dist/packages/ddoc/extensions/trailing-node/index.d.ts +1 -0
- package/dist/packages/ddoc/extensions/trailing-node/trailing-node.d.ts +12 -0
- package/dist/packages/ddoc/extensions/twitter-embed/embedded-tweet.d.ts +18 -0
- package/dist/packages/ddoc/extensions/twitter-embed/index.d.ts +1 -0
- package/dist/packages/ddoc/extensions/twitter-embed/tweet-component-node-view.d.ts +3 -0
- package/dist/packages/ddoc/hooks/use-content-item-actions.d.ts +10 -0
- package/dist/packages/ddoc/hooks/use-editing-context.d.ts +10 -0
- package/dist/packages/ddoc/hooks/use-visibility.d.ts +21 -0
- package/dist/packages/ddoc/navbar/navbar.d.ts +6 -0
- package/dist/packages/ddoc/node-selector.d.ts +10 -0
- package/dist/packages/ddoc/props.d.ts +27 -0
- package/dist/packages/ddoc/slash-comand.d.ts +5 -0
- package/dist/packages/ddoc/utils/debounce.d.ts +1 -0
- package/dist/packages/ddoc/utils/get-render-container.d.ts +4 -0
- package/dist/packages/ddoc/utils/upload-images.d.ts +8 -0
- package/dist/style.css +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +81 -0
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { Dispatch, FC, SetStateAction } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface BubbleColorMenuItem {
|
|
5
|
+
name: string;
|
|
6
|
+
color: string;
|
|
7
|
+
}
|
|
8
|
+
interface ColorSelectorProps {
|
|
9
|
+
editor: Editor;
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
setIsOpen: Dispatch<SetStateAction<boolean>>;
|
|
12
|
+
}
|
|
13
|
+
export declare const ColorSelector: FC<ColorSelectorProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary' | 'quaternary' | 'ghost';
|
|
4
|
+
export type ButtonSize = 'medium' | 'small' | 'icon' | 'iconSmall';
|
|
5
|
+
export type ButtonProps = {
|
|
6
|
+
variant?: ButtonVariant;
|
|
7
|
+
active?: boolean;
|
|
8
|
+
activeClassname?: string;
|
|
9
|
+
buttonSize?: ButtonSize;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
} & React.ButtonHTMLAttributes<HTMLButtonElement>;
|
|
13
|
+
export declare const Button: React.ForwardRefExoticComponent<{
|
|
14
|
+
variant?: ButtonVariant | undefined;
|
|
15
|
+
active?: boolean | undefined;
|
|
16
|
+
activeClassname?: string | undefined;
|
|
17
|
+
buttonSize?: ButtonSize | undefined;
|
|
18
|
+
disabled?: boolean | undefined;
|
|
19
|
+
className?: string | undefined;
|
|
20
|
+
} & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
|
|
3
|
+
export declare const DropdownCategoryTitle: ({ children, }: {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const DropdownButton: ({ children, isActive, onClick, disabled, className, }: {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
isActive?: boolean;
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
className?: string;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { icons } from 'lucide-react';
|
|
2
|
+
|
|
3
|
+
export type IconProps = {
|
|
4
|
+
name: keyof typeof icons;
|
|
5
|
+
className?: string;
|
|
6
|
+
strokeWidth?: number;
|
|
7
|
+
};
|
|
8
|
+
export declare const Icon: import('react').MemoExoticComponent<({ name, className, strokeWidth }: IconProps) => import("react/jsx-runtime").JSX.Element | null>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { HTMLProps } from 'react';
|
|
2
|
+
|
|
3
|
+
export type SurfaceProps = HTMLProps<HTMLDivElement> & {
|
|
4
|
+
withShadow?: boolean;
|
|
5
|
+
withBorder?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const Surface: import('react').ForwardRefExoticComponent<Omit<SurfaceProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes, HTMLProps } from 'react';
|
|
2
|
+
import { ButtonProps } from './button';
|
|
3
|
+
|
|
4
|
+
export type ToolbarWrapperProps = {
|
|
5
|
+
shouldShowContent?: boolean;
|
|
6
|
+
isVertical?: boolean;
|
|
7
|
+
} & HTMLProps<HTMLDivElement>;
|
|
8
|
+
export type ToolbarDividerProps = {
|
|
9
|
+
horizontal?: boolean;
|
|
10
|
+
} & HTMLProps<HTMLDivElement>;
|
|
11
|
+
export type ToolbarButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
12
|
+
active?: boolean;
|
|
13
|
+
activeClassname?: string;
|
|
14
|
+
tooltip?: string;
|
|
15
|
+
buttonSize?: ButtonProps['buttonSize'];
|
|
16
|
+
variant?: ButtonProps['variant'];
|
|
17
|
+
};
|
|
18
|
+
export declare const Toolbar: {
|
|
19
|
+
Wrapper: import('react').ForwardRefExoticComponent<Omit<ToolbarWrapperProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
20
|
+
Divider: import('react').ForwardRefExoticComponent<Omit<ToolbarDividerProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
|
|
21
|
+
Button: import('react').ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
22
|
+
active?: boolean | undefined;
|
|
23
|
+
activeClassname?: string | undefined;
|
|
24
|
+
tooltip?: string | undefined;
|
|
25
|
+
buttonSize?: ButtonProps['buttonSize'];
|
|
26
|
+
variant?: ButtonProps['variant'];
|
|
27
|
+
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
28
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Editor as CoreEditor } from '@tiptap/core';
|
|
3
|
+
import { Editor } from '@tiptap/react';
|
|
4
|
+
import { EditorState } from '@tiptap/pm/state';
|
|
5
|
+
import { EditorView } from '@tiptap/pm/view';
|
|
6
|
+
|
|
7
|
+
export interface MenuProps {
|
|
8
|
+
editor: Editor;
|
|
9
|
+
appendTo?: React.RefObject<any>;
|
|
10
|
+
shouldHide?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface ShouldShowProps {
|
|
13
|
+
editor?: CoreEditor;
|
|
14
|
+
view: EditorView;
|
|
15
|
+
state?: EditorState;
|
|
16
|
+
oldState?: EditorState;
|
|
17
|
+
from?: number;
|
|
18
|
+
to?: number;
|
|
19
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BubbleMenuProps } from '@tiptap/react';
|
|
2
|
+
import { FC } from 'react';
|
|
3
|
+
|
|
4
|
+
export interface BubbleMenuItem {
|
|
5
|
+
name: string;
|
|
6
|
+
isActive: () => boolean;
|
|
7
|
+
command: () => void;
|
|
8
|
+
icon: any;
|
|
9
|
+
}
|
|
10
|
+
type EditorBubbleMenuProps = Omit<BubbleMenuProps, 'children'>;
|
|
11
|
+
export declare const EditorBubbleMenu: FC<EditorBubbleMenuProps>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { default as React, Dispatch, SetStateAction } from 'react';
|
|
2
|
+
import { IEditorTool } from './hooks/use-visibility';
|
|
3
|
+
import { Editor } from '@tiptap/react';
|
|
4
|
+
|
|
5
|
+
interface IEditorToolElement {
|
|
6
|
+
icon: any;
|
|
7
|
+
title: string;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
isActive: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const useEditorToolbar: ({ editor }: {
|
|
12
|
+
editor: Editor;
|
|
13
|
+
}) => {
|
|
14
|
+
toolbar: (IEditorToolElement | null)[];
|
|
15
|
+
toolRef: React.RefObject<HTMLDivElement>;
|
|
16
|
+
toolVisibilty: IEditorTool;
|
|
17
|
+
setToolVisibility: React.Dispatch<React.SetStateAction<IEditorTool>>;
|
|
18
|
+
};
|
|
19
|
+
export declare const TextHighlighter: ({ editor, setVisibility, elementRef, }: {
|
|
20
|
+
editor: Editor;
|
|
21
|
+
elementRef: React.RefObject<HTMLDivElement>;
|
|
22
|
+
setVisibility: Dispatch<SetStateAction<IEditorTool>>;
|
|
23
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare const EditorFontFamily: ({ elementRef, editor, setToolVisibility, }: {
|
|
25
|
+
elementRef: React.RefObject<HTMLDivElement>;
|
|
26
|
+
editor: Editor;
|
|
27
|
+
setToolVisibility: Dispatch<SetStateAction<IEditorTool>>;
|
|
28
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export declare const EditorAlignment: ({ elementRef, editor, setToolVisibility, }: {
|
|
30
|
+
elementRef: React.RefObject<HTMLDivElement>;
|
|
31
|
+
editor: Editor;
|
|
32
|
+
setToolVisibility: Dispatch<SetStateAction<IEditorTool>>;
|
|
33
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export declare const EditorList: ({ elementRef, editor, setToolVisibility, }: {
|
|
35
|
+
elementRef: React.RefObject<HTMLDivElement>;
|
|
36
|
+
editor: Editor;
|
|
37
|
+
setToolVisibility: Dispatch<SetStateAction<IEditorTool>>;
|
|
38
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare const LinkPopup: ({ elementRef, editor, setToolVisibility, bubbleMenu, setIsLinkPopupOpen, }: {
|
|
40
|
+
elementRef: React.RefObject<HTMLDivElement>;
|
|
41
|
+
editor: Editor;
|
|
42
|
+
setToolVisibility: Dispatch<SetStateAction<IEditorTool>>;
|
|
43
|
+
bubbleMenu?: boolean;
|
|
44
|
+
setIsLinkPopupOpen?: Dispatch<SetStateAction<boolean>>;
|
|
45
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export declare const TextColor: ({ editor, setVisibility, elementRef, }: {
|
|
47
|
+
editor: Editor;
|
|
48
|
+
elementRef: React.RefObject<HTMLDivElement>;
|
|
49
|
+
setVisibility: Dispatch<SetStateAction<IEditorTool>>;
|
|
50
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
51
|
+
export declare const TextHeading: ({ editor, setVisibility, elementRef, }: {
|
|
52
|
+
editor: Editor;
|
|
53
|
+
elementRef: React.RefObject<HTMLDivElement>;
|
|
54
|
+
setVisibility: Dispatch<SetStateAction<IEditorTool>>;
|
|
55
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
declare module '@tiptap/core' {
|
|
4
|
+
interface Commands<ReturnType> {
|
|
5
|
+
actionButton: {
|
|
6
|
+
/**
|
|
7
|
+
* Toggle a actionButton
|
|
8
|
+
*/
|
|
9
|
+
setActionButton: (option?: string) => ReturnType;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export interface ActionButtonOptions {
|
|
14
|
+
HTMLAttributes: Record<string, any>;
|
|
15
|
+
}
|
|
16
|
+
export declare const actionButton: Node<ActionButtonOptions, any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './action-button';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Editor } from '@tiptap/core';
|
|
2
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
3
|
+
|
|
4
|
+
export declare const Modal: ({ editor, setShowModal, node, }: {
|
|
5
|
+
editor?: Editor;
|
|
6
|
+
setShowModal: Dispatch<SetStateAction<boolean>>;
|
|
7
|
+
node: any;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
declare module '@tiptap/core' {
|
|
4
|
+
interface Commands<ReturnType> {
|
|
5
|
+
customkeymap: {
|
|
6
|
+
/**
|
|
7
|
+
* Select text between node boundaries
|
|
8
|
+
*/
|
|
9
|
+
selectTextWithinNodeBoundaries: () => ReturnType;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
declare const CustomKeymap: Extension<any, any>;
|
|
14
|
+
export default CustomKeymap;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
export interface DBlockOptions {
|
|
4
|
+
HTMLAttributes: Record<string, any>;
|
|
5
|
+
}
|
|
6
|
+
export type ListTypes = 'bulletList' | 'orderedList' | 'taskList';
|
|
7
|
+
declare module '@tiptap/core' {
|
|
8
|
+
interface Commands<ReturnType> {
|
|
9
|
+
dBlock: {
|
|
10
|
+
/**
|
|
11
|
+
* Toggle a dBlock
|
|
12
|
+
*/
|
|
13
|
+
setDBlock: (position?: number) => ReturnType;
|
|
14
|
+
mergeDBlocksIntoList: (listType: ListTypes) => ReturnType;
|
|
15
|
+
splitListToDBlocks: (listType: ListTypes) => ReturnType;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export declare const DBlock: Node<DBlockOptions, any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dblock';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NodeType } from '@tiptap/pm/model';
|
|
2
|
+
import { InputRule } from '@tiptap/core';
|
|
3
|
+
|
|
4
|
+
export declare const defaultExtensions: (import('@tiptap/core').Extension<any, any> | import('@tiptap/core').Node<any, any> | import('@tiptap/core').Mark<any, any>)[];
|
|
5
|
+
export declare const createInputRule: (pattern: RegExp, data: string, type: NodeType) => InputRule;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './document';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
export interface IframeOptions {
|
|
4
|
+
allowFullscreen: boolean;
|
|
5
|
+
HTMLAttributes: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
};
|
|
8
|
+
width?: number;
|
|
9
|
+
height?: number;
|
|
10
|
+
}
|
|
11
|
+
declare module '@tiptap/core' {
|
|
12
|
+
interface Commands<ReturnType> {
|
|
13
|
+
iframe: {
|
|
14
|
+
/**
|
|
15
|
+
* Add an iframe
|
|
16
|
+
*/
|
|
17
|
+
setIframe: (options: {
|
|
18
|
+
src: string;
|
|
19
|
+
alt?: string;
|
|
20
|
+
title?: string;
|
|
21
|
+
width?: number;
|
|
22
|
+
height?: number;
|
|
23
|
+
}) => ReturnType;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export declare const Iframe: Node<IframeOptions, any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './iframe';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ResolvedPos, Node } from 'prosemirror-model';
|
|
2
|
+
import { Selection } from 'prosemirror-state';
|
|
3
|
+
|
|
4
|
+
export declare class ColumnSelection extends Selection {
|
|
5
|
+
constructor(selection: Selection);
|
|
6
|
+
_$from: ResolvedPos;
|
|
7
|
+
_$to: ResolvedPos;
|
|
8
|
+
get $from(): ResolvedPos;
|
|
9
|
+
get $to(): ResolvedPos;
|
|
10
|
+
map(): this;
|
|
11
|
+
content(): import('prosemirror-model').Slice;
|
|
12
|
+
eq(other: Selection): boolean;
|
|
13
|
+
toJSON(): any;
|
|
14
|
+
expandSelection(doc: Node): void;
|
|
15
|
+
static create(doc: Node, from: number, to: number): ColumnSelection;
|
|
16
|
+
getFirstNode(): Node | null;
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
|
|
3
|
+
export declare enum ColumnLayout {
|
|
4
|
+
AlignLeft = "align-left",
|
|
5
|
+
AlignRight = "align-right",
|
|
6
|
+
AlignCenter = "align-center"
|
|
7
|
+
}
|
|
8
|
+
declare module '@tiptap/core' {
|
|
9
|
+
interface Commands<ReturnType> {
|
|
10
|
+
columns: {
|
|
11
|
+
unsetColumns: () => ReturnType;
|
|
12
|
+
setColumns: (columns: number) => ReturnType;
|
|
13
|
+
setLayout: (layout: ColumnLayout) => ReturnType;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export declare const Columns: Node<any, any>;
|
|
18
|
+
export default Columns;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
import { Column } from './column';
|
|
3
|
+
import { Columns } from './columns';
|
|
4
|
+
|
|
5
|
+
export interface ColumnExtensionOptions {
|
|
6
|
+
column?: boolean;
|
|
7
|
+
columns?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const ColumnExtension: Extension<ColumnExtensionOptions, any>;
|
|
10
|
+
export { Column, Columns };
|
|
11
|
+
export default ColumnExtension;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './columns-menu';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { JSONContent } from '@tiptap/core';
|
|
2
|
+
import { Node, ResolvedPos } from 'prosemirror-model';
|
|
3
|
+
|
|
4
|
+
export declare const buildNode: ({ type, content }: JSONContent) => JSONContent;
|
|
5
|
+
export declare const buildParagraph: ({ content }: Partial<JSONContent>) => JSONContent;
|
|
6
|
+
export declare const buildDBlock: ({ content }: Partial<JSONContent>) => JSONContent;
|
|
7
|
+
export declare const buildColumn: ({ content }: Partial<JSONContent>) => JSONContent;
|
|
8
|
+
export declare const buildColumnBlock: ({ content }: Partial<JSONContent>) => JSONContent;
|
|
9
|
+
export declare const buildNColumns: (n: number) => JSONContent[];
|
|
10
|
+
interface PredicateProps {
|
|
11
|
+
node: Node;
|
|
12
|
+
pos: number;
|
|
13
|
+
start: number;
|
|
14
|
+
}
|
|
15
|
+
export type Predicate = (props: PredicateProps) => boolean;
|
|
16
|
+
export declare const findParentNodeClosestToPos: ($pos: ResolvedPos, predicate: Predicate) => {
|
|
17
|
+
start: number;
|
|
18
|
+
depth: number;
|
|
19
|
+
node: Node;
|
|
20
|
+
pos: number;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './resizable-media';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './media-paste-drop-plugin';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Plugin } from 'prosemirror-state';
|
|
2
|
+
|
|
3
|
+
export type UploadFnType = (image: File) => Promise<string>;
|
|
4
|
+
/**
|
|
5
|
+
* This function creates a Prosemirror plugin that handles pasting and dropping of media files.
|
|
6
|
+
* It accepts an upload function as a parameter which is used to upload the media files.
|
|
7
|
+
* The plugin prevents the default paste and drop event, uploads the media file (if an upload function is provided),
|
|
8
|
+
* creates a new node with the uploaded media file and replaces the current selection with the new node.
|
|
9
|
+
* If no upload function is provided, it reads the media file as DataURL and uses this in the new node.
|
|
10
|
+
* The function returns a new instance of the Plugin.
|
|
11
|
+
*/
|
|
12
|
+
export declare const getMediaPasteDropPlugin: (upload: UploadFnType) => Plugin<any>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
import { UploadFnType } from './media-paste-drop-plugin';
|
|
3
|
+
|
|
4
|
+
declare module '@tiptap/core' {
|
|
5
|
+
interface Commands<ReturnType> {
|
|
6
|
+
resizableMedia: {
|
|
7
|
+
/**
|
|
8
|
+
* Set media
|
|
9
|
+
*/
|
|
10
|
+
setMedia: (options: {
|
|
11
|
+
'media-type': 'img' | 'video';
|
|
12
|
+
src: string;
|
|
13
|
+
alt?: string;
|
|
14
|
+
title?: string;
|
|
15
|
+
width?: string;
|
|
16
|
+
height?: string;
|
|
17
|
+
}) => ReturnType;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export interface MediaOptions {
|
|
22
|
+
HTMLAttributes: Record<string, any>;
|
|
23
|
+
uploadFn: UploadFnType;
|
|
24
|
+
}
|
|
25
|
+
export declare const IMAGE_INPUT_REGEX: RegExp;
|
|
26
|
+
export declare const VIDEO_INPUT_REGEX: RegExp;
|
|
27
|
+
export declare const ResizableMedia: Node<MediaOptions, any>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Node as ProseMirrorNode } from 'prosemirror-model';
|
|
2
|
+
import { NodeView } from 'prosemirror-view';
|
|
3
|
+
|
|
4
|
+
export declare function updateColumns(node: ProseMirrorNode, colgroup: Element, table: HTMLTableElement, cellMinWidth: number, overrideCol?: number, overrideValue?: string): void;
|
|
5
|
+
export declare class TableView implements NodeView {
|
|
6
|
+
node: ProseMirrorNode;
|
|
7
|
+
cellMinWidth: number;
|
|
8
|
+
dom: Element;
|
|
9
|
+
table: HTMLTableElement;
|
|
10
|
+
colgroup: Element;
|
|
11
|
+
contentDOM: HTMLElement;
|
|
12
|
+
constructor(node: ProseMirrorNode, cellMinWidth: number);
|
|
13
|
+
update(node: ProseMirrorNode): boolean;
|
|
14
|
+
ignoreMutation(mutation: MutationRecord | {
|
|
15
|
+
type: 'selection';
|
|
16
|
+
target: Element;
|
|
17
|
+
}): boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { Node, ParentConfig } from '@tiptap/core';
|
|
2
|
+
import { NodeView } from 'prosemirror-view';
|
|
3
|
+
|
|
4
|
+
export interface TableOptions {
|
|
5
|
+
HTMLAttributes: Record<string, never>;
|
|
6
|
+
resizable: boolean;
|
|
7
|
+
handleWidth: number;
|
|
8
|
+
cellMinWidth: number;
|
|
9
|
+
View: NodeView;
|
|
10
|
+
lastColumnResizable: boolean;
|
|
11
|
+
allowTableNodeSelection: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare module '@tiptap/core' {
|
|
14
|
+
interface Commands<ReturnType> {
|
|
15
|
+
table: {
|
|
16
|
+
insertTable: (options?: {
|
|
17
|
+
rows?: number;
|
|
18
|
+
cols?: number;
|
|
19
|
+
withHeaderRow?: boolean;
|
|
20
|
+
}) => ReturnType;
|
|
21
|
+
addColumnBefore: () => ReturnType;
|
|
22
|
+
addColumnAfter: () => ReturnType;
|
|
23
|
+
deleteColumn: () => ReturnType;
|
|
24
|
+
addRowBefore: () => ReturnType;
|
|
25
|
+
addRowAfter: () => ReturnType;
|
|
26
|
+
deleteRow: () => ReturnType;
|
|
27
|
+
deleteTable: () => ReturnType;
|
|
28
|
+
mergeCells: () => ReturnType;
|
|
29
|
+
splitCell: () => ReturnType;
|
|
30
|
+
toggleHeaderColumn: () => ReturnType;
|
|
31
|
+
toggleHeaderRow: () => ReturnType;
|
|
32
|
+
toggleHeaderCell: () => ReturnType;
|
|
33
|
+
mergeOrSplit: () => ReturnType;
|
|
34
|
+
setCellAttribute: (name: string, value: never) => ReturnType;
|
|
35
|
+
goToNextCell: () => ReturnType;
|
|
36
|
+
goToPreviousCell: () => ReturnType;
|
|
37
|
+
fixTables: () => ReturnType;
|
|
38
|
+
setCellSelection: (position: {
|
|
39
|
+
anchorCell: number;
|
|
40
|
+
headCell?: number;
|
|
41
|
+
}) => ReturnType;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
interface NodeConfig<Options, Storage> {
|
|
45
|
+
/**
|
|
46
|
+
* Table Role
|
|
47
|
+
*/
|
|
48
|
+
tableRole?: string | ((this: {
|
|
49
|
+
name: string;
|
|
50
|
+
options: Options;
|
|
51
|
+
storage: Storage;
|
|
52
|
+
parent: ParentConfig<NodeConfig<Options>>['tableRole'];
|
|
53
|
+
}) => string);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export declare const Table: Node<TableOptions, any>;
|
package/dist/packages/ddoc/extensions/supercharged-table/extension-table/utilities/create-table.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Fragment, Node as ProsemirrorNode, Schema } from 'prosemirror-model';
|
|
2
|
+
|
|
3
|
+
export declare function createTable(schema: Schema, rowsCount: number, colsCount: number, withHeaderRow: boolean, cellContent?: Fragment | ProsemirrorNode | Array<ProsemirrorNode>): ProsemirrorNode;
|