@seorii/tiptap 0.2.18 → 0.2.19

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 $$slots.default}
41
- <slot />
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 name="bubble" />
141
144
  </main>
142
145
  {/if}
143
146
  </BubbleMenu>
@@ -4,12 +4,14 @@ declare const __propDef: {
4
4
  props: {
5
5
  colors?: any[] | undefined;
6
6
  editable: any;
7
+ override: any;
7
8
  };
8
9
  events: {
9
10
  [evt: string]: CustomEvent<any>;
10
11
  };
11
12
  slots: {
12
- default: {};
13
+ override: {};
14
+ bubble: {};
13
15
  };
14
16
  };
15
17
  export type BubbleProps = typeof __propDef.props;
@@ -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
- {#if $$slots.bubble}
130
- <Bubble {colors} {editable}>
131
- <slot name="bubble" />
132
- </Bubble>
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seorii/tiptap",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "svelte-kit sync && svelte-package",