@seorii/tiptap 0.2.18 → 0.2.20
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.
|
@@ -9,7 +9,7 @@ import { Button, Icon, IconButton, Input, List, OneLine, Tooltip } from 'nunui';
|
|
|
9
9
|
import i18n from '../i18n';
|
|
10
10
|
import ColorPicker from 'svelte-awesome-color-picker';
|
|
11
11
|
import { isTextSelection } from '@tiptap/core';
|
|
12
|
-
export let colors = [], editable;
|
|
12
|
+
export let colors = [], editable, override;
|
|
13
13
|
const tiptap = getContext('editor');
|
|
14
14
|
let link = false, href = '', sel = '', _sel = '';
|
|
15
15
|
$: selection = $tiptap?.state?.selection;
|
|
@@ -37,8 +37,10 @@ const shouldShow = ({ view, state, from, to }) => {
|
|
|
37
37
|
{#if $tiptap}
|
|
38
38
|
<BubbleMenu editor={$tiptap} updateDelay={50} {shouldShow}
|
|
39
39
|
tippyOptions={{moveTransition: 'transform 0.2s cubic-bezier(1,.5,0,.85)', animation:'shift-away-subtle', duration: [200, 50]}}>
|
|
40
|
-
{#if
|
|
41
|
-
<
|
|
40
|
+
{#if override}
|
|
41
|
+
<main>
|
|
42
|
+
<slot name="override" />
|
|
43
|
+
</main>
|
|
42
44
|
{:else}
|
|
43
45
|
<main>
|
|
44
46
|
{#if link}
|
|
@@ -138,6 +140,7 @@ const shouldShow = ({ view, state, from, to }) => {
|
|
|
138
140
|
<ToolbarButton icon="link" prop="link" handler={() => link = true} />
|
|
139
141
|
{/if}
|
|
140
142
|
{/if}
|
|
143
|
+
<slot />
|
|
141
144
|
</main>
|
|
142
145
|
{/if}
|
|
143
146
|
</BubbleMenu>
|
|
@@ -23,6 +23,7 @@ export let colors = [
|
|
|
23
23
|
'#3f51b5', //blue
|
|
24
24
|
'#ab47bc' //purple
|
|
25
25
|
];
|
|
26
|
+
export let bubbleOverride = false;
|
|
26
27
|
const san = (body) => sanitizeHtml(body, {
|
|
27
28
|
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img', 'math-inline', 'math-node', 'iframe', 'lite-youtube', 'blockquote', 'embed', 'mark', ...allowedTags]),
|
|
28
29
|
allowedStyles: '*', allowedAttributes: {
|
|
@@ -126,13 +127,10 @@ function selectItem(index) {
|
|
|
126
127
|
<Floating />
|
|
127
128
|
{/if}
|
|
128
129
|
{#if editable || mark}
|
|
129
|
-
{
|
|
130
|
-
<
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
{:else}
|
|
134
|
-
<Bubble {colors} {editable} />
|
|
135
|
-
{/if}
|
|
130
|
+
<Bubble {colors} {editable} override={bubbleOverride}>
|
|
131
|
+
<slot name="bubble" />
|
|
132
|
+
<slot name="bubbleOverride" slot="override" />
|
|
133
|
+
</Bubble>
|
|
136
134
|
{/if}
|
|
137
135
|
</main>
|
|
138
136
|
|
|
@@ -16,6 +16,7 @@ declare const __propDef: {
|
|
|
16
16
|
allowedTags?: string[] | undefined;
|
|
17
17
|
allowedAttributes?: any;
|
|
18
18
|
colors?: string[] | undefined;
|
|
19
|
+
bubbleOverride?: boolean | undefined;
|
|
19
20
|
};
|
|
20
21
|
events: {
|
|
21
22
|
[evt: string]: CustomEvent<any>;
|
|
@@ -23,6 +24,9 @@ declare const __propDef: {
|
|
|
23
24
|
slots: {
|
|
24
25
|
preloader: {};
|
|
25
26
|
bubble: {};
|
|
27
|
+
bubbleOverride: {
|
|
28
|
+
slot: string;
|
|
29
|
+
};
|
|
26
30
|
};
|
|
27
31
|
};
|
|
28
32
|
export type TipTapProps = typeof __propDef.props;
|