@seorii/tiptap 0.2.0 → 0.2.1
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.
|
@@ -43,7 +43,7 @@ export const emoji = {
|
|
|
43
43
|
filtered.push({
|
|
44
44
|
title: emojis[i] + ' ' + tags[i],
|
|
45
45
|
command: ({ editor, range }) => {
|
|
46
|
-
editor.chain().deleteRange(fixRange(editor, range, ':')).insertContent(emojis[i]).run();
|
|
46
|
+
editor.chain().deleteRange(fixRange(editor, range, ':')).insertContent(emojis[i] + ' ').run();
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
if (filtered.length >= max)
|
|
@@ -7,15 +7,7 @@ export declare const suggest: {
|
|
|
7
7
|
query: any;
|
|
8
8
|
}) => {
|
|
9
9
|
section: any;
|
|
10
|
-
list:
|
|
11
|
-
icon: string;
|
|
12
|
-
title: any;
|
|
13
|
-
subtitle: any;
|
|
14
|
-
command: ({ editor, range }: {
|
|
15
|
-
editor: any;
|
|
16
|
-
range: any;
|
|
17
|
-
}) => void;
|
|
18
|
-
}[];
|
|
10
|
+
list: any[];
|
|
19
11
|
}[];
|
|
20
12
|
render: () => {
|
|
21
13
|
onStart: (props: any) => void;
|
|
@@ -28,7 +28,7 @@ $: setTimeout(() => focus?.focus?.(), 100);
|
|
|
28
28
|
<div class="title">iframe</div>
|
|
29
29
|
</header>
|
|
30
30
|
<Input placeholder="url" fullWidth bind:value={iframe} bind:input={focus}
|
|
31
|
-
on:submit={() => $tiptap.
|
|
31
|
+
on:submit={() => $tiptap.chain().focus().insertContent({type: 'iframe', attrs: {src: iframe}}).insertContent('\n').run()}/>
|
|
32
32
|
<footer>
|
|
33
33
|
<Button tabindex="0" transparent small on:click={() => {
|
|
34
34
|
iframe = ''
|
|
@@ -38,8 +38,8 @@ $: setTimeout(() => focus?.focus?.(), 100);
|
|
|
38
38
|
<Button tabindex="0" transparent small
|
|
39
39
|
on:click={() => {
|
|
40
40
|
$slashSelection?.();
|
|
41
|
-
$tiptap.
|
|
42
|
-
}>{i18n('insert')}
|
|
41
|
+
$tiptap.chain().focus().insertContent({type: 'iframe', attrs: {src: iframe}}).insertContent('\n').run();
|
|
42
|
+
}}>{i18n('insert')}
|
|
43
43
|
</Button>
|
|
44
44
|
</footer>
|
|
45
45
|
</div>
|
|
@@ -50,7 +50,7 @@ $: setTimeout(() => focus?.focus?.(), 100);
|
|
|
50
50
|
<div class="title">Youtube</div>
|
|
51
51
|
</header>
|
|
52
52
|
<Input placeholder="url" fullWidth bind:value={iframe} bind:input={focus}
|
|
53
|
-
on:submit={() => $tiptap.
|
|
53
|
+
on:submit={() => $tiptap.chain().focus().insertVideoPlayer({url: iframe}).insertContent('\n').run()}/>
|
|
54
54
|
<footer>
|
|
55
55
|
<Button tabindex="0" transparent small on:click={() => {
|
|
56
56
|
iframe = ''
|
|
@@ -59,7 +59,7 @@ $: setTimeout(() => focus?.focus?.(), 100);
|
|
|
59
59
|
</Button>
|
|
60
60
|
<Button tabindex="0" transparent small on:click={() => {
|
|
61
61
|
$slashSelection?.();
|
|
62
|
-
$tiptap.
|
|
62
|
+
$tiptap.chain().focus().insertVideoPlayer({url: iframe}).insertContent('\n').run();
|
|
63
63
|
}}>{i18n('insert')}
|
|
64
64
|
</Button>
|
|
65
65
|
</footer>
|
|
@@ -23,11 +23,13 @@ const san = (body) => sanitizeHtml(body, {
|
|
|
23
23
|
},
|
|
24
24
|
});
|
|
25
25
|
export let body = '', editable = false, ref = null, options = {};
|
|
26
|
-
export
|
|
26
|
+
export let imageUpload = fallbackUpload, style = '';
|
|
27
|
+
export let blocks = [];
|
|
27
28
|
const tiptap = setContext('editor', writable(null));
|
|
28
29
|
let element, fullscreen = false, mounted = false, last = '';
|
|
29
30
|
$: $tiptap && $tiptap.setEditable(editable);
|
|
30
31
|
$: browser && (window.__image_uploader = imageUpload);
|
|
32
|
+
$: browser && (window.__tiptap_blocks = blocks);
|
|
31
33
|
if (browser) {
|
|
32
34
|
onMount(() => {
|
|
33
35
|
body = last = san(body);
|
|
@@ -8,7 +8,8 @@ declare const __propDef: {
|
|
|
8
8
|
ref?: null | undefined;
|
|
9
9
|
options?: {} | undefined;
|
|
10
10
|
imageUpload?: UploadFn | undefined;
|
|
11
|
-
style?:
|
|
11
|
+
style?: string | undefined;
|
|
12
|
+
blocks?: any[] | undefined;
|
|
12
13
|
};
|
|
13
14
|
events: {
|
|
14
15
|
[evt: string]: CustomEvent<any>;
|
|
@@ -21,7 +22,5 @@ export type TipTapProps = typeof __propDef.props;
|
|
|
21
22
|
export type TipTapEvents = typeof __propDef.events;
|
|
22
23
|
export type TipTapSlots = typeof __propDef.slots;
|
|
23
24
|
export default class TipTap extends SvelteComponentTyped<TipTapProps, TipTapEvents, TipTapSlots> {
|
|
24
|
-
get imageUpload(): UploadFn;
|
|
25
|
-
get style(): "";
|
|
26
25
|
}
|
|
27
26
|
export {};
|