@flexiui/svelte-rich-text 0.0.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.
- package/README.md +184 -0
- package/dist/RichText.svelte +1023 -0
- package/dist/RichText.svelte.d.ts +15 -0
- package/dist/extensions/EnhancedLink.d.ts +1 -0
- package/dist/extensions/EnhancedLink.js +33 -0
- package/dist/extensions/SpecialBox.d.ts +10 -0
- package/dist/extensions/SpecialBox.js +33 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/styles.css +181 -0
- package/package.json +47 -0
|
@@ -0,0 +1,1023 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { EnhancedLink } from './extensions/EnhancedLink';
|
|
3
|
+
import "./styles.css";
|
|
4
|
+
|
|
5
|
+
import { Color } from "@tiptap/extension-text-style";
|
|
6
|
+
import Highlight from "@tiptap/extension-highlight";
|
|
7
|
+
import TextAlign from '@tiptap/extension-text-align'
|
|
8
|
+
import { ListItem, ListKit } from "@tiptap/extension-list";
|
|
9
|
+
import { TextStyle } from "@tiptap/extension-text-style";
|
|
10
|
+
import StarterKit from "@tiptap/starter-kit";
|
|
11
|
+
// import { Editor } from "@tiptap/core";
|
|
12
|
+
import {
|
|
13
|
+
BubbleMenu,
|
|
14
|
+
createEditor,
|
|
15
|
+
Editor,
|
|
16
|
+
EditorContent,
|
|
17
|
+
} from "svelte-tiptap";
|
|
18
|
+
import Link from "@tiptap/extension-link";
|
|
19
|
+
import Underline from "@tiptap/extension-underline";
|
|
20
|
+
import { onMount, onDestroy } from "svelte";
|
|
21
|
+
|
|
22
|
+
import { Dropdown, DropdownItem } from "@flexiui/svelte-dropdown";
|
|
23
|
+
import type { Readable } from 'svelte/store';
|
|
24
|
+
|
|
25
|
+
// const {id, className, editable = false, value = ''} = $props();
|
|
26
|
+
declare interface Props {
|
|
27
|
+
id?: string;
|
|
28
|
+
className?: string;
|
|
29
|
+
editable?: boolean;
|
|
30
|
+
content?: any;
|
|
31
|
+
customExtensions?: any[];
|
|
32
|
+
editorEvents?: {
|
|
33
|
+
onTransaction?: (params: any) => void;
|
|
34
|
+
onBeforeCreate?: (params: any) => void;
|
|
35
|
+
onCreate?: (params: any) => void;
|
|
36
|
+
onUpdate: (params: any) => void;
|
|
37
|
+
onFocus?: (params: any) => void;
|
|
38
|
+
onBlur?: (params: any) => void;
|
|
39
|
+
onDestroy?: (params: any) => void;
|
|
40
|
+
onDrop?: (params: any) => void;
|
|
41
|
+
onDelete?: (params: any) => void;
|
|
42
|
+
onContentError?: (params: any) => void;
|
|
43
|
+
onSelectionUpdate?: (params: any) => void;
|
|
44
|
+
onPaste?: (params: any) => void;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let {
|
|
49
|
+
id = 'fl-rich-text-editor',
|
|
50
|
+
className,
|
|
51
|
+
editable,
|
|
52
|
+
content,
|
|
53
|
+
customExtensions = [],
|
|
54
|
+
editorEvents = {
|
|
55
|
+
onTransaction: () => {},
|
|
56
|
+
onBeforeCreate: () => {},
|
|
57
|
+
onCreate: () => {},
|
|
58
|
+
onUpdate: () => {},
|
|
59
|
+
onFocus: () => {},
|
|
60
|
+
onBlur: () => {},
|
|
61
|
+
onDestroy: () => {},
|
|
62
|
+
onDrop: () => {},
|
|
63
|
+
onDelete: () => {},
|
|
64
|
+
onContentError: () => {},
|
|
65
|
+
onSelectionUpdate: () => {},
|
|
66
|
+
onPaste: () => {},
|
|
67
|
+
}
|
|
68
|
+
}: Props = $props();
|
|
69
|
+
|
|
70
|
+
const HEADINGS = [
|
|
71
|
+
{
|
|
72
|
+
level: 1,
|
|
73
|
+
ariaLabel: "H1",
|
|
74
|
+
icon: `<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM21.0005 8V20H19.0005L19 10.204L17 10.74V8.67L19.5005 8H21.0005Z"></path></svg>`
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
level: 2,
|
|
78
|
+
ariaLabel: "H2",
|
|
79
|
+
icon: `<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 8C20.5711 8 22.25 9.67893 22.25 11.75C22.25 12.6074 21.9623 13.3976 21.4781 14.0292L21.3302 14.2102L18.0343 18H22V20H15L14.9993 18.444L19.8207 12.8981C20.0881 12.5908 20.25 12.1893 20.25 11.75C20.25 10.7835 19.4665 10 18.5 10C17.5818 10 16.8288 10.7071 16.7558 11.6065L16.75 11.75H14.75C14.75 9.67893 16.4289 8 18.5 8Z"></path></svg>`
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
level: 3,
|
|
83
|
+
ariaLabel: "H3",
|
|
84
|
+
icon: `<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M22 8L21.9984 10L19.4934 12.883C21.0823 13.3184 22.25 14.7728 22.25 16.5C22.25 18.5711 20.5711 20.25 18.5 20.25C16.674 20.25 15.1528 18.9449 14.8184 17.2166L16.7821 16.8352C16.9384 17.6413 17.6481 18.25 18.5 18.25C19.4665 18.25 20.25 17.4665 20.25 16.5C20.25 15.5335 19.4665 14.75 18.5 14.75C18.214 14.75 17.944 14.8186 17.7056 14.9403L16.3992 13.3932L19.3484 10H15V8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"></path></svg>`
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
level: 4,
|
|
88
|
+
ariaLabel: "H4",
|
|
89
|
+
icon: `<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM22 8V16H23.5V18H22V20H20V18H14.5V16.66L19.5 8H22ZM20 11.133L17.19 16H20V11.133Z"></path></svg>`
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
level: 5,
|
|
93
|
+
ariaLabel: "H5",
|
|
94
|
+
icon: `<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M22 8V10H17.6769L17.2126 12.6358C17.5435 12.5472 17.8912 12.5 18.25 12.5C20.4591 12.5 22.25 14.2909 22.25 16.5C22.25 18.7091 20.4591 20.5 18.25 20.5C16.4233 20.5 14.8827 19.2756 14.4039 17.6027L16.3271 17.0519C16.5667 17.8881 17.3369 18.5 18.25 18.5C19.3546 18.5 20.25 17.6046 20.25 16.5C20.25 15.3954 19.3546 14.5 18.25 14.5C17.6194 14.5 17.057 14.7918 16.6904 15.2478L14.8803 14.3439L16 8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"></path></svg>`
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
level: 6,
|
|
98
|
+
ariaLabel: "H6",
|
|
99
|
+
icon: `<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M21.097 8L18.499 12.5C20.7091 12.5 22.5 14.2909 22.5 16.5C22.5 18.7091 20.7091 20.5 18.5 20.5C16.2909 20.5 14.5 18.7091 14.5 16.5C14.5 15.7636 14.699 15.0737 15.0461 14.4811L18.788 8H21.097ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 14.5C17.3954 14.5 16.5 15.3954 16.5 16.5C16.5 17.6046 17.3954 18.5 18.5 18.5C19.6046 18.5 20.5 17.6046 20.5 16.5C20.5 15.3954 19.6046 14.5 18.5 14.5Z"></path></svg>`
|
|
100
|
+
}
|
|
101
|
+
];
|
|
102
|
+
|
|
103
|
+
let recalculateDropdownPosition = $state(null);
|
|
104
|
+
|
|
105
|
+
let activeDropdownKey = $state(null);
|
|
106
|
+
|
|
107
|
+
function handleOpenDropdown(e) {
|
|
108
|
+
console.log(e);
|
|
109
|
+
activeDropdownKey = e.detail.key;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function handleCloseDropdown(e) {
|
|
113
|
+
console.log(e);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
let activePosition:
|
|
117
|
+
| "top-left"
|
|
118
|
+
| "top-center"
|
|
119
|
+
| "top-right"
|
|
120
|
+
| "bottom-left"
|
|
121
|
+
| "bottom-center"
|
|
122
|
+
| "bottom-right"
|
|
123
|
+
| "left-top"
|
|
124
|
+
| "left-center"
|
|
125
|
+
| "left-bottom"
|
|
126
|
+
| "right-top"
|
|
127
|
+
| "right-center"
|
|
128
|
+
| "right-bottom" = $state("bottom-center");
|
|
129
|
+
|
|
130
|
+
let refreshDropdown = $state(null);
|
|
131
|
+
let toggleByKey = $state(null);
|
|
132
|
+
|
|
133
|
+
let editor = $state() as Readable<Editor>;
|
|
134
|
+
|
|
135
|
+
let currentJSON = { "type": "doc", "content": [ { "type": "heading", "attrs": { "level": 1 }, "content": [ { "type": "text", "text": "Hi there," } ] }, { "type": "taskList", "content": [ { "type": "taskItem", "attrs": { "checked": true }, "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "Esto es un checkbox" } ] } ] }, { "type": "taskItem", "attrs": { "checked": true }, "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "Otro item del checkbox" } ] } ] }, { "type": "taskItem", "attrs": { "checked": false }, "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "jhjkhjkjhkjh" } ] } ] }, { "type": "taskItem", "attrs": { "checked": false }, "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "hgfhfgh" } ] } ] } ] }, { "type": "paragraph", "content": [ { "type": "text", "text": "this is a " }, { "type": "text", "marks": [ { "type": "italic" } ], "text": "basic" }, { "type": "text", "text": " example of " }, { "type": "text", "marks": [ { "type": "bold" } ], "text": "Tiptap" }, { "type": "text", "text": ". Sure, there are all kind of basic text styles you’d probably expect from a text editor. But wait until you see the lists:" } ] }, { "type": "bulletList", "content": [ { "type": "listItem", "attrs": { "color": "" }, "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "That’s a bullet list with one …" } ] } ] }, { "type": "listItem", "attrs": { "color": "" }, "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "… or two list items." } ] } ] } ] }, { "type": "paragraph", "content": [ { "type": "text", "text": "Isn’t that great? And all of that is editable. But wait, there’s more. Let’s try a code block:" } ] }, { "type": "codeBlock", "attrs": { "language": "css" }, "content": [ { "type": "text", "text": "body {\n display: none;\n}" } ] }, { "type": "paragraph", "content": [ { "type": "text", "text": "I know, I know, this is impressive. It’s only the tip of the iceberg though. Give it a try and click a little bit around. Don’t forget to check the other examples too." } ] }, { "type": "blockquote", "content": [ { "type": "paragraph", "content": [ { "type": "text", "text": "Wow, that’s amazing. Good work, boy! 👏 " }, { "type": "hardBreak" }, { "type": "text", "text": "— Mom" } ] } ] }, { "type": "paragraph" } ] }
|
|
136
|
+
if (!content) {
|
|
137
|
+
content = currentJSON;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const extensions = [
|
|
141
|
+
Color.configure({ types: [TextStyle.name, ListItem.name] }),
|
|
142
|
+
Highlight.configure({ multicolor: true }),
|
|
143
|
+
TextStyle,
|
|
144
|
+
StarterKit.configure({
|
|
145
|
+
// Disable an included extension
|
|
146
|
+
trailingNode: false,
|
|
147
|
+
link: false,
|
|
148
|
+
// bulletList: false,
|
|
149
|
+
// listItem: false,
|
|
150
|
+
// orderedList: false,
|
|
151
|
+
// listKeymap: false,
|
|
152
|
+
}),
|
|
153
|
+
Underline,
|
|
154
|
+
// Link.configure({
|
|
155
|
+
// openOnClick: false,
|
|
156
|
+
// autolink: true,
|
|
157
|
+
// defaultProtocol: "https",
|
|
158
|
+
// protocols: ["http", "https"],
|
|
159
|
+
// isAllowedUri: (url, ctx) => {
|
|
160
|
+
// try {
|
|
161
|
+
// // construct URL
|
|
162
|
+
// const parsedUrl = url.includes(":")
|
|
163
|
+
// ? new URL(url)
|
|
164
|
+
// : new URL(`${ctx.defaultProtocol}://${url}`);
|
|
165
|
+
|
|
166
|
+
// // use default validation
|
|
167
|
+
// if (!ctx.defaultValidate(parsedUrl.href)) {
|
|
168
|
+
// return false;
|
|
169
|
+
// }
|
|
170
|
+
|
|
171
|
+
// // disallowed protocols
|
|
172
|
+
// const disallowedProtocols = ["ftp", "file", "mailto"];
|
|
173
|
+
// const protocol = parsedUrl.protocol.replace(":", "");
|
|
174
|
+
|
|
175
|
+
// if (disallowedProtocols.includes(protocol)) {
|
|
176
|
+
// return false;
|
|
177
|
+
// }
|
|
178
|
+
|
|
179
|
+
// // only allow protocols specified in ctx.protocols
|
|
180
|
+
// const allowedProtocols = ctx.protocols.map((p) =>
|
|
181
|
+
// typeof p === "string" ? p : p.scheme
|
|
182
|
+
// );
|
|
183
|
+
|
|
184
|
+
// if (!allowedProtocols.includes(protocol)) {
|
|
185
|
+
// return false;
|
|
186
|
+
// }
|
|
187
|
+
|
|
188
|
+
// // disallowed domains
|
|
189
|
+
// const disallowedDomains = [
|
|
190
|
+
// "example-phishing.com",
|
|
191
|
+
// "malicious-site.net",
|
|
192
|
+
// ];
|
|
193
|
+
// const domain = parsedUrl.hostname;
|
|
194
|
+
|
|
195
|
+
// if (disallowedDomains.includes(domain)) {
|
|
196
|
+
// return false;
|
|
197
|
+
// }
|
|
198
|
+
|
|
199
|
+
// // all checks have passed
|
|
200
|
+
// return true;
|
|
201
|
+
// } catch {
|
|
202
|
+
// return false;
|
|
203
|
+
// }
|
|
204
|
+
// },
|
|
205
|
+
// shouldAutoLink: (url) => {
|
|
206
|
+
// try {
|
|
207
|
+
// // construct URL
|
|
208
|
+
// const parsedUrl = url.includes(":")
|
|
209
|
+
// ? new URL(url)
|
|
210
|
+
// : new URL(`https://${url}`);
|
|
211
|
+
|
|
212
|
+
// // only auto-link if the domain is not in the disallowed list
|
|
213
|
+
// const disallowedDomains = [
|
|
214
|
+
// "example-no-autolink.com",
|
|
215
|
+
// "another-no-autolink.com",
|
|
216
|
+
// ];
|
|
217
|
+
// const domain = parsedUrl.hostname;
|
|
218
|
+
|
|
219
|
+
// return !disallowedDomains.includes(domain);
|
|
220
|
+
// } catch {
|
|
221
|
+
// return false;
|
|
222
|
+
// }
|
|
223
|
+
// },
|
|
224
|
+
// }),
|
|
225
|
+
EnhancedLink,
|
|
226
|
+
Link.configure({
|
|
227
|
+
openOnClick: false,
|
|
228
|
+
HTMLAttributes: {
|
|
229
|
+
target: "_self",
|
|
230
|
+
rel: "noopener noreferrer",
|
|
231
|
+
},
|
|
232
|
+
}),
|
|
233
|
+
ListKit,
|
|
234
|
+
TextAlign.configure({
|
|
235
|
+
types: ['heading', 'paragraph', 'bulletList', 'taskList', 'listItem', 'blockquote'],
|
|
236
|
+
}),
|
|
237
|
+
...customExtensions,
|
|
238
|
+
]
|
|
239
|
+
onMount(() => {
|
|
240
|
+
editor = createEditor({
|
|
241
|
+
extensions,
|
|
242
|
+
content,
|
|
243
|
+
onTransaction: ({ editor, transaction }) => {
|
|
244
|
+
// console.log('onTransaction', editor, transaction)
|
|
245
|
+
editorEvents.onTransaction({ editor, transaction });
|
|
246
|
+
editor = editor;
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
onBeforeCreate({ editor }) {
|
|
250
|
+
// console.log('onBeforeCreate', editor)
|
|
251
|
+
editorEvents.onBeforeCreate({ editor });
|
|
252
|
+
// Before the view is created.
|
|
253
|
+
},
|
|
254
|
+
onCreate: ({ editor }) => {
|
|
255
|
+
// console.log('onCreate', editor)
|
|
256
|
+
editorEvents.onCreate({ editor });
|
|
257
|
+
},
|
|
258
|
+
|
|
259
|
+
onUpdate: ({ editor }) => {
|
|
260
|
+
// console.log('onUpdate', editor)
|
|
261
|
+
editorEvents.onUpdate({ editor, html: editor.getHTML(), json: editor.getJSON() });
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
onPaste: (event, slice) => {
|
|
265
|
+
// console.log('onPaste', event, slice)
|
|
266
|
+
editorEvents.onPaste({ event, slice });
|
|
267
|
+
},
|
|
268
|
+
|
|
269
|
+
onSelectionUpdate({ editor }) {
|
|
270
|
+
// console.log('onSelectionUpdate', editor)
|
|
271
|
+
// The selection has changed.
|
|
272
|
+
editorEvents.onSelectionUpdate({ editor });
|
|
273
|
+
},
|
|
274
|
+
onFocus({ editor, event }) {
|
|
275
|
+
// console.log('onFocus', editor, event)
|
|
276
|
+
// The editor is focused.
|
|
277
|
+
editorEvents.onFocus({ editor, event });
|
|
278
|
+
},
|
|
279
|
+
onBlur({ editor, event }) {
|
|
280
|
+
// The editor isn’t focused anymore.
|
|
281
|
+
// console.log('onBlur', editor, event)
|
|
282
|
+
editorEvents.onBlur({ editor, event });
|
|
283
|
+
},
|
|
284
|
+
onDestroy() {
|
|
285
|
+
// The editor is being destroyed.
|
|
286
|
+
// console.log('onDestroy')
|
|
287
|
+
editorEvents.onDestroy({ editor, message: "onDestroy" });
|
|
288
|
+
},
|
|
289
|
+
onDrop(event: any, slice: any, moved: boolean) {
|
|
290
|
+
// The editor is being pasted into.
|
|
291
|
+
// console.log('onDrop', event, slice, moved)
|
|
292
|
+
editorEvents.onDrop({ editor, event, slice, moved });
|
|
293
|
+
},
|
|
294
|
+
onDelete({ type, deletedRange, newRange, partial, from, to }) {
|
|
295
|
+
// Content was deleted from the editor (either a node or mark).
|
|
296
|
+
// console.log('onDelete', type, deletedRange, newRange, partial, from, to)
|
|
297
|
+
editorEvents.onDelete({ editor, type, deletedRange, newRange, partial, from, to });
|
|
298
|
+
},
|
|
299
|
+
onContentError({ editor, error, disableCollaboration }) {
|
|
300
|
+
// console.log('onContentError', editor, error, disableCollaboration)
|
|
301
|
+
editorEvents.onContentError({ editor, error, disableCollaboration });
|
|
302
|
+
// The editor content does not match the schema.
|
|
303
|
+
},
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
onDestroy(() => {
|
|
308
|
+
if (editor) {
|
|
309
|
+
$editor.destroy();
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
function changeDropdownPosition(position) {
|
|
314
|
+
activePosition = position;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function setLink() {
|
|
318
|
+
const previousUrl = $editor.getAttributes("link").href;
|
|
319
|
+
const url = window.prompt("URL", previousUrl);
|
|
320
|
+
|
|
321
|
+
// cancelled
|
|
322
|
+
if (url === null) {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
// empty
|
|
327
|
+
if (url === "") {
|
|
328
|
+
$editor.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
329
|
+
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// update link
|
|
334
|
+
try {
|
|
335
|
+
$editor
|
|
336
|
+
.chain()
|
|
337
|
+
.focus()
|
|
338
|
+
.extendMarkRange("link")
|
|
339
|
+
.setLink({ href: url })
|
|
340
|
+
.run();
|
|
341
|
+
|
|
342
|
+
setTimeout(() => {
|
|
343
|
+
const allLinks = $editor.view.dom.querySelectorAll("a");
|
|
344
|
+
allLinks.forEach((link: any) => {
|
|
345
|
+
link.addEventListener("click", (e: any) => {
|
|
346
|
+
e.preventDefault();
|
|
347
|
+
// console.log("Prevented navigation:", link.getAttribute("href"));
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
}, 100);
|
|
351
|
+
} catch (e) {
|
|
352
|
+
alert(e.message);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function toggleSpecialBox() {
|
|
357
|
+
if ($editor) {
|
|
358
|
+
$editor.chain().focus().specialBox().run();
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
</script>
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
<div class="fl-rich-text {className}" class:editable>
|
|
365
|
+
{#if editor}
|
|
366
|
+
<header class="fl-rich-text-toolbar">
|
|
367
|
+
<div role="group" class="fl-rich-text-toolbar-group flex-auto">
|
|
368
|
+
<button
|
|
369
|
+
type="button"
|
|
370
|
+
onclick={() => $editor.chain().focus().undo().run()}
|
|
371
|
+
disabled={!$editor.can().chain().focus().undo().run()}
|
|
372
|
+
aria-label="Undo"
|
|
373
|
+
>
|
|
374
|
+
<svg
|
|
375
|
+
width="24"
|
|
376
|
+
height="24"
|
|
377
|
+
class="tiptap-button-icon"
|
|
378
|
+
viewBox="0 0 24 24"
|
|
379
|
+
fill="currentColor"
|
|
380
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
381
|
+
><path
|
|
382
|
+
fill-rule="evenodd"
|
|
383
|
+
clip-rule="evenodd"
|
|
384
|
+
d="M9.70711 3.70711C10.0976 3.31658 10.0976 2.68342 9.70711 2.29289C9.31658 1.90237 8.68342 1.90237 8.29289 2.29289L3.29289 7.29289C2.90237 7.68342 2.90237 8.31658 3.29289 8.70711L8.29289 13.7071C8.68342 14.0976 9.31658 14.0976 9.70711 13.7071C10.0976 13.3166 10.0976 12.6834 9.70711 12.2929L6.41421 9H14.5C15.0909 9 15.6761 9.1164 16.2221 9.34254C16.768 9.56869 17.2641 9.90016 17.682 10.318C18.0998 10.7359 18.4313 11.232 18.6575 11.7779C18.8836 12.3239 19 12.9091 19 13.5C19 14.0909 18.8836 14.6761 18.6575 15.2221C18.4313 15.768 18.0998 16.2641 17.682 16.682C17.2641 17.0998 16.768 17.4313 16.2221 17.6575C15.6761 17.8836 15.0909 18 14.5 18H11C10.4477 18 10 18.4477 10 19C10 19.5523 10.4477 20 11 20H14.5C15.3536 20 16.1988 19.8319 16.9874 19.5052C17.7761 19.1786 18.4926 18.6998 19.0962 18.0962C19.6998 17.4926 20.1786 16.7761 20.5052 15.9874C20.8319 15.1988 21 14.3536 21 13.5C21 12.6464 20.8319 11.8012 20.5052 11.0126C20.1786 10.2239 19.6998 9.50739 19.0962 8.90381C18.4926 8.30022 17.7761 7.82144 16.9874 7.49478C16.1988 7.16813 15.3536 7 14.5 7H6.41421L9.70711 3.70711Z"
|
|
385
|
+
fill="currentColor"
|
|
386
|
+
></path></svg
|
|
387
|
+
>
|
|
388
|
+
</button>
|
|
389
|
+
<button
|
|
390
|
+
type="button"
|
|
391
|
+
onclick={() => $editor.chain().focus().redo().run()}
|
|
392
|
+
disabled={!$editor.can().chain().focus().redo().run()}
|
|
393
|
+
aria-label="Redo"
|
|
394
|
+
>
|
|
395
|
+
<svg
|
|
396
|
+
width="24"
|
|
397
|
+
height="24"
|
|
398
|
+
class="tiptap-button-icon"
|
|
399
|
+
viewBox="0 0 24 24"
|
|
400
|
+
fill="currentColor"
|
|
401
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
402
|
+
><path
|
|
403
|
+
fill-rule="evenodd"
|
|
404
|
+
clip-rule="evenodd"
|
|
405
|
+
d="M15.7071 2.29289C15.3166 1.90237 14.6834 1.90237 14.2929 2.29289C13.9024 2.68342 13.9024 3.31658 14.2929 3.70711L17.5858 7H9.5C7.77609 7 6.12279 7.68482 4.90381 8.90381C3.68482 10.1228 3 11.7761 3 13.5C3 14.3536 3.16813 15.1988 3.49478 15.9874C3.82144 16.7761 4.30023 17.4926 4.90381 18.0962C6.12279 19.3152 7.77609 20 9.5 20H13C13.5523 20 14 19.5523 14 19C14 18.4477 13.5523 18 13 18H9.5C8.30653 18 7.16193 17.5259 6.31802 16.682C5.90016 16.2641 5.56869 15.768 5.34254 15.2221C5.1164 14.6761 5 14.0909 5 13.5C5 12.3065 5.47411 11.1619 6.31802 10.318C7.16193 9.47411 8.30653 9 9.5 9H17.5858L14.2929 12.2929C13.9024 12.6834 13.9024 13.3166 14.2929 13.7071C14.6834 14.0976 15.3166 14.0976 15.7071 13.7071L20.7071 8.70711C21.0976 8.31658 21.0976 7.68342 20.7071 7.29289L15.7071 2.29289Z"
|
|
406
|
+
fill="currentColor"
|
|
407
|
+
></path></svg
|
|
408
|
+
>
|
|
409
|
+
</button>
|
|
410
|
+
</div>
|
|
411
|
+
|
|
412
|
+
<div class="fl-rich-text-toolbar-group">
|
|
413
|
+
<button
|
|
414
|
+
type="button"
|
|
415
|
+
onclick={() => changeDropdownPosition("bottom-center")}
|
|
416
|
+
data-dropdown-toggle="dropdown"
|
|
417
|
+
data-dropdown-trigger="click"
|
|
418
|
+
data-dropdown-key={"heading-dropdown-key"}
|
|
419
|
+
class:is-active={$editor.isActive("heading")}
|
|
420
|
+
aria-label="Heading"
|
|
421
|
+
>
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
{#each HEADINGS as heading}
|
|
425
|
+
{#if $editor.isActive("heading", { level: Number(heading.level) })}
|
|
426
|
+
{@html heading.icon}
|
|
427
|
+
{/if}
|
|
428
|
+
{/each}
|
|
429
|
+
|
|
430
|
+
{#if !$editor.isActive("heading")}
|
|
431
|
+
<svg width="24" height="24" class="tiptap-button-icon" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M6 3C6.55228 3 7 3.44772 7 4V11H17V4C17 3.44772 17.4477 3 18 3C18.5523 3 19 3.44772 19 4V20C19 20.5523 18.5523 21 18 21C17.4477 21 17 20.5523 17 20V13H7V20C7 20.5523 6.55228 21 6 21C5.44772 21 5 20.5523 5 20V4C5 3.44772 5.44772 3 6 3Z" fill="currentColor"></path></svg>
|
|
432
|
+
{/if}
|
|
433
|
+
|
|
434
|
+
<svg
|
|
435
|
+
class="toogle-dropdown-button-icon"
|
|
436
|
+
aria-hidden="true"
|
|
437
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
438
|
+
fill="none"
|
|
439
|
+
viewBox="0 0 10 6"
|
|
440
|
+
><path
|
|
441
|
+
stroke="currentColor"
|
|
442
|
+
stroke-linecap="round"
|
|
443
|
+
stroke-linejoin="round"
|
|
444
|
+
stroke-width="2"
|
|
445
|
+
d="m1 1 4 4 4-4"
|
|
446
|
+
></path></svg
|
|
447
|
+
>
|
|
448
|
+
</button>
|
|
449
|
+
</div>
|
|
450
|
+
|
|
451
|
+
<div role="group" class="fl-rich-text-toolbar-group">
|
|
452
|
+
<button aria-label="List"
|
|
453
|
+
type="button"
|
|
454
|
+
onclick={() => changeDropdownPosition("bottom-center")}
|
|
455
|
+
data-dropdown-toggle="dropdown"
|
|
456
|
+
data-dropdown-trigger="click"
|
|
457
|
+
data-dropdown-key={"list-dropdown-key"}
|
|
458
|
+
class:is-active={$editor.isActive("bulletList") || $editor.isActive("orderedList") || $editor.isActive("taskList")}
|
|
459
|
+
>
|
|
460
|
+
|
|
461
|
+
{#if $editor.isActive("bulletList")}
|
|
462
|
+
<svg width="24" height="24" class="tiptap-button-icon" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 6C7 5.44772 7.44772 5 8 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H8C7.44772 7 7 6.55228 7 6Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M7 12C7 11.4477 7.44772 11 8 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H8C7.44772 13 7 12.5523 7 12Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M7 18C7 17.4477 7.44772 17 8 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H8C7.44772 19 7 18.5523 7 18Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M2 6C2 5.44772 2.44772 5 3 5H3.01C3.56228 5 4.01 5.44772 4.01 6C4.01 6.55228 3.56228 7 3.01 7H3C2.44772 7 2 6.55228 2 6Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M2 12C2 11.4477 2.44772 11 3 11H3.01C3.56228 11 4.01 11.4477 4.01 12C4.01 12.5523 3.56228 13 3.01 13H3C2.44772 13 2 12.5523 2 12Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M2 18C2 17.4477 2.44772 17 3 17H3.01C3.56228 17 4.01 17.4477 4.01 18C4.01 18.5523 3.56228 19 3.01 19H3C2.44772 19 2 18.5523 2 18Z" fill="currentColor"></path></svg>
|
|
463
|
+
{:else if $editor.isActive("orderedList")}
|
|
464
|
+
<svg width="24" height="24" class="tiptap-button-icon" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M9 6C9 5.44772 9.44772 5 10 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H10C9.44772 7 9 6.55228 9 6Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M9 12C9 11.4477 9.44772 11 10 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H10C9.44772 13 9 12.5523 9 12Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M9 18C9 17.4477 9.44772 17 10 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H10C9.44772 19 9 18.5523 9 18Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M3 6C3 5.44772 3.44772 5 4 5H5C5.55228 5 6 5.44772 6 6V10C6 10.5523 5.55228 11 5 11C4.44772 11 4 10.5523 4 10V7C3.44772 7 3 6.55228 3 6Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M3 10C3 9.44772 3.44772 9 4 9H6C6.55228 9 7 9.44772 7 10C7 10.5523 6.55228 11 6 11H4C3.44772 11 3 10.5523 3 10Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M5.82219 13.0431C6.54543 13.4047 6.99997 14.1319 6.99997 15C6.99997 15.5763 6.71806 16.0426 6.48747 16.35C6.31395 16.5814 6.1052 16.8044 5.91309 17H5.99997C6.55226 17 6.99997 17.4477 6.99997 18C6.99997 18.5523 6.55226 19 5.99997 19H3.99997C3.44769 19 2.99997 18.5523 2.99997 18C2.99997 17.4237 3.28189 16.9575 3.51247 16.65C3.74323 16.3424 4.03626 16.0494 4.26965 15.8161C4.27745 15.8083 4.2852 15.8006 4.29287 15.7929C4.55594 15.5298 4.75095 15.3321 4.88748 15.15C4.96287 15.0495 4.99021 14.9922 4.99911 14.9714C4.99535 14.9112 4.9803 14.882 4.9739 14.8715C4.96613 14.8588 4.95382 14.845 4.92776 14.8319C4.87723 14.8067 4.71156 14.7623 4.44719 14.8944C3.95321 15.1414 3.35254 14.9412 3.10555 14.4472C2.85856 13.9533 3.05878 13.3526 3.55276 13.1056C4.28839 12.7378 5.12272 12.6934 5.82219 13.0431Z" fill="currentColor"></path></svg>
|
|
465
|
+
{:else if $editor.isActive("taskList")}
|
|
466
|
+
<svg width="24" height="24" class="tiptap-button-icon" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M2 6C2 4.89543 2.89543 4 4 4H8C9.10457 4 10 4.89543 10 6V10C10 11.1046 9.10457 12 8 12H4C2.89543 12 2 11.1046 2 10V6ZM8 6H4V10H8V6Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071L2.29289 17.7071C1.90237 17.3166 1.90237 16.6834 2.29289 16.2929C2.68342 15.9024 3.31658 15.9024 3.70711 16.2929L5 17.5858L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M12 6C12 5.44772 12.4477 5 13 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H13C12.4477 7 12 6.55228 12 6Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M12 12C12 11.4477 12.4477 11 13 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H13C12.4477 13 12 12.5523 12 12Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M12 18C12 17.4477 12.4477 17 13 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H13C12.4477 19 12 18.5523 12 18Z" fill="currentColor"></path></svg>
|
|
467
|
+
{:else}
|
|
468
|
+
<svg width="24" height="24" class="tiptap-button-icon" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 6C7 5.44772 7.44772 5 8 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H8C7.44772 7 7 6.55228 7 6Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M7 12C7 11.4477 7.44772 11 8 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H8C7.44772 13 7 12.5523 7 12Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M7 18C7 17.4477 7.44772 17 8 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H8C7.44772 19 7 18.5523 7 18Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M2 6C2 5.44772 2.44772 5 3 5H3.01C3.56228 5 4.01 5.44772 4.01 6C4.01 6.55228 3.56228 7 3.01 7H3C2.44772 7 2 6.55228 2 6Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M2 12C2 11.4477 2.44772 11 3 11H3.01C3.56228 11 4.01 11.4477 4.01 12C4.01 12.5523 3.56228 13 3.01 13H3C2.44772 13 2 12.5523 2 12Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M2 18C2 17.4477 2.44772 17 3 17H3.01C3.56228 17 4.01 17.4477 4.01 18C4.01 18.5523 3.56228 19 3.01 19H3C2.44772 19 2 18.5523 2 18Z" fill="currentColor"></path></svg>
|
|
469
|
+
{/if}
|
|
470
|
+
|
|
471
|
+
<svg
|
|
472
|
+
class="toogle-dropdown-button-icon"
|
|
473
|
+
aria-hidden="true"
|
|
474
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
475
|
+
fill="none"
|
|
476
|
+
viewBox="0 0 10 6"
|
|
477
|
+
><path
|
|
478
|
+
stroke="currentColor"
|
|
479
|
+
stroke-linecap="round"
|
|
480
|
+
stroke-linejoin="round"
|
|
481
|
+
stroke-width="2"
|
|
482
|
+
d="m1 1 4 4 4-4"
|
|
483
|
+
></path></svg
|
|
484
|
+
>
|
|
485
|
+
</button>
|
|
486
|
+
|
|
487
|
+
<button aria-label="Code block"
|
|
488
|
+
type="button"
|
|
489
|
+
onclick={() => $editor.chain().focus().toggleCodeBlock().run()}
|
|
490
|
+
class={$editor.isActive("codeBlock") ? "is-active" : ""}
|
|
491
|
+
>
|
|
492
|
+
<svg
|
|
493
|
+
width="24"
|
|
494
|
+
height="24"
|
|
495
|
+
class="tiptap-button-icon"
|
|
496
|
+
viewBox="0 0 24 24"
|
|
497
|
+
fill="currentColor"
|
|
498
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
499
|
+
><path
|
|
500
|
+
fill-rule="evenodd"
|
|
501
|
+
clip-rule="evenodd"
|
|
502
|
+
d="M6.70711 2.29289C7.09763 2.68342 7.09763 3.31658 6.70711 3.70711L4.41421 6L6.70711 8.29289C7.09763 8.68342 7.09763 9.31658 6.70711 9.70711C6.31658 10.0976 5.68342 10.0976 5.29289 9.70711L2.29289 6.70711C1.90237 6.31658 1.90237 5.68342 2.29289 5.29289L5.29289 2.29289C5.68342 1.90237 6.31658 1.90237 6.70711 2.29289Z"
|
|
503
|
+
fill="currentColor"
|
|
504
|
+
></path><path
|
|
505
|
+
fill-rule="evenodd"
|
|
506
|
+
clip-rule="evenodd"
|
|
507
|
+
d="M10.2929 2.29289C10.6834 1.90237 11.3166 1.90237 11.7071 2.29289L14.7071 5.29289C15.0976 5.68342 15.0976 6.31658 14.7071 6.70711L11.7071 9.70711C11.3166 10.0976 10.6834 10.0976 10.2929 9.70711C9.90237 9.31658 9.90237 8.68342 10.2929 8.29289L12.5858 6L10.2929 3.70711C9.90237 3.31658 9.90237 2.68342 10.2929 2.29289Z"
|
|
508
|
+
fill="currentColor"
|
|
509
|
+
></path><path
|
|
510
|
+
fill-rule="evenodd"
|
|
511
|
+
clip-rule="evenodd"
|
|
512
|
+
d="M17 4C17 3.44772 17.4477 3 18 3H19C20.6569 3 22 4.34315 22 6V18C22 19.6569 20.6569 21 19 21H5C3.34315 21 2 19.6569 2 18V12C2 11.4477 2.44772 11 3 11C3.55228 11 4 11.4477 4 12V18C4 18.5523 4.44772 19 5 19H19C19.5523 19 20 18.5523 20 18V6C20 5.44772 19.5523 5 19 5H18C17.4477 5 17 4.55228 17 4Z"
|
|
513
|
+
fill="currentColor"
|
|
514
|
+
></path></svg
|
|
515
|
+
>
|
|
516
|
+
</button>
|
|
517
|
+
|
|
518
|
+
<button aria-label="Blockquote"
|
|
519
|
+
type="button"
|
|
520
|
+
onclick={() => $editor.chain().focus().toggleBlockquote().run()}
|
|
521
|
+
class={$editor.isActive("blockquote") ? "is-active" : ""}
|
|
522
|
+
>
|
|
523
|
+
<svg
|
|
524
|
+
width="15"
|
|
525
|
+
height="15"
|
|
526
|
+
viewBox="0 0 15 15"
|
|
527
|
+
fill="none"
|
|
528
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
529
|
+
><path
|
|
530
|
+
d="M9.42503 3.44136C10.0561 3.23654 10.7837 3.2402 11.3792 3.54623C12.7532 4.25224 13.3477 6.07191 12.7946 8C12.5465 8.8649 12.1102 9.70472 11.1861 10.5524C10.262 11.4 8.98034 11.9 8.38571 11.9C8.17269 11.9 8 11.7321 8 11.525C8 11.3179 8.17644 11.15 8.38571 11.15C9.06497 11.15 9.67189 10.7804 10.3906 10.236C10.9406 9.8193 11.3701 9.28633 11.608 8.82191C12.0628 7.93367 12.0782 6.68174 11.3433 6.34901C10.9904 6.73455 10.5295 6.95946 9.97725 6.95946C8.7773 6.95946 8.0701 5.99412 8.10051 5.12009C8.12957 4.28474 8.66032 3.68954 9.42503 3.44136ZM3.42503 3.44136C4.05614 3.23654 4.78366 3.2402 5.37923 3.54623C6.7532 4.25224 7.34766 6.07191 6.79462 8C6.54654 8.8649 6.11019 9.70472 5.1861 10.5524C4.26201 11.4 2.98034 11.9 2.38571 11.9C2.17269 11.9 2 11.7321 2 11.525C2 11.3179 2.17644 11.15 2.38571 11.15C3.06497 11.15 3.67189 10.7804 4.39058 10.236C4.94065 9.8193 5.37014 9.28633 5.60797 8.82191C6.06282 7.93367 6.07821 6.68174 5.3433 6.34901C4.99037 6.73455 4.52948 6.95946 3.97725 6.95946C2.7773 6.95946 2.0701 5.99412 2.10051 5.12009C2.12957 4.28474 2.66032 3.68954 3.42503 3.44136Z"
|
|
531
|
+
fill="currentColor"
|
|
532
|
+
fill-rule="evenodd"
|
|
533
|
+
clip-rule="evenodd"
|
|
534
|
+
></path></svg
|
|
535
|
+
>
|
|
536
|
+
</button>
|
|
537
|
+
</div>
|
|
538
|
+
|
|
539
|
+
<div role="group" class="fl-rich-text-toolbar-group">
|
|
540
|
+
<button
|
|
541
|
+
type="button"
|
|
542
|
+
onclick={() => $editor.chain().focus().toggleBold().run()}
|
|
543
|
+
disabled={!$editor.can().chain().focus().toggleBold().run()}
|
|
544
|
+
class={$editor.isActive("bold") ? "is-active" : ""}
|
|
545
|
+
aria-label="Bold"
|
|
546
|
+
>
|
|
547
|
+
<svg
|
|
548
|
+
width="24"
|
|
549
|
+
height="24"
|
|
550
|
+
class="fl-button-icon"
|
|
551
|
+
viewBox="0 0 24 24"
|
|
552
|
+
fill="currentColor"
|
|
553
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
554
|
+
><path
|
|
555
|
+
fill-rule="evenodd"
|
|
556
|
+
clip-rule="evenodd"
|
|
557
|
+
d="M6 2.5C5.17157 2.5 4.5 3.17157 4.5 4V20C4.5 20.8284 5.17157 21.5 6 21.5H15C16.4587 21.5 17.8576 20.9205 18.8891 19.8891C19.9205 18.8576 20.5 17.4587 20.5 16C20.5 14.5413 19.9205 13.1424 18.8891 12.1109C18.6781 11.9 18.4518 11.7079 18.2128 11.5359C19.041 10.5492 19.5 9.29829 19.5 8C19.5 6.54131 18.9205 5.14236 17.8891 4.11091C16.8576 3.07946 15.4587 2.5 14 2.5H6ZM14 10.5C14.663 10.5 15.2989 10.2366 15.7678 9.76777C16.2366 9.29893 16.5 8.66304 16.5 8C16.5 7.33696 16.2366 6.70107 15.7678 6.23223C15.2989 5.76339 14.663 5.5 14 5.5H7.5V10.5H14ZM7.5 18.5V13.5H15C15.663 13.5 16.2989 13.7634 16.7678 14.2322C17.2366 14.7011 17.5 15.337 17.5 16C17.5 16.663 17.2366 17.2989 16.7678 17.7678C16.2989 18.2366 15.663 18.5 15 18.5H7.5Z"
|
|
558
|
+
fill="currentColor"
|
|
559
|
+
></path></svg
|
|
560
|
+
>
|
|
561
|
+
</button>
|
|
562
|
+
<button
|
|
563
|
+
type="button"
|
|
564
|
+
onclick={() => $editor.chain().focus().toggleItalic().run()}
|
|
565
|
+
disabled={!$editor.can().chain().focus().toggleItalic().run()}
|
|
566
|
+
class={$editor.isActive("italic") ? "is-active" : ""}
|
|
567
|
+
aria-label="Italic"
|
|
568
|
+
>
|
|
569
|
+
<svg
|
|
570
|
+
width="24"
|
|
571
|
+
height="24"
|
|
572
|
+
class="tiptap-button-icon"
|
|
573
|
+
viewBox="0 0 24 24"
|
|
574
|
+
fill="currentColor"
|
|
575
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
576
|
+
><path
|
|
577
|
+
d="M15.0222 3H19C19.5523 3 20 3.44772 20 4C20 4.55228 19.5523 5 19 5H15.693L10.443 19H14C14.5523 19 15 19.4477 15 20C15 20.5523 14.5523 21 14 21H9.02418C9.00802 21.0004 8.99181 21.0004 8.97557 21H5C4.44772 21 4 20.5523 4 20C4 19.4477 4.44772 19 5 19H8.30704L13.557 5H10C9.44772 5 9 4.55228 9 4C9 3.44772 9.44772 3 10 3H14.9782C14.9928 2.99968 15.0075 2.99967 15.0222 3Z"
|
|
578
|
+
fill="currentColor"
|
|
579
|
+
></path></svg
|
|
580
|
+
>
|
|
581
|
+
</button>
|
|
582
|
+
<button
|
|
583
|
+
type="button"
|
|
584
|
+
onclick={() => $editor.chain().focus().toggleUnderline().run()}
|
|
585
|
+
disabled={!$editor.can().chain().focus().toggleStrike().run()}
|
|
586
|
+
class={$editor.isActive("underline") ? "is-active" : ""}
|
|
587
|
+
aria-label="Underline"
|
|
588
|
+
>
|
|
589
|
+
<svg
|
|
590
|
+
width="24"
|
|
591
|
+
height="24"
|
|
592
|
+
class="tiptap-button-icon"
|
|
593
|
+
viewBox="0 0 24 24"
|
|
594
|
+
fill="currentColor"
|
|
595
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
596
|
+
><path
|
|
597
|
+
fill-rule="evenodd"
|
|
598
|
+
clip-rule="evenodd"
|
|
599
|
+
d="M7 4C7 3.44772 6.55228 3 6 3C5.44772 3 5 3.44772 5 4V10C5 11.8565 5.7375 13.637 7.05025 14.9497C8.36301 16.2625 10.1435 17 12 17C13.8565 17 15.637 16.2625 16.9497 14.9497C18.2625 13.637 19 11.8565 19 10V4C19 3.44772 18.5523 3 18 3C17.4477 3 17 3.44772 17 4V10C17 11.3261 16.4732 12.5979 15.5355 13.5355C14.5979 14.4732 13.3261 15 12 15C10.6739 15 9.40215 14.4732 8.46447 13.5355C7.52678 12.5979 7 11.3261 7 10V4ZM4 19C3.44772 19 3 19.4477 3 20C3 20.5523 3.44772 21 4 21H20C20.5523 21 21 20.5523 21 20C21 19.4477 20.5523 19 20 19H4Z"
|
|
600
|
+
fill="currentColor"
|
|
601
|
+
></path></svg
|
|
602
|
+
>
|
|
603
|
+
</button>
|
|
604
|
+
<button
|
|
605
|
+
type="button"
|
|
606
|
+
onclick={() => $editor.chain().focus().toggleStrike().run()}
|
|
607
|
+
disabled={!$editor.can().chain().focus().toggleStrike().run()}
|
|
608
|
+
class={$editor.isActive("strike") ? "is-active" : ""}
|
|
609
|
+
aria-label="Strike"
|
|
610
|
+
>
|
|
611
|
+
<svg
|
|
612
|
+
width="24"
|
|
613
|
+
height="24"
|
|
614
|
+
class="tiptap-button-icon"
|
|
615
|
+
viewBox="0 0 24 24"
|
|
616
|
+
fill="currentColor"
|
|
617
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
618
|
+
><path
|
|
619
|
+
d="M9.00039 3H16.0001C16.5524 3 17.0001 3.44772 17.0001 4C17.0001 4.55229 16.5524 5 16.0001 5H9.00011C8.68006 4.99983 8.36412 5.07648 8.07983 5.22349C7.79555 5.37051 7.55069 5.5836 7.36585 5.84487C7.181 6.10614 7.06155 6.40796 7.01754 6.72497C6.97352 7.04198 7.00623 7.36492 7.11292 7.66667C7.29701 8.18737 7.02414 8.75872 6.50344 8.94281C5.98274 9.1269 5.4114 8.85403 5.2273 8.33333C5.01393 7.72984 4.94851 7.08396 5.03654 6.44994C5.12456 5.81592 5.36346 5.21229 5.73316 4.68974C6.10285 4.1672 6.59256 3.74101 7.16113 3.44698C7.72955 3.15303 8.36047 2.99975 9.00039 3Z"
|
|
620
|
+
fill="currentColor"
|
|
621
|
+
></path><path
|
|
622
|
+
d="M18 13H20C20.5523 13 21 12.5523 21 12C21 11.4477 20.5523 11 20 11H4C3.44772 11 3 11.4477 3 12C3 12.5523 3.44772 13 4 13H14C14.7956 13 15.5587 13.3161 16.1213 13.8787C16.6839 14.4413 17 15.2044 17 16C17 16.7956 16.6839 17.5587 16.1213 18.1213C15.5587 18.6839 14.7956 19 14 19H6C5.44772 19 5 19.4477 5 20C5 20.5523 5.44772 21 6 21H14C15.3261 21 16.5979 20.4732 17.5355 19.5355C18.4732 18.5979 19 17.3261 19 16C19 14.9119 18.6453 13.8604 18 13Z"
|
|
623
|
+
fill="currentColor"
|
|
624
|
+
></path></svg
|
|
625
|
+
>
|
|
626
|
+
</button>
|
|
627
|
+
<button
|
|
628
|
+
type="button"
|
|
629
|
+
onclick={() => $editor.chain().focus().toggleCode().run()}
|
|
630
|
+
disabled={!$editor.can().chain().focus().toggleCode().run()}
|
|
631
|
+
class={$editor.isActive("code") ? "is-active" : ""}
|
|
632
|
+
aria-label="Code"
|
|
633
|
+
>
|
|
634
|
+
<svg
|
|
635
|
+
width="24"
|
|
636
|
+
height="24"
|
|
637
|
+
class="tiptap-button-icon"
|
|
638
|
+
viewBox="0 0 24 24"
|
|
639
|
+
fill="currentColor"
|
|
640
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
641
|
+
><path
|
|
642
|
+
d="M15.4545 4.2983C15.6192 3.77115 15.3254 3.21028 14.7983 3.04554C14.2712 2.88081 13.7103 3.1746 13.5455 3.70175L8.54554 19.7017C8.38081 20.2289 8.6746 20.7898 9.20175 20.9545C9.72889 21.1192 10.2898 20.8254 10.4545 20.2983L15.4545 4.2983Z"
|
|
643
|
+
fill="currentColor"
|
|
644
|
+
></path><path
|
|
645
|
+
d="M6.70711 7.29289C7.09763 7.68342 7.09763 8.31658 6.70711 8.70711L3.41421 12L6.70711 15.2929C7.09763 15.6834 7.09763 16.3166 6.70711 16.7071C6.31658 17.0976 5.68342 17.0976 5.29289 16.7071L1.29289 12.7071C0.902369 12.3166 0.902369 11.6834 1.29289 11.2929L5.29289 7.29289C5.68342 6.90237 6.31658 6.90237 6.70711 7.29289Z"
|
|
646
|
+
fill="currentColor"
|
|
647
|
+
></path><path
|
|
648
|
+
d="M17.2929 7.29289C17.6834 6.90237 18.3166 6.90237 18.7071 7.29289L22.7071 11.2929C23.0976 11.6834 23.0976 12.3166 22.7071 12.7071L18.7071 16.7071C18.3166 17.0976 17.6834 17.0976 17.2929 16.7071C16.9024 16.3166 16.9024 15.6834 17.2929 15.2929L20.5858 12L17.2929 8.70711C16.9024 8.31658 16.9024 7.68342 17.2929 7.29289Z"
|
|
649
|
+
fill="currentColor"
|
|
650
|
+
></path></svg
|
|
651
|
+
>
|
|
652
|
+
</button>
|
|
653
|
+
</div>
|
|
654
|
+
|
|
655
|
+
<!-- <button
|
|
656
|
+
type="button"
|
|
657
|
+
onclick={() => $editor.chain().focus().setParagraph().run()}
|
|
658
|
+
class={$editor.isActive("paragraph") ? "is-active" : ""}
|
|
659
|
+
>
|
|
660
|
+
Paragraph
|
|
661
|
+
</button> -->
|
|
662
|
+
|
|
663
|
+
<button
|
|
664
|
+
type="button"
|
|
665
|
+
onclick={() => setLink()}
|
|
666
|
+
class="fl-bubble-menu-mark-button"
|
|
667
|
+
class:is-active={$editor.isActive("link")}
|
|
668
|
+
aria-label="Link"
|
|
669
|
+
>
|
|
670
|
+
<svg
|
|
671
|
+
width="16"
|
|
672
|
+
height="16"
|
|
673
|
+
class="tiptap-button-icon"
|
|
674
|
+
viewBox="0 0 24 24"
|
|
675
|
+
fill="currentColor"
|
|
676
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
677
|
+
><path
|
|
678
|
+
d="M16.9958 1.06669C15.4226 1.05302 13.907 1.65779 12.7753 2.75074L12.765 2.76086L11.045 4.47086C10.6534 4.86024 10.6515 5.49341 11.0409 5.88507C11.4303 6.27673 12.0634 6.27858 12.4551 5.88919L14.1697 4.18456C14.9236 3.45893 15.9319 3.05752 16.9784 3.06662C18.0272 3.07573 19.0304 3.49641 19.772 4.23804C20.5137 4.97967 20.9344 5.98292 20.9435 7.03171C20.9526 8.07776 20.5515 9.08563 19.8265 9.83941L16.833 12.8329C16.4274 13.2386 15.9393 13.5524 15.4019 13.7529C14.8645 13.9533 14.2903 14.0359 13.7181 13.9949C13.146 13.9539 12.5894 13.7904 12.0861 13.5154C11.5827 13.2404 11.1444 12.8604 10.8008 12.401C10.47 11.9588 9.84333 11.8685 9.40108 12.1993C8.95883 12.5301 8.86849 13.1568 9.1993 13.599C9.71464 14.288 10.3721 14.858 11.1272 15.2705C11.8822 15.683 12.7171 15.9283 13.5753 15.9898C14.4334 16.0513 15.2948 15.9274 16.1009 15.6267C16.907 15.326 17.639 14.8555 18.2473 14.247L21.2472 11.2471L21.2593 11.2347C22.3523 10.1031 22.9571 8.58751 22.9434 7.01433C22.9297 5.44115 22.2987 3.93628 21.1863 2.82383C20.0738 1.71138 18.5689 1.08036 16.9958 1.06669Z"
|
|
679
|
+
fill="currentColor"
|
|
680
|
+
></path><path
|
|
681
|
+
d="M10.4247 8.0102C9.56657 7.94874 8.70522 8.07256 7.89911 8.37326C7.09305 8.67395 6.36096 9.14458 5.75272 9.753L2.75285 12.7529L2.74067 12.7653C1.64772 13.8969 1.04295 15.4125 1.05662 16.9857C1.07029 18.5589 1.70131 20.0637 2.81376 21.1762C3.9262 22.2886 5.43108 22.9196 7.00426 22.9333C8.57744 22.947 10.0931 22.3422 11.2247 21.2493L11.2371 21.2371L12.9471 19.5271C13.3376 19.1366 13.3376 18.5034 12.9471 18.1129C12.5565 17.7223 11.9234 17.7223 11.5328 18.1129L9.82932 19.8164C9.07555 20.5414 8.06768 20.9425 7.02164 20.9334C5.97285 20.9243 4.9696 20.5036 4.22797 19.762C3.48634 19.0203 3.06566 18.0171 3.05655 16.9683C3.04746 15.9222 3.44851 14.9144 4.17355 14.1606L7.16719 11.167C7.5727 10.7613 8.06071 10.4476 8.59811 10.2471C9.13552 10.0467 9.70976 9.96412 10.2819 10.0051C10.854 10.0461 11.4106 10.2096 11.9139 10.4846C12.4173 10.7596 12.8556 11.1397 13.1992 11.599C13.53 12.0412 14.1567 12.1316 14.5989 11.8007C15.0412 11.4699 15.1315 10.8433 14.8007 10.401C14.2854 9.71205 13.6279 9.14198 12.8729 8.72948C12.1178 8.31697 11.2829 8.07166 10.4247 8.0102Z"
|
|
682
|
+
fill="currentColor"
|
|
683
|
+
></path></svg
|
|
684
|
+
>
|
|
685
|
+
</button>
|
|
686
|
+
|
|
687
|
+
<button
|
|
688
|
+
class="fl-bubble-menu-mark-button"
|
|
689
|
+
class:is-active={$editor?.isActive("specialBox")}
|
|
690
|
+
onclick={toggleSpecialBox}
|
|
691
|
+
type="button"
|
|
692
|
+
aria-label="Special Box"
|
|
693
|
+
>
|
|
694
|
+
<span class="special-box-icon">A</span>
|
|
695
|
+
</button>
|
|
696
|
+
|
|
697
|
+
<button
|
|
698
|
+
type="button"
|
|
699
|
+
onclick={() => $editor.chain().focus().setHorizontalRule().run()}
|
|
700
|
+
aria-label="Horizontal rule"
|
|
701
|
+
>
|
|
702
|
+
<svg
|
|
703
|
+
width="15"
|
|
704
|
+
height="15"
|
|
705
|
+
viewBox="0 0 15 15"
|
|
706
|
+
fill="none"
|
|
707
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
708
|
+
><path
|
|
709
|
+
d="M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z"
|
|
710
|
+
fill="currentColor"
|
|
711
|
+
fill-rule="evenodd"
|
|
712
|
+
clip-rule="evenodd"
|
|
713
|
+
></path></svg
|
|
714
|
+
>
|
|
715
|
+
</button>
|
|
716
|
+
|
|
717
|
+
<button
|
|
718
|
+
type="button"
|
|
719
|
+
onclick={() => $editor.chain().focus().setHardBreak().run()}
|
|
720
|
+
aria-label="Hard break"
|
|
721
|
+
>
|
|
722
|
+
<svg
|
|
723
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
724
|
+
width="24"
|
|
725
|
+
height="24"
|
|
726
|
+
viewBox="0 0 24 24"
|
|
727
|
+
fill="none"
|
|
728
|
+
stroke="currentColor"
|
|
729
|
+
stroke-width="2"
|
|
730
|
+
stroke-linecap="round"
|
|
731
|
+
stroke-linejoin="round"
|
|
732
|
+
class="icon icon-tabler icons-tabler-outline icon-tabler-corner-down-left"
|
|
733
|
+
><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path
|
|
734
|
+
d="M18 6v6a3 3 0 0 1 -3 3h-10l4 -4m0 8l-4 -4"
|
|
735
|
+
></path></svg
|
|
736
|
+
>
|
|
737
|
+
</button>
|
|
738
|
+
|
|
739
|
+
<button
|
|
740
|
+
type="button"
|
|
741
|
+
onclick={() => $editor.chain().focus().setColor("#958DF1").run()}
|
|
742
|
+
class={$editor.isActive("textStyle", { color: "#958DF1" })
|
|
743
|
+
? "is-active"
|
|
744
|
+
: ""}
|
|
745
|
+
>
|
|
746
|
+
<span
|
|
747
|
+
style="background: #958DF1;width: 16px;height: 16px;border-radius: 100%;margin-right: 6px;border: 1px solid #d7d7d78a;box-sizing: border-box;"
|
|
748
|
+
></span>
|
|
749
|
+
Purple
|
|
750
|
+
</button>
|
|
751
|
+
|
|
752
|
+
<div role="group" class="fl-rich-text-toolbar-group">
|
|
753
|
+
<button
|
|
754
|
+
type="button"
|
|
755
|
+
onclick={() => $editor.chain().focus().toggleTextAlign('left').run()}
|
|
756
|
+
class:is-active={$editor.isActive({ textAlign: 'left' })}
|
|
757
|
+
aria-label="Align left"
|
|
758
|
+
>
|
|
759
|
+
<svg
|
|
760
|
+
width="15"
|
|
761
|
+
height="15"
|
|
762
|
+
viewBox="0 0 15 15"
|
|
763
|
+
fill="none"
|
|
764
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
765
|
+
><path
|
|
766
|
+
d="M2 4.5C2 4.22386 2.22386 4 2.5 4H12.5C12.7761 4 13 4.22386 13 4.5C13 4.77614 12.7761 5 12.5 5H2.5C2.22386 5 2 4.77614 2 4.5ZM2 7.5C2 7.22386 2.22386 7 2.5 7H7.5C7.77614 7 8 7.22386 8 7.5C8 7.77614 7.77614 8 7.5 8H2.5C2.22386 8 2 7.77614 2 7.5ZM2 10.5C2 10.2239 2.22386 10 2.5 10H10.5C10.7761 10 11 10.2239 11 10.5C11 10.7761 10.7761 11 10.5 11H2.5C2.22386 11 2 10.7761 2 10.5Z"
|
|
767
|
+
fill="currentColor"
|
|
768
|
+
fill-rule="evenodd"
|
|
769
|
+
clip-rule="evenodd"
|
|
770
|
+
></path></svg
|
|
771
|
+
>
|
|
772
|
+
</button>
|
|
773
|
+
|
|
774
|
+
<button
|
|
775
|
+
type="button"
|
|
776
|
+
onclick={() => $editor.chain().focus().toggleTextAlign('center').run()}
|
|
777
|
+
class:is-active={$editor.isActive({ textAlign: 'center' })}
|
|
778
|
+
aria-label="Align center"
|
|
779
|
+
>
|
|
780
|
+
<svg
|
|
781
|
+
width="15"
|
|
782
|
+
height="15"
|
|
783
|
+
viewBox="0 0 15 15"
|
|
784
|
+
fill="none"
|
|
785
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
786
|
+
><path
|
|
787
|
+
d="M2 4.5C2 4.22386 2.22386 4 2.5 4H12.5C12.7761 4 13 4.22386 13 4.5C13 4.77614 12.7761 5 12.5 5H2.5C2.22386 5 2 4.77614 2 4.5ZM4 7.5C4 7.22386 4.22386 7 4.5 7H10.5C10.7761 7 11 7.22386 11 7.5C11 7.77614 10.7761 8 10.5 8H4.5C4.22386 8 4 7.77614 4 7.5ZM3 10.5C3 10.2239 3.22386 10 3.5 10H11.5C11.7761 10 12 10.2239 12 10.5C12 10.7761 11.7761 11 11.5 11H3.5C3.22386 11 3 10.7761 3 10.5Z"
|
|
788
|
+
fill="currentColor"
|
|
789
|
+
fill-rule="evenodd"
|
|
790
|
+
clip-rule="evenodd"
|
|
791
|
+
></path></svg
|
|
792
|
+
>
|
|
793
|
+
</button>
|
|
794
|
+
|
|
795
|
+
<button
|
|
796
|
+
type="button"
|
|
797
|
+
onclick={() => $editor.chain().focus().toggleTextAlign('right').run()}
|
|
798
|
+
class:is-active={$editor.isActive({ textAlign: 'right' })}
|
|
799
|
+
aria-label="Align right"
|
|
800
|
+
>
|
|
801
|
+
<svg
|
|
802
|
+
width="15"
|
|
803
|
+
height="15"
|
|
804
|
+
viewBox="0 0 15 15"
|
|
805
|
+
fill="none"
|
|
806
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
807
|
+
><path
|
|
808
|
+
d="M2 4.5C2 4.22386 2.22386 4 2.5 4H12.5C12.7761 4 13 4.22386 13 4.5C13 4.77614 12.7761 5 12.5 5H2.5C2.22386 5 2 4.77614 2 4.5ZM7 7.5C7 7.22386 7.22386 7 7.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H7.5C7.22386 8 7 7.77614 7 7.5ZM4 10.5C4 10.2239 4.22386 10 4.5 10H12.5C12.7761 10 13 10.2239 13 10.5C13 10.7761 12.7761 11 12.5 11H4.5C4.22386 11 4 10.7761 4 10.5Z"
|
|
809
|
+
fill="currentColor"
|
|
810
|
+
fill-rule="evenodd"
|
|
811
|
+
clip-rule="evenodd"
|
|
812
|
+
></path></svg
|
|
813
|
+
>
|
|
814
|
+
</button>
|
|
815
|
+
</div>
|
|
816
|
+
|
|
817
|
+
<button
|
|
818
|
+
type="button"
|
|
819
|
+
onclick={() => $editor.chain().focus().unsetAllMarks().run()}
|
|
820
|
+
>Clear marks</button
|
|
821
|
+
>
|
|
822
|
+
<button
|
|
823
|
+
type="button"
|
|
824
|
+
onclick={() => $editor.chain().focus().clearNodes().run()}
|
|
825
|
+
>Clear nodes</button
|
|
826
|
+
>
|
|
827
|
+
|
|
828
|
+
<Dropdown
|
|
829
|
+
bind:refreshDropdown
|
|
830
|
+
bind:calculatePosition={recalculateDropdownPosition}
|
|
831
|
+
bind:toggleByKey
|
|
832
|
+
position={activePosition}
|
|
833
|
+
yOffset={0}
|
|
834
|
+
xOffset={0}
|
|
835
|
+
margin={3}
|
|
836
|
+
id="dropdown"
|
|
837
|
+
on:close={handleCloseDropdown}
|
|
838
|
+
on:open={handleOpenDropdown}
|
|
839
|
+
>
|
|
840
|
+
{#if activeDropdownKey === 'heading-dropdown-key'}
|
|
841
|
+
<div role="group" class="fl-rich-text-toolbar-group">
|
|
842
|
+
<button
|
|
843
|
+
type="button"
|
|
844
|
+
onclick={() =>
|
|
845
|
+
$editor.chain().focus().toggleHeading({ level: 1 }).run()}
|
|
846
|
+
class={$editor.isActive("heading", { level: 1 }) ? "is-active" : ""}
|
|
847
|
+
aria-label="H1"
|
|
848
|
+
>
|
|
849
|
+
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM21.0005 8V20H19.0005L19 10.204L17 10.74V8.67L19.5005 8H21.0005Z"></path></svg>
|
|
850
|
+
</button>
|
|
851
|
+
|
|
852
|
+
<button
|
|
853
|
+
type="button"
|
|
854
|
+
onclick={() =>
|
|
855
|
+
$editor.chain().focus().toggleHeading({ level: 2 }).run()}
|
|
856
|
+
class={$editor.isActive("heading", { level: 2 }) ? "is-active" : ""}
|
|
857
|
+
aria-label="H2"
|
|
858
|
+
>
|
|
859
|
+
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 8C20.5711 8 22.25 9.67893 22.25 11.75C22.25 12.6074 21.9623 13.3976 21.4781 14.0292L21.3302 14.2102L18.0343 18H22V20H15L14.9993 18.444L19.8207 12.8981C20.0881 12.5908 20.25 12.1893 20.25 11.75C20.25 10.7835 19.4665 10 18.5 10C17.5818 10 16.8288 10.7071 16.7558 11.6065L16.75 11.75H14.75C14.75 9.67893 16.4289 8 18.5 8Z"></path></svg>
|
|
860
|
+
</button>
|
|
861
|
+
|
|
862
|
+
<button
|
|
863
|
+
type="button"
|
|
864
|
+
onclick={() =>
|
|
865
|
+
$editor.chain().focus().toggleHeading({ level: 3 }).run()}
|
|
866
|
+
class={$editor.isActive("heading", { level: 3 }) ? "is-active" : ""}
|
|
867
|
+
aria-label="H3"
|
|
868
|
+
>
|
|
869
|
+
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M22 8L21.9984 10L19.4934 12.883C21.0823 13.3184 22.25 14.7728 22.25 16.5C22.25 18.5711 20.5711 20.25 18.5 20.25C16.674 20.25 15.1528 18.9449 14.8184 17.2166L16.7821 16.8352C16.9384 17.6413 17.6481 18.25 18.5 18.25C19.4665 18.25 20.25 17.4665 20.25 16.5C20.25 15.5335 19.4665 14.75 18.5 14.75C18.214 14.75 17.944 14.8186 17.7056 14.9403L16.3992 13.3932L19.3484 10H15V8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"></path></svg>
|
|
870
|
+
</button>
|
|
871
|
+
|
|
872
|
+
<button
|
|
873
|
+
type="button"
|
|
874
|
+
onclick={() =>
|
|
875
|
+
$editor.chain().focus().toggleHeading({ level: 4 }).run()}
|
|
876
|
+
class={$editor.isActive("heading", { level: 4 }) ? "is-active" : ""}
|
|
877
|
+
aria-label="H4"
|
|
878
|
+
>
|
|
879
|
+
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM22 8V16H23.5V18H22V20H20V18H14.5V16.66L19.5 8H22ZM20 11.133L17.19 16H20V11.133Z"></path></svg>
|
|
880
|
+
</button>
|
|
881
|
+
|
|
882
|
+
<button
|
|
883
|
+
type="button"
|
|
884
|
+
onclick={() =>
|
|
885
|
+
$editor.chain().focus().toggleHeading({ level: 5 }).run()}
|
|
886
|
+
class={$editor.isActive("heading", { level: 5 }) ? "is-active" : ""}
|
|
887
|
+
aria-label="H5"
|
|
888
|
+
>
|
|
889
|
+
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M22 8V10H17.6769L17.2126 12.6358C17.5435 12.5472 17.8912 12.5 18.25 12.5C20.4591 12.5 22.25 14.2909 22.25 16.5C22.25 18.7091 20.4591 20.5 18.25 20.5C16.4233 20.5 14.8827 19.2756 14.4039 17.6027L16.3271 17.0519C16.5667 17.8881 17.3369 18.5 18.25 18.5C19.3546 18.5 20.25 17.6046 20.25 16.5C20.25 15.3954 19.3546 14.5 18.25 14.5C17.6194 14.5 17.057 14.7918 16.6904 15.2478L14.8803 14.3439L16 8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"></path></svg>
|
|
890
|
+
</button>
|
|
891
|
+
|
|
892
|
+
<button
|
|
893
|
+
type="button"
|
|
894
|
+
onclick={() =>
|
|
895
|
+
$editor.chain().focus().toggleHeading({ level: 6 }).run()}
|
|
896
|
+
class={$editor.isActive("heading", { level: 6 }) ? "is-active" : ""}
|
|
897
|
+
aria-label="H6"
|
|
898
|
+
>
|
|
899
|
+
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M21.097 8L18.499 12.5C20.7091 12.5 22.5 14.2909 22.5 16.5C22.5 18.7091 20.7091 20.5 18.5 20.5C16.2909 20.5 14.5 18.7091 14.5 16.5C14.5 15.7636 14.699 15.0737 15.0461 14.4811L18.788 8H21.097ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 14.5C17.3954 14.5 16.5 15.3954 16.5 16.5C16.5 17.6046 17.3954 18.5 18.5 18.5C19.6046 18.5 20.5 17.6046 20.5 16.5C20.5 15.3954 19.6046 14.5 18.5 14.5Z"></path></svg>
|
|
900
|
+
</button>
|
|
901
|
+
</div>
|
|
902
|
+
{:else if activeDropdownKey === 'list-dropdown-key'}
|
|
903
|
+
<div role="group" class="fl-rich-text-toolbar-group">
|
|
904
|
+
<button aria-label="Bullet list"
|
|
905
|
+
type="button"
|
|
906
|
+
onclick={() => $editor.chain().focus().toggleBulletList().run()}
|
|
907
|
+
class={$editor.isActive("bulletList") ? "is-active" : ""}
|
|
908
|
+
>
|
|
909
|
+
<svg width="24" height="24" class="tiptap-button-icon" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 6C7 5.44772 7.44772 5 8 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H8C7.44772 7 7 6.55228 7 6Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M7 12C7 11.4477 7.44772 11 8 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H8C7.44772 13 7 12.5523 7 12Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M7 18C7 17.4477 7.44772 17 8 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H8C7.44772 19 7 18.5523 7 18Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M2 6C2 5.44772 2.44772 5 3 5H3.01C3.56228 5 4.01 5.44772 4.01 6C4.01 6.55228 3.56228 7 3.01 7H3C2.44772 7 2 6.55228 2 6Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M2 12C2 11.4477 2.44772 11 3 11H3.01C3.56228 11 4.01 11.4477 4.01 12C4.01 12.5523 3.56228 13 3.01 13H3C2.44772 13 2 12.5523 2 12Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M2 18C2 17.4477 2.44772 17 3 17H3.01C3.56228 17 4.01 17.4477 4.01 18C4.01 18.5523 3.56228 19 3.01 19H3C2.44772 19 2 18.5523 2 18Z" fill="currentColor"></path></svg>
|
|
910
|
+
</button>
|
|
911
|
+
|
|
912
|
+
<button aria-label="Ordered list"
|
|
913
|
+
type="button"
|
|
914
|
+
onclick={() => $editor.chain().focus().toggleOrderedList().run()}
|
|
915
|
+
class={$editor.isActive("orderedList") ? "is-active" : ""}
|
|
916
|
+
>
|
|
917
|
+
<svg width="24" height="24" class="tiptap-button-icon" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M9 6C9 5.44772 9.44772 5 10 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H10C9.44772 7 9 6.55228 9 6Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M9 12C9 11.4477 9.44772 11 10 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H10C9.44772 13 9 12.5523 9 12Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M9 18C9 17.4477 9.44772 17 10 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H10C9.44772 19 9 18.5523 9 18Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M3 6C3 5.44772 3.44772 5 4 5H5C5.55228 5 6 5.44772 6 6V10C6 10.5523 5.55228 11 5 11C4.44772 11 4 10.5523 4 10V7C3.44772 7 3 6.55228 3 6Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M3 10C3 9.44772 3.44772 9 4 9H6C6.55228 9 7 9.44772 7 10C7 10.5523 6.55228 11 6 11H4C3.44772 11 3 10.5523 3 10Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M5.82219 13.0431C6.54543 13.4047 6.99997 14.1319 6.99997 15C6.99997 15.5763 6.71806 16.0426 6.48747 16.35C6.31395 16.5814 6.1052 16.8044 5.91309 17H5.99997C6.55226 17 6.99997 17.4477 6.99997 18C6.99997 18.5523 6.55226 19 5.99997 19H3.99997C3.44769 19 2.99997 18.5523 2.99997 18C2.99997 17.4237 3.28189 16.9575 3.51247 16.65C3.74323 16.3424 4.03626 16.0494 4.26965 15.8161C4.27745 15.8083 4.2852 15.8006 4.29287 15.7929C4.55594 15.5298 4.75095 15.3321 4.88748 15.15C4.96287 15.0495 4.99021 14.9922 4.99911 14.9714C4.99535 14.9112 4.9803 14.882 4.9739 14.8715C4.96613 14.8588 4.95382 14.845 4.92776 14.8319C4.87723 14.8067 4.71156 14.7623 4.44719 14.8944C3.95321 15.1414 3.35254 14.9412 3.10555 14.4472C2.85856 13.9533 3.05878 13.3526 3.55276 13.1056C4.28839 12.7378 5.12272 12.6934 5.82219 13.0431Z" fill="currentColor"></path></svg>
|
|
918
|
+
</button>
|
|
919
|
+
|
|
920
|
+
<button aria-label="Task list"
|
|
921
|
+
type="button"
|
|
922
|
+
onclick={() => $editor.chain().focus().toggleTaskList().run()}
|
|
923
|
+
class={$editor.isActive("taskList") ? "is-active" : ""}
|
|
924
|
+
>
|
|
925
|
+
<svg width="24" height="24" class="tiptap-button-icon" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M2 6C2 4.89543 2.89543 4 4 4H8C9.10457 4 10 4.89543 10 6V10C10 11.1046 9.10457 12 8 12H4C2.89543 12 2 11.1046 2 10V6ZM8 6H4V10H8V6Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M9.70711 14.2929C10.0976 14.6834 10.0976 15.3166 9.70711 15.7071L5.70711 19.7071C5.31658 20.0976 4.68342 20.0976 4.29289 19.7071L2.29289 17.7071C1.90237 17.3166 1.90237 16.6834 2.29289 16.2929C2.68342 15.9024 3.31658 15.9024 3.70711 16.2929L5 17.5858L8.29289 14.2929C8.68342 13.9024 9.31658 13.9024 9.70711 14.2929Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M12 6C12 5.44772 12.4477 5 13 5H21C21.5523 5 22 5.44772 22 6C22 6.55228 21.5523 7 21 7H13C12.4477 7 12 6.55228 12 6Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M12 12C12 11.4477 12.4477 11 13 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H13C12.4477 13 12 12.5523 12 12Z" fill="currentColor"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M12 18C12 17.4477 12.4477 17 13 17H21C21.5523 17 22 17.4477 22 18C22 18.5523 21.5523 19 21 19H13C12.4477 19 12 18.5523 12 18Z" fill="currentColor"></path></svg>
|
|
926
|
+
</button>
|
|
927
|
+
</div>
|
|
928
|
+
{/if}
|
|
929
|
+
</Dropdown>
|
|
930
|
+
</header>
|
|
931
|
+
{/if}
|
|
932
|
+
|
|
933
|
+
<EditorContent editor={$editor} class="fl-rich-text-content" />
|
|
934
|
+
</div>
|
|
935
|
+
|
|
936
|
+
<style>
|
|
937
|
+
.flex-auto {
|
|
938
|
+
flex: auto;
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
.fl-rich-text {
|
|
942
|
+
display: flex;
|
|
943
|
+
flex-direction: column;
|
|
944
|
+
width: 100%;
|
|
945
|
+
height: 100%;
|
|
946
|
+
min-height: 56px;
|
|
947
|
+
border-radius: 10px;
|
|
948
|
+
overflow: hidden;
|
|
949
|
+
background-color: var(--bg-color);
|
|
950
|
+
color: var(--text-color);
|
|
951
|
+
border: 1px solid #eeeeee0d;
|
|
952
|
+
box-sizing: border-box;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
.fl-rich-text-toolbar {
|
|
956
|
+
display: flex;
|
|
957
|
+
flex-wrap: nowrap;
|
|
958
|
+
overflow: auto;
|
|
959
|
+
align-items: center;
|
|
960
|
+
gap: var(--toolbar-gap);
|
|
961
|
+
padding: var(--toolbar-padding);
|
|
962
|
+
|
|
963
|
+
button {
|
|
964
|
+
padding: 8px 8px;
|
|
965
|
+
flex: auto;
|
|
966
|
+
border: none;
|
|
967
|
+
background: rgba(255, 255, 255, 0.1);
|
|
968
|
+
border-radius: 8px;
|
|
969
|
+
color: var(--text-color);
|
|
970
|
+
font-size: 14px;
|
|
971
|
+
display: flex;
|
|
972
|
+
align-items: center;
|
|
973
|
+
justify-content: center;
|
|
974
|
+
white-space: nowrap;
|
|
975
|
+
gap: 2px;
|
|
976
|
+
cursor: pointer;
|
|
977
|
+
|
|
978
|
+
&:disabled {
|
|
979
|
+
cursor: not-allowed;
|
|
980
|
+
opacity: 0.5;
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
.toogle-dropdown-button-icon {
|
|
984
|
+
width: 7px;
|
|
985
|
+
height: 7px;
|
|
986
|
+
margin-left: 4px;
|
|
987
|
+
}
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
:global(.fl-rich-text-toolbar button svg) {
|
|
992
|
+
|
|
993
|
+
width: 16px;
|
|
994
|
+
height: 16px;
|
|
995
|
+
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
.fl-rich-text-toolbar-group {
|
|
999
|
+
display: flex;
|
|
1000
|
+
flex-wrap: nowrap;
|
|
1001
|
+
gap: var(--toolbar-gap);
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
button.is-active {
|
|
1005
|
+
background: var(--purple);
|
|
1006
|
+
color: white;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
.special-box-icon {
|
|
1010
|
+
width: 16px;
|
|
1011
|
+
height: 16px;
|
|
1012
|
+
display: flex ;
|
|
1013
|
+
align-items: center;
|
|
1014
|
+
justify-content: center;
|
|
1015
|
+
font-weight: 500;
|
|
1016
|
+
border: none;
|
|
1017
|
+
padding: 0px;
|
|
1018
|
+
font-size: 12px;
|
|
1019
|
+
border-radius: 3px;
|
|
1020
|
+
outline: 1px dashed #818181;
|
|
1021
|
+
scale: 1.1;
|
|
1022
|
+
}
|
|
1023
|
+
</style>
|