@flexiui/svelte-rich-text 0.0.71 → 0.0.73
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/RichText.svelte +10 -2
- package/dist/styles.css +55 -55
- package/dist/svelte-tiptap-extends/BubbleMenu.svelte +56 -0
- package/dist/svelte-tiptap-extends/BubbleMenu.svelte.d.ts +14 -0
- package/dist/svelte-tiptap-extends/utils.d.ts +4 -0
- package/dist/svelte-tiptap-extends/utils.js +8 -0
- package/package.json +1 -1
package/dist/RichText.svelte
CHANGED
|
@@ -21,10 +21,11 @@
|
|
|
21
21
|
createEditor,
|
|
22
22
|
Editor,
|
|
23
23
|
// EditorContent,
|
|
24
|
-
BubbleMenu,
|
|
24
|
+
// BubbleMenu,
|
|
25
25
|
} from "svelte-tiptap";
|
|
26
26
|
|
|
27
27
|
import EditorContent from "./svelte-tiptap-extends/EditorContent.svelte";
|
|
28
|
+
import BubbleMenu from "./svelte-tiptap-extends/BubbleMenu.svelte";
|
|
28
29
|
import { getRichTextExtensions } from "./getExtensions";
|
|
29
30
|
import { rgbToHex } from "./utils";
|
|
30
31
|
|
|
@@ -953,6 +954,7 @@ function onOpenChangeHighlight(open: boolean) {
|
|
|
953
954
|
{/if}
|
|
954
955
|
</div>
|
|
955
956
|
{/if}
|
|
957
|
+
|
|
956
958
|
<div
|
|
957
959
|
class="fl-toolbar-dropdown-panel"
|
|
958
960
|
bind:this={tooltip}
|
|
@@ -1308,7 +1310,13 @@ function onOpenChangeHighlight(open: boolean) {
|
|
|
1308
1310
|
}}
|
|
1309
1311
|
appendTo={document.body}
|
|
1310
1312
|
>
|
|
1311
|
-
<div
|
|
1313
|
+
<div
|
|
1314
|
+
data-test-id="bubble-menu"
|
|
1315
|
+
class="fl-bubble-menu flex"
|
|
1316
|
+
style="
|
|
1317
|
+
--fl-editor-accent-color: {editorConfig.editorAccentColor};
|
|
1318
|
+
"
|
|
1319
|
+
>
|
|
1312
1320
|
{#each bubbleMenuGroups as bubbleMenuGroup}
|
|
1313
1321
|
{#if bubbleMenuGroup.length > 0}
|
|
1314
1322
|
<div role="group" class="fl-rich-text-toolbar-group">
|
package/dist/styles.css
CHANGED
|
@@ -123,66 +123,66 @@
|
|
|
123
123
|
background: transparent;
|
|
124
124
|
line-height: 1.6;
|
|
125
125
|
}
|
|
126
|
+
}
|
|
126
127
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
.fl-bubble-menu {
|
|
129
|
+
padding: 6px;
|
|
130
|
+
background: #242424b0;
|
|
131
|
+
border: 1px solid #ffffff12;
|
|
132
|
+
backdrop-filter: blur(16px);
|
|
133
|
+
border-radius: 14px;
|
|
134
|
+
display: flex;
|
|
135
|
+
gap: 5px;
|
|
136
|
+
position: relative;
|
|
137
|
+
z-index: var(--fl-toolbar-z-index, 10);
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
.fl-bubble-menu-mark-button {
|
|
141
|
+
border-radius: 9px;
|
|
142
|
+
border: none;
|
|
133
143
|
display: flex;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
padding-inline: 6px;
|
|
154
|
-
|
|
155
|
-
svg {
|
|
156
|
-
width: 16px;
|
|
157
|
-
height: 16px;
|
|
158
|
-
|
|
159
|
-
&.toogle-dropdown-button-icon {
|
|
160
|
-
width: 8px;
|
|
161
|
-
margin: 0 2px 0 6px;
|
|
162
|
-
}
|
|
144
|
+
align-items: center;
|
|
145
|
+
justify-content: center;
|
|
146
|
+
padding: 6px 11px;
|
|
147
|
+
min-width: 30px;
|
|
148
|
+
min-height: 30px;
|
|
149
|
+
background: rgba(255, 255, 255, 0.1);
|
|
150
|
+
transition: background 0.3s ease;
|
|
151
|
+
cursor: pointer;
|
|
152
|
+
|
|
153
|
+
&.fl-bubble-menu-mark-button {
|
|
154
|
+
padding-inline: 6px;
|
|
155
|
+
|
|
156
|
+
svg {
|
|
157
|
+
width: 16px;
|
|
158
|
+
height: 16px;
|
|
159
|
+
|
|
160
|
+
&.toogle-dropdown-button-icon {
|
|
161
|
+
width: 8px;
|
|
162
|
+
margin: 0 2px 0 6px;
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
|
+
}
|
|
165
166
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
167
|
+
&.is-active {
|
|
168
|
+
background: var(--fl-editor-accent-color);
|
|
169
|
+
color: white;
|
|
170
|
+
|
|
171
|
+
&.accent-soft {
|
|
172
|
+
background: transparent;
|
|
173
|
+
color: var(--fl-editor-accent-color);
|
|
174
|
+
position: relative;
|
|
175
|
+
|
|
176
|
+
&::after {
|
|
177
|
+
content: "";
|
|
178
|
+
position: absolute;
|
|
179
|
+
width: 100%;
|
|
180
|
+
height: 100%;
|
|
181
|
+
left: 0;
|
|
182
|
+
top: 0;
|
|
183
|
+
background: var(--fl-editor-accent-color);
|
|
184
|
+
opacity: 0.15;
|
|
185
|
+
border-radius: inherit;
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { onMount } from 'svelte';
|
|
3
|
+
import { BubbleMenuPlugin, type BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
|
|
4
|
+
|
|
5
|
+
import type { ComponentInputProps } from './types';
|
|
6
|
+
import { invariant } from './utils';
|
|
7
|
+
|
|
8
|
+
type Props = ComponentInputProps<BubbleMenuPluginProps>;
|
|
9
|
+
|
|
10
|
+
const {
|
|
11
|
+
editor,
|
|
12
|
+
options = {},
|
|
13
|
+
pluginKey = 'SvelteTiptapBubbleMenu',
|
|
14
|
+
shouldShow = null,
|
|
15
|
+
updateDelay = 250,
|
|
16
|
+
appendTo = null,
|
|
17
|
+
children,
|
|
18
|
+
class: className,
|
|
19
|
+
}: Props = $props();
|
|
20
|
+
|
|
21
|
+
invariant(editor, 'Missing editor instance.');
|
|
22
|
+
|
|
23
|
+
let element: HTMLElement;
|
|
24
|
+
|
|
25
|
+
onMount(() => {
|
|
26
|
+
element.style.visibility = 'hidden';
|
|
27
|
+
element.style.position = 'absolute';
|
|
28
|
+
|
|
29
|
+
const plugin = BubbleMenuPlugin({
|
|
30
|
+
pluginKey,
|
|
31
|
+
editor,
|
|
32
|
+
element,
|
|
33
|
+
options,
|
|
34
|
+
shouldShow,
|
|
35
|
+
updateDelay,
|
|
36
|
+
appendTo,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
editor.registerPlugin(plugin);
|
|
40
|
+
|
|
41
|
+
return () => {
|
|
42
|
+
editor?.unregisterPlugin(pluginKey);
|
|
43
|
+
window.requestAnimationFrame(() => {
|
|
44
|
+
if (element && element.parentNode) {
|
|
45
|
+
element.parentNode.removeChild(element);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<div bind:this={element} class={className} style="visibility: hidden;">
|
|
53
|
+
{#if children}
|
|
54
|
+
{@render children()}
|
|
55
|
+
{/if}
|
|
56
|
+
</div>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: Record<string, never>;
|
|
4
|
+
events: {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
};
|
|
7
|
+
slots: {};
|
|
8
|
+
};
|
|
9
|
+
export type BubbleMenuProps = typeof __propDef.props;
|
|
10
|
+
export type BubbleMenuEvents = typeof __propDef.events;
|
|
11
|
+
export type BubbleMenuSlots = typeof __propDef.slots;
|
|
12
|
+
export default class BubbleMenu extends SvelteComponentTyped<BubbleMenuProps, BubbleMenuEvents, BubbleMenuSlots> {
|
|
13
|
+
}
|
|
14
|
+
export {};
|