@fastkit/vui 0.12.9 → 0.12.10

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.
Files changed (33) hide show
  1. package/dist/vui.css +138 -409
  2. package/dist/vui.css.map +1 -1
  3. package/dist/vui.d.ts +97 -409
  4. package/dist/vui.mjs +167 -1125
  5. package/dist/vui.mjs.map +1 -1
  6. package/package.json +18 -40
  7. package/src/components/index.ts +3 -1
  8. package/src/injections.ts +1 -1
  9. package/src/components/VWysiwygEditor/VWysiwygEditor.scss +0 -68
  10. package/src/components/VWysiwygEditor/VWysiwygEditor.tsx +0 -354
  11. package/src/components/VWysiwygEditor/extensions/color.ts +0 -72
  12. package/src/components/VWysiwygEditor/extensions/index.ts +0 -2
  13. package/src/components/VWysiwygEditor/extensions/linter/Linter.scss +0 -139
  14. package/src/components/VWysiwygEditor/extensions/linter/Linter.tsx +0 -210
  15. package/src/components/VWysiwygEditor/extensions/linter/LinterPlugin.ts +0 -65
  16. package/src/components/VWysiwygEditor/extensions/linter/index.ts +0 -5
  17. package/src/components/VWysiwygEditor/extensions/linter/plugins/BadWords.tsx +0 -50
  18. package/src/components/VWysiwygEditor/extensions/linter/plugins/HeadingLevel.ts +0 -39
  19. package/src/components/VWysiwygEditor/extensions/linter/plugins/Punctuation.ts +0 -49
  20. package/src/components/VWysiwygEditor/extensions/linter/plugins/index.ts +0 -3
  21. package/src/components/VWysiwygEditor/extensions/linter/utils.ts +0 -28
  22. package/src/components/VWysiwygEditor/index.ts +0 -4
  23. package/src/components/VWysiwygEditor/schemes.ts +0 -251
  24. package/src/components/VWysiwygEditor/tools/bullet-list.ts +0 -18
  25. package/src/components/VWysiwygEditor/tools/color.scss +0 -134
  26. package/src/components/VWysiwygEditor/tools/color.tsx +0 -90
  27. package/src/components/VWysiwygEditor/tools/format-bold.ts +0 -19
  28. package/src/components/VWysiwygEditor/tools/format-italic.ts +0 -18
  29. package/src/components/VWysiwygEditor/tools/format-underline.ts +0 -18
  30. package/src/components/VWysiwygEditor/tools/history.ts +0 -26
  31. package/src/components/VWysiwygEditor/tools/index.ts +0 -8
  32. package/src/components/VWysiwygEditor/tools/link.ts +0 -57
  33. package/src/components/VWysiwygEditor/tools/ordered-list.ts +0 -21
@@ -1,251 +0,0 @@
1
- import { type VuiService } from '../../service';
2
- import {
3
- type Editor,
4
- type Extensions,
5
- type Node,
6
- type Extension,
7
- type Mark,
8
- type AnyExtension,
9
- type EditorOptions,
10
- } from '@tiptap/vue-3';
11
- import { type IconName } from '../VIcon';
12
- import { VNodeChild } from 'vue';
13
-
14
- const EDITOR_EVENTS = [
15
- 'beforeCreate',
16
- 'create',
17
- 'update',
18
- 'selectionUpdate',
19
- 'transaction',
20
- 'focus',
21
- 'blur',
22
- 'destroy',
23
- ] as const;
24
-
25
- type PrefixedEventName<S extends string> = `on${Capitalize<S>}`;
26
-
27
- const prefixedEventName = <S extends string>(
28
- source: S,
29
- ): PrefixedEventName<S> => {
30
- return `on${source.charAt(0).toUpperCase()}${source.slice(1)}` as any;
31
- };
32
-
33
- export type WysiwygEditorEvent = (typeof EDITOR_EVENTS)[number];
34
-
35
- export type WysiwygEditorPrefixedEvent = PrefixedEventName<WysiwygEditorEvent>;
36
-
37
- // eslint-disable-next-line @typescript-eslint/no-empty-interface
38
- export interface WysiwygEditorEventsOptions
39
- extends Partial<Pick<EditorOptions, WysiwygEditorPrefixedEvent>> {}
40
-
41
- export type WysiwygEditorEventsBucket = {
42
- [EV in WysiwygEditorEvent]: NonNullable<
43
- WysiwygEditorEventsOptions[PrefixedEventName<EV>]
44
- >[];
45
- };
46
-
47
- export class WysiwygEditorInitializeContext {
48
- readonly listeners: WysiwygEditorEventsBucket = {} as any;
49
- private readonly _vui: () => VuiService;
50
-
51
- get vui() {
52
- return this._vui();
53
- }
54
-
55
- constructor(
56
- vuiGetter: () => VuiService,
57
- opts: WysiwygEditorEventsOptions = {},
58
- ) {
59
- this._vui = vuiGetter;
60
-
61
- EDITOR_EVENTS.forEach((event) => {
62
- this.listeners[event] = [];
63
- const prefixed = prefixedEventName(event);
64
- const fn = opts[prefixed];
65
- fn && this.listeners[event].push(fn as any);
66
- });
67
- }
68
-
69
- on<EV extends WysiwygEditorEvent>(
70
- ev: EV,
71
- handler: NonNullable<WysiwygEditorEventsOptions[PrefixedEventName<EV>]>,
72
- ) {
73
- this.listeners[ev].push(handler);
74
- return () => this.off(ev, handler);
75
- }
76
-
77
- off<EV extends WysiwygEditorEvent>(
78
- ev: EV,
79
- handler: NonNullable<WysiwygEditorEventsOptions[PrefixedEventName<EV>]>,
80
- ) {
81
- this.listeners[ev] = this.listeners[ev].filter(
82
- (_handler) => _handler !== handler,
83
- ) as any;
84
- }
85
-
86
- editorOptions() {
87
- const opts: WysiwygEditorEventsOptions = {};
88
-
89
- EDITOR_EVENTS.forEach((event) => {
90
- const prefixed = prefixedEventName(event);
91
- opts[prefixed] = (props) => {
92
- const handlers = this.listeners[event];
93
- handlers.forEach((handler) => {
94
- handler(props as any);
95
- });
96
- };
97
- });
98
-
99
- return opts;
100
- }
101
- }
102
-
103
- export interface WysiwygEditorContext {
104
- editor: Editor;
105
- vui: VuiService;
106
- }
107
-
108
- export type WysiwygExtensionFactory<Options = any, Storage = any> = (
109
- ctx: WysiwygEditorInitializeContext,
110
- ) =>
111
- | Extension<Options, Storage>
112
- | Node<Options, Storage>
113
- | Mark<Options, Storage>;
114
-
115
- export interface CreatedWysiwygExtension<Options = any, Storage = any> {
116
- __isCreatedWysiwygExtension: true;
117
- _configs: Partial<Options>[];
118
- configure(
119
- options?: Partial<Options>,
120
- ): CreatedWysiwygExtension<Options, Storage>;
121
- raw: WysiwygExtensionSource<Options, Storage>;
122
- }
123
-
124
- export type WysiwygExtensionSource<Options = any, Storage = any> =
125
- | Extension<Options, Storage>
126
- | Node<Options, Storage>
127
- | Mark<Options, Storage>
128
- | WysiwygExtensionFactory<Options, Storage>;
129
-
130
- export type RawWysiwygExtension<Options = any, Storage = any> =
131
- | WysiwygExtensionSource<Options, Storage>
132
- | CreatedWysiwygExtension<Options, Storage>;
133
-
134
- // export function createWysiwygExtension<Options = any, Storage = any>(
135
- // extension: Extension<Options, Storage>,
136
- // ): Extension<Options, Storage>;
137
- // export function createWysiwygExtension<Options = any, Storage = any>(
138
- // node: Node<Options, Storage>,
139
- // ): Node<Options, Storage>;
140
- // export function createWysiwygExtension<Options = any, Storage = any>(
141
- // mark: Mark<Options, Storage>,
142
- // ): Mark<Options, Storage>;
143
- // export function createWysiwygExtension<Options = any, Storage = any>(
144
- // factory: WysiwygExtensionFactory<Options, Storage>,
145
- // ): WysiwygExtensionFactory<Options, Storage>;
146
-
147
- function isCreatedWysiwygExtension<Options = any, Storage = any>(
148
- source: unknown,
149
- ): source is CreatedWysiwygExtension<Options, Storage> {
150
- return (
151
- !!source &&
152
- typeof source === 'object' &&
153
- (source as CreatedWysiwygExtension).__isCreatedWysiwygExtension === true
154
- );
155
- }
156
-
157
- export function createWysiwygExtension<Options = any, Storage = any>(
158
- extension: WysiwygExtensionSource<Options, Storage>,
159
- ) {
160
- const ext: CreatedWysiwygExtension<Options, Storage> = {
161
- __isCreatedWysiwygExtension: true,
162
- _configs: [],
163
- configure: (opts) => {
164
- opts && ext._configs.push(opts);
165
- return ext;
166
- },
167
- raw: extension,
168
- };
169
- return ext;
170
- }
171
-
172
- function resolveRawWysiwygExtension(
173
- raw: RawWysiwygExtension,
174
- ctx: WysiwygEditorInitializeContext,
175
- ): AnyExtension {
176
- if (isCreatedWysiwygExtension(raw)) {
177
- const { raw: _raw, _configs } = raw;
178
- let ext = typeof _raw === 'function' ? _raw(ctx) : _raw;
179
- _configs.forEach((config) => {
180
- ext = ext.configure(config);
181
- });
182
- return ext;
183
- }
184
- return typeof raw === 'function' ? raw(ctx) : raw;
185
- }
186
-
187
- export function resolveRawWysiwygExtensions(
188
- raws: RawWysiwygExtension[],
189
- ctx: WysiwygEditorInitializeContext,
190
- ) {
191
- return raws.map((raw) => resolveRawWysiwygExtension(raw, ctx));
192
- }
193
-
194
- export interface WysiwygEditorTool {
195
- key: string;
196
- icon:
197
- | IconName
198
- | ((ctx: WysiwygEditorContext) => IconName | (() => VNodeChild));
199
- active?: boolean | ((ctx: WysiwygEditorContext) => boolean);
200
- disabled?: boolean | ((ctx: WysiwygEditorContext) => boolean);
201
- onClick: (ctx: WysiwygEditorContext, ev: MouseEvent) => any;
202
- floating?: boolean;
203
- extensions?: Extensions;
204
- }
205
-
206
- export type WysiwygEditorToolFactory<Options = void> = (
207
- vui: VuiService,
208
- options?: Options,
209
- ) => WysiwygEditorTool | WysiwygEditorTool[];
210
-
211
- export type RawWysiwygEditorTool =
212
- | WysiwygEditorTool
213
- | WysiwygEditorToolFactory<any>;
214
-
215
- function resolveRawWysiwygEditorTool(
216
- raw: RawWysiwygEditorTool,
217
- vui: VuiService,
218
- ) {
219
- return typeof raw === 'function' ? raw(vui) : raw;
220
- }
221
-
222
- export interface ResolvedWysiwygEditorSettings {
223
- tools: WysiwygEditorTool[];
224
- extensions: Extensions;
225
- }
226
-
227
- export function resolveRawWysiwygEditorTools(
228
- rawTools: RawWysiwygEditorTool[],
229
- vui: VuiService,
230
- ): ResolvedWysiwygEditorSettings {
231
- const tools: WysiwygEditorTool[] = [];
232
- const extensions: Extensions = [];
233
-
234
- rawTools.forEach((raw) => {
235
- let resolved = resolveRawWysiwygEditorTool(raw, vui);
236
- if (!Array.isArray(resolved)) {
237
- resolved = [resolved];
238
- }
239
- resolved.forEach((tool) => {
240
- tools.push(tool);
241
- if (tool.extensions) {
242
- extensions.push(...tool.extensions);
243
- }
244
- });
245
- });
246
-
247
- return {
248
- tools,
249
- extensions,
250
- };
251
- }
@@ -1,18 +0,0 @@
1
- import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';
2
- import { BulletList, BulletListOptions } from '@tiptap/extension-bullet-list';
3
-
4
- export const WysiwygBulletListTool: WysiwygEditorToolFactory<
5
- BulletListOptions
6
- > = (vui, options) => {
7
- const tool: WysiwygEditorTool = {
8
- key: 'bulletList',
9
- icon: vui.icon('editorformatListBulleted'),
10
- active: ({ editor }) => editor.isActive('bulletList'),
11
- onClick: ({ editor }) => {
12
- editor.chain().focus().toggleBulletList().run();
13
- },
14
- floating: true,
15
- extensions: [BulletList.configure(options)],
16
- };
17
- return tool;
18
- };
@@ -1,134 +0,0 @@
1
- :root {
2
- --v-wysiwyg-color-tool: 30px;
3
- }
4
-
5
- @layer vui {
6
- .v-wysiwyg-color-tool {
7
- &__button {
8
- position: relative;
9
- display: inline-flex;
10
- align-items: center;
11
- justify-content: center;
12
- vertical-align: bottom;
13
-
14
- &__bar {
15
- position: absolute;
16
- right: 0;
17
- bottom: 0;
18
- left: 0;
19
- display: block;
20
- height: 2px;
21
- background: currentColor;
22
- }
23
- }
24
-
25
- &__menu {
26
- .v-dialog__content {
27
- min-width: 0;
28
- }
29
-
30
- .v-dialog__body {
31
- padding: 2px;
32
- }
33
- }
34
-
35
- &__items {
36
- --item-size: var(--v-wysiwyg-color-tool);
37
-
38
- display: inline-flex;
39
- flex-wrap: wrap;
40
- align-items: center;
41
- max-width: calc(var(--item-size) * 5);
42
- vertical-align: bottom;
43
-
44
- &--with-label {
45
- display: flex;
46
- flex-direction: column;
47
- // flex-wrap: nowrap;
48
- align-items: flex-start;
49
- max-width: none;
50
- padding: 2px;
51
- }
52
- }
53
-
54
- &__item {
55
- --focus-offset: calc(var(--item-size) * 0.05);
56
-
57
- position: relative;
58
- display: flex;
59
- flex-basis: var(--item-size);
60
- align-items: center;
61
- width: var(--item-size);
62
- height: var(--item-size);
63
- padding: 0;
64
- margin: 0;
65
- // margin: 2px;
66
- cursor: pointer;
67
- background: transparent;
68
- border: 0;
69
- border-radius: 0;
70
- outline: 0;
71
- appearance: none;
72
-
73
- &__color {
74
- position: relative;
75
- flex: 0 0 var(--item-size);
76
- width: var(--item-size);
77
- height: var(--item-size);
78
-
79
- &::before {
80
- position: absolute;
81
- inset: 0;
82
- display: block;
83
- content: '';
84
- background: currentColor;
85
- border: solid 1px transparent;
86
- transition: all 0.15s;
87
- }
88
- }
89
-
90
- &__name {
91
- position: relative;
92
- padding: 0 8px;
93
- font-size: 12px;
94
- white-space: nowrap;
95
- }
96
-
97
- &:hover &__color,
98
- &:focus &__color {
99
- &::before {
100
- inset: var(--focus-offset) var(--focus-offset) var(--focus-offset)
101
- var(--focus-offset);
102
- border-color: rgba(0, 0, 0, 0.1);
103
- }
104
- }
105
- }
106
-
107
- &__items--with-label &__item {
108
- flex-basis: auto;
109
- width: auto;
110
- width: 100%;
111
-
112
- &::before {
113
- position: absolute;
114
- inset: 0;
115
- display: block;
116
- content: '';
117
- background: currentColor;
118
- opacity: 0;
119
- transition: opacity 0.15s;
120
- }
121
-
122
- &:hover,
123
- &:focus {
124
- &::before {
125
- opacity: 0.1;
126
- }
127
- }
128
-
129
- & + .v-wysiwyg-color-tool__item {
130
- margin-top: 2px;
131
- }
132
- }
133
- }
134
- }
@@ -1,90 +0,0 @@
1
- import './color.scss';
2
-
3
- import { VNodeChild } from 'vue';
4
- import { WysiwygColorExtension } from '../extensions';
5
- import { type VuiService } from '../../../service';
6
- import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';
7
- import TextStyle from '@tiptap/extension-text-style';
8
- import { VIcon } from '../../VIcon';
9
-
10
- export interface WysiwygColorItem {
11
- key?: string | number;
12
- name?: VNodeChild | ((vui: VuiService) => VNodeChild);
13
- color: string | null;
14
- }
15
-
16
- export interface CreateWysiwygColorToolOptions {
17
- items: WysiwygColorItem[];
18
- withLabel?: boolean;
19
- }
20
-
21
- export function createWysiwygColorTool(opts: CreateWysiwygColorToolOptions) {
22
- const WysiwygColorTool: WysiwygEditorToolFactory = (vui) => {
23
- const tool: WysiwygEditorTool = {
24
- key: 'textColor',
25
- // active: ({ editor }) => editor.isActive('textStyle'),
26
- icon:
27
- ({ editor }) =>
28
- () => {
29
- const color: string | undefined =
30
- editor.getAttributes('textStyle').color;
31
- const style = { color };
32
- return (
33
- <span class="v-wysiwyg-color-tool__button">
34
- <VIcon
35
- class="v-wysiwyg-color-tool__button__icon"
36
- name={vui.icon('editorTextColor')}
37
- />
38
- <span class="v-wysiwyg-color-tool__button__bar" style={style} />
39
- </span>
40
- );
41
- },
42
- onClick: (ctx, ev) => {
43
- ctx.vui.menu({
44
- class: 'v-wysiwyg-color-tool__menu',
45
- activator: ev,
46
- content: (stack) => (
47
- <div
48
- class={[
49
- 'v-wysiwyg-color-tool__items',
50
- { 'v-wysiwyg-color-tool__items--with-label': opts.withLabel },
51
- ]}>
52
- {opts.items.map((item, index) => (
53
- <button
54
- key={item.key == null ? index : item.key}
55
- class="v-wysiwyg-color-tool__item"
56
- type="button"
57
- onClick={() => {
58
- const { color } = item;
59
- let command = ctx.editor.chain().focus();
60
- if (color) {
61
- command = command.setColor(color);
62
- } else {
63
- command = command.unsetColor();
64
- }
65
- command.run();
66
- stack.close();
67
- }}>
68
- <span
69
- class="v-wysiwyg-color-tool__item__color"
70
- style={item.color ? { color: item.color } : {}}
71
- />
72
- {opts.withLabel && (
73
- <span class="v-wysiwyg-color-tool__item__name">
74
- {item.name}
75
- </span>
76
- )}
77
- </button>
78
- ))}
79
- </div>
80
- ),
81
- });
82
- },
83
- floating: true,
84
- extensions: [TextStyle, WysiwygColorExtension],
85
- };
86
- return tool;
87
- };
88
-
89
- return WysiwygColorTool;
90
- }
@@ -1,19 +0,0 @@
1
- import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';
2
- import { Bold, BoldOptions } from '@tiptap/extension-bold';
3
-
4
- export const WysiwygFormatBoldTool: WysiwygEditorToolFactory<BoldOptions> = (
5
- vui,
6
- options,
7
- ) => {
8
- const tool: WysiwygEditorTool = {
9
- key: 'formatBold',
10
- icon: vui.icon('editorformatBold'),
11
- active: ({ editor }) => editor.isActive('bold'),
12
- onClick: ({ editor }) => {
13
- editor.chain().focus().toggleBold().run();
14
- },
15
- floating: true,
16
- extensions: [Bold.configure(options)],
17
- };
18
- return tool;
19
- };
@@ -1,18 +0,0 @@
1
- import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';
2
- import { Italic, ItalicOptions } from '@tiptap/extension-italic';
3
-
4
- export const WysiwygFormatItalicTool: WysiwygEditorToolFactory<
5
- ItalicOptions
6
- > = (vui, options) => {
7
- const tool: WysiwygEditorTool = {
8
- key: 'formatItalic',
9
- icon: vui.icon('editorformatItalic'),
10
- active: ({ editor }) => editor.isActive('italic'),
11
- onClick: ({ editor }) => {
12
- editor.chain().focus().toggleItalic().run();
13
- },
14
- floating: true,
15
- extensions: [Italic.configure(options)],
16
- };
17
- return tool;
18
- };
@@ -1,18 +0,0 @@
1
- import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';
2
- import { Underline, UnderlineOptions } from '@tiptap/extension-underline';
3
-
4
- export const WysiwygFormatUnderlineTool: WysiwygEditorToolFactory<
5
- UnderlineOptions
6
- > = (vui, options) => {
7
- const tool: WysiwygEditorTool = {
8
- key: 'formatUnderline',
9
- icon: vui.icon('editorformatUnderline'),
10
- active: ({ editor }) => editor.isActive('underline'),
11
- onClick: ({ editor }) => {
12
- editor.chain().focus().toggleUnderline().run();
13
- },
14
- floating: true,
15
- extensions: [Underline.configure(options)],
16
- };
17
- return tool;
18
- };
@@ -1,26 +0,0 @@
1
- import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';
2
- import { History, HistoryOptions } from '@tiptap/extension-history';
3
-
4
- export const WysiwygHistoryTool: WysiwygEditorToolFactory<HistoryOptions> = (
5
- vui,
6
- options,
7
- ) => {
8
- const undo: WysiwygEditorTool = {
9
- key: 'history-undo',
10
- icon: vui.icon('editorUndo'),
11
- disabled: ({ editor }) => !editor.can().undo(),
12
- onClick: ({ editor }) => {
13
- editor.chain().focus().undo().run();
14
- },
15
- extensions: [History.configure(options)],
16
- };
17
- const redo: WysiwygEditorTool = {
18
- key: 'history-redo',
19
- icon: vui.icon('editorRedo'),
20
- disabled: ({ editor }) => !editor.can().redo(),
21
- onClick: ({ editor }) => {
22
- editor.chain().focus().redo().run();
23
- },
24
- };
25
- return [undo, redo];
26
- };
@@ -1,8 +0,0 @@
1
- export * from './bullet-list';
2
- export * from './format-bold';
3
- export * from './format-italic';
4
- export * from './format-underline';
5
- export * from './history';
6
- export * from './link';
7
- export * from './ordered-list';
8
- export * from './color';
@@ -1,57 +0,0 @@
1
- import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';
2
- import { Link, LinkOptions } from '@tiptap/extension-link';
3
- import { validateIf, url } from '@fastkit/rules';
4
-
5
- export const WysiwygLinkTool: WysiwygEditorToolFactory<LinkOptions> = (
6
- vui,
7
- options,
8
- ) => {
9
- const tool: WysiwygEditorTool = {
10
- key: 'link',
11
- // icon: ({ editor }) => {
12
- // return vui.icon(editor.isActive('link') ? 'editorLinkOff' : 'editorLink');
13
- // },
14
- icon: vui.icon('editorLink'),
15
- active: ({ editor }) => editor.isActive('link'),
16
- // disabled: ({ editor }) => {
17
- // const { $from, $to } = editor.view.state.selection;
18
- // return $to.pos - $from.pos === 0;
19
- // },
20
- onClick: async ({ vui, editor }) => {
21
- const { href = '' } = editor.getAttributes('link');
22
- const result = await vui.prompt({
23
- input: {
24
- label: 'Link URL',
25
- rules: [validateIf, url],
26
- initialValue: href,
27
- size: 'sm',
28
- autofocus: true,
29
- },
30
- });
31
-
32
- if (result === undefined || result === false) {
33
- return;
34
- }
35
-
36
- const range = editor.chain().focus().extendMarkRange('link');
37
-
38
- if (!result) {
39
- range.unsetLink().run();
40
- } else {
41
- range
42
- .setLink({
43
- href: result,
44
- })
45
- .run();
46
- }
47
- },
48
- floating: true,
49
- extensions: [
50
- Link.configure({
51
- openOnClick: false,
52
- ...options,
53
- }),
54
- ],
55
- };
56
- return tool;
57
- };
@@ -1,21 +0,0 @@
1
- import { WysiwygEditorToolFactory, WysiwygEditorTool } from '../schemes';
2
- import {
3
- OrderedList,
4
- OrderedListOptions,
5
- } from '@tiptap/extension-ordered-list';
6
-
7
- export const WysiwygOrderedListTool: WysiwygEditorToolFactory<
8
- OrderedListOptions
9
- > = (vui, options) => {
10
- const tool: WysiwygEditorTool = {
11
- key: 'orderedList',
12
- icon: vui.icon('editorformatListNumbered'),
13
- active: ({ editor }) => editor.isActive('orderedList'),
14
- onClick: ({ editor }) => {
15
- editor.chain().focus().toggleOrderedList().run();
16
- },
17
- floating: true,
18
- extensions: [OrderedList.configure(options)],
19
- };
20
- return tool;
21
- };