@platecms/delta-smart-text 0.1.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 +38 -0
- package/components/DeltaSlateEditor.vue.d.ts +23 -0
- package/index.cjs +960 -0
- package/index.css +1 -0
- package/index.d.ts +12 -0
- package/index.js +48186 -0
- package/package.json +59 -0
- package/react/components/DeltaSlateEditor.d.ts +6 -0
- package/react/components/DeltaSlateEditorConnector.d.ts +9 -0
- package/react/components/Element.d.ts +7 -0
- package/react/components/Leaf.d.ts +7 -0
- package/react/components/elements/CodeElement.d.ts +8 -0
- package/react/components/elements/ContentValueElement.d.ts +8 -0
- package/react/components/inputs/SearchInput.d.ts +5 -0
- package/react/components/menus/ContentAndFormatMenu.d.ts +4 -0
- package/react/components/menus/ContentLibraryMenu.d.ts +4 -0
- package/react/components/menus/ReusableContentMenu.d.ts +3 -0
- package/react/components/menus/content/ContentItemsMenu.d.ts +5 -0
- package/react/components/menus/content/ContentTypesMenu.d.ts +6 -0
- package/react/components/menus/content/partials/ContentFieldMenuItem.d.ts +6 -0
- package/react/components/menus/content/partials/ContentValueMenuItem.d.ts +7 -0
- package/react/components/menus/partials/MenuButton.d.ts +8 -0
- package/react/components/menus/partials/MenuContainer.d.ts +4 -0
- package/react/components/menus/partials/MenuHeader.d.ts +6 -0
- package/react/components/toolbar/Toolbar.d.ts +6 -0
- package/react/components/toolbar/ToolbarBlockButton.d.ts +13 -0
- package/react/components/toolbar/ToolbarHeadingDropdownButton.d.ts +2 -0
- package/react/components/toolbar/ToolbarMarkButton.d.ts +7 -0
- package/react/components/toolbar/content/ContentExtractToolbarButton.d.ts +2 -0
- package/react/components/toolbar/content/ContentLibraryToolbarButton.d.ts +5 -0
- package/react/components/toolbar/content/ContentToolbar.d.ts +4 -0
- package/react/config/hotkeys.d.ts +2 -0
- package/react/plugins/index.d.ts +3 -0
- package/react/store/editorSlice.d.ts +161 -0
- package/react/store/store.d.ts +5 -0
- package/react/types.d.ts +55 -0
- package/react/utils/decorator.d.ts +15 -0
- package/react/utils/index.d.ts +15 -0
package/package.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@platecms/delta-smart-text",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Provides a component to display smart text by using slate.",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://bitbucket.org/startmetplate/delta.git"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://bitbucket.org/startmetplate/delta/src/dev/packages/delta-smart-text",
|
|
14
|
+
"main": "./index.js",
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"type": "module",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"import": "./index.mjs",
|
|
20
|
+
"require": "./index.js",
|
|
21
|
+
"types": "./index.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./index.css": "./index.css"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@fortawesome/free-regular-svg-icons": "6.7.2",
|
|
27
|
+
"@fortawesome/free-solid-svg-icons": "6.7.2",
|
|
28
|
+
"@fortawesome/react-fontawesome": "0.2.2",
|
|
29
|
+
"@platecms/delta-cast": "0.4.8",
|
|
30
|
+
"@platecms/delta-plate-resource-notation": "1.4.1",
|
|
31
|
+
"@graphql-codegen/cli": "5.0.3",
|
|
32
|
+
"@graphql-typed-document-node/core": "3.2.0",
|
|
33
|
+
"@platecms/delta-cast-util-to-plaintext": "1.0.3",
|
|
34
|
+
"@reduxjs/toolkit": "2.5.1",
|
|
35
|
+
"class-transformer": "0.5.1",
|
|
36
|
+
"graphql": "16.10.0",
|
|
37
|
+
"is-hotkey": "0.2.0",
|
|
38
|
+
"lodash": "4.17.21",
|
|
39
|
+
"prismjs": "1.29.0",
|
|
40
|
+
"react": "19.0.0",
|
|
41
|
+
"react-dom": "19.0.0",
|
|
42
|
+
"react-redux": "9.2.0",
|
|
43
|
+
"redux-watch": "1.2.0",
|
|
44
|
+
"reflect-metadata": "0.2.2",
|
|
45
|
+
"slate": "0.112.0",
|
|
46
|
+
"slate-react": "0.112.1",
|
|
47
|
+
"tslib": "2.8.1",
|
|
48
|
+
"uuid": "11.0.5",
|
|
49
|
+
"vue": "3.5.13",
|
|
50
|
+
"@vitejs/plugin-vue": "4.5.0",
|
|
51
|
+
"vite-plugin-dts": "4.5.0",
|
|
52
|
+
"@tailwindcss/vite": "4.0.6",
|
|
53
|
+
"@vitejs/plugin-react": "4.3.4",
|
|
54
|
+
"zwitch": "2.0.4",
|
|
55
|
+
"@apollo/client": "3.13.1",
|
|
56
|
+
"@testing-library/react": "^16.3.0",
|
|
57
|
+
"react-tooltip": "^5.28.1"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ApolloClient, NormalizedCacheObject } from '@apollo/client';
|
|
2
|
+
export declare class DeltaSlateEditorConnector {
|
|
3
|
+
private readonly root;
|
|
4
|
+
private readonly uuid;
|
|
5
|
+
private readonly context;
|
|
6
|
+
private readonly client;
|
|
7
|
+
constructor(targetEl: HTMLElement, uuid: string, client: ApolloClient<NormalizedCacheObject>, context: HTMLElement | null);
|
|
8
|
+
render(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { DeltaElement } from '../types';
|
|
3
|
+
export declare function Element({ attributes, children, element, }: {
|
|
4
|
+
attributes: HTMLAttributes<HTMLElement>;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
element: DeltaElement;
|
|
7
|
+
}): React.ReactElement;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { CodeElement as CodeElementType } from '../../types';
|
|
3
|
+
export declare function CodeElement(props: {
|
|
4
|
+
attributes: HTMLAttributes<HTMLElement>;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
element: CodeElementType;
|
|
7
|
+
}): React.ReactElement;
|
|
8
|
+
export default CodeElement;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { default as React, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { ContentValueElement as ContentValueElementType } from '../../types';
|
|
3
|
+
export declare function ContentValueElement({ attributes, children, element, }: {
|
|
4
|
+
attributes: HTMLAttributes<HTMLElement>;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
element: ContentValueElementType;
|
|
7
|
+
}): React.ReactElement;
|
|
8
|
+
export default ContentValueElement;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ContentType } from './../../../../../__generated__/graphql';
|
|
2
|
+
export declare function ContentTypesMenu({ onContentTypeClick, }: {
|
|
3
|
+
uuid: string;
|
|
4
|
+
onContentTypeClick: (contentType: ContentType) => void;
|
|
5
|
+
}): React.ReactElement;
|
|
6
|
+
export default ContentTypesMenu;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ContentValue } from '../../../../../../__generated__/graphql';
|
|
3
|
+
export declare function ContentValueMenuItem({ contentValue, onClick, }: {
|
|
4
|
+
contentValue: ContentValue;
|
|
5
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
6
|
+
}): React.ReactElement;
|
|
7
|
+
export default ContentValueMenuItem;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IconDefinition } from '@fortawesome/free-regular-svg-icons';
|
|
2
|
+
import { default as React, ReactNode } from 'react';
|
|
3
|
+
export declare function MenuButton({ icon, text, onClick, children, }: {
|
|
4
|
+
icon?: IconDefinition;
|
|
5
|
+
text: string;
|
|
6
|
+
onClick?: (event: React.MouseEvent) => void;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}): React.ReactElement;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
import { HeadingElement, ListElement } from '../../types';
|
|
3
|
+
import { IconDefinition } from '@fortawesome/free-regular-svg-icons';
|
|
4
|
+
export declare function ToolbarBlockButton({ format, properties, icon, children, }: {
|
|
5
|
+
format: "code" | "heading" | "list";
|
|
6
|
+
icon: IconDefinition;
|
|
7
|
+
properties?: {
|
|
8
|
+
level?: HeadingElement["level"];
|
|
9
|
+
ordered?: ListElement["ordered"];
|
|
10
|
+
};
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}): React.ReactElement;
|
|
13
|
+
export default ToolbarBlockButton;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { IconDefinition } from '@fortawesome/free-regular-svg-icons';
|
|
3
|
+
declare function ToolbarMarkButton({ format, icon, }: {
|
|
4
|
+
format: "bold" | "italic" | "strikethrough" | "underline";
|
|
5
|
+
icon: IconDefinition;
|
|
6
|
+
}): React.ReactElement;
|
|
7
|
+
export default ToolbarMarkButton;
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { BaseSelection, Descendant } from 'slate';
|
|
2
|
+
import { ContentItem, ContentType } from '../../../__generated__/graphql';
|
|
3
|
+
interface EditorSlice {
|
|
4
|
+
states: EditorState[];
|
|
5
|
+
}
|
|
6
|
+
export interface EditorState {
|
|
7
|
+
uuid: string;
|
|
8
|
+
search: string;
|
|
9
|
+
target: BaseSelection | undefined;
|
|
10
|
+
initialValue: Descendant[];
|
|
11
|
+
value: Descendant[];
|
|
12
|
+
selected: {
|
|
13
|
+
contentType: string | undefined;
|
|
14
|
+
contentItem: string | undefined;
|
|
15
|
+
};
|
|
16
|
+
options: {
|
|
17
|
+
contentTypes: ContentType[];
|
|
18
|
+
contentItems: Record<string, ContentItem[]>;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export declare const defaultEditorFieldState: Omit<EditorState, "uuid">;
|
|
22
|
+
declare function selectStates(state: EditorSlice): EditorState[];
|
|
23
|
+
declare function selectStateIndex(state: EditorSlice, uuid: string): number;
|
|
24
|
+
export declare const selectById: import('@reduxjs/toolkit').Selector<{
|
|
25
|
+
editor: EditorSlice;
|
|
26
|
+
}, EditorState, [uuid: string]> & {
|
|
27
|
+
unwrapped: ((state: EditorSlice, uuid: string) => EditorState) & {
|
|
28
|
+
clearCache: () => void;
|
|
29
|
+
resultsCount: () => number;
|
|
30
|
+
resetResultsCount: () => void;
|
|
31
|
+
} & {
|
|
32
|
+
resultFunc: (resultFuncArgs_0: EditorState[], resultFuncArgs_1: number) => EditorState;
|
|
33
|
+
memoizedResultFunc: ((resultFuncArgs_0: EditorState[], resultFuncArgs_1: number) => EditorState) & {
|
|
34
|
+
clearCache: () => void;
|
|
35
|
+
resultsCount: () => number;
|
|
36
|
+
resetResultsCount: () => void;
|
|
37
|
+
};
|
|
38
|
+
lastResult: () => EditorState;
|
|
39
|
+
dependencies: [typeof selectStates, typeof selectStateIndex];
|
|
40
|
+
recomputations: () => number;
|
|
41
|
+
resetRecomputations: () => void;
|
|
42
|
+
dependencyRecomputations: () => number;
|
|
43
|
+
resetDependencyRecomputations: () => void;
|
|
44
|
+
} & {
|
|
45
|
+
memoize: typeof import('@reduxjs/toolkit').weakMapMemoize;
|
|
46
|
+
argsMemoize: typeof import('@reduxjs/toolkit').weakMapMemoize;
|
|
47
|
+
};
|
|
48
|
+
}, selectByIdTarget: import('@reduxjs/toolkit').Selector<{
|
|
49
|
+
editor: EditorSlice;
|
|
50
|
+
}, BaseSelection | undefined, [uuid: string]> & {
|
|
51
|
+
unwrapped: ((state: EditorSlice, uuid: string) => BaseSelection | undefined) & {
|
|
52
|
+
clearCache: () => void;
|
|
53
|
+
resultsCount: () => number;
|
|
54
|
+
resetResultsCount: () => void;
|
|
55
|
+
} & {
|
|
56
|
+
resultFunc: (resultFuncArgs_0: EditorState) => BaseSelection | undefined;
|
|
57
|
+
memoizedResultFunc: ((resultFuncArgs_0: EditorState) => BaseSelection | undefined) & {
|
|
58
|
+
clearCache: () => void;
|
|
59
|
+
resultsCount: () => number;
|
|
60
|
+
resetResultsCount: () => void;
|
|
61
|
+
};
|
|
62
|
+
lastResult: () => BaseSelection | undefined;
|
|
63
|
+
dependencies: [((state: EditorSlice, uuid: string) => EditorState) & {
|
|
64
|
+
clearCache: () => void;
|
|
65
|
+
resultsCount: () => number;
|
|
66
|
+
resetResultsCount: () => void;
|
|
67
|
+
} & {
|
|
68
|
+
resultFunc: (resultFuncArgs_0: EditorState[], resultFuncArgs_1: number) => EditorState;
|
|
69
|
+
memoizedResultFunc: ((resultFuncArgs_0: EditorState[], resultFuncArgs_1: number) => EditorState) & {
|
|
70
|
+
clearCache: () => void;
|
|
71
|
+
resultsCount: () => number;
|
|
72
|
+
resetResultsCount: () => void;
|
|
73
|
+
};
|
|
74
|
+
lastResult: () => EditorState;
|
|
75
|
+
dependencies: [typeof selectStates, typeof selectStateIndex];
|
|
76
|
+
recomputations: () => number;
|
|
77
|
+
resetRecomputations: () => void;
|
|
78
|
+
dependencyRecomputations: () => number;
|
|
79
|
+
resetDependencyRecomputations: () => void;
|
|
80
|
+
} & {
|
|
81
|
+
memoize: typeof import('@reduxjs/toolkit').weakMapMemoize;
|
|
82
|
+
argsMemoize: typeof import('@reduxjs/toolkit').weakMapMemoize;
|
|
83
|
+
}];
|
|
84
|
+
recomputations: () => number;
|
|
85
|
+
resetRecomputations: () => void;
|
|
86
|
+
dependencyRecomputations: () => number;
|
|
87
|
+
resetDependencyRecomputations: () => void;
|
|
88
|
+
} & {
|
|
89
|
+
memoize: typeof import('@reduxjs/toolkit').weakMapMemoize;
|
|
90
|
+
argsMemoize: typeof import('@reduxjs/toolkit').weakMapMemoize;
|
|
91
|
+
};
|
|
92
|
+
}, selectByIdSelected: import('@reduxjs/toolkit').Selector<{
|
|
93
|
+
editor: EditorSlice;
|
|
94
|
+
}, {
|
|
95
|
+
contentType: string | undefined;
|
|
96
|
+
contentItem: string | undefined;
|
|
97
|
+
}, [uuid: string]> & {
|
|
98
|
+
unwrapped: ((state: EditorSlice, uuid: string) => {
|
|
99
|
+
contentType: string | undefined;
|
|
100
|
+
contentItem: string | undefined;
|
|
101
|
+
}) & {
|
|
102
|
+
clearCache: () => void;
|
|
103
|
+
resultsCount: () => number;
|
|
104
|
+
resetResultsCount: () => void;
|
|
105
|
+
} & {
|
|
106
|
+
resultFunc: (resultFuncArgs_0: EditorState) => {
|
|
107
|
+
contentType: string | undefined;
|
|
108
|
+
contentItem: string | undefined;
|
|
109
|
+
};
|
|
110
|
+
memoizedResultFunc: ((resultFuncArgs_0: EditorState) => {
|
|
111
|
+
contentType: string | undefined;
|
|
112
|
+
contentItem: string | undefined;
|
|
113
|
+
}) & {
|
|
114
|
+
clearCache: () => void;
|
|
115
|
+
resultsCount: () => number;
|
|
116
|
+
resetResultsCount: () => void;
|
|
117
|
+
};
|
|
118
|
+
lastResult: () => {
|
|
119
|
+
contentType: string | undefined;
|
|
120
|
+
contentItem: string | undefined;
|
|
121
|
+
};
|
|
122
|
+
dependencies: [((state: EditorSlice, uuid: string) => EditorState) & {
|
|
123
|
+
clearCache: () => void;
|
|
124
|
+
resultsCount: () => number;
|
|
125
|
+
resetResultsCount: () => void;
|
|
126
|
+
} & {
|
|
127
|
+
resultFunc: (resultFuncArgs_0: EditorState[], resultFuncArgs_1: number) => EditorState;
|
|
128
|
+
memoizedResultFunc: ((resultFuncArgs_0: EditorState[], resultFuncArgs_1: number) => EditorState) & {
|
|
129
|
+
clearCache: () => void;
|
|
130
|
+
resultsCount: () => number;
|
|
131
|
+
resetResultsCount: () => void;
|
|
132
|
+
};
|
|
133
|
+
lastResult: () => EditorState;
|
|
134
|
+
dependencies: [typeof selectStates, typeof selectStateIndex];
|
|
135
|
+
recomputations: () => number;
|
|
136
|
+
resetRecomputations: () => void;
|
|
137
|
+
dependencyRecomputations: () => number;
|
|
138
|
+
resetDependencyRecomputations: () => void;
|
|
139
|
+
} & {
|
|
140
|
+
memoize: typeof import('@reduxjs/toolkit').weakMapMemoize;
|
|
141
|
+
argsMemoize: typeof import('@reduxjs/toolkit').weakMapMemoize;
|
|
142
|
+
}];
|
|
143
|
+
recomputations: () => number;
|
|
144
|
+
resetRecomputations: () => void;
|
|
145
|
+
dependencyRecomputations: () => number;
|
|
146
|
+
resetDependencyRecomputations: () => void;
|
|
147
|
+
} & {
|
|
148
|
+
memoize: typeof import('@reduxjs/toolkit').weakMapMemoize;
|
|
149
|
+
argsMemoize: typeof import('@reduxjs/toolkit').weakMapMemoize;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
export declare const setState: import('@reduxjs/toolkit').ActionCreatorWithPayload<{
|
|
153
|
+
uuid: string;
|
|
154
|
+
state?: Partial<Omit<EditorState, "uuid">>;
|
|
155
|
+
context?: string;
|
|
156
|
+
}, "editor/setState">, setInitialValue: import('@reduxjs/toolkit').ActionCreatorWithPayload<{
|
|
157
|
+
uuid: string;
|
|
158
|
+
initialValue: Descendant[];
|
|
159
|
+
}, "editor/setInitialValue">;
|
|
160
|
+
declare const _default: import('@reduxjs/toolkit').Reducer<EditorSlice>;
|
|
161
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Action, Store, ThunkAction } from '@reduxjs/toolkit';
|
|
2
|
+
export declare const store: Store;
|
|
3
|
+
export type RootState = ReturnType<typeof store.getState>;
|
|
4
|
+
export type AppDispatch = typeof store.dispatch;
|
|
5
|
+
export type AppThunk<ReturnType = void> = ThunkAction<ReturnType, RootState, unknown, Action<string>>;
|
package/react/types.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { BaseEditor } from 'slate';
|
|
2
|
+
import { ReactEditor } from 'slate-react';
|
|
3
|
+
import { Root } from '../../../cast/src/index.ts';
|
|
4
|
+
declare module "slate" {
|
|
5
|
+
interface CustomTypes {
|
|
6
|
+
Editor: BaseEditor & ReactEditor;
|
|
7
|
+
Element: DeltaElement;
|
|
8
|
+
Text: DeltaLeaf;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export interface DeltaLeafMarkdown {
|
|
12
|
+
title?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export type DeltaElement = BlockquoteElement | CodeElement | ContentValueElement | HeadingElement | ListElement | ListItemElement | ParagraphElement;
|
|
15
|
+
export type DeltaLeaf = DeltaLeafMarkdown & {
|
|
16
|
+
text: string;
|
|
17
|
+
bold?: true;
|
|
18
|
+
italic?: true;
|
|
19
|
+
underline?: true;
|
|
20
|
+
strikethrough?: true;
|
|
21
|
+
inlineCode?: true;
|
|
22
|
+
highlight?: true;
|
|
23
|
+
};
|
|
24
|
+
export interface ParagraphElement {
|
|
25
|
+
type: "paragraph";
|
|
26
|
+
children: (ContentValueElement | DeltaLeaf)[];
|
|
27
|
+
}
|
|
28
|
+
export interface HeadingElement {
|
|
29
|
+
type: "heading";
|
|
30
|
+
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
31
|
+
children: DeltaLeaf[];
|
|
32
|
+
}
|
|
33
|
+
export interface ListElement {
|
|
34
|
+
type: "list";
|
|
35
|
+
ordered: boolean;
|
|
36
|
+
children: ListItemElement[];
|
|
37
|
+
}
|
|
38
|
+
export interface ListItemElement {
|
|
39
|
+
type: "listItem";
|
|
40
|
+
children: DeltaLeaf[];
|
|
41
|
+
}
|
|
42
|
+
export interface BlockquoteElement {
|
|
43
|
+
type: "blockquote";
|
|
44
|
+
children: DeltaLeaf[];
|
|
45
|
+
}
|
|
46
|
+
export interface CodeElement {
|
|
47
|
+
type: "code";
|
|
48
|
+
children: DeltaLeaf[];
|
|
49
|
+
}
|
|
50
|
+
export interface ContentValueElement {
|
|
51
|
+
type: "contentValue";
|
|
52
|
+
prn: string;
|
|
53
|
+
root: Root | undefined;
|
|
54
|
+
children: DeltaLeaf[];
|
|
55
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DeltaLeaf } from '../types';
|
|
2
|
+
export type Decorator<T> = (element: T, decorations: string[]) => string[];
|
|
3
|
+
export type LeafDecorator = Decorator<DeltaLeaf>;
|
|
4
|
+
declare function fontWeight(leaf: DeltaLeaf, decorations: string[]): string[];
|
|
5
|
+
declare function fontSize(leaf: DeltaLeaf, decorations: string[]): string[];
|
|
6
|
+
declare function fontStyle(leaf: DeltaLeaf, decorations: string[]): string[];
|
|
7
|
+
declare function textDecoration(leaf: DeltaLeaf, decorations: string[]): string[];
|
|
8
|
+
export declare class DecoratorBuilder<T extends object> {
|
|
9
|
+
private readonly element;
|
|
10
|
+
private readonly decorators;
|
|
11
|
+
constructor(element: T);
|
|
12
|
+
add(decorator: Decorator<T>): DecoratorBuilder<T>;
|
|
13
|
+
build(): (decorations: string[]) => string[];
|
|
14
|
+
}
|
|
15
|
+
export { fontSize, fontWeight, fontStyle, textDecoration };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseEditor, Editor } from 'slate';
|
|
2
|
+
import { DeltaLeaf, HeadingElement, ListElement } from '../types';
|
|
3
|
+
import { ReactEditor } from 'slate-react';
|
|
4
|
+
import { default as React } from 'react';
|
|
5
|
+
export declare function hasMark(editor: Editor, format: keyof Omit<DeltaLeaf, "text">): boolean;
|
|
6
|
+
export declare function toggleMark(editor: Editor, format: keyof Omit<DeltaLeaf, "text">): void;
|
|
7
|
+
export declare function isBlockActive(editor: BaseEditor & ReactEditor, format: "code" | "heading" | "list", properties?: {
|
|
8
|
+
level?: HeadingElement["level"];
|
|
9
|
+
ordered?: ListElement["ordered"];
|
|
10
|
+
}): boolean;
|
|
11
|
+
export declare function toggleBlock(editor: BaseEditor & ReactEditor, format: "code" | "heading" | "list", properties?: {
|
|
12
|
+
level?: HeadingElement["level"];
|
|
13
|
+
ordered?: ListElement["ordered"];
|
|
14
|
+
}): void;
|
|
15
|
+
export declare function useClickOutside(ref: React.RefObject<HTMLElement | null>, callback: () => void): void;
|