@yoopta/editor 2.0.1 → 4.0.0-rc.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/UI/BlockOptions/BlockOptions.d.ts +23 -0
- package/dist/UI/BlockOptions/BlockOptions.d.ts.map +1 -0
- package/dist/UI/ExtendedBlockActions/ExtendedBlockActions.d.ts +10 -0
- package/dist/UI/ExtendedBlockActions/ExtendedBlockActions.d.ts.map +1 -0
- package/dist/UI/index.d.ts +29 -0
- package/dist/UI/index.d.ts.map +1 -0
- package/dist/YooptaEditor.d.ts +18 -3
- package/dist/YooptaEditor.d.ts.map +1 -0
- package/dist/components/Block/Block.d.ts +8 -0
- package/dist/components/Block/Block.d.ts.map +1 -0
- package/dist/components/Block/BlockActions.d.ts +12 -0
- package/dist/components/Block/BlockActions.d.ts.map +1 -0
- package/dist/components/Editor/Editor.d.ts +8 -12
- package/dist/components/Editor/Editor.d.ts.map +1 -0
- package/dist/components/Editor/RenderBlocks.d.ts +10 -0
- package/dist/components/Editor/RenderBlocks.d.ts.map +1 -0
- package/dist/components/Editor/defaultValue.d.ts +7 -0
- package/dist/components/Editor/defaultValue.d.ts.map +1 -0
- package/dist/components/Editor/dnd.d.ts +10 -0
- package/dist/components/Editor/dnd.d.ts.map +1 -0
- package/dist/components/Editor/utils.d.ts +2 -6
- package/dist/components/Editor/utils.d.ts.map +1 -0
- package/dist/components/NoSsr/NoSsr.d.ts +1 -0
- package/dist/components/NoSsr/NoSsr.d.ts.map +1 -0
- package/dist/components/SelectionBox/SelectionBox.d.ts +20 -0
- package/dist/components/SelectionBox/SelectionBox.d.ts.map +1 -0
- package/dist/components/SelectionBox/hooks.d.ts +7 -0
- package/dist/components/SelectionBox/hooks.d.ts.map +1 -0
- package/dist/components/TextLeaf/TextLeaf.d.ts +8 -0
- package/dist/components/TextLeaf/TextLeaf.d.ts.map +1 -0
- package/dist/contexts/UltraYooptaContext/ToolsContext.d.ts +25 -0
- package/dist/contexts/UltraYooptaContext/ToolsContext.d.ts.map +1 -0
- package/dist/contexts/UltraYooptaContext/UltraYooptaContext.d.ts +31 -0
- package/dist/contexts/UltraYooptaContext/UltraYooptaContext.d.ts.map +1 -0
- package/dist/editor/core/getEditorValue.d.ts +3 -0
- package/dist/editor/core/getEditorValue.d.ts.map +1 -0
- package/dist/editor/index.d.ts +4 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/selection/blur.d.ts +7 -0
- package/dist/editor/selection/blur.d.ts.map +1 -0
- package/dist/editor/selection/setBlockSelected.d.ts +7 -0
- package/dist/editor/selection/setBlockSelected.d.ts.map +1 -0
- package/dist/editor/selection/setSelection.d.ts +3 -0
- package/dist/editor/selection/setSelection.d.ts.map +1 -0
- package/dist/editor/textFormats/getValue.d.ts +3 -0
- package/dist/editor/textFormats/getValue.d.ts.map +1 -0
- package/dist/editor/textFormats/isActive.d.ts +3 -0
- package/dist/editor/textFormats/isActive.d.ts.map +1 -0
- package/dist/editor/textFormats/toggle.d.ts +3 -0
- package/dist/editor/textFormats/toggle.d.ts.map +1 -0
- package/dist/editor/textFormats/update.d.ts +3 -0
- package/dist/editor/textFormats/update.d.ts.map +1 -0
- package/dist/editor/transforms/createBlock.d.ts +6 -0
- package/dist/editor/transforms/createBlock.d.ts.map +1 -0
- package/dist/editor/transforms/decreaseBlockDepth.d.ts +3 -0
- package/dist/editor/transforms/decreaseBlockDepth.d.ts.map +1 -0
- package/dist/editor/transforms/deleteBlock.d.ts +7 -0
- package/dist/editor/transforms/deleteBlock.d.ts.map +1 -0
- package/dist/editor/transforms/duplicateBlock.d.ts +6 -0
- package/dist/editor/transforms/duplicateBlock.d.ts.map +1 -0
- package/dist/editor/transforms/focusBlock.d.ts +7 -0
- package/dist/editor/transforms/focusBlock.d.ts.map +1 -0
- package/dist/editor/transforms/getBlockElement.d.ts +2 -0
- package/dist/editor/transforms/getBlockElement.d.ts.map +1 -0
- package/dist/editor/transforms/increaseBlockDepth.d.ts +3 -0
- package/dist/editor/transforms/increaseBlockDepth.d.ts.map +1 -0
- package/dist/editor/transforms/insertBlock.d.ts +3 -0
- package/dist/editor/transforms/insertBlock.d.ts.map +1 -0
- package/dist/editor/transforms/moveBlock.d.ts +3 -0
- package/dist/editor/transforms/moveBlock.d.ts.map +1 -0
- package/dist/editor/transforms/splitBlock.d.ts +3 -0
- package/dist/editor/transforms/splitBlock.d.ts.map +1 -0
- package/dist/editor/transforms/toggleBlock.d.ts +4 -0
- package/dist/editor/transforms/toggleBlock.d.ts.map +1 -0
- package/dist/editor/transforms/updateBlock.d.ts +3 -0
- package/dist/editor/transforms/updateBlock.d.ts.map +1 -0
- package/dist/editor/transforms/updateBlockElement.d.ts +3 -0
- package/dist/editor/transforms/updateBlockElement.d.ts.map +1 -0
- package/dist/editor/types.d.ts +92 -0
- package/dist/editor/types.d.ts.map +1 -0
- package/dist/extensions/shortcuts.d.ts +4 -0
- package/dist/extensions/shortcuts.d.ts.map +1 -0
- package/dist/handlers/index.d.ts +5 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/onKeyDown.d.ts +4 -0
- package/dist/handlers/onKeyDown.d.ts.map +1 -0
- package/dist/hooks/useForceRender.d.ts +2 -0
- package/dist/hooks/useForceRender.d.ts.map +1 -0
- package/dist/index.d.ts +12 -38
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -6
- package/dist/marks/index.d.ts +13 -0
- package/dist/marks/index.d.ts.map +1 -0
- package/dist/plugins/SlateEditorComponent.d.ts +12 -0
- package/dist/plugins/SlateEditorComponent.d.ts.map +1 -0
- package/dist/plugins/createYooptaPlugin.d.ts +9 -0
- package/dist/plugins/createYooptaPlugin.d.ts.map +1 -0
- package/dist/plugins/extenstions/withInlines.d.ts +2 -0
- package/dist/plugins/extenstions/withInlines.d.ts.map +1 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/types.d.ts +71 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/tools/ActionMenuList/ActionMenuComponent.d.ts +14 -0
- package/dist/tools/ActionMenuList/ActionMenuComponent.d.ts.map +1 -0
- package/dist/tools/ActionMenuList/ActionMenuList.d.ts +10 -0
- package/dist/tools/ActionMenuList/ActionMenuList.d.ts.map +1 -0
- package/dist/tools/ActionMenuList/events.d.ts +12 -0
- package/dist/tools/ActionMenuList/events.d.ts.map +1 -0
- package/dist/tools/Toolbar/HighlightColor.d.ts +14 -0
- package/dist/tools/Toolbar/HighlightColor.d.ts.map +1 -0
- package/dist/tools/Toolbar/Toolbar.d.ts +4 -0
- package/dist/tools/Toolbar/Toolbar.d.ts.map +1 -0
- package/dist/tools/Toolbar/ToolbarComponent.d.ts +9 -0
- package/dist/tools/Toolbar/ToolbarComponent.d.ts.map +1 -0
- package/dist/types/eventHandlers.d.ts +1 -0
- package/dist/types/eventHandlers.d.ts.map +1 -0
- package/dist/utils/blockElements.d.ts +13 -0
- package/dist/utils/blockElements.d.ts.map +1 -0
- package/dist/utils/deepClone.d.ts +1 -0
- package/dist/utils/deepClone.d.ts.map +1 -0
- package/dist/utils/editorBuilders.d.ts +11 -0
- package/dist/utils/editorBuilders.d.ts.map +1 -0
- package/dist/utils/findPluginBlockBySelectionPath.d.ts +3 -0
- package/dist/utils/findPluginBlockBySelectionPath.d.ts.map +1 -0
- package/dist/utils/findPluginBlockByType.d.ts +7 -0
- package/dist/utils/findPluginBlockByType.d.ts.map +1 -0
- package/dist/utils/findSlateBySelectionPath.d.ts +3 -0
- package/dist/utils/findSlateBySelectionPath.d.ts.map +1 -0
- package/dist/utils/generateId.d.ts +1 -0
- package/dist/utils/generateId.d.ts.map +1 -0
- package/dist/utils/getMaxOffsetInElement.d.ts +2 -0
- package/dist/utils/getMaxOffsetInElement.d.ts.map +1 -0
- package/dist/utils/hotkeys.d.ts +4 -0
- package/dist/utils/hotkeys.d.ts.map +1 -0
- package/dist/utils/serializeHTML.d.ts +1 -0
- package/dist/utils/serializeHTML.d.ts.map +1 -0
- package/package.json +18 -18
- package/dist/components/Editor/TextLeaf/TextLeaf.d.ts +0 -9
- package/dist/components/Editor/plugins/deleteFragment.d.ts +0 -2
- package/dist/components/Editor/plugins/nonEmptyEditor.d.ts +0 -2
- package/dist/components/Editor/plugins/pasteHtml.d.ts +0 -3
- package/dist/components/Editor/plugins/shortcuts.d.ts +0 -2
- package/dist/components/Editor/plugins/voids.d.ts +0 -2
- package/dist/components/ElementOptions/ElementOptions.d.ts +0 -18
- package/dist/components/ElementOptions/Overlay.d.ts +0 -7
- package/dist/components/ElementWrapper/ElementActions.d.ts +0 -12
- package/dist/components/ElementWrapper/ElementWrapper.d.ts +0 -14
- package/dist/components/YooptaEditor/YooptaEditor.d.ts +0 -21
- package/dist/contexts/NodeSettingsContext/NodeSettingsContext.d.ts +0 -29
- package/dist/contexts/YooptaContext/YooptaContext.d.ts +0 -54
- package/dist/hooks/useDragDrop.d.ts +0 -25
- package/dist/hooks/useHover.d.ts +0 -2
- package/dist/hooks/useIntersetionObserver.d.ts +0 -12
- package/dist/hooks/useScrollToElement.d.ts +0 -1
- package/dist/types.d.ts +0 -53
- package/dist/utils/deserializeHTML.d.ts +0 -4
- package/dist/utils/getElementClassname.d.ts +0 -8
- package/dist/utils/marks.d.ts +0 -14
- package/dist/utils/nodes.d.ts +0 -5
- package/dist/utils/plugins.d.ts +0 -102
- package/dist/utils/storage.d.ts +0 -4
- package/dist/utils/validate.d.ts +0 -1
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { YooptaBaseElement, YooptaTools } from '../../types';
|
|
3
|
-
import { YooptaPluginType } from '../../utils/plugins';
|
|
4
|
-
import { YooptaMark } from '../../utils/marks';
|
|
5
|
-
export type HoveredElement = YooptaBaseElement<string> | null;
|
|
6
|
-
type YooptaToolsMap = {
|
|
7
|
-
Toolbar: (props: any) => ReactElement;
|
|
8
|
-
ActionMenu: (props: any) => ReactElement;
|
|
9
|
-
ChatGPT: (props: any) => ReactElement;
|
|
10
|
-
LinkTool: (props: any) => ReactElement;
|
|
11
|
-
[x: string]: (props: any) => ReactElement;
|
|
12
|
-
};
|
|
13
|
-
export type YooptaContextReturnValues = {
|
|
14
|
-
marks: MarksMap;
|
|
15
|
-
elements: ElementsMap;
|
|
16
|
-
tools?: YooptaToolsMap | undefined;
|
|
17
|
-
};
|
|
18
|
-
export type YooptaContextHandlers = {};
|
|
19
|
-
export type YooptaContextType = YooptaContextReturnValues;
|
|
20
|
-
type Props = {
|
|
21
|
-
children: ReactNode;
|
|
22
|
-
plugins: Omit<YooptaPluginType, 'childPlugin'>[];
|
|
23
|
-
marks?: YooptaMark[];
|
|
24
|
-
tools?: YooptaTools | undefined;
|
|
25
|
-
};
|
|
26
|
-
export type ToggleOptions = {
|
|
27
|
-
shouldDeleteText: boolean;
|
|
28
|
-
};
|
|
29
|
-
export type ElementsMap = {
|
|
30
|
-
[x: string]: {
|
|
31
|
-
type: YooptaPluginType['type'];
|
|
32
|
-
create: YooptaPluginType['createElement'];
|
|
33
|
-
define: YooptaPluginType['defineElement'];
|
|
34
|
-
toggle: (options?: ToggleOptions) => void;
|
|
35
|
-
isActive: boolean;
|
|
36
|
-
options: {
|
|
37
|
-
displayLabel?: string;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
export type MarksMap = {
|
|
42
|
-
[x: string]: {
|
|
43
|
-
toggle: (options?: {
|
|
44
|
-
only: boolean;
|
|
45
|
-
}) => void;
|
|
46
|
-
isActive: boolean;
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
declare const YooptaContextProvider: ({ children, plugins: pluginList, marks: markList, tools }: Props) => JSX.Element;
|
|
50
|
-
declare const useYoopta: () => YooptaContextReturnValues;
|
|
51
|
-
declare const useMarks: () => MarksMap;
|
|
52
|
-
declare const useElements: () => ElementsMap;
|
|
53
|
-
declare const useTools: () => YooptaToolsMap | undefined;
|
|
54
|
-
export { YooptaContextProvider, useYoopta, useMarks, useElements, useTools };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { DragEvent } from 'react';
|
|
2
|
-
import { Node, NodeEntry } from 'slate';
|
|
3
|
-
import { YooEditor, YooptaBaseElement } from '../types';
|
|
4
|
-
export type DraggedNode = {
|
|
5
|
-
path: number[] | null;
|
|
6
|
-
element: Pick<YooptaBaseElement<string>, 'id' | 'type'> | null;
|
|
7
|
-
parent: NodeEntry<Node> | null;
|
|
8
|
-
};
|
|
9
|
-
export type DndState = {
|
|
10
|
-
from: DraggedNode;
|
|
11
|
-
to: DraggedNode;
|
|
12
|
-
};
|
|
13
|
-
export type DragDropValues = {
|
|
14
|
-
dndState: DndState;
|
|
15
|
-
disableWhileDrag: boolean;
|
|
16
|
-
DRAG_MAP: Map<YooptaBaseElement<string>['id'], YooptaBaseElement<string>>;
|
|
17
|
-
};
|
|
18
|
-
export type DragDropHandlers = {
|
|
19
|
-
onDrop: (_e: DragEvent<HTMLDivElement>) => void;
|
|
20
|
-
onDragEnter: (_e: DragEvent<HTMLDivElement>) => void;
|
|
21
|
-
onDragEnd: (_e: any) => void;
|
|
22
|
-
onDragStart: (_e: any, from: DraggedNode) => void;
|
|
23
|
-
};
|
|
24
|
-
export declare const DEFAULT_DRAG_STATE: DndState;
|
|
25
|
-
export declare const useDragDrop: (editor: YooEditor) => [DragDropValues, DragDropHandlers];
|
package/dist/hooks/useHover.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param {DOM Ref} elementRef - DOM ref for checking the intersection
|
|
4
|
-
* @param {Observer Params} - https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API
|
|
5
|
-
* @returns {IntersectionObserverEntry} - https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserverEntry
|
|
6
|
-
*/
|
|
7
|
-
export declare function useIntersectionObserver(elementRef: any, { threshold, root, rootMargin, freezeOnceVisible }?: {
|
|
8
|
-
threshold?: number | undefined;
|
|
9
|
-
root?: null | undefined;
|
|
10
|
-
rootMargin?: string | undefined;
|
|
11
|
-
freezeOnceVisible?: boolean | undefined;
|
|
12
|
-
}): IntersectionObserverEntry | Record<string, unknown>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useScrollToElement: () => null;
|
package/dist/types.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { BaseEditor, BaseElement } from 'slate';
|
|
2
|
-
import { ReactEditor, RenderElementProps as ElementProps } from 'slate-react';
|
|
3
|
-
import { HistoryEditor } from 'slate-history';
|
|
4
|
-
import { YooptaPluginType, YooptaRenderHTMLAttributes } from './utils/plugins';
|
|
5
|
-
import { CSSProperties, ReactNode } from 'react';
|
|
6
|
-
export type EmptyText = {
|
|
7
|
-
text: string;
|
|
8
|
-
};
|
|
9
|
-
export type YooptaElementConfig = {
|
|
10
|
-
nodeType: 'block' | 'inline' | 'void';
|
|
11
|
-
};
|
|
12
|
-
export type Modify<T, R> = Omit<T, keyof R> & R;
|
|
13
|
-
export type YooptaBaseElement<T> = {
|
|
14
|
-
id: string;
|
|
15
|
-
type: T;
|
|
16
|
-
children: BaseElement['children'];
|
|
17
|
-
data?: any;
|
|
18
|
-
} & YooptaElementConfig;
|
|
19
|
-
export type RenderYooptaElementProps<T extends BaseElement = BaseElement> = ElementProps & {
|
|
20
|
-
element: T;
|
|
21
|
-
} & YooptaRenderHTMLAttributes;
|
|
22
|
-
export type YooptaEditorValue<V> = V[];
|
|
23
|
-
export type YooptaBaseToolEvents = {
|
|
24
|
-
[x: string]: (...args: any) => void;
|
|
25
|
-
};
|
|
26
|
-
export type YooptaBaseToolProps<P extends YooptaPluginType = YooptaPluginType, Events extends YooptaBaseToolEvents = YooptaBaseToolEvents> = {
|
|
27
|
-
style?: CSSProperties;
|
|
28
|
-
className?: string;
|
|
29
|
-
plugins?: P[];
|
|
30
|
-
fromHook?: boolean;
|
|
31
|
-
on?: Events;
|
|
32
|
-
};
|
|
33
|
-
export interface YooEditor extends BaseEditor, ReactEditor, HistoryEditor {
|
|
34
|
-
shortcuts: Record<string, YooptaPluginType>;
|
|
35
|
-
plugins: Record<YooptaBaseElement<string>['type'], YooptaPluginType<any, YooptaBaseElement<string>>>;
|
|
36
|
-
}
|
|
37
|
-
export type YooptaNodeElementSettings = {
|
|
38
|
-
options?: {
|
|
39
|
-
handlers?: {
|
|
40
|
-
onCopy?: () => void;
|
|
41
|
-
onDelete?: () => void;
|
|
42
|
-
onDuplicate?: () => void;
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
drag?: boolean;
|
|
46
|
-
plus?: boolean;
|
|
47
|
-
};
|
|
48
|
-
export type YooptaTools = {
|
|
49
|
-
ActionMenu?: ReactNode;
|
|
50
|
-
Toolbar?: ReactNode;
|
|
51
|
-
ChatGPT?: ReactNode;
|
|
52
|
-
[x: string]: ReactNode;
|
|
53
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { YooptaBaseElement } from '../types';
|
|
2
|
-
import { YooptaPluginType } from './plugins';
|
|
3
|
-
export declare function mergePluginTypesToMapHMTLNodeName(plugins: Record<YooptaBaseElement<string>['type'], YooptaPluginType<any, YooptaBaseElement<string>>>): Record<YooptaBaseElement<string>['type'], YooptaPluginType<any, YooptaBaseElement<string>>>;
|
|
4
|
-
export declare function deserializeHtml(htmlString: string, plugins: Record<YooptaBaseElement<string>['type'], YooptaPluginType<any, YooptaBaseElement<string>>>): any;
|
package/dist/utils/marks.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { RenderLeafProps } from 'slate-react';
|
|
3
|
-
export type YooptaMark = {
|
|
4
|
-
type: string;
|
|
5
|
-
hotkey?: string;
|
|
6
|
-
render: (props: RenderLeafProps) => JSX.Element;
|
|
7
|
-
};
|
|
8
|
-
export type YooptaMarksConfig = {
|
|
9
|
-
type: string;
|
|
10
|
-
className: string;
|
|
11
|
-
hotkey?: string;
|
|
12
|
-
as?: string;
|
|
13
|
-
};
|
|
14
|
-
export declare function createYooptaMark({ type, hotkey, className, as }: YooptaMarksConfig): YooptaMark;
|
package/dist/utils/nodes.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Path } from 'slate';
|
|
2
|
-
import { YooEditor } from '../types';
|
|
3
|
-
export declare const getMatchedNode: (editor: YooEditor, type: string) => false | import("slate").NodeEntry<import("slate").Node>;
|
|
4
|
-
export declare const isElementActive: (editor: YooEditor, type: string) => boolean;
|
|
5
|
-
export declare const getElementByPath: (editor: YooEditor, path?: Path, mode?: 'all' | 'highest' | 'lowest') => any;
|
package/dist/utils/plugins.d.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { HTMLAttributes, ReactElement } from 'react';
|
|
2
|
-
import { Element, NodeEntry, Range } from 'slate';
|
|
3
|
-
import { RenderLeafProps } from 'slate-react';
|
|
4
|
-
import { YooEditor, RenderYooptaElementProps, YooptaBaseElement } from '../types';
|
|
5
|
-
import { EditorEventHandlers } from '../types/eventHandlers';
|
|
6
|
-
import { HOTKEYS_TYPE } from './hotkeys';
|
|
7
|
-
export type HandlersOptions = {
|
|
8
|
-
hotkeys: HOTKEYS_TYPE;
|
|
9
|
-
defaultNode: Element;
|
|
10
|
-
};
|
|
11
|
-
export type DecoratorFn = (nodeEntry: NodeEntry) => Range[];
|
|
12
|
-
export type YooptaPluginEventHandlers = {
|
|
13
|
-
[key in keyof EditorEventHandlers]: (editor: YooEditor, options: HandlersOptions) => EditorEventHandlers[key] | void;
|
|
14
|
-
};
|
|
15
|
-
export type YooptaPluginBaseOptions = YooptaRenderHTMLAttributes & {
|
|
16
|
-
searchString?: string;
|
|
17
|
-
displayLabel?: string;
|
|
18
|
-
};
|
|
19
|
-
export type YooptaRenderElementFunc<P extends YooptaBaseElement<string> = YooptaBaseElement<string>> = (editor: YooEditor, plugin: YooptaPluginType) => (props: RenderYooptaElementProps<P> & YooptaRenderHTMLAttributes) => ReactElement;
|
|
20
|
-
export type YooptaRender<P extends YooptaBaseElement<string>> = YooptaRenderElementFunc<P>;
|
|
21
|
-
export type ExtendedYooptaRender<P extends YooptaBaseElement<string>> = {
|
|
22
|
-
editor: YooptaRenderElementFunc<P>;
|
|
23
|
-
render: (props: RenderYooptaElementProps<P> & YooptaRenderHTMLAttributes) => ReactElement;
|
|
24
|
-
};
|
|
25
|
-
export type YooptaRenderHTMLAttributes = {
|
|
26
|
-
HTMLAttributes?: HTMLAttributes<HTMLElement>;
|
|
27
|
-
};
|
|
28
|
-
export type YooptaRenderer<P extends YooptaBaseElement<string>> = ExtendedYooptaRender<P> | YooptaRender<P>;
|
|
29
|
-
type DeserializeHTML = {
|
|
30
|
-
nodeName: string | string[];
|
|
31
|
-
parse?: (el: HTMLElement) => any | null;
|
|
32
|
-
};
|
|
33
|
-
type Serializes<T, S> = {
|
|
34
|
-
serialize?: (node: T, text: string) => string;
|
|
35
|
-
deserialize?: S;
|
|
36
|
-
};
|
|
37
|
-
type Exports<T> = {
|
|
38
|
-
html: Serializes<T, DeserializeHTML>;
|
|
39
|
-
markdown: Serializes<T, {
|
|
40
|
-
mark: string;
|
|
41
|
-
parse: (mark: any) => any;
|
|
42
|
-
}>;
|
|
43
|
-
};
|
|
44
|
-
export type YooptaPluginType<O extends YooptaPluginBaseOptions = YooptaPluginBaseOptions, P extends YooptaBaseElement<string> = YooptaBaseElement<string>> = {
|
|
45
|
-
/**
|
|
46
|
-
* The type of the plugin and element.
|
|
47
|
-
*/
|
|
48
|
-
type: string;
|
|
49
|
-
/**
|
|
50
|
-
* The plugin's renderer which can be .
|
|
51
|
-
*/
|
|
52
|
-
renderer: YooptaRenderer<P>;
|
|
53
|
-
/**
|
|
54
|
-
* The element placeholder.
|
|
55
|
-
*/
|
|
56
|
-
placeholder?: string | null;
|
|
57
|
-
/**
|
|
58
|
-
* The element's shortcuts.
|
|
59
|
-
*/
|
|
60
|
-
shortcut?: string | string[];
|
|
61
|
-
/**
|
|
62
|
-
* The element's exports which contain rules for deserializers and serializers for plain text([WIP]) html, markdown.
|
|
63
|
-
*/
|
|
64
|
-
exports?: Exports<P>;
|
|
65
|
-
/**
|
|
66
|
-
* The element's events: onKeyDown, onCopy and etc.
|
|
67
|
-
*/
|
|
68
|
-
events?: YooptaPluginEventHandlers;
|
|
69
|
-
/**
|
|
70
|
-
* The element's options object that can be extended with custom options for your plugin
|
|
71
|
-
* Default options: HTMLAttributes
|
|
72
|
-
*/
|
|
73
|
-
options?: O;
|
|
74
|
-
/**
|
|
75
|
-
*
|
|
76
|
-
* @param editor
|
|
77
|
-
* @returns
|
|
78
|
-
*/
|
|
79
|
-
extendEditor?: (editor: YooEditor) => YooEditor;
|
|
80
|
-
/**
|
|
81
|
-
* Slate decorator for text ranges. Check docs: https://docs.slatejs.org/concepts/09-rendering#decorations
|
|
82
|
-
*/
|
|
83
|
-
decorator?: (editor: YooEditor) => DecoratorFn;
|
|
84
|
-
/** Slate leaves. Check docs: https://docs.slatejs.org/concepts/09-rendering#decorations */
|
|
85
|
-
leaf?: (editor: YooEditor) => (props: RenderLeafProps) => any;
|
|
86
|
-
/** Useful key for plugins which contain children as plugin. For example NumberedList contain childPlugin ListItem */
|
|
87
|
-
childPlugin?: YooptaPlugin<any, any>;
|
|
88
|
-
hasParent?: boolean;
|
|
89
|
-
createElement?: (editor: YooEditor, elementData?: Partial<P>) => void;
|
|
90
|
-
defineElement: () => P;
|
|
91
|
-
};
|
|
92
|
-
export type ParentYooptaPlugin = Omit<YooptaPluginType, 'childPlugin' | 'hasParent'>;
|
|
93
|
-
export declare class YooptaPlugin<O extends YooptaPluginBaseOptions, P extends YooptaBaseElement<string>> {
|
|
94
|
-
#private;
|
|
95
|
-
constructor(inputPlugin: YooptaPluginType<O, P>);
|
|
96
|
-
extend(overrides: Partial<Pick<YooptaPluginType<O, P>, 'type' | 'renderer' | 'placeholder' | 'shortcut' | 'exports' | 'events' | 'options' | 'extendEditor'>>): YooptaPlugin<O, P>;
|
|
97
|
-
get getPlugin(): YooptaPluginType<O, P>;
|
|
98
|
-
}
|
|
99
|
-
export declare function createYooptaPlugin<O extends YooptaPluginBaseOptions, P extends YooptaBaseElement<string>>(input: YooptaPluginType<O, P>): YooptaPlugin<O, P>;
|
|
100
|
-
export declare function mergePlugins<O extends YooptaPluginBaseOptions, P extends YooptaBaseElement<string>>(plugins: YooptaPlugin<O, P>[]): YooptaPluginType<O, P>[];
|
|
101
|
-
export declare function mergePluginTypesToMap(plugins: YooptaPluginType<any, YooptaBaseElement<string>>[]): Record<YooptaBaseElement<string>['type'], YooptaPluginType<any, YooptaBaseElement<string>>>;
|
|
102
|
-
export {};
|
package/dist/utils/storage.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { YooptaEditorValue } from '../types';
|
|
2
|
-
export type OFFLINE_STORAGE = boolean | string;
|
|
3
|
-
export declare function getStorageName(offline?: OFFLINE_STORAGE): string;
|
|
4
|
-
export declare function getInitialState<V>(storageName: string, offline?: OFFLINE_STORAGE, value?: YooptaEditorValue<V>): YooptaEditorValue<V>;
|
package/dist/utils/validate.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function isValidYooptaNodes(nodes: any): boolean;
|