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