@seorii/tiptap 0.2.22 → 0.3.0-next.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 (49) hide show
  1. package/dist/i18n/en-us/index.js +1 -1
  2. package/dist/i18n/index.js +2 -3
  3. package/dist/i18n/ko-kr/index.js +1 -1
  4. package/dist/index.d.ts +2 -2
  5. package/dist/index.js +3 -3
  6. package/dist/plugin/command/emoji.d.ts +2 -2
  7. package/dist/plugin/command/emoji.js +7 -3
  8. package/dist/plugin/command/stores.d.ts +0 -1
  9. package/dist/plugin/command/suggest.d.ts +2 -2
  10. package/dist/plugin/command/suggest.js +85 -26
  11. package/dist/plugin/embed.js +15 -9
  12. package/dist/plugin/iframe.js +19 -10
  13. package/dist/plugin/image/dragdrop.js +10 -12
  14. package/dist/plugin/image/index.d.ts +1 -1
  15. package/dist/plugin/image/index.js +12 -8
  16. package/dist/plugin/indent.js +16 -14
  17. package/dist/plugin/orderedlist/index.js +55 -23
  18. package/dist/plugin/orderedlist/korean.scss +12 -13
  19. package/dist/plugin/orderedlist/toggleList.js +7 -7
  20. package/dist/plugin/table/deleteTable.d.ts +1 -1
  21. package/dist/plugin/table/deleteTable.js +2 -2
  22. package/dist/plugin/table/index.js +10 -6
  23. package/dist/plugin/table/style/cell.scss +14 -13
  24. package/dist/plugin/table/style/grip.scss +61 -59
  25. package/dist/plugin/table/style/resize.scss +21 -23
  26. package/dist/plugin/table/style/table.scss +72 -69
  27. package/dist/plugin/table/tableCell/index.js +6 -6
  28. package/dist/plugin/table/tableHeader/index.js +6 -6
  29. package/dist/plugin/table/tableRow/index.js +1 -1
  30. package/dist/plugin/table/util.d.ts +2 -2
  31. package/dist/plugin/table/util.js +9 -9
  32. package/dist/plugin/youtube.d.ts +2 -2
  33. package/dist/plugin/youtube.js +35 -26
  34. package/dist/tiptap/Bubble.svelte +199 -95
  35. package/dist/tiptap/Bubble.svelte.d.ts +7 -21
  36. package/dist/tiptap/Command.svelte +125 -59
  37. package/dist/tiptap/Command.svelte.d.ts +4 -16
  38. package/dist/tiptap/Floating.svelte +67 -41
  39. package/dist/tiptap/Floating.svelte.d.ts +2 -14
  40. package/dist/tiptap/TipTap.svelte +210 -132
  41. package/dist/tiptap/TipTap.svelte.d.ts +18 -34
  42. package/dist/tiptap/ToolbarButton.svelte +33 -21
  43. package/dist/tiptap/ToolbarButton.svelte.d.ts +10 -25
  44. package/dist/tiptap/index.d.ts +1 -1
  45. package/dist/tiptap/index.js +2 -2
  46. package/dist/tiptap/setMath.js +5 -2
  47. package/dist/tiptap/tiptap.d.ts +2 -2
  48. package/dist/tiptap/tiptap.js +87 -76
  49. package/package.json +109 -102
@@ -1,126 +1,208 @@
1
- <script>import { browser } from '$app/environment';
2
- import { beforeUpdate, onMount, setContext } from 'svelte';
3
- import { writable } from 'svelte/store';
4
- import sanitizeHtml from 'sanitize-html';
5
- import '@seorii/prosemirror-math/style.css';
6
- import Bubble from './Bubble.svelte';
7
- import Floating from './Floating.svelte';
8
- import Command from './Command.svelte';
9
- import { slashItems, slashProps, slashVisible } from '../plugin/command/stores';
10
- import i18n from '../i18n';
11
- import { fallbackUpload } from '../plugin/image/dragdrop';
12
- export let body = '', editable = false, mark = false, ref = null, options = {}, loaded = false;
13
- export let imageUpload = fallbackUpload, style = '';
14
- export let blocks = [], placeholder = i18n('placeholder');
15
- export let sanitize = {};
16
- export let colors = [
17
- '#ef5350', //red
18
- '#ec407a', //pink
19
- '#ff7043', //orange
20
- '#daca3b', //yellow
21
- '#8bc34a', //green
22
- '#2196f3', //blue
23
- '#3f51b5', //blue
24
- '#ab47bc' //purple
25
- ];
26
- export let bubbleOverride = false;
27
- const san = (body) => sanitizeHtml(body, {
28
- ...sanitize,
29
- allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img', 'math-inline', 'math-node', 'iframe', 'lite-youtube', 'blockquote', 'embed', 'mark', 'code', ...sanitize.allowedTags]),
30
- allowedStyles: '*', allowedAttributes: {
31
- '*': ['style', 'class'],
32
- a: ['href', 'name', 'target'],
33
- img: ['src', 'srcset', 'alt', 'title', 'width', 'height', 'loading'],
34
- iframe: ['src', 'width', 'height', 'frameborder', 'allowfullscreen'],
35
- th: ['colwidth', 'colspan', 'rowspan'],
36
- td: ['colwidth', 'colspan', 'rowspan'],
37
- 'lite-youtube': ['videoid', 'params', 'nocookie', 'title', 'provider'],
38
- embed: ['src', 'type', 'frameborder', 'allowfullscreen'],
39
- mark: ['style', 'data-color'],
40
- code: ['class'],
41
- ...sanitize.allowedAttributes
42
- }
43
- });
44
- const tiptap = setContext('editor', writable(null));
45
- let element, fullscreen = false, mounted = false, last = '';
46
- $: $tiptap && $tiptap.setEditable(editable);
47
- $: browser && (window.__image_uploader = imageUpload);
48
- $: browser && (window.__tiptap_blocks = blocks);
49
- if (browser) {
50
- onMount(() => {
51
- body = last = san(body);
52
- mounted = true;
53
- Promise.all([import('./tiptap'), import('@justinribeiro/lite-youtube')]).then(([{ default: tt }]) => {
54
- if (!mounted)
55
- return;
56
- ref = $tiptap = tt(element, body, {
57
- placeholder,
58
- editable: editable,
59
- onTransaction: () => ref = $tiptap = $tiptap,
60
- ...options
61
- });
62
- $tiptap.on('update', ({ editor: tiptap }) => {
63
- let content = tiptap.getHTML(), json = tiptap.getJSON().content;
64
- if (Array.isArray(json) && json.length === 1 && json[0].type === 'paragraph' && !json[0].hasOwnProperty('content'))
65
- content = null;
66
- body = last = content;
67
- });
68
- loaded = true;
69
- });
70
- return () => {
71
- mounted = false;
72
- $tiptap?.destroy?.();
73
- };
74
- });
75
- beforeUpdate(() => {
76
- if (last === body)
77
- return;
78
- body = san(body);
79
- $tiptap?.commands?.setContent?.(body);
80
- });
81
- }
82
- let selectedIndex = 0;
83
- $: selectedIndex = $slashVisible ? selectedIndex : 0;
84
- function handleKeydown(event) {
85
- if (!$slashVisible)
86
- return;
87
- let count = $slashItems.length;
88
- if ($slashItems[0]?.list)
89
- count = $slashItems.reduce((acc, item) => acc + item.list.length, 0);
90
- if (event.key === 'ArrowUp') {
91
- event.preventDefault();
92
- selectedIndex = (selectedIndex + count - 1) % count;
93
- return true;
94
- }
95
- if (event.key === 'ArrowDown') {
96
- event.preventDefault();
97
- selectedIndex = (selectedIndex + 1) % count;
98
- return true;
99
- }
100
- if (event.key === 'Enter') {
101
- event.preventDefault();
102
- selectItem(selectedIndex);
103
- return true;
104
- }
105
- return false;
106
- }
107
- function selectItem(index) {
108
- const item = $slashItems[0]?.list ? $slashItems.map(i => i.list).flat()[index] : $slashItems[index];
109
- if (item) {
110
- let range = $slashProps.range;
111
- item.command({ editor: $tiptap, range });
112
- }
113
- }
1
+ <script lang="ts">
2
+ import { onMount, onDestroy, setContext, untrack } from 'svelte';
3
+ import sanitizeHtml from 'sanitize-html';
4
+ import '@seorii/prosemirror-math/style.css';
5
+ import Bubble from './Bubble.svelte';
6
+ import Floating from './Floating.svelte';
7
+ import Command from './Command.svelte';
8
+ import { slashItems, slashProps, slashVisible } from '../plugin/command/stores';
9
+ import i18n from '../i18n';
10
+ import type { UploadFn } from '../plugin/image/dragdrop';
11
+ import { fallbackUpload } from '../plugin/image/dragdrop';
12
+ import { Render } from 'nunui';
13
+
14
+ type Props = {
15
+ body: string;
16
+ editable?: boolean;
17
+ mark?: boolean;
18
+ ref?: any;
19
+ options?: Record<string, any>;
20
+ loaded?: boolean;
21
+ imageUpload?: UploadFn;
22
+ style?: string;
23
+ blocks?: any[];
24
+ placeholder?: string;
25
+ sanitize?: Record<string, any>;
26
+ colors?: string[];
27
+ bubble?: any;
28
+ preloader?: any;
29
+ crossorigin?: 'anonymous' | 'use-credentials';
30
+ };
31
+
32
+ let {
33
+ body = $bindable<string>(),
34
+ editable = false,
35
+ mark = false,
36
+ ref = $bindable(null),
37
+ options = {},
38
+ loaded = $bindable(false),
39
+ imageUpload = fallbackUpload,
40
+ style = '',
41
+ blocks = [],
42
+ placeholder = i18n('placeholder'),
43
+ sanitize = {},
44
+ colors = [
45
+ '#ef5350', //red
46
+ '#ec407a', //pink
47
+ '#ff7043', //orange
48
+ '#daca3b', //yellow
49
+ '#8bc34a', //green
50
+ '#2196f3', //blue
51
+ '#3f51b5', //blue
52
+ '#ab47bc' //purple
53
+ ],
54
+ bubble = null,
55
+ preloader,
56
+ crossorigin = 'anonymous',
57
+ }: Props = $props();
58
+
59
+ const san = (body: string) =>
60
+ sanitizeHtml(body || '', {
61
+ ...(sanitize || {}),
62
+ allowedTags: sanitizeHtml.defaults.allowedTags.concat([
63
+ 'img',
64
+ 'math-inline',
65
+ 'math-node',
66
+ 'iframe',
67
+ 'lite-youtube',
68
+ 'blockquote',
69
+ 'embed',
70
+ 'mark',
71
+ 'code',
72
+ ...(sanitize.allowedTags || [])
73
+ ]),
74
+ allowedStyles: '*' as any,
75
+ allowedAttributes: {
76
+ '*': ['style', 'class'],
77
+ a: ['href', 'name', 'target'],
78
+ img: ['src', 'srcset', 'alt', 'title', 'width', 'height', 'loading'],
79
+ iframe: ['src', 'width', 'height', 'frameborder', 'allowfullscreen'],
80
+ th: ['colwidth', 'colspan', 'rowspan'],
81
+ td: ['colwidth', 'colspan', 'rowspan'],
82
+ 'lite-youtube': ['videoid', 'params', 'nocookie', 'title', 'provider'],
83
+ embed: ['src', 'type', 'frameborder', 'allowfullscreen'],
84
+ mark: ['style', 'data-color'],
85
+ code: ['class'],
86
+ ...(sanitize.allowedAttributes || [])
87
+ }
88
+ });
89
+
90
+ const tiptap = $state({ v: null as any, c: 0 });
91
+ setContext('editor', tiptap);
92
+ let element: Element,
93
+ fullscreen = $state(false),
94
+ mounted = $state(false),
95
+ last = $state('');
96
+
97
+ $effect(() => {
98
+ if (tiptap.v) tiptap.v.setEditable(editable);
99
+ });
100
+
101
+ $effect(() => {
102
+ (window as any).__image_uploader = imageUpload;
103
+ (window as any).__tiptap_blocks = blocks;
104
+ });
105
+
106
+ $effect(() => {
107
+ const r = untrack(() => san(body));
108
+ body = r;
109
+ last = r;
110
+ mounted = true;
111
+ Promise.all([import('./tiptap'), import('@justinribeiro/lite-youtube')]).then(
112
+ ([{ default: tt }]) => {
113
+ if (!untrack(() => mounted)) return;
114
+ tiptap.v = ref = tt(element, r, {
115
+ placeholder,
116
+ editable,
117
+ onTransaction: () => {
118
+ tiptap.v = ref = tiptap.v;
119
+ tiptap.c++;
120
+ },
121
+ crossorigin,
122
+ ...options
123
+ });
124
+ tiptap.v.on('update', ({ editor: tiptap }: any) => {
125
+ let content = tiptap.getHTML(),
126
+ json = tiptap.getJSON().content;
127
+ if (
128
+ Array.isArray(json) &&
129
+ json.length === 1 &&
130
+ json[0].type === 'paragraph' &&
131
+ !json[0].hasOwnProperty('content')
132
+ )
133
+ content = null;
134
+ body = last = content;
135
+ });
136
+ loaded = true;
137
+ }
138
+ );
139
+ return () => {
140
+ mounted = false;
141
+ untrack(() => tiptap.v?.destroy?.());
142
+ };
143
+ });
144
+
145
+ $effect.pre(() => {
146
+ if (last === body) return;
147
+ const r = san(body);
148
+ body = r;
149
+ last = r;
150
+ tiptap.v?.commands?.setContent?.(body);
151
+ });
152
+
153
+ let selectedIndex = $state(0);
154
+ $effect(() => {
155
+ if (!slashVisible) selectedIndex = 0;
156
+ });
157
+
158
+ function handleKeydown(event: KeyboardEvent) {
159
+ if (!$slashVisible) return;
160
+ let count = $slashItems.length;
161
+ if (($slashItems[0] as any)?.list) count = $slashItems.reduce((acc, item) => acc + (item as any).list.length, 0);
162
+ if (event.key === 'ArrowUp') {
163
+ event.preventDefault();
164
+ selectedIndex = (selectedIndex + count - 1) % count;
165
+ return true;
166
+ }
167
+ if (event.key === 'ArrowDown') {
168
+ event.preventDefault();
169
+ selectedIndex = (selectedIndex + 1) % count;
170
+ return true;
171
+ }
172
+
173
+ if (event.key === 'Enter') {
174
+ event.preventDefault();
175
+ selectItem(selectedIndex);
176
+ return true;
177
+ }
178
+
179
+ return false;
180
+ }
181
+
182
+ function selectItem(index: number) {
183
+ const item = ($slashItems[0] as any)?.list
184
+ ? $slashItems.map((i: any) => i.list).flat()[index]
185
+ : $slashItems[index];
186
+ if (item) {
187
+ let range = $slashProps.range;
188
+ item.command({ editor: tiptap.v, range });
189
+ }
190
+ }
114
191
  </script>
115
192
 
116
- <main class:fullscreen class:editable>
193
+ <main class:fullscreen class:editable {style}>
117
194
  <div class="wrapper">
118
- <div bind:this={element} class="target" on:keydown|capture={handleKeydown}></div>
119
- {#if !$tiptap}
120
- {#if $$slots.preloader}
121
- <slot name="preloader" />
195
+ <!-- svelte-ignore a11y_no_static_element_interactions -->
196
+ <div bind:this={element} class="target" onkeydown={handleKeydown}></div>
197
+ {#if !tiptap.v}
198
+ {#if preloader}
199
+ <Render it={preloader} />
122
200
  {:else}
123
- {i18n('loading')}
201
+ <div class="target">
202
+ <div>
203
+ {@html san(body)}
204
+ </div>
205
+ </div>
124
206
  {/if}
125
207
  {/if}
126
208
  </div>
@@ -129,23 +211,18 @@ function selectItem(index) {
129
211
  <Floating />
130
212
  {/if}
131
213
  {#if editable || mark}
132
- <Bubble {colors} {editable} override={bubbleOverride}>
133
- <slot name="bubble" />
134
- <slot name="bubbleOverride" slot="override" />
214
+ <Bubble {colors} {editable} override={bubble}>
215
+ <Render it={bubble} />
135
216
  </Bubble>
136
217
  {/if}
137
218
  </main>
138
219
 
139
-
140
220
  <style>main {
141
221
  position: relative;
142
222
  overscroll-behavior: none;
143
- --shadow: 0 1px 2px rgba(127, 127, 127, 0.07),
144
- 0 2px 4px rgba(127, 127, 127, 0.07),
145
- 0 4px 8px rgba(127, 127, 127, 0.07),
146
- 0 8px 16px rgba(127, 127, 127, 0.07),
147
- 0 16px 32px rgba(127, 127, 127, 0.07),
148
- 0 32px 64px rgba(127, 127, 127, 0.07);
223
+ --shadow: 0 1px 2px rgba(127, 127, 127, 0.07), 0 2px 4px rgba(127, 127, 127, 0.07),
224
+ 0 4px 8px rgba(127, 127, 127, 0.07), 0 8px 16px rgba(127, 127, 127, 0.07),
225
+ 0 16px 32px rgba(127, 127, 127, 0.07), 0 32px 64px rgba(127, 127, 127, 0.07);
149
226
  }
150
227
  main.fullscreen {
151
228
  z-index: 999999999;
@@ -223,7 +300,8 @@ div > :global(div) :global(table) {
223
300
  border: 1px solid var(--primary-light1);
224
301
  border-radius: 12px;
225
302
  }
226
- div > :global(div) :global(table) :global(th), div > :global(div) :global(table) :global(td) {
303
+ div > :global(div) :global(th),
304
+ div > :global(div) :global(td) {
227
305
  padding: 8px;
228
306
  border: 1px solid var(--primary-light1);
229
307
  }
@@ -241,10 +319,10 @@ div > :global(div) :global(.iframe-wrapper) {
241
319
  height: 600px;
242
320
  border-radius: 12px;
243
321
  }
244
- div > :global(div) :global(.iframe-wrapper) :global(iframe) {
322
+ div > :global(div) :global(iframe) {
245
323
  position: absolute;
246
324
  top: 0;
247
325
  left: 0;
248
326
  width: 100%;
249
327
  height: 100%;
250
- }</style>
328
+ }</style>
@@ -1,36 +1,20 @@
1
- import { SvelteComponentTyped } from "svelte";
2
1
  import '@seorii/prosemirror-math/style.css';
3
2
  import type { UploadFn } from '../plugin/image/dragdrop';
4
- declare const __propDef: {
5
- props: {
6
- body?: string | undefined;
7
- editable?: boolean | undefined;
8
- mark?: boolean | undefined;
9
- ref?: null | undefined;
10
- options?: {} | undefined;
11
- loaded?: boolean | undefined;
12
- imageUpload?: UploadFn | undefined;
13
- style?: string | undefined;
14
- blocks?: any[] | undefined;
15
- placeholder?: any;
16
- sanitize?: any;
17
- colors?: string[] | undefined;
18
- bubbleOverride?: boolean | undefined;
19
- };
20
- events: {
21
- [evt: string]: CustomEvent<any>;
22
- };
23
- slots: {
24
- preloader: {};
25
- bubble: {};
26
- bubbleOverride: {
27
- slot: string;
28
- };
29
- };
30
- };
31
- export type TipTapProps = typeof __propDef.props;
32
- export type TipTapEvents = typeof __propDef.events;
33
- export type TipTapSlots = typeof __propDef.slots;
34
- export default class TipTap extends SvelteComponentTyped<TipTapProps, TipTapEvents, TipTapSlots> {
35
- }
36
- export {};
3
+ declare const TipTap: import("svelte").Component<{
4
+ body: string;
5
+ editable?: boolean;
6
+ mark?: boolean;
7
+ ref?: any;
8
+ options?: Record<string, any>;
9
+ loaded?: boolean;
10
+ imageUpload?: UploadFn;
11
+ style?: string;
12
+ blocks?: any[];
13
+ placeholder?: string;
14
+ sanitize?: Record<string, any>;
15
+ colors?: string[];
16
+ bubble?: any;
17
+ preloader?: any;
18
+ crossorigin?: "anonymous" | "use-credentials";
19
+ }, {}, "body" | "ref" | "loaded">;
20
+ export default TipTap;
@@ -1,26 +1,38 @@
1
- <script>import { getContext } from "svelte";
2
- import { Button, IconButton } from "nunui";
3
- const editor = getContext("editor");
4
- export let prop = '', attrs = '', label = '', icon = '', methodName = 'toggle' + prop.charAt(0).toUpperCase() + prop.slice(1), tooltip, handler;
5
- $: isActive = () => {
6
- return editor && prop && $editor.isActive(prop, attrs);
7
- };
8
- function toggle() {
9
- if (!$editor)
10
- return;
11
- //$editor.chain().focus().clearNodes().run()
12
- if (handler)
13
- return handler();
14
- setTimeout(() => $editor.chain().focus()[methodName](attrs)?.run(), 0);
15
- }
1
+ <script lang="ts">
2
+ import { getContext } from 'svelte';
3
+ import { Button, IconButton, Render } from 'nunui';
4
+
5
+ const editor = getContext<{ v: any }>('editor');
6
+ const tiptap = $derived(editor.v);
7
+
8
+ let {
9
+ prop = '',
10
+ attrs = '',
11
+ label = '',
12
+ icon = '',
13
+ methodName = 'toggle' + prop.charAt(0).toUpperCase() + prop.slice(1),
14
+ tooltip,
15
+ handler,
16
+ ...rest
17
+ } = $props();
18
+
19
+ const isActive = $derived(() => {
20
+ return editor && prop && tiptap.isActive(prop, attrs);
21
+ });
22
+
23
+ function toggle() {
24
+ if (!tiptap) return;
25
+ //tiptap.chain().focus().clearNodes().run()
26
+ if (handler) return handler();
27
+ setTimeout(() => tiptap.chain().focus()[methodName](attrs)?.run(), 0);
28
+ }
16
29
  </script>
17
30
 
18
31
  {#if icon}
19
- <IconButton size="1.2em" {icon} active={isActive()} on:click={toggle} tooltip={tooltip} tabindex="0"/>
32
+ <IconButton size="1.2em" {icon} active={isActive()} onclick={toggle} {tooltip} tabindex="0" />
20
33
  {:else}
21
- <Button outlined={!isActive()} on:click={handler || toggle} small {...$$restProps}>
22
- {label}
23
- <slot/>
24
- </Button>
34
+ <Button outlined={!isActive()} onclick={handler || toggle} small {...rest}>
35
+ {label}
36
+ <Render it={children} />
37
+ </Button>
25
38
  {/if}
26
-
@@ -1,25 +1,10 @@
1
- import { SvelteComponentTyped } from "svelte";
2
- declare const __propDef: {
3
- props: {
4
- [x: string]: any;
5
- prop?: string | undefined;
6
- attrs?: string | undefined;
7
- label?: string | undefined;
8
- icon?: string | undefined;
9
- methodName?: string | undefined;
10
- tooltip: any;
11
- handler: any;
12
- };
13
- events: {
14
- [evt: string]: CustomEvent<any>;
15
- };
16
- slots: {
17
- default: {};
18
- };
19
- };
20
- export type ToolbarButtonProps = typeof __propDef.props;
21
- export type ToolbarButtonEvents = typeof __propDef.events;
22
- export type ToolbarButtonSlots = typeof __propDef.slots;
23
- export default class ToolbarButton extends SvelteComponentTyped<ToolbarButtonProps, ToolbarButtonEvents, ToolbarButtonSlots> {
24
- }
25
- export {};
1
+ declare const ToolbarButton: import("svelte").Component<{
2
+ prop?: string;
3
+ attrs?: string;
4
+ label?: string;
5
+ icon?: string;
6
+ methodName?: unknown;
7
+ tooltip: unknown;
8
+ handler: unknown;
9
+ } & Record<string, unknown>, {}, "">;
10
+ export default ToolbarButton;
@@ -1,2 +1,2 @@
1
1
  export default TipTap;
2
- import TipTap from "./TipTap.svelte";
2
+ import TipTap from './TipTap.svelte';
@@ -1,3 +1,3 @@
1
- import TipTap from "./TipTap.svelte";
1
+ import TipTap from './TipTap.svelte';
2
2
 
3
- export default TipTap;
3
+ export default TipTap;
@@ -1,6 +1,8 @@
1
1
  export default function setMath(tiptap) {
2
2
  const { selection } = tiptap.state;
3
- tiptap.chain().command(({ state, tr }) => state.doc.nodesBetween(selection.from, selection.to, (node, position) => {
3
+ tiptap
4
+ .chain()
5
+ .command(({ state, tr }) => state.doc.nodesBetween(selection.from, selection.to, (node, position) => {
4
6
  if (!node.isTextblock || selection.from === selection.to)
5
7
  return;
6
8
  const startPosition = Math.max(position + 1, selection.from);
@@ -10,5 +12,6 @@ export default function setMath(tiptap) {
10
12
  const updatedText = node.textContent.substring(substringFrom, substringTo);
11
13
  const newNode = state.schema.nodes.math_inline.create(null, state.schema.text(updatedText));
12
14
  tr = tr.replaceWith(startPosition, endPosition, newNode);
13
- })).run();
15
+ }))
16
+ .run();
14
17
  }
@@ -1,3 +1,3 @@
1
- import { Editor } from "@tiptap/core";
2
- declare const _default: (element: Element, content: string, { placeholder, plugins, ...props }?: any) => Editor;
1
+ import { Editor } from '@tiptap/core';
2
+ declare const _default: (element: Element, content: string, { placeholder, plugins, crossorigin, ...props }?: any) => Editor;
3
3
  export default _default;