@flexiui/svelte-rich-text 0.0.60 → 0.0.61

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.
Files changed (82) hide show
  1. package/README.md +388 -185
  2. package/dist/RichText.svelte +382 -2070
  3. package/dist/RichText.svelte.d.ts +28 -0
  4. package/dist/Toolbar/RenderToolbarButton.svelte +147 -0
  5. package/dist/Toolbar/RenderToolbarButton.svelte.d.ts +14 -0
  6. package/dist/Toolbar/action-buttons/ClearFormatting.svelte +31 -0
  7. package/dist/Toolbar/action-buttons/ClearFormatting.svelte.d.ts +14 -0
  8. package/dist/Toolbar/action-buttons/ClearNodes.svelte +15 -0
  9. package/dist/Toolbar/action-buttons/ClearNodes.svelte.d.ts +14 -0
  10. package/dist/Toolbar/action-buttons/MergeCellsBtn.svelte +31 -0
  11. package/dist/Toolbar/action-buttons/MergeCellsBtn.svelte.d.ts +14 -0
  12. package/dist/Toolbar/action-buttons/Redo.svelte +26 -0
  13. package/dist/Toolbar/action-buttons/Redo.svelte.d.ts +14 -0
  14. package/dist/Toolbar/action-buttons/SplitCellBtn.svelte +31 -0
  15. package/dist/Toolbar/action-buttons/SplitCellBtn.svelte.d.ts +14 -0
  16. package/dist/Toolbar/action-buttons/Undo.svelte +30 -0
  17. package/dist/Toolbar/action-buttons/Undo.svelte.d.ts +14 -0
  18. package/dist/Toolbar/action-buttons/marks/Bold.svelte +29 -0
  19. package/dist/Toolbar/action-buttons/marks/Bold.svelte.d.ts +14 -0
  20. package/dist/Toolbar/action-buttons/marks/CodeMarkBtn.svelte +33 -0
  21. package/dist/Toolbar/action-buttons/marks/CodeMarkBtn.svelte.d.ts +14 -0
  22. package/dist/Toolbar/action-buttons/marks/FontSize.svelte +99 -0
  23. package/dist/Toolbar/action-buttons/marks/FontSize.svelte.d.ts +14 -0
  24. package/dist/Toolbar/action-buttons/marks/Italic.svelte +27 -0
  25. package/dist/Toolbar/action-buttons/marks/Italic.svelte.d.ts +14 -0
  26. package/dist/Toolbar/action-buttons/marks/LinkBtn.svelte +64 -0
  27. package/dist/Toolbar/action-buttons/marks/LinkBtn.svelte.d.ts +14 -0
  28. package/dist/Toolbar/action-buttons/marks/SpecialBox.svelte +21 -0
  29. package/dist/Toolbar/action-buttons/marks/SpecialBox.svelte.d.ts +14 -0
  30. package/dist/Toolbar/action-buttons/marks/Strike.svelte +30 -0
  31. package/dist/Toolbar/action-buttons/marks/Strike.svelte.d.ts +14 -0
  32. package/dist/Toolbar/action-buttons/marks/TextAlign.svelte +66 -0
  33. package/dist/Toolbar/action-buttons/marks/TextAlign.svelte.d.ts +14 -0
  34. package/dist/Toolbar/action-buttons/marks/Underline.svelte +29 -0
  35. package/dist/Toolbar/action-buttons/marks/Underline.svelte.d.ts +14 -0
  36. package/dist/Toolbar/action-buttons/nodes/Audio.svelte +60 -0
  37. package/dist/Toolbar/action-buttons/nodes/Audio.svelte.d.ts +14 -0
  38. package/dist/Toolbar/action-buttons/nodes/Blockquote.svelte +25 -0
  39. package/dist/Toolbar/action-buttons/nodes/Blockquote.svelte.d.ts +14 -0
  40. package/dist/Toolbar/action-buttons/nodes/CodeBlock.svelte +37 -0
  41. package/dist/Toolbar/action-buttons/nodes/CodeBlock.svelte.d.ts +14 -0
  42. package/dist/Toolbar/action-buttons/nodes/HardBreakBtn.svelte +26 -0
  43. package/dist/Toolbar/action-buttons/nodes/HardBreakBtn.svelte.d.ts +14 -0
  44. package/dist/Toolbar/action-buttons/nodes/HeadingBtn.svelte +78 -0
  45. package/dist/Toolbar/action-buttons/nodes/HeadingBtn.svelte.d.ts +14 -0
  46. package/dist/Toolbar/action-buttons/nodes/HorizontalRule.svelte +24 -0
  47. package/dist/Toolbar/action-buttons/nodes/HorizontalRule.svelte.d.ts +14 -0
  48. package/dist/Toolbar/action-buttons/nodes/Image.svelte +60 -0
  49. package/dist/Toolbar/action-buttons/nodes/Image.svelte.d.ts +14 -0
  50. package/dist/Toolbar/action-buttons/nodes/InlineMath.svelte +50 -0
  51. package/dist/Toolbar/action-buttons/nodes/InlineMath.svelte.d.ts +14 -0
  52. package/dist/Toolbar/action-buttons/nodes/ListBtn.svelte +43 -0
  53. package/dist/Toolbar/action-buttons/nodes/ListBtn.svelte.d.ts +14 -0
  54. package/dist/Toolbar/action-buttons/nodes/MediaGridBtn.svelte +58 -0
  55. package/dist/Toolbar/action-buttons/nodes/MediaGridBtn.svelte.d.ts +14 -0
  56. package/dist/Toolbar/action-buttons/nodes/Table.svelte +60 -0
  57. package/dist/Toolbar/action-buttons/nodes/Table.svelte.d.ts +14 -0
  58. package/dist/Toolbar/bubble-menus/BubbleMenuImage.svelte +139 -0
  59. package/dist/Toolbar/bubble-menus/BubbleMenuImage.svelte.d.ts +14 -0
  60. package/dist/Toolbar/dropdown-buttons/HeadingsDropdownBtn.svelte +64 -0
  61. package/dist/Toolbar/dropdown-buttons/HeadingsDropdownBtn.svelte.d.ts +14 -0
  62. package/dist/Toolbar/dropdown-buttons/HighlightDropdownBtn.svelte +45 -0
  63. package/dist/Toolbar/dropdown-buttons/HighlightDropdownBtn.svelte.d.ts +14 -0
  64. package/dist/Toolbar/dropdown-buttons/LineHeightDropdownBtn.svelte +18 -0
  65. package/dist/Toolbar/dropdown-buttons/LineHeightDropdownBtn.svelte.d.ts +14 -0
  66. package/dist/Toolbar/dropdown-buttons/ListsDropdownBtn.svelte +188 -0
  67. package/dist/Toolbar/dropdown-buttons/ListsDropdownBtn.svelte.d.ts +14 -0
  68. package/dist/Toolbar/dropdown-buttons/TextColorDropdownBtn.svelte +37 -0
  69. package/dist/Toolbar/dropdown-buttons/TextColorDropdownBtn.svelte.d.ts +14 -0
  70. package/dist/Toolbar/dropdowns/LineHeightDropdown.svelte +26 -0
  71. package/dist/Toolbar/dropdowns/LineHeightDropdown.svelte.d.ts +14 -0
  72. package/dist/Toolbar/toolbar-utils.d.ts +1 -0
  73. package/dist/Toolbar/toolbar-utils.js +15 -0
  74. package/dist/extensions/NodeFontSize.d.ts +10 -0
  75. package/dist/extensions/NodeFontSize.js +53 -0
  76. package/dist/extensions/SemanticHeadings.d.ts +10 -0
  77. package/dist/extensions/SemanticHeadings.js +124 -0
  78. package/dist/extensions/Table/TableCellNodeView.svelte +0 -4
  79. package/dist/getExtensions.d.ts +7 -0
  80. package/dist/getExtensions.js +13 -2
  81. package/dist/styles.css +53 -10
  82. package/package.json +1 -1
@@ -1,15 +1,20 @@
1
1
  <script lang="ts">
2
+ import "./styles.css";
3
+ import "katex/dist/katex.min.css";
4
+
5
+ import { onMount, onDestroy, setContext } from "svelte";
6
+ import type { Readable } from "svelte/store";
7
+
8
+ import { computePosition, offset, autoUpdate } from "@floating-ui/dom";
9
+
2
10
  import {
3
11
  Mathematics,
4
12
  migrateMathStrings,
5
13
  } from "@tiptap/extension-mathematics";
6
14
 
7
- import { HEADINGS, rgbToHex } from "./utils";
8
- import "./styles.css";
9
- import "katex/dist/katex.min.css";
15
+ import { CharacterCount } from '@tiptap/extensions'
10
16
 
11
- import { onMount, onDestroy } from "svelte";
12
- import type { Readable } from "svelte/store";
17
+ import { CellSelection } from "prosemirror-tables";
13
18
 
14
19
  import {
15
20
  createEditor,
@@ -18,17 +23,48 @@
18
23
  BubbleMenu,
19
24
  } from "svelte-tiptap";
20
25
 
21
- import { computePosition, offset, autoUpdate } from "@floating-ui/dom";
22
26
  import { getRichTextExtensions } from "./getExtensions";
23
- import { CellSelection } from "prosemirror-tables";
27
+
28
+ import { rgbToHex } from "./utils";
29
+
30
+ import SpecialBox from "./Toolbar/action-buttons/marks/SpecialBox.svelte";
31
+
32
+ import MergeCellsBtn from "./Toolbar/action-buttons/MergeCellsBtn.svelte";
33
+ import SplitCellBtn from "./Toolbar/action-buttons/SplitCellBtn.svelte";
34
+
35
+ import HeadingBtn from "./Toolbar/action-buttons/nodes/HeadingBtn.svelte";
36
+ import HardBreakBtn from "./Toolbar/action-buttons/nodes/HardBreakBtn.svelte";
37
+
38
+ import CodeMarkBtn from "./Toolbar/action-buttons/marks/CodeMarkBtn.svelte";
39
+ import LinkBtn from "./Toolbar/action-buttons/marks/LinkBtn.svelte";
40
+ import Strike from "./Toolbar/action-buttons/marks/Strike.svelte";
41
+ import Underline from "./Toolbar/action-buttons/marks/Underline.svelte";
42
+ import Italic from "./Toolbar/action-buttons/marks/Italic.svelte";
43
+ import Bold from "./Toolbar/action-buttons/marks/Bold.svelte";
44
+
45
+ import HighlightDropdownBtn from "./Toolbar/dropdown-buttons/HighlightDropdownBtn.svelte";
46
+ import TextColorDropdownBtn from "./Toolbar/dropdown-buttons/TextColorDropdownBtn.svelte";
47
+
48
+ import LineHeightDropdown from "./Toolbar/dropdowns/LineHeightDropdown.svelte";
49
+ import ListBtn from "./Toolbar/action-buttons/nodes/ListBtn.svelte";
50
+ import BubbleMenuImage from "./Toolbar/bubble-menus/BubbleMenuImage.svelte";
51
+
52
+ import RenderToolbarButton from "./Toolbar/RenderToolbarButton.svelte";
24
53
 
25
54
  export interface Props {
26
55
  id?: string;
27
56
  className?: string;
28
57
  editable?: boolean;
29
- content?: string | {type: string, content: any[]} | null;
58
+ content?: string | { type: string; content: any[] } | null;
30
59
  nodesLimit?: number;
60
+ charactersLimit?: number;
31
61
  limitWarningMessage?: string;
62
+ showToolbar?: boolean;
63
+ toolbarAlign?: string;
64
+ semanticHeadings?: boolean;
65
+ uniqueH1?: boolean;
66
+ toolbarConfig?: ToolbarConfig;
67
+ bubbleMenuConfig?: BubbleMenuConfig;
32
68
  customExtensions?: any[];
33
69
  editorEvents?: {
34
70
  onTransaction?: (params: any) => void;
@@ -53,7 +89,12 @@
53
89
  toolbarBgColor?: string;
54
90
  toolbarTextColor?: string;
55
91
  toolbarPadding?: string;
92
+ toolbarJustifyContent?: string;
56
93
  toolbarGap?: string;
94
+ toolbarBtnPadding?: string;
95
+ toolbarBtnRadius?: string;
96
+ toolbarBtnMinHeight?: string;
97
+ toolbarBtnMinWidth?: string;
57
98
  docMaxWidth?: string;
58
99
  docPadding?: string;
59
100
  docBg?: string;
@@ -67,13 +108,41 @@
67
108
 
68
109
  export type RichTextProps = Props;
69
110
 
111
+ type ToolbarButton =
112
+ | string
113
+ | {
114
+ type?: string;
115
+ tooltip?: string;
116
+ icon?: string;
117
+ name?: string;
118
+ };
119
+
120
+ type ToolbarSelect = {
121
+ select: ToolbarButton[];
122
+ name?: string;
123
+ tooltip?: string;
124
+ icon?: string;
125
+ type?: string;
126
+ };
127
+
128
+ type ToolbarItem = ToolbarButton | ToolbarSelect;
129
+ type ToolbarConfig = ToolbarItem[] | ToolbarItem[][];
130
+ type BubbleMenuConfig = ToolbarItem[] | ToolbarItem[][];
131
+
70
132
  let {
71
133
  id = "fl-rich-text-editor",
72
134
  className,
73
135
  editable,
74
136
  content,
75
137
  nodesLimit,
138
+ charactersLimit,
76
139
  limitWarningMessage,
140
+ showToolbar = true,
141
+ toolbarAlign = "center",
142
+ semanticHeadings = false,
143
+ uniqueH1 = false,
144
+ toolbarConfig = undefined,
145
+ bubbleMenuConfig = undefined,
77
146
  customExtensions = [],
78
147
  editorEvents = {
79
148
  onTransaction: () => {},
@@ -93,6 +162,25 @@
93
162
  }: Props = $props();
94
163
 
95
164
  let editor = $state() as Readable<Editor>;
165
+
166
+ const DEFAULT_TOOLBAR = [
167
+ [{ type: "undo" }, "redo"],
168
+ [{ type: "headings" }, { type: "lists" }],
169
+ ["codeBlock", "blockquote"],
170
+ ["fontSize", "lineHeight"],
171
+ ["horizontalRule", "hardBreak"],
172
+ ["inlineMath"],
173
+ ["image", "audio"],
174
+ ["mediaGrid", "table"],
175
+ ["textAlignLeft", "textAlignCenter", "textAlignRight", "clearFormatting", "clearNodes"],
176
+ // ...
177
+ ];
178
+
179
+ const DEFAULT_BUBBLE_MENU = [
180
+ ["bold", "italic", "underline", "strike", "code", "link", "specialBox"],
181
+ ["textColor", "highlight", "hardBreak"],
182
+ ];
183
+
96
184
  const defaultEditorConfig = {
97
185
  editorAccentColor: "var(--purple)",
98
186
  editorBgColor: "transparent",
@@ -102,7 +190,12 @@
102
190
  toolbarTextColor: "currentColor",
103
191
  toolbarZIndex: 10,
104
192
  toolbarPadding: "8px",
193
+ toolbarJustifyContent: "center",
105
194
  toolbarGap: "5px",
195
+ toolbarBtnPadding: "0 9px",
196
+ toolbarBtnRadius: "9px",
197
+ toolbarBtnMinHeight: "34px",
198
+ toolbarBtnMinWidth: "34px",
106
199
  docMaxWidth: "1032px",
107
200
  docPadding: "2rem",
108
201
  docBg: "transparent",
@@ -118,48 +211,13 @@
118
211
  ...(config ?? {}),
119
212
  });
120
213
 
121
- let bubbleOffset =
122
- $editor?.storage.tableCell.customTableSelection === "column" ? 18 : 8;
123
- let imageUrlInputEl: HTMLInputElement = $state(null) as HTMLInputElement;
124
- let imageUrlInputValue: string = $state(null);
214
+ if (toolbarAlign === "left") {
215
+ editorConfig.toolbarJustifyContent = "flex-start";
216
+ } else if (toolbarAlign === "right") {
217
+ editorConfig.toolbarJustifyContent = "flex-end";
218
+ }
125
219
 
126
- const extensions = getRichTextExtensions({
127
- editable: true,
128
- customExtensions: [
129
- Mathematics.configure({
130
- inlineOptions: {
131
- onClick: (node, pos) => {
132
- // you can do anything on click, e.g. open a dialog to edit the math node
133
- // or just a prompt to edit the LaTeX code for a quick prototype
134
- const katex = prompt(
135
- "Update math LaTeX expression:",
136
- node.attrs.latex
137
- );
138
- if (katex) {
139
- $editor
140
- .chain()
141
- .setNodeSelection(pos)
142
- .updateInlineMath({ latex: katex })
143
- .focus()
144
- .run();
145
- }
146
- },
147
- },
148
- blockOptions: {
149
- // optional options for the block math node
150
- },
151
- katexOptions: {
152
- displayMode: false,
153
- throwOnError: false,
154
- macros: {
155
- "\\RR": "\\mathbb{R}",
156
- "\\ZZ": "\\mathbb{Z}",
157
- },
158
- },
159
- }),
160
- ...customExtensions,
161
- ],
162
- });
220
+ let bubbleOffset = $editor?.storage.tableCell.customTableSelection === "column" ? 18 : 8;
163
221
 
164
222
  let tooltipVisible = $state(false);
165
223
  let tooltipX = $state(0);
@@ -168,16 +226,39 @@
168
226
  let cleanup: () => void;
169
227
  let currentTriggerEl: HTMLElement | null = null;
170
228
 
171
- let textColorDropdownTriggerEl: HTMLElement | null = $state(
172
- null
173
- ) as HTMLElement;
174
-
175
229
  let activeDropdownType = $state(null);
176
230
  let enterPressed = $state(false);
177
231
  let fontSize = $state(16) as number;
178
232
  let lineHeight = $state(null) as number;
179
233
  let currentNodeCount = $state(0);
180
234
  let showLimitWarning = $state(false);
235
+ let nodeCounters = $state({ totalCount: 0, h1Count: 0 });
236
+
237
+ type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;
238
+ let headingLevels: HeadingLevel[] = [1, 2, 3, 4, 5, 6];
239
+
240
+ let recentCustomColors = $state([]) as string[];
241
+
242
+ const isAccentSoft = editorConfig.buttonStyle === "accent-soft";
243
+ let percentage = $derived.by(() => {
244
+ return $editor ? Math.round((100 / charactersLimit) * $editor.storage.characterCount.characters()) : 0
245
+ });
246
+
247
+ let toolbarGroups = $derived(
248
+ toolbarConfig
249
+ ? Array.isArray(toolbarConfig[0])
250
+ ? (toolbarConfig as ToolbarItem[][])
251
+ : [toolbarConfig]
252
+ : DEFAULT_TOOLBAR,
253
+ );
254
+
255
+ let bubbleMenuGroups = $derived(
256
+ bubbleMenuConfig
257
+ ? Array.isArray(bubbleMenuConfig[0])
258
+ ? (bubbleMenuConfig as ToolbarItem[][])
259
+ : [bubbleMenuConfig]
260
+ : DEFAULT_BUBBLE_MENU,
261
+ );
181
262
 
182
263
  const TEXT_COLOR_PALETTE = [
183
264
  editorConfig.editorAccentColor,
@@ -205,7 +286,47 @@
205
286
  "rgb(255, 102, 142)",
206
287
  ];
207
288
 
208
- let recentCustomColors = $state([]) as string[];
289
+ const extensions = getRichTextExtensions({
290
+ editable: true,
291
+ customExtensions: [
292
+ Mathematics.configure({
293
+ inlineOptions: {
294
+ onClick: (node, pos) => {
295
+ // you can do anything on click, e.g. open a dialog to edit the math node
296
+ // or just a prompt to edit the LaTeX code for a quick prototype
297
+ const katex = prompt(
298
+ "Update math LaTeX expression:",
299
+ node.attrs.latex,
300
+ );
301
+ if (katex) {
302
+ $editor
303
+ .chain()
304
+ .setNodeSelection(pos)
305
+ .updateInlineMath({ latex: katex })
306
+ .focus()
307
+ .run();
308
+ }
309
+ },
310
+ },
311
+ blockOptions: {
312
+ // optional options for the block math node
313
+ },
314
+ katexOptions: {
315
+ displayMode: false,
316
+ throwOnError: false,
317
+ macros: {
318
+ "\\RR": "\\mathbb{R}",
319
+ "\\ZZ": "\\mathbb{Z}",
320
+ },
321
+ },
322
+ }),
323
+
324
+ charactersLimit && CharacterCount.configure({
325
+ limit: charactersLimit,
326
+ }),
327
+ ...customExtensions,
328
+ ],
329
+ });
209
330
 
210
331
  function toogleDropdown(el: HTMLElement, type: string = null) {
211
332
  if (!el) return;
@@ -255,29 +376,6 @@
255
376
  });
256
377
  }
257
378
 
258
- // función para saber si hay una selección de celdas
259
- const isCellSelection = () =>
260
- $editor && $editor.state.selection instanceof CellSelection;
261
-
262
- // función para contar nodos en el documento
263
- function countNodes(doc: any): number {
264
- // Solo contar los nodos de primer nivel (hijos directos del doc)
265
- console.log(doc);
266
- if (doc.type === 'doc' && doc.content) {
267
- return doc.content.length;
268
- }
269
- return 0;
270
- }
271
-
272
- // función para actualizar el contador de nodos
273
- function updateNodeCount() {
274
- if ($editor) {
275
-
276
- currentNodeCount = countNodes($editor.getJSON());
277
-
278
- }
279
- }
280
-
281
379
  onMount(() => {
282
380
  editor = createEditor({
283
381
  extensions,
@@ -291,11 +389,23 @@
291
389
  // Verificar si hay límite de nodos y si se ha alcanzado
292
390
  enterPressed = true;
293
391
 
294
- if (nodesLimit) {
392
+ const isList =
393
+ $editor.isActive("bulletList") ||
394
+ $editor.isActive("orderedList") ||
395
+ $editor.isActive("taskList");
396
+
397
+ const { from } = view.state.selection;
398
+
399
+ // Obtener el nodo de ProseMirror en la posición actual
400
+ const pos = view.state.doc.resolve(from);
401
+ const nodeBefore = pos.node(pos.depth);
402
+
403
+ const isNodeEmpty = nodeBefore.content.size === 0;
404
+
405
+ if ((nodesLimit && !isList) || (isList && isNodeEmpty)) {
295
406
  const currentCount = currentNodeCount;
296
407
  if (currentCount >= nodesLimit) {
297
-
298
- if(!showLimitWarning){
408
+ if (!showLimitWarning) {
299
409
  showLimitWarning = true;
300
410
  setTimeout(() => {
301
411
  showLimitWarning = false;
@@ -305,7 +415,6 @@
305
415
  event.preventDefault();
306
416
  event.stopPropagation();
307
417
  return true;
308
-
309
418
  }
310
419
  }
311
420
 
@@ -343,7 +452,7 @@
343
452
  // console.log({ computedSize, computedLineHeight });
344
453
 
345
454
  const lineHeightPx = parseFloat(
346
- computedLineHeight.replace("px", "")
455
+ computedLineHeight.replace("px", ""),
347
456
  );
348
457
  const fontSizePx = parseFloat(computedSize.replace("px", ""));
349
458
 
@@ -352,6 +461,7 @@
352
461
  // console.log(lineHeightUnitless.toFixed(2)); // ej: "x.xx"
353
462
 
354
463
  fontSize = Math.round(Number(computedSize.replace("px", "")));
464
+ $editor.chain().focus().unsetNodeFontSize().run();
355
465
  $editor.chain().focus().unsetFontSize().run();
356
466
 
357
467
  $editor.chain().focus().unsetNodeLineHeight().run();
@@ -362,9 +472,7 @@
362
472
  },
363
473
  },
364
474
  onTransaction: ({ editor, transaction }) => {
365
-
366
475
  // Actualizar contador de nodos
367
-
368
476
  updateNodeCount();
369
477
 
370
478
  if (enterPressed) {
@@ -416,6 +524,9 @@
416
524
  lineHeight = Number(lineHeightUnitless.toFixed(2));
417
525
  }
418
526
  }
527
+
528
+ // find editor h1 and toggle the extra h1 to paragraph
529
+ normalizeH1(editor);
419
530
  },
420
531
 
421
532
  onBeforeCreate({ editor }) {
@@ -425,8 +536,8 @@
425
536
  onCreate: ({ editor }) => {
426
537
  editorEvents.onCreate({ editor });
427
538
  migrateMathStrings(editor);
428
-
429
- updateNodeCount();
539
+
540
+ // updateNodeCount();
430
541
  },
431
542
 
432
543
  onUpdate: ({ editor }) => {
@@ -473,6 +584,7 @@
473
584
  },
474
585
  });
475
586
  });
587
+
476
588
 
477
589
  onDestroy(() => {
478
590
  if (editor) {
@@ -480,124 +592,61 @@
480
592
  }
481
593
  });
482
594
 
483
- function setLink() {
484
- const previousUrl = $editor.getAttributes("link").href;
485
- const url = window.prompt("URL", previousUrl);
595
+ // Helper functions
486
596
 
487
- if (url === null) {
488
- return;
489
- }
490
-
491
- if (url === "") {
492
- $editor.chain().focus().extendMarkRange("link").unsetLink().run();
493
-
494
- return;
495
- }
496
-
497
- try {
498
- $editor
499
- .chain()
500
- .focus()
501
- .extendMarkRange("link")
502
- .setLink({ href: url })
503
- .run();
504
-
505
- setTimeout(() => {
506
- const allLinks = $editor.view.dom.querySelectorAll("a");
507
- allLinks.forEach((link: any) => {
508
- link.addEventListener("click", (e: any) => {
509
- e.preventDefault();
510
- });
511
- });
512
- }, 100);
513
- } catch (e) {
514
- // console.log(e.message);
515
- }
597
+ function isButton(item: ToolbarItem): item is ToolbarButton {
598
+ return (
599
+ typeof item === "string" ||
600
+ (typeof item === "object" && !("select" in item))
601
+ );
516
602
  }
517
603
 
518
- function toggleSpecialBox() {
519
- if ($editor) {
520
- $editor.chain().focus().specialBox().run();
521
- }
522
- }
604
+ // función para saber si hay una selección de celdas
605
+ const isCellSelection = () =>
606
+ $editor && $editor.state.selection instanceof CellSelection;
523
607
 
524
- function addInlineMath() {
525
- const hasSelection = !$editor.state.selection.empty;
526
-
527
- if (hasSelection) {
528
- const latex = prompt("Enter inline math LaTeX expression:", "");
529
- if (latex) {
530
- return $editor
531
- .chain()
532
- .deleteSelection()
533
- .insertInlineMath({ latex })
534
- .focus()
535
- .run();
536
- }
537
- return;
538
- }
608
+ // función para contar nodos en el documento
609
+ function countNodes(doc: any): { totalCount: number; h1Count: number } {
610
+ // Solo contar los nodos de primer nivel (hijos directos del doc)
611
+ const h1Count = doc?.content?.filter((node) => node.type === "h1").length;
539
612
 
540
- const latex = prompt("Enter inline math LaTeX expression:", "");
541
- if (latex) {
542
- return $editor.chain().insertInlineMath({ latex }).focus().run();
613
+ if (doc.type === "doc" && doc.content) {
614
+ return { totalCount: doc.content.length, h1Count };
543
615
  }
544
- }
545
-
546
- function decrementFontSize() {
547
- fontSize = fontSize - 1;
548
- $editor
549
- .chain()
550
- .focus()
551
- .setFontSize(fontSize + "px")
552
- .run();
553
- }
554
-
555
- function incrementFontSize() {
556
- fontSize = fontSize + 1;
557
- $editor
558
- .chain()
559
- .focus()
560
- .setFontSize(fontSize + "px")
561
- .run();
562
- }
563
616
 
564
- function handleRangeInput(e: any) {
565
- $editor.commands.setNodeLineHeight(lineHeight.toString());
617
+ return { totalCount: 0, h1Count: 0 };
566
618
  }
567
619
 
568
- function addAudio() {
569
- const previousSrc = $editor.getAttributes("audio").src;
570
- const src = window.prompt("Enter the URL of the audio:", previousSrc);
571
- if (!src) {
572
- alert("Please enter a valid URL");
573
- return;
620
+ // función para actualizar el contador de nodos
621
+ function updateNodeCount() {
622
+ if ($editor) {
623
+ nodeCounters = countNodes($editor.getJSON());
624
+ currentNodeCount = nodeCounters.totalCount;
574
625
  }
575
-
576
- $editor.chain().focus().setAudio({ src, controls: true }).run();
577
626
  }
578
627
 
579
- function addImage() {
580
- const previousSrc = $editor.getAttributes("image").src;
581
- const src = window.prompt("Enter the URL of the image:", previousSrc);
628
+ function normalizeH1(editor) {
629
+ const { state } = editor;
630
+ const { doc } = state;
631
+
632
+ let firstFound = false;
633
+ let tr = state.tr;
634
+
635
+ doc.descendants((node, pos) => {
636
+ // console.log(node.type.name);
637
+ if (node.type.name === "h1") {
638
+ // console.log("Es un h1");
639
+ if (!firstFound) {
640
+ firstFound = true;
641
+ } else {
642
+ tr = tr.setNodeMarkup(pos, state.schema.nodes.paragraph);
643
+ }
644
+ }
645
+ });
582
646
 
583
- if (!src) {
584
- alert("Please enter a valid URL");
585
- return;
647
+ if (tr.docChanged) {
648
+ editor.view.dispatch(tr);
586
649
  }
587
-
588
- $editor.chain().focus().setImage({ src }).run();
589
- }
590
-
591
- function addMediaGrid() {
592
- $editor.chain().focus().insertGrid({ cols: 2 }).run();
593
- }
594
-
595
- function addTable() {
596
- $editor
597
- .chain()
598
- .focus()
599
- .insertTable({ rows: 3, cols: 3, withHeaderRow: true })
600
- .run();
601
650
  }
602
651
  </script>
603
652
 
@@ -613,7 +662,12 @@
613
662
  --fl-toolbar-padding: {editorConfig.toolbarPadding};
614
663
  --fl-toolbar-gap: {editorConfig.toolbarGap};
615
664
  --fl-toolbar-bg: {editorConfig.toolbarBgColor};
665
+ --fl-toolbar-justify-content: {editorConfig.toolbarJustifyContent};
616
666
  --fl-toolbar-text-color: {editorConfig.toolbarTextColor};
667
+ --fl-toolbar-btn-padding: {editorConfig.toolbarBtnPadding};
668
+ --fl-toolbar-btn-radius: {editorConfig.toolbarBtnRadius};
669
+ --fl-toolbar-btn-min-height: {editorConfig.toolbarBtnMinHeight};
670
+ --fl-toolbar-btn-min-width: {editorConfig.toolbarBtnMinWidth || editorConfig.toolbarBtnMinHeight};
617
671
  --fl-doc-max-width: {editorConfig.docMaxWidth};
618
672
  --fl-doc-padding: {editorConfig.docPadding};
619
673
  --fl-doc-bg: {editorConfig.docBg};
@@ -623,938 +677,47 @@
623
677
  --fl-doc-text-color: {editorConfig.docTextColor};
624
678
  "
625
679
  >
626
- {#if editor}
680
+ {#if editor && showToolbar}
627
681
  <header class="fl-rich-text-toolbar">
628
682
  <div class="fl-rich-text-toolbar-container container">
629
- <!-- Undo/Redo -->
630
- <div role="group" class="fl-rich-text-toolbar-group">
631
- <button
632
- type="button"
633
- onclick={() => $editor.chain().focus().undo().run()}
634
- disabled={!$editor.can().chain().focus().undo().run()}
635
- aria-label="Undo"
636
- >
637
- <svg
638
- width="24"
639
- height="24"
640
- class="tiptap-button-icon"
641
- viewBox="0 0 24 24"
642
- fill="currentColor"
643
- xmlns="http://www.w3.org/2000/svg"
644
- ><path
645
- fill-rule="evenodd"
646
- clip-rule="evenodd"
647
- 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"
648
- fill="currentColor"
649
- ></path></svg
650
- >
651
- </button>
652
-
653
- <button
654
- type="button"
655
- onclick={() => $editor.chain().focus().redo().run()}
656
- disabled={!$editor.can().chain().focus().redo().run()}
657
- aria-label="Redo"
658
- >
659
- <svg
660
- width="24"
661
- height="24"
662
- class="tiptap-button-icon"
663
- viewBox="0 0 24 24"
664
- fill="currentColor"
665
- xmlns="http://www.w3.org/2000/svg"
666
- ><path
667
- fill-rule="evenodd"
668
- clip-rule="evenodd"
669
- 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"
670
- fill="currentColor"
671
- ></path></svg
672
- >
673
- </button>
674
- </div>
675
-
676
- <!-- Heading & list dropdowns -->
677
- <div class="fl-rich-text-toolbar-group">
678
- <!-- Heading -->
679
- <button
680
- type="button"
681
- onclick={(e) => toogleDropdown(e.currentTarget, "headings-dropdown")}
682
- class:is-active={$editor.isActive("heading") ||
683
- $editor.isActive("h1")}
684
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
685
- aria-label="Heading"
686
- >
687
- {#if $editor.isActive("heading")}
688
- {#each HEADINGS as heading}
689
- {#if $editor.isActive( "heading", { level: Number(heading.level) } )}
690
- {@html heading.icon}
683
+ {#each toolbarGroups as toolbarGroup}
684
+ {#if toolbarGroup.length > 0}
685
+ <div role="group" class="fl-rich-text-toolbar-group">
686
+ {#each toolbarGroup as toolbarItem}
687
+ {#if Array.isArray(toolbarItem)}
688
+ <!-- Si por alguna razón hay un array anidado, manejarlo -->
689
+ <p>Array anidado (no debería pasar)</p>
690
+ {:else if typeof toolbarItem === "string"}
691
+ <RenderToolbarButton
692
+ type={toolbarItem}
693
+ {editor}
694
+ {nodeCounters}
695
+ {nodesLimit}
696
+ {currentNodeCount}
697
+ accentSoft={isAccentSoft}
698
+ {fontSize}
699
+ onToggleDropdown={(e: MouseEvent, dropdownName: string) => {
700
+ toogleDropdown(e.currentTarget as HTMLElement, dropdownName);
701
+ }}
702
+ />
703
+ {:else if isButton(toolbarItem)}
704
+ <RenderToolbarButton
705
+ type={toolbarItem.type}
706
+ {editor}
707
+ {nodeCounters}
708
+ {nodesLimit}
709
+ {currentNodeCount}
710
+ accentSoft={isAccentSoft}
711
+ {fontSize}
712
+ onToggleDropdown={(e: MouseEvent, dropdownName: string) => {
713
+ toogleDropdown(e.currentTarget as HTMLElement, dropdownName);
714
+ }}
715
+ />
691
716
  {/if}
692
717
  {/each}
693
- {:else if $editor.isActive("h1")}
694
- {@html HEADINGS[0].icon}
695
- {/if}
696
-
697
- {#if !$editor.isActive("heading") && !$editor.isActive("h1")}
698
- <svg
699
- width="24"
700
- height="24"
701
- class="tiptap-button-icon"
702
- viewBox="0 0 24 24"
703
- fill="currentColor"
704
- xmlns="http://www.w3.org/2000/svg"
705
- ><path
706
- 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"
707
- fill="currentColor"
708
- ></path></svg
709
- >
710
- {/if}
711
-
712
- <svg
713
- class="toogle-dropdown-button-icon"
714
- aria-hidden="true"
715
- xmlns="http://www.w3.org/2000/svg"
716
- fill="none"
717
- viewBox="0 0 20 12"
718
- >
719
- <defs>
720
- <symbol id="dropdown-arrow" viewBox="0 0 10 6" fill="none">
721
- <path
722
- stroke="currentColor"
723
- stroke-linecap="round"
724
- stroke-linejoin="round"
725
- stroke-width="2"
726
- d="m1 1 4 4 4-4"
727
- ></path>
728
- </symbol>
729
- </defs>
730
- <use href="#dropdown-arrow"></use>
731
- </svg>
732
- </button>
733
-
734
- <!-- List -->
735
- <button
736
- aria-label="List"
737
- type="button"
738
- onclick={(e) => toogleDropdown(e.currentTarget, "list-dropdown")}
739
- class:is-active={$editor.isActive("bulletList") ||
740
- $editor.isActive("orderedList") ||
741
- $editor.isActive("taskList")}
742
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
743
- >
744
- {#if $editor.isActive("bulletList")}
745
- <svg
746
- width="24"
747
- height="24"
748
- class="tiptap-button-icon"
749
- viewBox="0 0 24 24"
750
- fill="currentColor"
751
- xmlns="http://www.w3.org/2000/svg"
752
- ><path
753
- fill-rule="evenodd"
754
- clip-rule="evenodd"
755
- 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"
756
- fill="currentColor"
757
- ></path><path
758
- fill-rule="evenodd"
759
- clip-rule="evenodd"
760
- 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"
761
- fill="currentColor"
762
- ></path><path
763
- fill-rule="evenodd"
764
- clip-rule="evenodd"
765
- 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"
766
- fill="currentColor"
767
- ></path><path
768
- fill-rule="evenodd"
769
- clip-rule="evenodd"
770
- 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"
771
- fill="currentColor"
772
- ></path><path
773
- fill-rule="evenodd"
774
- clip-rule="evenodd"
775
- 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"
776
- fill="currentColor"
777
- ></path><path
778
- fill-rule="evenodd"
779
- clip-rule="evenodd"
780
- 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"
781
- fill="currentColor"
782
- ></path></svg
783
- >
784
- {:else if $editor.isActive("orderedList")}
785
- <svg
786
- width="24"
787
- height="24"
788
- class="tiptap-button-icon"
789
- viewBox="0 0 24 24"
790
- fill="currentColor"
791
- xmlns="http://www.w3.org/2000/svg"
792
- ><path
793
- fill-rule="evenodd"
794
- clip-rule="evenodd"
795
- 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"
796
- fill="currentColor"
797
- ></path><path
798
- fill-rule="evenodd"
799
- clip-rule="evenodd"
800
- 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"
801
- fill="currentColor"
802
- ></path><path
803
- fill-rule="evenodd"
804
- clip-rule="evenodd"
805
- 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"
806
- fill="currentColor"
807
- ></path><path
808
- fill-rule="evenodd"
809
- clip-rule="evenodd"
810
- 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"
811
- fill="currentColor"
812
- ></path><path
813
- fill-rule="evenodd"
814
- clip-rule="evenodd"
815
- 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"
816
- fill="currentColor"
817
- ></path><path
818
- fill-rule="evenodd"
819
- clip-rule="evenodd"
820
- 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"
821
- fill="currentColor"
822
- ></path></svg
823
- >
824
- {:else if $editor.isActive("taskList")}
825
- <svg
826
- width="24"
827
- height="24"
828
- class="tiptap-button-icon"
829
- viewBox="0 0 24 24"
830
- fill="currentColor"
831
- xmlns="http://www.w3.org/2000/svg"
832
- ><path
833
- fill-rule="evenodd"
834
- clip-rule="evenodd"
835
- 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"
836
- fill="currentColor"
837
- ></path><path
838
- fill-rule="evenodd"
839
- clip-rule="evenodd"
840
- 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"
841
- fill="currentColor"
842
- ></path><path
843
- fill-rule="evenodd"
844
- clip-rule="evenodd"
845
- 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"
846
- fill="currentColor"
847
- ></path><path
848
- fill-rule="evenodd"
849
- clip-rule="evenodd"
850
- 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"
851
- fill="currentColor"
852
- ></path><path
853
- fill-rule="evenodd"
854
- clip-rule="evenodd"
855
- 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"
856
- fill="currentColor"
857
- ></path></svg
858
- >
859
- {:else}
860
- <svg
861
- width="24"
862
- height="24"
863
- class="tiptap-button-icon"
864
- viewBox="0 0 24 24"
865
- fill="currentColor"
866
- xmlns="http://www.w3.org/2000/svg"
867
- ><path
868
- fill-rule="evenodd"
869
- clip-rule="evenodd"
870
- 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"
871
- fill="currentColor"
872
- ></path><path
873
- fill-rule="evenodd"
874
- clip-rule="evenodd"
875
- 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"
876
- fill="currentColor"
877
- ></path><path
878
- fill-rule="evenodd"
879
- clip-rule="evenodd"
880
- 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"
881
- fill="currentColor"
882
- ></path><path
883
- fill-rule="evenodd"
884
- clip-rule="evenodd"
885
- 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"
886
- fill="currentColor"
887
- ></path><path
888
- fill-rule="evenodd"
889
- clip-rule="evenodd"
890
- 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"
891
- fill="currentColor"
892
- ></path><path
893
- fill-rule="evenodd"
894
- clip-rule="evenodd"
895
- 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"
896
- fill="currentColor"
897
- ></path></svg
898
- >
899
- {/if}
900
-
901
- <svg
902
- class="toogle-dropdown-button-icon"
903
- aria-hidden="true"
904
- xmlns="http://www.w3.org/2000/svg"
905
- fill="none"
906
- viewBox="0 0 10 6"
907
- >
908
- <use href="#dropdown-arrow"></use>
909
- </svg>
910
- </button>
911
- </div>
912
-
913
- <!-- Code block & blockquote -->
914
- <div role="group" class="fl-rich-text-toolbar-group">
915
- <!-- Code block -->
916
- <button
917
- aria-label="Code block"
918
- type="button"
919
- onclick={() => $editor.chain().focus().toggleCodeBlock().run()}
920
- class={$editor.isActive("codeBlock") ? "is-active" : ""}
921
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
922
- >
923
- <svg
924
- width="24"
925
- height="24"
926
- class="tiptap-button-icon"
927
- viewBox="0 0 24 24"
928
- fill="currentColor"
929
- xmlns="http://www.w3.org/2000/svg"
930
- ><path
931
- fill-rule="evenodd"
932
- clip-rule="evenodd"
933
- 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"
934
- fill="currentColor"
935
- ></path><path
936
- fill-rule="evenodd"
937
- clip-rule="evenodd"
938
- 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"
939
- fill="currentColor"
940
- ></path><path
941
- fill-rule="evenodd"
942
- clip-rule="evenodd"
943
- 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"
944
- fill="currentColor"
945
- ></path></svg
946
- >
947
- </button>
948
-
949
- <!-- Blockquote -->
950
- <button
951
- aria-label="Blockquote"
952
- type="button"
953
- onclick={() => $editor.chain().focus().toggleBlockquote().run()}
954
- class={$editor.isActive("blockquote") ? "is-active" : ""}
955
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
956
- >
957
- <svg
958
- width="15"
959
- height="15"
960
- viewBox="0 0 15 15"
961
- fill="none"
962
- xmlns="http://www.w3.org/2000/svg"
963
- ><path
964
- 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"
965
- fill="currentColor"
966
- fill-rule="evenodd"
967
- clip-rule="evenodd"
968
- ></path></svg
969
- >
970
- </button>
971
- </div>
972
-
973
- <!-- Font size editor -->
974
- <div role="group" class="fl-rich-text-toolbar-group">
975
- <div class="fl-font-size-editor">
976
- <button
977
- type="button"
978
- aria-label="Decrease font size"
979
- onclick={decrementFontSize}
980
- class="fl-font-size-editor-button"
981
- >
982
- <svg
983
- xmlns="http://www.w3.org/2000/svg"
984
- width="24"
985
- height="24"
986
- viewBox="0 0 24 24"
987
- fill="none"
988
- stroke="currentColor"
989
- stroke-width="2"
990
- stroke-linecap="round"
991
- stroke-linejoin="round"
992
- class="icon icon-tabler icons-tabler-outline icon-tabler-minus"
993
- ><path stroke="none" d="M0 0h24v24H0z" fill="none" /><path
994
- d="M5 12l14 0"
995
- /></svg
996
- >
997
- </button>
998
- <input type="text" bind:value={fontSize} />
999
- <button
1000
- type="button"
1001
- aria-label="Increase font size"
1002
- onclick={incrementFontSize}
1003
- class="fl-font-size-editor-button"
1004
- >
1005
- <svg
1006
- xmlns="http://www.w3.org/2000/svg"
1007
- width="24"
1008
- height="24"
1009
- viewBox="0 0 24 24"
1010
- fill="none"
1011
- stroke="currentColor"
1012
- stroke-width="2"
1013
- stroke-linecap="round"
1014
- stroke-linejoin="round"
1015
- class="icon icon-tabler icons-tabler-outline icon-tabler-plus"
1016
- ><path stroke="none" d="M0 0h24v24H0z" fill="none" /><path
1017
- d="M12 5l0 14"
1018
- /><path d="M5 12l14 0" /></svg
1019
- >
1020
- </button>
1021
- </div>
1022
- </div>
1023
-
1024
- <!-- Line height -->
1025
- <div role="group" class="fl-rich-text-toolbar-group">
1026
- <button
1027
- class="fl-font-size-button"
1028
- aria-label="Line height"
1029
- type="button"
1030
- onclick={(e) =>
1031
- toogleDropdown(e.currentTarget, "line-height-dropdown")}
1032
- >
1033
- <svg
1034
- xmlns="http://www.w3.org/2000/svg"
1035
- width="16"
1036
- height="16"
1037
- viewBox="0 0 24 24"
1038
- fill="none"
1039
- stroke="currentColor"
1040
- stroke-width="2"
1041
- stroke-linecap="round"
1042
- stroke-linejoin="round"
1043
- class="icon icon-tabler icons-tabler-outline icon-tabler-line-height"
1044
- ><path stroke="none" d="M0 0h24v24H0z" fill="none" /><path
1045
- d="M3 8l3 -3l3 3"
1046
- /><path d="M3 16l3 3l3 -3" /><path d="M6 5l0 14" /><path
1047
- d="M13 6l7 0"
1048
- /><path d="M13 12l7 0" /><path d="M13 18l7 0" /></svg
1049
- >
1050
-
1051
- <svg
1052
- class="toogle-dropdown-button-icon"
1053
- aria-hidden="true"
1054
- xmlns="http://www.w3.org/2000/svg"
1055
- fill="none"
1056
- viewBox="0 0 10 6"
1057
- >
1058
- <use href="#dropdown-arrow"></use>
1059
- </svg>
1060
- </button>
1061
- </div>
1062
-
1063
- <!-- Bold, Italic, Underline, Strike, Code, Link -->
1064
- <!-- <div role="group" class="fl-rich-text-toolbar-group">
1065
- <button
1066
- type="button"
1067
- onclick={() => $editor.chain().focus().toggleBold().run()}
1068
- disabled={!$editor.can().chain().focus().toggleBold().run()}
1069
- class={$editor.isActive("bold") ? "is-active" : ""}
1070
- aria-label="Bold"
1071
- >
1072
- <svg
1073
- width="24"
1074
- height="24"
1075
- class="fl-button-icon"
1076
- viewBox="0 0 24 24"
1077
- fill="currentColor"
1078
- xmlns="http://www.w3.org/2000/svg"
1079
- ><path
1080
- fill-rule="evenodd"
1081
- clip-rule="evenodd"
1082
- 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"
1083
- fill="currentColor"
1084
- ></path></svg
1085
- >
1086
- </button>
1087
-
1088
- <button
1089
- type="button"
1090
- onclick={() => $editor.chain().focus().toggleItalic().run()}
1091
- disabled={!$editor.can().chain().focus().toggleItalic().run()}
1092
- class={$editor.isActive("italic") ? "is-active" : ""}
1093
- aria-label="Italic"
1094
- >
1095
- <svg
1096
- width="24"
1097
- height="24"
1098
- class="tiptap-button-icon"
1099
- viewBox="0 0 24 24"
1100
- fill="currentColor"
1101
- xmlns="http://www.w3.org/2000/svg"
1102
- ><path
1103
- 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"
1104
- fill="currentColor"
1105
- ></path></svg
1106
- >
1107
- </button>
1108
-
1109
- <button
1110
- type="button"
1111
- onclick={() => $editor.chain().focus().toggleUnderline().run()}
1112
- disabled={!$editor.can().chain().focus().toggleUnderline().run()}
1113
- class={$editor.isActive("underline") ? "is-active" : ""}
1114
- aria-label="Underline"
1115
- >
1116
- <svg
1117
- width="24"
1118
- height="24"
1119
- class="tiptap-button-icon"
1120
- viewBox="0 0 24 24"
1121
- fill="currentColor"
1122
- xmlns="http://www.w3.org/2000/svg"
1123
- ><path
1124
- fill-rule="evenodd"
1125
- clip-rule="evenodd"
1126
- 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"
1127
- fill="currentColor"
1128
- ></path></svg
1129
- >
1130
- </button>
1131
-
1132
- <button
1133
- type="button"
1134
- onclick={() => $editor.chain().focus().toggleStrike().run()}
1135
- disabled={!$editor.can().chain().focus().toggleStrike().run()}
1136
- class={$editor.isActive("strike") ? "is-active" : ""}
1137
- aria-label="Strike"
1138
- >
1139
- <svg
1140
- width="24"
1141
- height="24"
1142
- class="tiptap-button-icon"
1143
- viewBox="0 0 24 24"
1144
- fill="currentColor"
1145
- xmlns="http://www.w3.org/2000/svg"
1146
- ><path
1147
- 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"
1148
- fill="currentColor"
1149
- ></path><path
1150
- 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"
1151
- fill="currentColor"
1152
- ></path></svg
1153
- >
1154
- </button>
1155
-
1156
- <button
1157
- type="button"
1158
- onclick={() => $editor.chain().focus().toggleCode().run()}
1159
- disabled={!$editor.can().chain().focus().toggleCode().run()}
1160
- class={$editor.isActive("code") ? "is-active" : ""}
1161
- aria-label="Code"
1162
- >
1163
- <svg
1164
- width="24"
1165
- height="24"
1166
- class="tiptap-button-icon"
1167
- viewBox="0 0 24 24"
1168
- fill="currentColor"
1169
- xmlns="http://www.w3.org/2000/svg"
1170
- ><path
1171
- 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"
1172
- fill="currentColor"
1173
- ></path><path
1174
- 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"
1175
- fill="currentColor"
1176
- ></path><path
1177
- 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"
1178
- fill="currentColor"
1179
- ></path></svg
1180
- >
1181
- </button>
1182
-
1183
- <button
1184
- type="button"
1185
- onclick={() => setLink()}
1186
- class="fl-bubble-menu-mark-button"
1187
- class:is-active={$editor.isActive("link")}
1188
- aria-label="Link"
1189
- >
1190
- <svg
1191
- width="16"
1192
- height="16"
1193
- class="tiptap-button-icon"
1194
- viewBox="0 0 24 24"
1195
- fill="currentColor"
1196
- xmlns="http://www.w3.org/2000/svg"
1197
- ><path
1198
- 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"
1199
- fill="currentColor"
1200
- ></path><path
1201
- 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"
1202
- fill="currentColor"
1203
- ></path></svg
1204
- >
1205
- </button>
1206
- </div> -->
1207
-
1208
- <!-- Special box, horizontal rule, Hard break -->
1209
- <div role="group" class="fl-rich-text-toolbar-group">
1210
- <!-- Special box -->
1211
- <button
1212
- class="fl-bubble-menu-mark-button"
1213
- class:is-active={$editor?.isActive("specialBox")}
1214
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
1215
- onclick={toggleSpecialBox}
1216
- type="button"
1217
- aria-label="Special Box"
1218
- >
1219
- <span class="special-box-icon">A</span>
1220
- </button>
1221
-
1222
- <!-- Horizontal rule -->
1223
- <button
1224
- type="button"
1225
- onclick={() => $editor.chain().focus().setHorizontalRule().run()}
1226
- aria-label="Horizontal rule"
1227
- >
1228
- <svg
1229
- width="15"
1230
- height="15"
1231
- viewBox="0 0 15 15"
1232
- fill="none"
1233
- xmlns="http://www.w3.org/2000/svg"
1234
- ><path
1235
- 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"
1236
- fill="currentColor"
1237
- fill-rule="evenodd"
1238
- clip-rule="evenodd"
1239
- ></path></svg
1240
- >
1241
- </button>
1242
-
1243
- <!-- Hard break -->
1244
- <button
1245
- type="button"
1246
- onclick={() => $editor.chain().focus().setHardBreak().run()}
1247
- aria-label="Hard break"
1248
- >
1249
- <svg
1250
- xmlns="http://www.w3.org/2000/svg"
1251
- width="24"
1252
- height="24"
1253
- viewBox="0 0 24 24"
1254
- fill="none"
1255
- stroke="currentColor"
1256
- stroke-width="2"
1257
- stroke-linecap="round"
1258
- stroke-linejoin="round"
1259
- class="icon icon-tabler icons-tabler-outline icon-tabler-corner-down-left"
1260
- ><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path
1261
- d="M18 6v6a3 3 0 0 1 -3 3h-10l4 -4m0 8l-4 -4"
1262
- ></path></svg
1263
- >
1264
- </button>
1265
- </div>
1266
-
1267
- <!-- Text color & highlight -->
1268
- <!-- <div role="group" class="fl-rich-text-toolbar-group">
1269
- <button
1270
- aria-label="Toggle text color dropdown"
1271
- type="button"
1272
- onclick={(e) =>
1273
- toogleDropdown(e.currentTarget, "text-color-dropdown")}
1274
- >
1275
- <span
1276
- class="fl-button-color-text-popover"
1277
- style="background: {$editor?.getAttributes('textStyle')?.color ||
1278
- 'currentColor'}"
1279
- ></span>
1280
-
1281
- <svg
1282
- class="toogle-dropdown-button-icon"
1283
- aria-hidden="true"
1284
- xmlns="http://www.w3.org/2000/svg"
1285
- fill="none"
1286
- viewBox="0 0 20 12"
1287
- >
1288
- <use href="#dropdown-arrow"></use>
1289
- </svg>
1290
- </button>
1291
-
1292
- <button
1293
- class="fl-bubble-menu-mark-button"
1294
- type="button"
1295
- aria-label="Highlight"
1296
- onclick={(e) => toogleDropdown(e.currentTarget, "highlight")}
1297
- >
1298
- <svg
1299
- width="24"
1300
- height="24"
1301
- class="tiptap-button-icon"
1302
- viewBox="0 0 24 24"
1303
- fill="currentColor"
1304
- xmlns="http://www.w3.org/2000/svg"
1305
- ><path
1306
- fill-rule="evenodd"
1307
- clip-rule="evenodd"
1308
- d="M14.7072 4.70711C15.0977 4.31658 15.0977 3.68342 14.7072 3.29289C14.3167 2.90237 13.6835 2.90237 13.293 3.29289L8.69294 7.89286L8.68594 7.9C8.13626 8.46079 7.82837 9.21474 7.82837 10C7.82837 10.2306 7.85491 10.4584 7.90631 10.6795L2.29289 16.2929C2.10536 16.4804 2 16.7348 2 17V20C2 20.5523 2.44772 21 3 21H12C12.2652 21 12.5196 20.8946 12.7071 20.7071L15.3205 18.0937C15.5416 18.1452 15.7695 18.1717 16.0001 18.1717C16.7853 18.1717 17.5393 17.8639 18.1001 17.3142L22.7072 12.7071C23.0977 12.3166 23.0977 11.6834 22.7072 11.2929C22.3167 10.9024 21.6835 10.9024 21.293 11.2929L16.6971 15.8887C16.5105 16.0702 16.2605 16.1717 16.0001 16.1717C15.7397 16.1717 15.4897 16.0702 15.303 15.8887L10.1113 10.697C9.92992 10.5104 9.82837 10.2604 9.82837 10C9.82837 9.73963 9.92992 9.48958 10.1113 9.30297L14.7072 4.70711ZM13.5858 17L9.00004 12.4142L4 17.4142V19H11.5858L13.5858 17Z"
1309
- fill="currentColor"
1310
- ></path>
1311
- </svg>
1312
- <svg
1313
- class="toogle-dropdown-button-icon"
1314
- aria-hidden="true"
1315
- xmlns="http://www.w3.org/2000/svg"
1316
- fill="none"
1317
- viewBox="0 0 10 6"
1318
- >
1319
- <path
1320
- stroke="currentColor"
1321
- stroke-linecap="round"
1322
- stroke-linejoin="round"
1323
- stroke-width="2"
1324
- d="m1 1 4 4 4-4"
1325
- ></path>
1326
- </svg>
1327
- </button>
1328
- </div> -->
1329
-
1330
- <!-- Inline math -->
1331
- <div role="group" class="fl-rich-text-toolbar-group">
1332
- <button
1333
- type="button"
1334
- onclick={addInlineMath}
1335
- aria-label="Add inline LaTeX math"
1336
- >
1337
- <svg
1338
- xmlns="http://www.w3.org/2000/svg"
1339
- width="16"
1340
- height="16"
1341
- viewBox="0 0 24 24"
1342
- fill="none"
1343
- stroke="currentColor"
1344
- stroke-width="2"
1345
- stroke-linecap="round"
1346
- stroke-linejoin="round"
1347
- class="icon icon-tabler icons-tabler-outline icon-tabler-math"
1348
- ><path stroke="none" d="M0 0h24v24H0z" fill="none" /><path
1349
- d="M19 5h-7l-4 14l-3 -6h-2"
1350
- /><path d="M14 13l6 6" /><path d="M14 19l6 -6" /></svg
1351
- >
1352
- </button>
1353
- </div>
1354
-
1355
- <!-- Audio & image -->
1356
- <div role="group" class="fl-rich-text-toolbar-group">
1357
- <!-- Image -->
1358
- <button
1359
- type="button"
1360
- onclick={addImage}
1361
- aria-label="Image"
1362
- class:is-active={$editor.isActive("image")}
1363
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
1364
- >
1365
- <svg
1366
- xmlns="http://www.w3.org/2000/svg"
1367
- width="24"
1368
- height="24"
1369
- viewBox="0 0 24 24"
1370
- fill="currentColor"
1371
- class="icon icon-tabler icons-tabler-filled icon-tabler-photo"
1372
- ><path stroke="none" d="M0 0h24v24H0z" fill="none" /><path
1373
- d="M8.813 11.612c.457 -.38 .918 -.38 1.386 .011l.108 .098l4.986 4.986l.094 .083a1 1 0 0 0 1.403 -1.403l-.083 -.094l-1.292 -1.293l.292 -.293l.106 -.095c.457 -.38 .918 -.38 1.386 .011l.108 .098l4.674 4.675a4 4 0 0 1 -3.775 3.599l-.206 .005h-12a4 4 0 0 1 -3.98 -3.603l6.687 -6.69l.106 -.095zm9.187 -9.612a4 4 0 0 1 3.995 3.8l.005 .2v9.585l-3.293 -3.292l-.15 -.137c-1.256 -1.095 -2.85 -1.097 -4.096 -.017l-.154 .14l-.307 .306l-2.293 -2.292l-.15 -.137c-1.256 -1.095 -2.85 -1.097 -4.096 -.017l-.154 .14l-5.307 5.306v-9.585a4 4 0 0 1 3.8 -3.995l.2 -.005h12zm-2.99 5l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007z"
1374
- /></svg
1375
- >
1376
- </button>
1377
- <!-- Audio -->
1378
- <button
1379
- type="button"
1380
- onclick={addAudio}
1381
- aria-label="Audio"
1382
- class:is-active={$editor.isActive("audio")}
1383
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
1384
- >
1385
- <svg
1386
- style="transform: scale(1.1);"
1387
- fill="currentColor"
1388
- width="24px"
1389
- viewBox="0 -960 960 960"
1390
- height="24px"
1391
- xmlns="http://www.w3.org/2000/svg"
1392
- ><path
1393
- d="M400-120q-66 0-113-47t-47-113q0-66 47-113t113-47q23 0 42.5 5.5T480-418v-422h240v160H560v400q0 66-47 113t-113 47Z"
1394
- ></path></svg
1395
- >
1396
- </button>
1397
- </div>
1398
-
1399
- <!-- Media Grid & Table -->
1400
- <div role="group" class="fl-rich-text-toolbar-group">
1401
- <!-- Grid -->
1402
- <button
1403
- type="button"
1404
- onclick={addMediaGrid}
1405
- aria-label="Media grid"
1406
- class:is-active={$editor.isActive("MediaGridComponent")}
1407
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
1408
- >
1409
- <svg
1410
- xmlns="http://www.w3.org/2000/svg"
1411
- width="24"
1412
- height="24"
1413
- viewBox="0 0 24 24"
1414
- fill="currentColor"
1415
- class="icon icon-tabler icons-tabler-filled icon-tabler-layout-grid"
1416
- ><path stroke="none" d="M0 0h24v24H0z" fill="none" /><path
1417
- d="M9 3a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-4a2 2 0 0 1 -2 -2v-4a2 2 0 0 1 2 -2z"
1418
- /><path
1419
- d="M19 3a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-4a2 2 0 0 1 -2 -2v-4a2 2 0 0 1 2 -2z"
1420
- /><path
1421
- d="M9 13a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-4a2 2 0 0 1 -2 -2v-4a2 2 0 0 1 2 -2z"
1422
- /><path
1423
- d="M19 13a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-4a2 2 0 0 1 -2 -2v-4a2 2 0 0 1 2 -2z"
1424
- /></svg
1425
- >
1426
- </button>
1427
- <!-- Table -->
1428
- <button
1429
- type="button"
1430
- onclick={addTable}
1431
- aria-label="Table"
1432
- class:is-active={$editor.isActive("table")}
1433
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
1434
- >
1435
- <svg
1436
- xmlns="http://www.w3.org/2000/svg"
1437
- width="24"
1438
- height="24"
1439
- viewBox="0 0 24 24"
1440
- fill="none"
1441
- stroke="currentColor"
1442
- stroke-width="2"
1443
- stroke-linecap="round"
1444
- stroke-linejoin="round"
1445
- class="icon icon-tabler icons-tabler-outline icon-tabler-table"
1446
- ><path stroke="none" d="M0 0h24v24H0z" fill="none" /><path
1447
- d="M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14"
1448
- /><path d="M3 10h18" /><path d="M10 3v18" /></svg
1449
- >
1450
- </button>
1451
- </div>
1452
-
1453
- <!-- Text align, clear formatting, clear nodes -->
1454
- <div role="group" class="fl-rich-text-toolbar-group">
1455
- <!-- Text align left -->
1456
- <button
1457
- type="button"
1458
- onclick={() => $editor.chain().focus().toggleTextAlign("left").run()}
1459
- class:is-active={$editor.isActive({ textAlign: "left" })}
1460
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
1461
- aria-label="Align left"
1462
- >
1463
- <svg
1464
- width="15"
1465
- height="15"
1466
- viewBox="0 0 15 15"
1467
- fill="none"
1468
- xmlns="http://www.w3.org/2000/svg"
1469
- ><path
1470
- 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"
1471
- fill="currentColor"
1472
- fill-rule="evenodd"
1473
- clip-rule="evenodd"
1474
- ></path></svg
1475
- >
1476
- </button>
1477
-
1478
- <!-- Text align center -->
1479
- <button
1480
- type="button"
1481
- onclick={() =>
1482
- $editor.chain().focus().toggleTextAlign("center").run()}
1483
- class:is-active={$editor.isActive({ textAlign: "center" })}
1484
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
1485
- aria-label="Align center"
1486
- >
1487
- <svg
1488
- width="15"
1489
- height="15"
1490
- viewBox="0 0 15 15"
1491
- fill="none"
1492
- xmlns="http://www.w3.org/2000/svg"
1493
- ><path
1494
- 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"
1495
- fill="currentColor"
1496
- fill-rule="evenodd"
1497
- clip-rule="evenodd"
1498
- ></path></svg
1499
- >
1500
- </button>
1501
-
1502
- <!-- Text align right -->
1503
- <button
1504
- type="button"
1505
- onclick={() => $editor.chain().focus().toggleTextAlign("right").run()}
1506
- class:is-active={$editor.isActive({ textAlign: "right" })}
1507
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
1508
- aria-label="Align right"
1509
- >
1510
- <svg
1511
- width="15"
1512
- height="15"
1513
- viewBox="0 0 15 15"
1514
- fill="none"
1515
- xmlns="http://www.w3.org/2000/svg"
1516
- ><path
1517
- 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"
1518
- fill="currentColor"
1519
- fill-rule="evenodd"
1520
- clip-rule="evenodd"
1521
- ></path></svg
1522
- >
1523
- </button>
1524
-
1525
- <!-- Clear formatting -->
1526
- <button
1527
- aria-label="Clear formatting"
1528
- type="button"
1529
- onclick={() => $editor.chain().focus().unsetAllMarks().run()}
1530
- >
1531
- <svg
1532
- xmlns="http://www.w3.org/2000/svg"
1533
- width="16"
1534
- height="16"
1535
- viewBox="0 0 24 24"
1536
- fill="none"
1537
- stroke="currentColor"
1538
- stroke-width="2"
1539
- stroke-linecap="round"
1540
- stroke-linejoin="round"
1541
- class="icon icon-tabler icons-tabler-outline icon-tabler-clear-formatting"
1542
- ><path stroke="none" d="M0 0h24v24H0z" fill="none" /><path
1543
- d="M17 15l4 4m0 -4l-4 4"
1544
- /><path d="M7 6v-1h11v1" /><path d="M7 19l4 0" /><path
1545
- d="M13 5l-4 14"
1546
- /></svg
1547
- >
1548
- </button>
1549
-
1550
- <!-- Clear nodes -->
1551
- <button
1552
- type="button"
1553
- onclick={() => $editor.chain().focus().clearNodes().run()}
1554
- >
1555
- Clear
1556
- </button>
1557
- </div>
718
+ </div>
719
+ {/if}
720
+ {/each}
1558
721
  </div>
1559
722
  </header>
1560
723
  {/if}
@@ -1564,33 +727,61 @@
1564
727
  <!-- Warning message for node limit -->
1565
728
  {#if showLimitWarning && nodesLimit}
1566
729
  <div class="fl-node-limit-warning">
1567
- {limitWarningMessage || ` No se pueden añadir más elementos a este editor. Max: ${nodesLimit} elementos.`}
730
+ {limitWarningMessage ||
731
+ ` No se pueden añadir más nodos a este editor. Max: ${nodesLimit}`}
1568
732
  </div>
1569
733
  {/if}
1570
734
 
1571
735
  <!-- Bottom bar showing node count -->
1572
736
  {#if nodesLimit}
1573
737
  <div class="fl-node-count-bar">
738
+
739
+ {#if charactersLimit}
740
+ <div class="fl-character-count" class:fl-character-count--warning={percentage >= 100}>
741
+ <svg height="20" width="20" viewBox="0 0 20 20">
742
+ <circle r="10" cx="10" cy="10" fill="#ffffff30" />
743
+ <circle
744
+ r="5"
745
+ cx="10"
746
+ cy="10"
747
+ fill="transparent"
748
+ stroke="currentColor"
749
+ stroke-width="10"
750
+ stroke-dasharray={`calc(${percentage} * 31.4 / 100) 31.4`}
751
+ transform="rotate(-90) translate(-20)"
752
+ />
753
+ <circle r="6" cx="10" cy="10" fill="var(--fl-editor-bg)" />
754
+ </svg>
755
+
756
+ <span>
757
+ Characters count: {$editor?.storage?.characterCount?.characters()} / {charactersLimit}
758
+ </span>
759
+
760
+ <span>
761
+ Words count: {$editor?.storage?.characterCount?.words()}
762
+ </span>
763
+ </div>
764
+ {/if}
765
+
766
+
1574
767
  <span class="fl-node-count-text">
1575
- {currentNodeCount} de {nodesLimit} elementos
768
+ Nodes count: {currentNodeCount} / {nodesLimit}
1576
769
  </span>
1577
- <div class="fl-node-count-progress">
1578
- <div
1579
- class="fl-node-count-progress-bar"
770
+
771
+ <!-- <div class="fl-node-count-progress">
772
+ <div
773
+ class="fl-node-count-progress-bar"
1580
774
  style="width: {Math.min((currentNodeCount / nodesLimit) * 100, 100)}%"
1581
775
  ></div>
1582
- </div>
776
+ </div> -->
1583
777
  </div>
1584
778
  {/if}
1585
-
1586
779
  </div>
1587
780
 
1588
781
  <div
1589
782
  class="fl-toolbar-dropdown-panel"
1590
783
  bind:this={tooltip}
1591
- style="display: {tooltipVisible
1592
- ? 'flex'
1593
- : 'none'};
784
+ style="display: {tooltipVisible ? 'flex' : 'none'};
1594
785
  left: {tooltipX}px;
1595
786
  top: {tooltipY}px;
1596
787
  --fl-editor-accent-color: {editorConfig.editorAccentColor};
@@ -1598,275 +789,23 @@
1598
789
  >
1599
790
  {#if activeDropdownType === "headings-dropdown"}
1600
791
  <div role="group" class="fl-rich-text-toolbar-group">
1601
- <button
1602
- type="button"
1603
- onclick={() =>
1604
- $editor.chain().focus().toggleHeading({ level: 1 }).run()}
1605
- class={$editor.isActive("heading", { level: 1 }) ||
1606
- $editor.isActive("h1")
1607
- ? "is-active"
1608
- : ""}
1609
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
1610
- aria-label="H1"
1611
- disabled={!$editor.isActive("h1")}
1612
- >
1613
- <svg
1614
- width="24"
1615
- height="24"
1616
- xmlns="http://www.w3.org/2000/svg"
1617
- viewBox="0 0 24 24"
1618
- fill="currentColor"
1619
- ><path
1620
- d="M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM21.0005 8V20H19.0005L19 10.204L17 10.74V8.67L19.5005 8H21.0005Z"
1621
- ></path></svg
1622
- >
1623
- </button>
1624
-
1625
- <button
1626
- type="button"
1627
- onclick={() =>
1628
- $editor.chain().focus().toggleHeading({ level: 2 }).run()}
1629
- class={$editor.isActive("heading", { level: 2 }) ? "is-active" : ""}
1630
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
1631
- aria-label="H2"
1632
- disabled={$editor.isActive("h1")}
1633
- >
1634
- <svg
1635
- width="16"
1636
- height="16"
1637
- xmlns="http://www.w3.org/2000/svg"
1638
- viewBox="0 0 24 24"
1639
- fill="currentColor"
1640
- ><path
1641
- 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"
1642
- ></path></svg
1643
- >
1644
- </button>
1645
-
1646
- <button
1647
- type="button"
1648
- onclick={() =>
1649
- $editor.chain().focus().toggleHeading({ level: 3 }).run()}
1650
- class={$editor.isActive("heading", { level: 3 }) ? "is-active" : ""}
1651
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
1652
- aria-label="H3"
1653
- disabled={$editor.isActive("h1")}
1654
- >
1655
- <svg
1656
- width="16"
1657
- height="16"
1658
- xmlns="http://www.w3.org/2000/svg"
1659
- viewBox="0 0 24 24"
1660
- fill="currentColor"
1661
- ><path
1662
- 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"
1663
- ></path></svg
1664
- >
1665
- </button>
1666
-
1667
- <button
1668
- type="button"
1669
- onclick={() =>
1670
- $editor.chain().focus().toggleHeading({ level: 4 }).run()}
1671
- class={$editor.isActive("heading", { level: 4 }) ? "is-active" : ""}
1672
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
1673
- aria-label="H4"
1674
- disabled={$editor.isActive("h1")}
1675
- >
1676
- <svg
1677
- width="16"
1678
- height="16"
1679
- xmlns="http://www.w3.org/2000/svg"
1680
- viewBox="0 0 24 24"
1681
- fill="currentColor"
1682
- ><path
1683
- d="M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM22 8V16H23.5V18H22V20H20V18H14.5V16.66L19.5 8H22ZM20 11.133L17.19 16H20V11.133Z"
1684
- ></path></svg
1685
- >
1686
- </button>
1687
-
1688
- <button
1689
- type="button"
1690
- onclick={() =>
1691
- $editor.chain().focus().toggleHeading({ level: 5 }).run()}
1692
- class={$editor.isActive("heading", { level: 5 }) ? "is-active" : ""}
1693
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
1694
- aria-label="H5"
1695
- disabled={$editor.isActive("h1")}
1696
- >
1697
- <svg
1698
- width="16"
1699
- height="16"
1700
- xmlns="http://www.w3.org/2000/svg"
1701
- viewBox="0 0 24 24"
1702
- fill="currentColor"
1703
- ><path
1704
- 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"
1705
- ></path></svg
1706
- >
1707
- </button>
1708
-
1709
- <button
1710
- type="button"
1711
- onclick={() =>
1712
- $editor.chain().focus().toggleHeading({ level: 6 }).run()}
1713
- class={$editor.isActive("heading", { level: 6 }) ? "is-active" : ""}
1714
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
1715
- aria-label="H6"
1716
- disabled={$editor.isActive("h1")}
1717
- >
1718
- <svg
1719
- width="16"
1720
- height="16"
1721
- xmlns="http://www.w3.org/2000/svg"
1722
- viewBox="0 0 24 24"
1723
- fill="currentColor"
1724
- ><path
1725
- 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"
1726
- ></path></svg
1727
- >
1728
- </button>
792
+ {#each headingLevels as level}
793
+ <HeadingBtn
794
+ {editor}
795
+ {nodeCounters}
796
+ {uniqueH1}
797
+ {level}
798
+ accenSoft={isAccentSoft}
799
+ />
800
+ {/each}
1729
801
  </div>
1730
- {:else if activeDropdownType === "list-dropdown"}
802
+ {:else if activeDropdownType === "lists-dropdown"}
1731
803
  <div role="group" class="fl-rich-text-toolbar-group">
1732
- <button
1733
- aria-label="Bullet list"
1734
- type="button"
1735
- onclick={() => $editor.chain().focus().toggleBulletList().run()}
1736
- class={$editor.isActive("bulletList") ? "is-active" : ""}
1737
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
1738
- >
1739
- <svg
1740
- width="24"
1741
- height="24"
1742
- class="tiptap-button-icon"
1743
- viewBox="0 0 24 24"
1744
- fill="currentColor"
1745
- xmlns="http://www.w3.org/2000/svg"
1746
- ><path
1747
- fill-rule="evenodd"
1748
- clip-rule="evenodd"
1749
- 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"
1750
- fill="currentColor"
1751
- ></path><path
1752
- fill-rule="evenodd"
1753
- clip-rule="evenodd"
1754
- 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"
1755
- fill="currentColor"
1756
- ></path><path
1757
- fill-rule="evenodd"
1758
- clip-rule="evenodd"
1759
- 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"
1760
- fill="currentColor"
1761
- ></path><path
1762
- fill-rule="evenodd"
1763
- clip-rule="evenodd"
1764
- 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"
1765
- fill="currentColor"
1766
- ></path><path
1767
- fill-rule="evenodd"
1768
- clip-rule="evenodd"
1769
- 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"
1770
- fill="currentColor"
1771
- ></path><path
1772
- fill-rule="evenodd"
1773
- clip-rule="evenodd"
1774
- 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"
1775
- fill="currentColor"
1776
- ></path></svg
1777
- >
1778
- </button>
804
+ <ListBtn {editor} type="bulletList" accenSoft={isAccentSoft} />
1779
805
 
1780
- <button
1781
- aria-label="Ordered list"
1782
- type="button"
1783
- onclick={() => $editor.chain().focus().toggleOrderedList().run()}
1784
- class={$editor.isActive("orderedList") ? "is-active" : ""}
1785
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
1786
- >
1787
- <svg
1788
- width="24"
1789
- height="24"
1790
- class="tiptap-button-icon"
1791
- viewBox="0 0 24 24"
1792
- fill="currentColor"
1793
- xmlns="http://www.w3.org/2000/svg"
1794
- ><path
1795
- fill-rule="evenodd"
1796
- clip-rule="evenodd"
1797
- 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"
1798
- fill="currentColor"
1799
- ></path><path
1800
- fill-rule="evenodd"
1801
- clip-rule="evenodd"
1802
- 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"
1803
- fill="currentColor"
1804
- ></path><path
1805
- fill-rule="evenodd"
1806
- clip-rule="evenodd"
1807
- 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"
1808
- fill="currentColor"
1809
- ></path><path
1810
- fill-rule="evenodd"
1811
- clip-rule="evenodd"
1812
- 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"
1813
- fill="currentColor"
1814
- ></path><path
1815
- fill-rule="evenodd"
1816
- clip-rule="evenodd"
1817
- 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"
1818
- fill="currentColor"
1819
- ></path><path
1820
- fill-rule="evenodd"
1821
- clip-rule="evenodd"
1822
- 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"
1823
- fill="currentColor"
1824
- ></path></svg
1825
- >
1826
- </button>
806
+ <ListBtn {editor} type="orderedList" accenSoft={isAccentSoft} />
1827
807
 
1828
- <button
1829
- aria-label="Task list"
1830
- type="button"
1831
- onclick={() => $editor.chain().focus().toggleTaskList().run()}
1832
- class={$editor.isActive("taskList") ? "is-active" : ""}
1833
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
1834
- >
1835
- <svg
1836
- width="24"
1837
- height="24"
1838
- class="tiptap-button-icon"
1839
- viewBox="0 0 24 24"
1840
- fill="currentColor"
1841
- xmlns="http://www.w3.org/2000/svg"
1842
- ><path
1843
- fill-rule="evenodd"
1844
- clip-rule="evenodd"
1845
- 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"
1846
- fill="currentColor"
1847
- ></path><path
1848
- fill-rule="evenodd"
1849
- clip-rule="evenodd"
1850
- 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"
1851
- fill="currentColor"
1852
- ></path><path
1853
- fill-rule="evenodd"
1854
- clip-rule="evenodd"
1855
- 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"
1856
- fill="currentColor"
1857
- ></path><path
1858
- fill-rule="evenodd"
1859
- clip-rule="evenodd"
1860
- 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"
1861
- fill="currentColor"
1862
- ></path><path
1863
- fill-rule="evenodd"
1864
- clip-rule="evenodd"
1865
- 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"
1866
- fill="currentColor"
1867
- ></path></svg
1868
- >
1869
- </button>
808
+ <ListBtn {editor} type="taskList" accenSoft={isAccentSoft} />
1870
809
  </div>
1871
810
  {:else if activeDropdownType === "text-color-dropdown"}
1872
811
  <div class="fl-editor-color-palette">
@@ -2146,27 +1085,19 @@
2146
1085
  {/if}
2147
1086
  </div>
2148
1087
  {:else if activeDropdownType === "line-height-dropdown"}
2149
- <div class="fl-range-element">
2150
- <span class="fl-range-element-value">
2151
- {lineHeight.toFixed(2)}
2152
- </span>
2153
- <input
2154
- oninput={handleRangeInput}
2155
- type="range"
2156
- min="0.5"
2157
- max="4"
2158
- step="0.05"
2159
- bind:value={lineHeight}
2160
- />
2161
- </div>
1088
+ <LineHeightDropdown {lineHeight} {editor} />
2162
1089
  {/if}
2163
1090
  </div>
2164
1091
 
2165
1092
  {#if editor}
2166
- <!-- General Menu -->
2167
1093
  <div class="hidden">
2168
1094
  <BubbleMenu
2169
- options={{ placement: "top", strategy: "fixed", offset: bubbleOffset, flip: false }}
1095
+ options={{
1096
+ placement: "top",
1097
+ strategy: "absolute",
1098
+ offset: bubbleOffset,
1099
+ flip: false,
1100
+ }}
2170
1101
  editor={$editor}
2171
1102
  shouldShow={() => {
2172
1103
  const emptySelection = $editor.state.selection.empty;
@@ -2178,15 +1109,11 @@
2178
1109
  const isColumn =
2179
1110
  $editor.storage.tableCell.customTableSelection === "column";
2180
1111
 
2181
- // ⛔️ Ocultar si hay flag de selección completa por fila/columna
2182
1112
  if (isRow || isColumn) {
2183
- // console.log(
2184
- // "Ocultar si hay flag de selección completa por fila/columna"
2185
- // );
2186
1113
  return false;
2187
1114
  }
2188
1115
 
2189
- // // ⛔️ Ocultar si es CellSelection completa (por seguridad)
1116
+ // // Ocultar si es CellSelection completa
2190
1117
  // if (selection instanceof CellSelection) {
2191
1118
  // return false;
2192
1119
  // }
@@ -2199,671 +1126,56 @@
2199
1126
  appendTo={document.body}
2200
1127
  >
2201
1128
  <div data-test-id="bubble-menu" class="fl-bubble-menu flex">
2202
- <div role="group" class="fl-rich-text-toolbar-group">
2203
- <!-- Bold -->
2204
- <button
2205
- type="button"
2206
- onclick={() => $editor.chain().focus().toggleBold().run()}
2207
- disabled={!$editor.can().chain().focus().toggleBold().run()}
2208
- class="fl-bubble-menu-mark-button"
2209
- class:is-active={$editor.isActive("bold")}
2210
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
2211
- aria-label="Bold"
2212
- >
2213
- <svg
2214
- width="24"
2215
- height="24"
2216
- class="fl-button-icon"
2217
- viewBox="0 0 24 24"
2218
- fill="currentColor"
2219
- xmlns="http://www.w3.org/2000/svg"
2220
- ><path
2221
- fill-rule="evenodd"
2222
- clip-rule="evenodd"
2223
- 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"
2224
- fill="currentColor"
2225
- ></path></svg
2226
- >
2227
- </button>
2228
-
2229
- <!-- Italic -->
2230
- <button
2231
- type="button"
2232
- onclick={() => $editor.chain().focus().toggleItalic().run()}
2233
- disabled={!$editor.can().chain().focus().toggleItalic().run()}
2234
- class="fl-bubble-menu-mark-button"
2235
- class:is-active={$editor.isActive("italic")}
2236
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
2237
- aria-label="Italic"
2238
- >
2239
- <svg
2240
- width="24"
2241
- height="24"
2242
- class="tiptap-button-icon"
2243
- viewBox="0 0 24 24"
2244
- fill="currentColor"
2245
- xmlns="http://www.w3.org/2000/svg"
2246
- ><path
2247
- 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"
2248
- fill="currentColor"
2249
- ></path></svg
2250
- >
2251
- </button>
2252
-
2253
- <!-- Underline -->
2254
- <button
2255
- type="button"
2256
- onclick={() => $editor.chain().focus().toggleUnderline().run()}
2257
- disabled={!$editor.can().chain().focus().toggleStrike().run()}
2258
- class="fl-bubble-menu-mark-button"
2259
- class:is-active={$editor.isActive("underline")}
2260
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
2261
- aria-label="Underline"
2262
- >
2263
- <svg
2264
- width="24"
2265
- height="24"
2266
- class="tiptap-button-icon"
2267
- viewBox="0 0 24 24"
2268
- fill="currentColor"
2269
- xmlns="http://www.w3.org/2000/svg"
2270
- ><path
2271
- fill-rule="evenodd"
2272
- clip-rule="evenodd"
2273
- 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"
2274
- fill="currentColor"
2275
- ></path></svg
2276
- >
2277
- </button>
2278
-
2279
- <!-- Strike -->
2280
- <button
2281
- type="button"
2282
- onclick={() => $editor.chain().focus().toggleStrike().run()}
2283
- disabled={!$editor.can().chain().focus().toggleStrike().run()}
2284
- class="fl-bubble-menu-mark-button"
2285
- class:is-active={$editor.isActive("strike")}
2286
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
2287
- aria-label="Strike"
2288
- >
2289
- <svg
2290
- width="24"
2291
- height="24"
2292
- class="tiptap-button-icon"
2293
- viewBox="0 0 24 24"
2294
- fill="currentColor"
2295
- xmlns="http://www.w3.org/2000/svg"
2296
- ><path
2297
- 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"
2298
- fill="currentColor"
2299
- ></path><path
2300
- 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"
2301
- fill="currentColor"
2302
- ></path></svg
2303
- >
2304
- </button>
2305
-
2306
- <!-- Code -->
2307
- <button
2308
- type="button"
2309
- onclick={() => $editor.chain().focus().toggleCode().run()}
2310
- disabled={!$editor.can().chain().focus().toggleCode().run()}
2311
- class="fl-bubble-menu-mark-button"
2312
- class:is-active={$editor.isActive("code")}
2313
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
2314
- aria-label="Code"
2315
- >
2316
- <svg
2317
- width="24"
2318
- height="24"
2319
- class="tiptap-button-icon"
2320
- viewBox="0 0 24 24"
2321
- fill="currentColor"
2322
- xmlns="http://www.w3.org/2000/svg"
2323
- ><path
2324
- 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"
2325
- fill="currentColor"
2326
- ></path><path
2327
- 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"
2328
- fill="currentColor"
2329
- ></path><path
2330
- 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"
2331
- fill="currentColor"
2332
- ></path></svg
2333
- >
2334
- </button>
2335
-
2336
- <!-- Link -->
2337
- <button
2338
- type="button"
2339
- onclick={() => setLink()}
2340
- class="fl-bubble-menu-mark-button"
2341
- class:is-active={$editor.isActive("link")}
2342
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
2343
- aria-label="Link"
2344
- >
2345
- <svg
2346
- width="24"
2347
- height="24"
2348
- class="tiptap-button-icon"
2349
- viewBox="0 0 24 24"
2350
- fill="currentColor"
2351
- xmlns="http://www.w3.org/2000/svg"
2352
- ><path
2353
- 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"
2354
- fill="currentColor"
2355
- ></path><path
2356
- 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"
2357
- fill="currentColor"
2358
- ></path></svg
2359
- >
2360
- </button>
2361
-
2362
- <!-- Highlight -->
2363
- <button
2364
- class="fl-bubble-menu-mark-button"
2365
- type="button"
2366
- aria-label="Highlight"
2367
- onclick={(e) => toogleDropdown(e.currentTarget, "highlight")}
2368
- >
2369
- <svg
2370
- width="24"
2371
- height="24"
2372
- class="tiptap-button-icon"
2373
- viewBox="0 0 24 24"
2374
- fill="currentColor"
2375
- xmlns="http://www.w3.org/2000/svg"
2376
- ><path
2377
- fill-rule="evenodd"
2378
- clip-rule="evenodd"
2379
- d="M14.7072 4.70711C15.0977 4.31658 15.0977 3.68342 14.7072 3.29289C14.3167 2.90237 13.6835 2.90237 13.293 3.29289L8.69294 7.89286L8.68594 7.9C8.13626 8.46079 7.82837 9.21474 7.82837 10C7.82837 10.2306 7.85491 10.4584 7.90631 10.6795L2.29289 16.2929C2.10536 16.4804 2 16.7348 2 17V20C2 20.5523 2.44772 21 3 21H12C12.2652 21 12.5196 20.8946 12.7071 20.7071L15.3205 18.0937C15.5416 18.1452 15.7695 18.1717 16.0001 18.1717C16.7853 18.1717 17.5393 17.8639 18.1001 17.3142L22.7072 12.7071C23.0977 12.3166 23.0977 11.6834 22.7072 11.2929C22.3167 10.9024 21.6835 10.9024 21.293 11.2929L16.6971 15.8887C16.5105 16.0702 16.2605 16.1717 16.0001 16.1717C15.7397 16.1717 15.4897 16.0702 15.303 15.8887L10.1113 10.697C9.92992 10.5104 9.82837 10.2604 9.82837 10C9.82837 9.73963 9.92992 9.48958 10.1113 9.30297L14.7072 4.70711ZM13.5858 17L9.00004 12.4142L4 17.4142V19H11.5858L13.5858 17Z"
2380
- fill="currentColor"
2381
- ></path>
2382
- </svg>
2383
- <svg
2384
- class="toogle-dropdown-button-icon"
2385
- aria-hidden="true"
2386
- xmlns="http://www.w3.org/2000/svg"
2387
- fill="none"
2388
- viewBox="0 0 10 6"
2389
- >
2390
- <path
2391
- stroke="currentColor"
2392
- stroke-linecap="round"
2393
- stroke-linejoin="round"
2394
- stroke-width="2"
2395
- d="m1 1 4 4 4-4"
2396
- ></path>
2397
- </svg>
2398
- </button>
2399
-
2400
- <!-- Text color -->
2401
- <button
2402
- aria-label="Text color"
2403
- type="button"
2404
- bind:this={textColorDropdownTriggerEl}
2405
- onclick={() =>
2406
- toogleDropdown(textColorDropdownTriggerEl, "text-color-dropdown")}
2407
- class="fl-bubble-menu-mark-button"
2408
- >
2409
- <span
2410
- class="fl-button-color-text-popover"
2411
- style="background: {$editor?.getAttributes('textStyle')?.color ||
2412
- 'currentColor'}"
2413
- ></span>
2414
-
2415
- <svg
2416
- class="toogle-dropdown-button-icon"
2417
- aria-hidden="true"
2418
- xmlns="http://www.w3.org/2000/svg"
2419
- fill="none"
2420
- viewBox="0 0 10 6"
2421
- >
2422
- <path
2423
- stroke="currentColor"
2424
- stroke-linecap="round"
2425
- stroke-linejoin="round"
2426
- stroke-width="2"
2427
- d="m1 1 4 4 4-4"
2428
- ></path>
2429
- </svg>
2430
- </button>
2431
-
2432
- {#if !isCellSelection()}
2433
- <button
2434
- class="fl-bubble-menu-mark-button"
2435
- type="button"
2436
- onclick={() => $editor.chain().focus().setHardBreak().run()}
2437
- aria-label="Hard break"
2438
- >
2439
- <svg
2440
- xmlns="http://www.w3.org/2000/svg"
2441
- width="24"
2442
- height="24"
2443
- viewBox="0 0 24 24"
2444
- fill="none"
2445
- stroke="currentColor"
2446
- stroke-width="2"
2447
- stroke-linecap="round"
2448
- stroke-linejoin="round"
2449
- class="icon icon-tabler icons-tabler-outline icon-tabler-corner-down-left"
2450
- ><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path
2451
- d="M18 6v6a3 3 0 0 1 -3 3h-10l4 -4m0 8l-4 -4"
2452
- ></path></svg
2453
- >
2454
- </button>
2455
- {/if}
2456
-
2457
- {#if isCellSelection()}
2458
- <button
2459
- class="fl-bubble-menu-mark-button"
2460
- type="button"
2461
- aria-label="Merge cells"
2462
- title="Merge cells"
2463
- onclick={() => $editor?.chain().focus().mergeCells().run()}
2464
- >
2465
- <svg
2466
- xmlns="http://www.w3.org/2000/svg"
2467
- viewBox="0 0 24 24"
2468
- width="16"
2469
- height="16"
2470
- fill="none"
2471
- stroke="currentColor"
2472
- stroke-width="2"
2473
- stroke-linecap="round"
2474
- stroke-linejoin="round"
2475
- style="opacity:1;"
2476
- ><path d="M12 21v-6m0-6V3M3 15h18M3 9h18"></path><rect
2477
- width="18"
2478
- height="18"
2479
- x="3"
2480
- y="3"
2481
- rx="2"
2482
- ></rect></svg
2483
- >
2484
- </button>
2485
-
2486
- <button
2487
- class="fl-bubble-menu-mark-button"
2488
- type="button"
2489
- aria-label="Split cell"
2490
- title="Split cell"
2491
- onclick={() => $editor?.chain().focus().splitCell().run()}
2492
- >
2493
- <svg
2494
- xmlns="http://www.w3.org/2000/svg"
2495
- viewBox="0 0 24 24"
2496
- width="16"
2497
- height="16"
2498
- fill="none"
2499
- stroke="currentColor"
2500
- stroke-width="2"
2501
- stroke-linecap="round"
2502
- stroke-linejoin="round"
2503
- style="opacity:1;"
2504
- ><path d="M12 15V9m-9 6h18M3 9h18" /><rect
2505
- width="18"
2506
- height="18"
2507
- x="3"
2508
- y="3"
2509
- rx="2"
2510
- /></svg
2511
- >
2512
- </button>
2513
- {/if}
2514
- </div>
2515
- </div>
2516
-
2517
- <!-- <div
2518
- class="fl-toolbar-dropdown-panel"
2519
- bind:this={tooltip}
2520
- style="display: {tooltipVisible
2521
- ? 'flex'
2522
- : 'none'}; left: {tooltipX}px; top: {tooltipY}px;"
2523
- >
2524
- {#if activeDropdownType === "text-color"}
2525
- <div class="fl-editor-color-palette">
2526
- <button
2527
- class="fl-color-swatch fl-color-picker-btn"
2528
- aria-label="Text color picker"
2529
- type="button"
2530
- >
2531
- <input
2532
- type="color"
2533
- onchange={(event: any) => {
2534
- recentCustomColors = [
2535
- ...recentCustomColors,
2536
- event?.target?.value,
2537
- ];
2538
- $editor.chain().focus().setColor(event?.target?.value).run();
2539
- hideDropdown();
2540
- }}
2541
- value={rgbToHex($editor?.getAttributes("textStyle")?.color)}
2542
- data-testid="setColor"
2543
- id="colorPicker"
2544
- />
2545
- </button>
2546
-
2547
- {#each TEXT_COLOR_PALETTE as color}
2548
- <button
2549
- class="fl-color-swatch"
2550
- class:active={$editor?.isActive("textStyle", {
2551
- color: color,
2552
- })}
2553
- onclick={() => {
2554
- $editor?.chain().focus().setColor(color).run();
2555
- hideDropdown();
2556
- }}
2557
- style="background-color: {color};"
2558
- aria-label={color}
2559
- >
2560
- </button>
2561
- {/each}
2562
-
2563
- <button
2564
- class="fl-color-swatch unset-color"
2565
- onclick={() => {
2566
- $editor?.chain().focus().unsetColor().run();
2567
- hideDropdown();
2568
- }}
2569
- style="background-color: #ffffff;"
2570
- aria-label="Unset color"
2571
- >
2572
- </button>
2573
-
2574
- {#if recentCustomColors.length > 0}
2575
- {#each recentCustomColors as color}
2576
- <button
2577
- class="fl-color-swatch"
2578
- class:active={$editor?.isActive("textStyle", {
2579
- color: color,
2580
- })}
2581
- onclick={() => {
2582
- $editor?.chain().focus().setColor(color).run();
2583
- hideDropdown();
1129
+ {#each bubbleMenuGroups as bubbleMenuGroup}
1130
+ {#if bubbleMenuGroup.length > 0}
1131
+ <div role="group" class="fl-rich-text-toolbar-group">
1132
+ {#each bubbleMenuGroup as bubbleMenuItem}
1133
+ {#if Array.isArray(bubbleMenuItem)}
1134
+ <!-- Si por alguna razón hay un array anidado, manejarlo -->
1135
+ <p>Array anidado (no debería pasar)</p>
1136
+ {:else if typeof bubbleMenuItem === "string"}
1137
+ <RenderToolbarButton
1138
+ type={bubbleMenuItem}
1139
+ {editor}
1140
+ {nodeCounters}
1141
+ {nodesLimit}
1142
+ {currentNodeCount}
1143
+ accentSoft={isAccentSoft}
1144
+ {fontSize}
1145
+ onToggleDropdown={(e: MouseEvent, dropdownName: string) => {
1146
+ toogleDropdown(e.currentTarget as HTMLElement, dropdownName);
2584
1147
  }}
2585
- style="background-color: {color};"
2586
- aria-label={color}
2587
- >
2588
- </button>
2589
- {/each}
2590
- {:else}
2591
- <button
2592
- class="fl-color-swatch"
2593
- style="outline: 1px dashed #ffffff66;background: transparent;"
2594
- onclick={() => alert("Not implemented yet")}
2595
- aria-label="Add new color"
2596
- >
2597
- <svg
2598
- xmlns="http://www.w3.org/2000/svg"
2599
- fill="none"
2600
- viewBox="0 0 24 24"
2601
- stroke-width="1.5"
2602
- stroke="currentColor"
2603
- class="size-6"
2604
- style="
2605
- width: 11px;
2606
- height: 11px;
2607
- "
2608
- >
2609
- <path
2610
- stroke-linecap="round"
2611
- stroke-linejoin="round"
2612
- d="M12 4.5v15m7.5-7.5h-15"
2613
- ></path>
2614
- </svg>
2615
- </button>
2616
-
2617
- <button
2618
- class="fl-color-swatch"
2619
- style="outline: 1px dashed #ffffff66;background: transparent;"
2620
- onclick={() => alert("Not implemented yet")}
2621
- aria-label="Add new color"
2622
- >
2623
- <svg
2624
- xmlns="http://www.w3.org/2000/svg"
2625
- fill="none"
2626
- viewBox="0 0 24 24"
2627
- stroke-width="1.5"
2628
- stroke="currentColor"
2629
- class="size-6"
2630
- style="
2631
- width: 11px;
2632
- height: 11px;
2633
- "
2634
- >
2635
- <path
2636
- stroke-linecap="round"
2637
- stroke-linejoin="round"
2638
- d="M12 4.5v15m7.5-7.5h-15"
2639
- ></path>
2640
- </svg>
2641
- </button>
2642
- {/if}
2643
- </div>
2644
- {:else if activeDropdownType === "highlight"}
2645
- <div class="fl-editor-color-palette">
2646
- <button
2647
- class="fl-color-swatch fl-color-picker-btn"
2648
- aria-label="Highlight color picker"
2649
- type="button"
2650
- >
2651
- <input
2652
- type="color"
2653
- onchange={(event: any) => {
2654
- recentCustomColors = [
2655
- ...recentCustomColors,
2656
- event?.target?.value,
2657
- ];
2658
- $editor
2659
- .chain()
2660
- .focus()
2661
- .setHighlight({ color: event?.target?.value })
2662
- .run();
2663
- hideDropdown();
2664
- }}
2665
- value={rgbToHex($editor?.getAttributes("textStyle")?.color)}
2666
- data-testid="setHiglight"
2667
- id="colorPicker"
2668
- />
2669
- </button>
2670
-
2671
- {#each HIGHLIGHT_COLOR_PALETTE as color}
2672
- <button
2673
- class="fl-color-swatch"
2674
- class:active={$editor?.isActive("textStyle", {
2675
- color: color,
2676
- })}
2677
- onclick={() => {
2678
- $editor?.chain().focus().setHighlight({ color }).run();
2679
- hideDropdown();
2680
- }}
2681
- style="background-color: {color};"
2682
- aria-label={color}
2683
- >
2684
- </button>
2685
- {/each}
2686
-
2687
- <button
2688
- class="fl-color-swatch unset-color"
2689
- onclick={() => {
2690
- $editor?.chain().focus().unsetColor().run();
2691
- hideDropdown();
2692
- }}
2693
- style="background-color: #ffffff;"
2694
- aria-label="Unset color"
2695
- >
2696
- </button>
2697
-
2698
- {#if recentCustomColors.length > 0}
2699
- {#each recentCustomColors as color}
2700
- <button
2701
- class="fl-color-swatch"
2702
- class:active={$editor?.isActive("textStyle", {
2703
- color: color,
2704
- })}
2705
- onclick={() => {
2706
- $editor?.chain().focus().setHighlight({ color }).run();
2707
- hideDropdown();
1148
+ />
1149
+ {:else if isButton(bubbleMenuItem)}
1150
+ <RenderToolbarButton
1151
+ type={bubbleMenuItem.type}
1152
+ {editor}
1153
+ {nodeCounters}
1154
+ {nodesLimit}
1155
+ {currentNodeCount}
1156
+ accentSoft={isAccentSoft}
1157
+ {fontSize}
1158
+ onToggleDropdown={(e: MouseEvent, dropdownName: string) => {
1159
+ toogleDropdown(e.currentTarget as HTMLElement, dropdownName);
2708
1160
  }}
2709
- style="background-color: {color};"
2710
- aria-label={color}
2711
- >
2712
- </button>
1161
+ />
1162
+ {/if}
2713
1163
  {/each}
2714
- {:else}
2715
- <button
2716
- class="fl-color-swatch"
2717
- style="outline: 1px dashed #ffffff66;background: transparent;"
2718
- onclick={() => alert("Not implemented yet")}
2719
- aria-label="Add new color"
2720
- >
2721
- <svg
2722
- xmlns="http://www.w3.org/2000/svg"
2723
- fill="none"
2724
- viewBox="0 0 24 24"
2725
- stroke-width="1.5"
2726
- stroke="currentColor"
2727
- class="size-6"
2728
- style="
2729
- width: 11px;
2730
- height: 11px;
2731
- "
2732
- >
2733
- <path
2734
- stroke-linecap="round"
2735
- stroke-linejoin="round"
2736
- d="M12 4.5v15m7.5-7.5h-15"
2737
- ></path>
2738
- </svg>
2739
- </button>
2740
-
2741
- <button
2742
- class="fl-color-swatch"
2743
- style="outline: 1px dashed #ffffff66;background: transparent;"
2744
- onclick={() => alert("Not implemented yet")}
2745
- aria-label="Add new color"
2746
- >
2747
- <svg
2748
- xmlns="http://www.w3.org/2000/svg"
2749
- fill="none"
2750
- viewBox="0 0 24 24"
2751
- stroke-width="1.5"
2752
- stroke="currentColor"
2753
- class="size-6"
2754
- style="
2755
- width: 11px;
2756
- height: 11px;
2757
- "
2758
- >
2759
- <path
2760
- stroke-linecap="round"
2761
- stroke-linejoin="round"
2762
- d="M12 4.5v15m7.5-7.5h-15"
2763
- ></path>
2764
- </svg>
2765
- </button>
2766
- {/if}
1164
+ </div>
1165
+ {/if}
1166
+ {/each}
1167
+
1168
+ {#if isCellSelection()}
1169
+ <div role="group" class="fl-rich-text-toolbar-group">
1170
+ <MergeCellsBtn {editor} />
1171
+ <SplitCellBtn {editor} />
2767
1172
  </div>
2768
1173
  {/if}
2769
- </div> -->
2770
- </BubbleMenu>
2771
- </div>
2772
-
2773
- <!-- Image Menu -->
2774
- <div class="hidden">
2775
- <BubbleMenu
2776
- editor={$editor}
2777
- shouldShow={() => {
2778
- const emptySelection = $editor.state.selection.empty;
2779
- if (emptySelection) {
2780
- return false;
2781
- }
2782
- return $editor.isActive("image");
2783
- }}
2784
- >
2785
- <div data-test-id="bubble-menu" class="fl-bubble-menu flex">
2786
- <input
2787
- class="fl-editor-image-url-input"
2788
- type="text"
2789
- placeholder="Insert image url"
2790
- bind:this={imageUrlInputEl}
2791
- value={$editor.getAttributes("image").src}
2792
- oninput={(e: any) => {
2793
- // console.log(e.target.value);
2794
- imageUrlInputValue = e.target.value;
2795
- }}
2796
- onkeydown={(e: any) => {
2797
- if (e.key === "Enter") {
2798
- e.preventDefault();
2799
- $editor
2800
- .chain()
2801
- .focus()
2802
- .setImage({ src: imageUrlInputEl?.value })
2803
- .run();
2804
- }
2805
- }}
2806
- />
2807
- <button
2808
- type="button"
2809
- aria-label="Insert image from url"
2810
- disabled={!imageUrlInputValue ||
2811
- imageUrlInputValue === $editor.getAttributes("image").src}
2812
- class:is-active={imageUrlInputValue &&
2813
- imageUrlInputValue !== $editor.getAttributes("image").src}
2814
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
2815
- onclick={() => {
2816
- $editor
2817
- .chain()
2818
- .focus()
2819
- .setImage({ src: imageUrlInputEl?.value })
2820
- .run();
2821
- }}
2822
- >
2823
- <svg
2824
- width="16"
2825
- height="16"
2826
- class="tiptap-button-icon"
2827
- viewBox="0 0 24 24"
2828
- fill="currentColor"
2829
- xmlns="http://www.w3.org/2000/svg"
2830
- ><path
2831
- fill-rule="evenodd"
2832
- clip-rule="evenodd"
2833
- d="M21 4C21 3.44772 20.5523 3 20 3C19.4477 3 19 3.44772 19 4V11C19 11.7956 18.6839 12.5587 18.1213 13.1213C17.5587 13.6839 16.7956 14 16 14H6.41421L9.70711 10.7071C10.0976 10.3166 10.0976 9.68342 9.70711 9.29289C9.31658 8.90237 8.68342 8.90237 8.29289 9.29289L3.29289 14.2929C2.90237 14.6834 2.90237 15.3166 3.29289 15.7071L8.29289 20.7071C8.68342 21.0976 9.31658 21.0976 9.70711 20.7071C10.0976 20.3166 10.0976 19.6834 9.70711 19.2929L6.41421 16H16C17.3261 16 18.5979 15.4732 19.5355 14.5355C20.4732 13.5979 21 12.3261 21 11V4Z"
2834
- fill="currentColor"
2835
- class="s-m1-89pp0R0Iu"
2836
- ></path></svg
2837
- >
2838
- </button>
2839
-
2840
- <button
2841
- type="button"
2842
- onclick={() => setLink()}
2843
- class="fl-bubble-menu-mark-button"
2844
- class:is-active={$editor.isActive("link")}
2845
- class:accent-soft={editorConfig.buttonStyle === "accent-soft"}
2846
- aria-label="Link"
2847
- >
2848
- <svg
2849
- width="16"
2850
- height="16"
2851
- class="tiptap-button-icon"
2852
- viewBox="0 0 24 24"
2853
- fill="currentColor"
2854
- xmlns="http://www.w3.org/2000/svg"
2855
- ><path
2856
- 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"
2857
- fill="currentColor"
2858
- ></path><path
2859
- 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"
2860
- fill="currentColor"
2861
- ></path></svg
2862
- >
2863
- </button>
2864
1174
  </div>
2865
1175
  </BubbleMenu>
2866
1176
  </div>
1177
+
1178
+ <BubbleMenuImage {editor} accentSoft={isAccentSoft} />
2867
1179
  {/if}
2868
1180
 
2869
1181
  <style>