@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.
- package/dist/i18n/en-us/index.js +1 -1
- package/dist/i18n/index.js +2 -3
- package/dist/i18n/ko-kr/index.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/plugin/command/emoji.d.ts +2 -2
- package/dist/plugin/command/emoji.js +7 -3
- package/dist/plugin/command/stores.d.ts +0 -1
- package/dist/plugin/command/suggest.d.ts +2 -2
- package/dist/plugin/command/suggest.js +85 -26
- package/dist/plugin/embed.js +15 -9
- package/dist/plugin/iframe.js +19 -10
- package/dist/plugin/image/dragdrop.js +10 -12
- package/dist/plugin/image/index.d.ts +1 -1
- package/dist/plugin/image/index.js +12 -8
- package/dist/plugin/indent.js +16 -14
- package/dist/plugin/orderedlist/index.js +55 -23
- package/dist/plugin/orderedlist/korean.scss +12 -13
- package/dist/plugin/orderedlist/toggleList.js +7 -7
- package/dist/plugin/table/deleteTable.d.ts +1 -1
- package/dist/plugin/table/deleteTable.js +2 -2
- package/dist/plugin/table/index.js +10 -6
- package/dist/plugin/table/style/cell.scss +14 -13
- package/dist/plugin/table/style/grip.scss +61 -59
- package/dist/plugin/table/style/resize.scss +21 -23
- package/dist/plugin/table/style/table.scss +72 -69
- package/dist/plugin/table/tableCell/index.js +6 -6
- package/dist/plugin/table/tableHeader/index.js +6 -6
- package/dist/plugin/table/tableRow/index.js +1 -1
- package/dist/plugin/table/util.d.ts +2 -2
- package/dist/plugin/table/util.js +9 -9
- package/dist/plugin/youtube.d.ts +2 -2
- package/dist/plugin/youtube.js +35 -26
- package/dist/tiptap/Bubble.svelte +199 -95
- package/dist/tiptap/Bubble.svelte.d.ts +7 -21
- package/dist/tiptap/Command.svelte +125 -59
- package/dist/tiptap/Command.svelte.d.ts +4 -16
- package/dist/tiptap/Floating.svelte +67 -41
- package/dist/tiptap/Floating.svelte.d.ts +2 -14
- package/dist/tiptap/TipTap.svelte +210 -132
- package/dist/tiptap/TipTap.svelte.d.ts +18 -34
- package/dist/tiptap/ToolbarButton.svelte +33 -21
- package/dist/tiptap/ToolbarButton.svelte.d.ts +10 -25
- package/dist/tiptap/index.d.ts +1 -1
- package/dist/tiptap/index.js +2 -2
- package/dist/tiptap/setMath.js +5 -2
- package/dist/tiptap/tiptap.d.ts +2 -2
- package/dist/tiptap/tiptap.js +87 -76
- package/package.json +109 -102
|
@@ -1,126 +1,208 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import '
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { fallbackUpload } from '../plugin/image/dragdrop';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
-
|
|
119
|
-
{
|
|
120
|
-
|
|
121
|
-
|
|
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
|
-
|
|
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={
|
|
133
|
-
<
|
|
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
|
-
|
|
145
|
-
|
|
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(
|
|
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(
|
|
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
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
32
|
+
<IconButton size="1.2em" {icon} active={isActive()} onclick={toggle} {tooltip} tabindex="0" />
|
|
20
33
|
{:else}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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;
|
package/dist/tiptap/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export default TipTap;
|
|
2
|
-
import TipTap from
|
|
2
|
+
import TipTap from './TipTap.svelte';
|
package/dist/tiptap/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import TipTap from
|
|
1
|
+
import TipTap from './TipTap.svelte';
|
|
2
2
|
|
|
3
|
-
export default TipTap;
|
|
3
|
+
export default TipTap;
|
package/dist/tiptap/setMath.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export default function setMath(tiptap) {
|
|
2
2
|
const { selection } = tiptap.state;
|
|
3
|
-
tiptap
|
|
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
|
-
}))
|
|
15
|
+
}))
|
|
16
|
+
.run();
|
|
14
17
|
}
|
package/dist/tiptap/tiptap.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Editor } from
|
|
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;
|