@flexiui/svelte-rich-text 0.0.60 → 0.0.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/README.md +388 -185
  2. package/dist/RichText.svelte +382 -2070
  3. package/dist/RichText.svelte.d.ts +28 -0
  4. package/dist/Toolbar/RenderToolbarButton.svelte +147 -0
  5. package/dist/Toolbar/RenderToolbarButton.svelte.d.ts +14 -0
  6. package/dist/Toolbar/action-buttons/ClearFormatting.svelte +31 -0
  7. package/dist/Toolbar/action-buttons/ClearFormatting.svelte.d.ts +14 -0
  8. package/dist/Toolbar/action-buttons/ClearNodes.svelte +15 -0
  9. package/dist/Toolbar/action-buttons/ClearNodes.svelte.d.ts +14 -0
  10. package/dist/Toolbar/action-buttons/MergeCellsBtn.svelte +31 -0
  11. package/dist/Toolbar/action-buttons/MergeCellsBtn.svelte.d.ts +14 -0
  12. package/dist/Toolbar/action-buttons/Redo.svelte +26 -0
  13. package/dist/Toolbar/action-buttons/Redo.svelte.d.ts +14 -0
  14. package/dist/Toolbar/action-buttons/SplitCellBtn.svelte +31 -0
  15. package/dist/Toolbar/action-buttons/SplitCellBtn.svelte.d.ts +14 -0
  16. package/dist/Toolbar/action-buttons/Undo.svelte +30 -0
  17. package/dist/Toolbar/action-buttons/Undo.svelte.d.ts +14 -0
  18. package/dist/Toolbar/action-buttons/marks/Bold.svelte +29 -0
  19. package/dist/Toolbar/action-buttons/marks/Bold.svelte.d.ts +14 -0
  20. package/dist/Toolbar/action-buttons/marks/CodeMarkBtn.svelte +33 -0
  21. package/dist/Toolbar/action-buttons/marks/CodeMarkBtn.svelte.d.ts +14 -0
  22. package/dist/Toolbar/action-buttons/marks/FontSize.svelte +99 -0
  23. package/dist/Toolbar/action-buttons/marks/FontSize.svelte.d.ts +14 -0
  24. package/dist/Toolbar/action-buttons/marks/Italic.svelte +27 -0
  25. package/dist/Toolbar/action-buttons/marks/Italic.svelte.d.ts +14 -0
  26. package/dist/Toolbar/action-buttons/marks/LinkBtn.svelte +64 -0
  27. package/dist/Toolbar/action-buttons/marks/LinkBtn.svelte.d.ts +14 -0
  28. package/dist/Toolbar/action-buttons/marks/SpecialBox.svelte +21 -0
  29. package/dist/Toolbar/action-buttons/marks/SpecialBox.svelte.d.ts +14 -0
  30. package/dist/Toolbar/action-buttons/marks/Strike.svelte +30 -0
  31. package/dist/Toolbar/action-buttons/marks/Strike.svelte.d.ts +14 -0
  32. package/dist/Toolbar/action-buttons/marks/TextAlign.svelte +66 -0
  33. package/dist/Toolbar/action-buttons/marks/TextAlign.svelte.d.ts +14 -0
  34. package/dist/Toolbar/action-buttons/marks/Underline.svelte +29 -0
  35. package/dist/Toolbar/action-buttons/marks/Underline.svelte.d.ts +14 -0
  36. package/dist/Toolbar/action-buttons/nodes/Audio.svelte +60 -0
  37. package/dist/Toolbar/action-buttons/nodes/Audio.svelte.d.ts +14 -0
  38. package/dist/Toolbar/action-buttons/nodes/Blockquote.svelte +25 -0
  39. package/dist/Toolbar/action-buttons/nodes/Blockquote.svelte.d.ts +14 -0
  40. package/dist/Toolbar/action-buttons/nodes/CodeBlock.svelte +37 -0
  41. package/dist/Toolbar/action-buttons/nodes/CodeBlock.svelte.d.ts +14 -0
  42. package/dist/Toolbar/action-buttons/nodes/HardBreakBtn.svelte +26 -0
  43. package/dist/Toolbar/action-buttons/nodes/HardBreakBtn.svelte.d.ts +14 -0
  44. package/dist/Toolbar/action-buttons/nodes/HeadingBtn.svelte +78 -0
  45. package/dist/Toolbar/action-buttons/nodes/HeadingBtn.svelte.d.ts +14 -0
  46. package/dist/Toolbar/action-buttons/nodes/HorizontalRule.svelte +24 -0
  47. package/dist/Toolbar/action-buttons/nodes/HorizontalRule.svelte.d.ts +14 -0
  48. package/dist/Toolbar/action-buttons/nodes/Image.svelte +60 -0
  49. package/dist/Toolbar/action-buttons/nodes/Image.svelte.d.ts +14 -0
  50. package/dist/Toolbar/action-buttons/nodes/InlineMath.svelte +50 -0
  51. package/dist/Toolbar/action-buttons/nodes/InlineMath.svelte.d.ts +14 -0
  52. package/dist/Toolbar/action-buttons/nodes/ListBtn.svelte +43 -0
  53. package/dist/Toolbar/action-buttons/nodes/ListBtn.svelte.d.ts +14 -0
  54. package/dist/Toolbar/action-buttons/nodes/MediaGridBtn.svelte +58 -0
  55. package/dist/Toolbar/action-buttons/nodes/MediaGridBtn.svelte.d.ts +14 -0
  56. package/dist/Toolbar/action-buttons/nodes/Table.svelte +60 -0
  57. package/dist/Toolbar/action-buttons/nodes/Table.svelte.d.ts +14 -0
  58. package/dist/Toolbar/bubble-menus/BubbleMenuImage.svelte +139 -0
  59. package/dist/Toolbar/bubble-menus/BubbleMenuImage.svelte.d.ts +14 -0
  60. package/dist/Toolbar/dropdown-buttons/HeadingsDropdownBtn.svelte +64 -0
  61. package/dist/Toolbar/dropdown-buttons/HeadingsDropdownBtn.svelte.d.ts +14 -0
  62. package/dist/Toolbar/dropdown-buttons/HighlightDropdownBtn.svelte +45 -0
  63. package/dist/Toolbar/dropdown-buttons/HighlightDropdownBtn.svelte.d.ts +14 -0
  64. package/dist/Toolbar/dropdown-buttons/LineHeightDropdownBtn.svelte +18 -0
  65. package/dist/Toolbar/dropdown-buttons/LineHeightDropdownBtn.svelte.d.ts +14 -0
  66. package/dist/Toolbar/dropdown-buttons/ListsDropdownBtn.svelte +188 -0
  67. package/dist/Toolbar/dropdown-buttons/ListsDropdownBtn.svelte.d.ts +14 -0
  68. package/dist/Toolbar/dropdown-buttons/TextColorDropdownBtn.svelte +37 -0
  69. package/dist/Toolbar/dropdown-buttons/TextColorDropdownBtn.svelte.d.ts +14 -0
  70. package/dist/Toolbar/dropdowns/LineHeightDropdown.svelte +26 -0
  71. package/dist/Toolbar/dropdowns/LineHeightDropdown.svelte.d.ts +14 -0
  72. package/dist/Toolbar/toolbar-utils.d.ts +1 -0
  73. package/dist/Toolbar/toolbar-utils.js +15 -0
  74. package/dist/extensions/NodeFontSize.d.ts +10 -0
  75. package/dist/extensions/NodeFontSize.js +53 -0
  76. package/dist/extensions/SemanticHeadings.d.ts +10 -0
  77. package/dist/extensions/SemanticHeadings.js +124 -0
  78. package/dist/extensions/Table/TableCellNodeView.svelte +0 -4
  79. package/dist/getExtensions.d.ts +7 -0
  80. package/dist/getExtensions.js +13 -2
  81. package/dist/styles.css +53 -10
  82. package/package.json +1 -1
@@ -1,6 +1,22 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
2
  import "./styles.css";
3
3
  import "katex/dist/katex.min.css";
4
+ type ToolbarButton = string | {
5
+ type?: string;
6
+ tooltip?: string;
7
+ icon?: string;
8
+ name?: string;
9
+ };
10
+ type ToolbarSelect = {
11
+ select: ToolbarButton[];
12
+ name?: string;
13
+ tooltip?: string;
14
+ icon?: string;
15
+ type?: string;
16
+ };
17
+ type ToolbarItem = ToolbarButton | ToolbarSelect;
18
+ type ToolbarConfig = ToolbarItem[] | ToolbarItem[][];
19
+ type BubbleMenuConfig = ToolbarItem[] | ToolbarItem[][];
4
20
  export interface Props {
5
21
  id?: string;
6
22
  className?: string;
@@ -10,7 +26,14 @@ export interface Props {
10
26
  content: any[];
11
27
  } | null;
12
28
  nodesLimit?: number;
29
+ charactersLimit?: number;
13
30
  limitWarningMessage?: string;
31
+ showToolbar?: boolean;
32
+ toolbarAlign?: string;
33
+ semanticHeadings?: boolean;
34
+ uniqueH1?: boolean;
35
+ toolbarConfig?: ToolbarConfig;
36
+ bubbleMenuConfig?: BubbleMenuConfig;
14
37
  customExtensions?: any[];
15
38
  editorEvents?: {
16
39
  onTransaction?: (params: any) => void;
@@ -35,7 +58,12 @@ export interface Props {
35
58
  toolbarBgColor?: string;
36
59
  toolbarTextColor?: string;
37
60
  toolbarPadding?: string;
61
+ toolbarJustifyContent?: string;
38
62
  toolbarGap?: string;
63
+ toolbarBtnPadding?: string;
64
+ toolbarBtnRadius?: string;
65
+ toolbarBtnMinHeight?: string;
66
+ toolbarBtnMinWidth?: string;
39
67
  docMaxWidth?: string;
40
68
  docPadding?: string;
41
69
  docBg?: string;
@@ -0,0 +1,147 @@
1
+ <script lang="ts">
2
+ import Undo from "./action-buttons/Undo.svelte";
3
+ import Redo from "./action-buttons/Redo.svelte";
4
+ import ClearFormatting from "./action-buttons/ClearFormatting.svelte";
5
+ import ClearNodes from "./action-buttons/ClearNodes.svelte";
6
+
7
+ import HeadingsDropdownBtn from "./dropdown-buttons/HeadingsDropdownBtn.svelte";
8
+ import ListsDropdownBtn from "./dropdown-buttons/ListsDropdownBtn.svelte";
9
+ import LineHeightDropdownBtn from "./dropdown-buttons/LineHeightDropdownBtn.svelte";
10
+
11
+ import CodeBlock from "./action-buttons/nodes/CodeBlock.svelte";
12
+ import Blockquote from "./action-buttons/nodes/Blockquote.svelte";
13
+ import HardBreakBtn from "./action-buttons/nodes/HardBreakBtn.svelte";
14
+ import HorizontalRule from "./action-buttons/nodes/HorizontalRule.svelte";
15
+ import Image from "./action-buttons/nodes/Image.svelte";
16
+ import Audio from "./action-buttons/nodes/Audio.svelte";
17
+ import InlineMath from "./action-buttons/nodes/InlineMath.svelte";
18
+ import MediaGridBtn from "./action-buttons/nodes/MediaGridBtn.svelte";
19
+ import Table from "./action-buttons/nodes/Table.svelte";
20
+
21
+ import TextAlign from "./action-buttons/marks/TextAlign.svelte";
22
+ import FontSize from "./action-buttons/marks/FontSize.svelte";
23
+ import SpecialBox from "./action-buttons/marks/SpecialBox.svelte";
24
+ import Bold from "./action-buttons/marks/Bold.svelte";
25
+ import CodeMarkBtn from "./action-buttons/marks/CodeMarkBtn.svelte";
26
+ import Italic from "./action-buttons/marks/Italic.svelte";
27
+ import LinkBtn from "./action-buttons/marks/LinkBtn.svelte";
28
+ import Strike from "./action-buttons/marks/Strike.svelte";
29
+ import Underline from "./action-buttons/marks/Underline.svelte";
30
+ import TextColorDropdownBtn from "./dropdown-buttons/TextColorDropdownBtn.svelte";
31
+ import HighlightDropdownBtn from "./dropdown-buttons/HighlightDropdownBtn.svelte";
32
+
33
+ let {
34
+ type,
35
+ editor,
36
+ nodeCounters,
37
+ nodesLimit,
38
+ currentNodeCount,
39
+ accentSoft,
40
+ fontSize,
41
+ onToggleDropdown,
42
+ } = $props();
43
+
44
+ function handleClick(event: MouseEvent, name: string) {
45
+ onToggleDropdown?.(event, name);
46
+ }
47
+ </script>
48
+
49
+ <!-- [] Todo: Mejorar el render para evitar tanto if.
50
+ A lo mejor crear un "diccionario/mapa" renderizar según el type.
51
+ -->
52
+ {#if type === "undo"}
53
+ <Undo {editor} />
54
+ {:else if type === "redo"}
55
+ <Redo {editor} />
56
+ {:else if type === "headings"}
57
+ <HeadingsDropdownBtn
58
+ {editor}
59
+ {accentSoft}
60
+ onToggleDropdown={(e: MouseEvent, dropdownName: string) => {
61
+ handleClick(e, dropdownName);
62
+ }}
63
+ />
64
+ {:else if type === "lists"}
65
+ <ListsDropdownBtn
66
+ {editor}
67
+ {accentSoft}
68
+ onToggleDropdown={(e: MouseEvent, dropdownName: string) => {
69
+ handleClick(e, dropdownName);
70
+ }}
71
+ />
72
+ {:else if type === "codeBlock"}
73
+ <CodeBlock {editor} accenSoft={accentSoft} />
74
+ {:else if type === "blockquote"}
75
+ <Blockquote {editor} accenSoft={accentSoft} />
76
+ {:else if type === "fontSize"}
77
+ <FontSize {editor} accenSoft={accentSoft} {fontSize} />
78
+ {:else if type === "lineHeight"}
79
+ <LineHeightDropdownBtn
80
+ onToggleDropdown={(e: MouseEvent, dropdownName: string) => {
81
+ handleClick(e, dropdownName);
82
+ }}
83
+ />
84
+ {:else if type === "horizontalRule"}
85
+ <HorizontalRule {editor} />
86
+ {:else if type === "hardBreak"}
87
+ <HardBreakBtn {editor} />
88
+ {:else if type === "inlineMath"}
89
+ <InlineMath {editor} />
90
+ {:else if type === "image"}
91
+ <Image {editor} {nodesLimit} {currentNodeCount} accenSoft={accentSoft} />
92
+ {:else if type === "audio"}
93
+ <Audio {editor} {nodesLimit} {currentNodeCount} accenSoft={accentSoft} />
94
+ {:else if type === "mediaGrid"}
95
+ <MediaGridBtn
96
+ {editor}
97
+ {nodesLimit}
98
+ {currentNodeCount}
99
+ accenSoft={accentSoft}
100
+ />
101
+ {:else if type === "table"}
102
+ <Table {editor} {nodesLimit} {currentNodeCount} accenSoft={accentSoft} />
103
+ {:else if type === "textAlignLeft"}
104
+ <TextAlign position="left" {editor} accenSoft={accentSoft} />
105
+ {:else if type === "textAlignCenter"}
106
+ <TextAlign position="center" {editor} accenSoft={accentSoft} />
107
+ {:else if type === "textAlignRight"}
108
+ <TextAlign position="right" {editor} accenSoft={accentSoft} />
109
+ {:else if type === "clearFormatting"}
110
+ <ClearFormatting {editor} />
111
+ {:else if type === "clearNodes"}
112
+ <ClearNodes {editor} />
113
+
114
+ {:else if type === "bold"}
115
+ <Bold {editor} accenSoft={accentSoft} />
116
+ {:else if type === "italic"}
117
+ <Italic {editor} accenSoft={accentSoft} />
118
+ {:else if type === "underline"}
119
+ <Underline {editor} accenSoft={accentSoft} />
120
+ {:else if type === "strike"}
121
+ <Strike {editor} accenSoft={accentSoft} />
122
+ {:else if type === "code"}
123
+ <CodeMarkBtn {editor} accenSoft={accentSoft} />
124
+ {:else if type === "link"}
125
+ <LinkBtn {editor} accenSoft={accentSoft} />
126
+ {:else if type === "specialBox"}
127
+ <SpecialBox {editor} accentSoft={accentSoft} />
128
+
129
+ {:else if type === "highlight"}
130
+ <HighlightDropdownBtn
131
+ onToggleDropdown={(e, dropdownName) => {
132
+ handleClick(e, dropdownName);
133
+ }}
134
+ />
135
+ {:else if type === "textColor"}
136
+ <TextColorDropdownBtn
137
+ {editor}
138
+ onToggleDropdown={(e, dropdownName) => {
139
+ handleClick(e, dropdownName);
140
+ }}
141
+ />
142
+
143
+ {:else if type === "hardBreak"}
144
+ <HardBreakBtn {editor} />
145
+ {:else}
146
+ <p>Render {type}</p>
147
+ {/if}
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type RenderToolbarButtonProps = typeof __propDef.props;
10
+ export type RenderToolbarButtonEvents = typeof __propDef.events;
11
+ export type RenderToolbarButtonSlots = typeof __propDef.slots;
12
+ export default class RenderToolbarButton extends SvelteComponentTyped<RenderToolbarButtonProps, RenderToolbarButtonEvents, RenderToolbarButtonSlots> {
13
+ }
14
+ export {};
@@ -0,0 +1,31 @@
1
+ <script lang="ts">
2
+ const {
3
+ editor,
4
+ accenSoft = false,
5
+ ariaLabel = "Clear formatting",
6
+ } = $props();
7
+ </script>
8
+
9
+ <button
10
+ aria-label={ariaLabel}
11
+ type="button"
12
+ onclick={() => $editor.chain().focus().unsetAllMarks().run()}
13
+ >
14
+ <svg
15
+ xmlns="http://www.w3.org/2000/svg"
16
+ width="16"
17
+ height="16"
18
+ viewBox="0 0 24 24"
19
+ fill="none"
20
+ stroke="currentColor"
21
+ stroke-width="2"
22
+ stroke-linecap="round"
23
+ stroke-linejoin="round"
24
+ class="icon icon-tabler icons-tabler-outline icon-tabler-clear-formatting"
25
+ ><path stroke="none" d="M0 0h24v24H0z" fill="none" /><path
26
+ d="M17 15l4 4m0 -4l-4 4"
27
+ /><path d="M7 6v-1h11v1" /><path d="M7 19l4 0" /><path
28
+ d="M13 5l-4 14"
29
+ /></svg
30
+ >
31
+ </button>
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type ClearFormattingProps = typeof __propDef.props;
10
+ export type ClearFormattingEvents = typeof __propDef.events;
11
+ export type ClearFormattingSlots = typeof __propDef.slots;
12
+ export default class ClearFormatting extends SvelteComponentTyped<ClearFormattingProps, ClearFormattingEvents, ClearFormattingSlots> {
13
+ }
14
+ export {};
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ const {
3
+ editor,
4
+ accenSoft = false,
5
+ ariaLabel = "Clear nodes",
6
+ } = $props();
7
+ </script>
8
+
9
+ <button
10
+ type="button"
11
+ onclick={() => $editor.chain().focus().clearNodes().run()}
12
+ aria-label={ariaLabel}
13
+ >
14
+ Clear
15
+ </button>
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type ClearNodesProps = typeof __propDef.props;
10
+ export type ClearNodesEvents = typeof __propDef.events;
11
+ export type ClearNodesSlots = typeof __propDef.slots;
12
+ export default class ClearNodes extends SvelteComponentTyped<ClearNodesProps, ClearNodesEvents, ClearNodesSlots> {
13
+ }
14
+ export {};
@@ -0,0 +1,31 @@
1
+ <script lang="ts">
2
+ const { editor, ariaLabel = "Merge cells" } = $props();
3
+ </script>
4
+
5
+ <button
6
+ class="fl-bubble-menu-mark-button"
7
+ type="button"
8
+ aria-label={ariaLabel}
9
+ title={ariaLabel}
10
+ onclick={() => $editor?.chain().focus().mergeCells().run()}
11
+ >
12
+ <svg
13
+ xmlns="http://www.w3.org/2000/svg"
14
+ viewBox="0 0 24 24"
15
+ width="16"
16
+ height="16"
17
+ fill="none"
18
+ stroke="currentColor"
19
+ stroke-width="2"
20
+ stroke-linecap="round"
21
+ stroke-linejoin="round"
22
+ style="opacity:1;"
23
+ ><path d="M12 21v-6m0-6V3M3 15h18M3 9h18"></path><rect
24
+ width="18"
25
+ height="18"
26
+ x="3"
27
+ y="3"
28
+ rx="2"
29
+ ></rect></svg
30
+ >
31
+ </button>
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type MergeCellsBtnProps = typeof __propDef.props;
10
+ export type MergeCellsBtnEvents = typeof __propDef.events;
11
+ export type MergeCellsBtnSlots = typeof __propDef.slots;
12
+ export default class MergeCellsBtn extends SvelteComponentTyped<MergeCellsBtnProps, MergeCellsBtnEvents, MergeCellsBtnSlots> {
13
+ }
14
+ export {};
@@ -0,0 +1,26 @@
1
+ <script lang="ts">
2
+ const { editor, accenSoft = false, ariaLabel = "Redo" } = $props();
3
+ </script>
4
+
5
+ <button
6
+ type="button"
7
+ onclick={() => $editor.chain().focus().redo().run()}
8
+ disabled={!$editor.can().chain().focus().redo().run()}
9
+ aria-label={ariaLabel}
10
+ class:accent-soft={accenSoft}
11
+ >
12
+ <svg
13
+ width="24"
14
+ height="24"
15
+ class="tiptap-button-icon"
16
+ viewBox="0 0 24 24"
17
+ fill="currentColor"
18
+ xmlns="http://www.w3.org/2000/svg"
19
+ ><path
20
+ fill-rule="evenodd"
21
+ clip-rule="evenodd"
22
+ 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"
23
+ fill="currentColor"
24
+ ></path></svg
25
+ >
26
+ </button>
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type RedoProps = typeof __propDef.props;
10
+ export type RedoEvents = typeof __propDef.events;
11
+ export type RedoSlots = typeof __propDef.slots;
12
+ export default class Redo extends SvelteComponentTyped<RedoProps, RedoEvents, RedoSlots> {
13
+ }
14
+ export {};
@@ -0,0 +1,31 @@
1
+ <script lang="ts">
2
+ const { editor, ariaLabel = "Split cell" } = $props();
3
+ </script>
4
+
5
+ <button
6
+ class="fl-bubble-menu-mark-button"
7
+ type="button"
8
+ aria-label={ariaLabel}
9
+ title={ariaLabel}
10
+ onclick={() => $editor?.chain().focus().splitCell().run()}
11
+ >
12
+ <svg
13
+ xmlns="http://www.w3.org/2000/svg"
14
+ viewBox="0 0 24 24"
15
+ width="16"
16
+ height="16"
17
+ fill="none"
18
+ stroke="currentColor"
19
+ stroke-width="2"
20
+ stroke-linecap="round"
21
+ stroke-linejoin="round"
22
+ style="opacity:1;"
23
+ ><path d="M12 15V9m-9 6h18M3 9h18" /><rect
24
+ width="18"
25
+ height="18"
26
+ x="3"
27
+ y="3"
28
+ rx="2"
29
+ /></svg
30
+ >
31
+ </button>
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type SplitCellBtnProps = typeof __propDef.props;
10
+ export type SplitCellBtnEvents = typeof __propDef.events;
11
+ export type SplitCellBtnSlots = typeof __propDef.slots;
12
+ export default class SplitCellBtn extends SvelteComponentTyped<SplitCellBtnProps, SplitCellBtnEvents, SplitCellBtnSlots> {
13
+ }
14
+ export {};
@@ -0,0 +1,30 @@
1
+ <script lang="ts">
2
+ const {
3
+ editor,
4
+ accenSoft = false,
5
+ ariaLabel = "Undo",
6
+ } = $props();
7
+ </script>
8
+
9
+ <button
10
+ type="button"
11
+ onclick={() => $editor.chain().focus().undo().run()}
12
+ disabled={!$editor.can().chain().focus().undo().run()}
13
+ aria-label={ariaLabel}
14
+ class:accent-soft={accenSoft}
15
+ >
16
+ <svg
17
+ width="24"
18
+ height="24"
19
+ class="tiptap-button-icon"
20
+ viewBox="0 0 24 24"
21
+ fill="currentColor"
22
+ xmlns="http://www.w3.org/2000/svg"
23
+ ><path
24
+ fill-rule="evenodd"
25
+ clip-rule="evenodd"
26
+ 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"
27
+ fill="currentColor"
28
+ ></path></svg
29
+ >
30
+ </button>
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type UndoProps = typeof __propDef.props;
10
+ export type UndoEvents = typeof __propDef.events;
11
+ export type UndoSlots = typeof __propDef.slots;
12
+ export default class Undo extends SvelteComponentTyped<UndoProps, UndoEvents, UndoSlots> {
13
+ }
14
+ export {};
@@ -0,0 +1,29 @@
1
+ <script lang="ts">
2
+ const { editor, accenSoft = false, ariaLabel = "Bold" } = $props();
3
+ </script>
4
+
5
+ <!-- Bold -->
6
+ <button
7
+ type="button"
8
+ onclick={() => $editor.chain().focus().toggleBold().run()}
9
+ disabled={!$editor.can().chain().focus().toggleBold().run()}
10
+ class="fl-bubble-menu-mark-button"
11
+ class:is-active={$editor.isActive("bold")}
12
+ class:accent-soft={accenSoft}
13
+ aria-label={ariaLabel}
14
+ >
15
+ <svg
16
+ width="24"
17
+ height="24"
18
+ class="fl-button-icon"
19
+ viewBox="0 0 24 24"
20
+ fill="currentColor"
21
+ xmlns="http://www.w3.org/2000/svg"
22
+ ><path
23
+ fill-rule="evenodd"
24
+ clip-rule="evenodd"
25
+ 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"
26
+ fill="currentColor"
27
+ ></path></svg
28
+ >
29
+ </button>
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type BoldProps = typeof __propDef.props;
10
+ export type BoldEvents = typeof __propDef.events;
11
+ export type BoldSlots = typeof __propDef.slots;
12
+ export default class Bold extends SvelteComponentTyped<BoldProps, BoldEvents, BoldSlots> {
13
+ }
14
+ export {};
@@ -0,0 +1,33 @@
1
+ <script lang="ts">
2
+ const { editor, accenSoft = false, ariaLabel = "Code mark" } = $props();
3
+ </script>
4
+
5
+ <!-- Code -->
6
+ <button
7
+ type="button"
8
+ onclick={() => $editor.chain().focus().toggleCode().run()}
9
+ disabled={!$editor.can().chain().focus().toggleCode().run()}
10
+ class="fl-bubble-menu-mark-button"
11
+ class:is-active={$editor.isActive("code")}
12
+ class:accent-soft={accenSoft}
13
+ aria-label={ariaLabel}
14
+ >
15
+ <svg
16
+ width="24"
17
+ height="24"
18
+ class="tiptap-button-icon"
19
+ viewBox="0 0 24 24"
20
+ fill="currentColor"
21
+ xmlns="http://www.w3.org/2000/svg"
22
+ ><path
23
+ 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"
24
+ fill="currentColor"
25
+ ></path><path
26
+ 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"
27
+ fill="currentColor"
28
+ ></path><path
29
+ 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"
30
+ fill="currentColor"
31
+ ></path></svg
32
+ >
33
+ </button>
@@ -0,0 +1,14 @@
1
+ import { SvelteComponentTyped } from "svelte";
2
+ declare const __propDef: {
3
+ props: Record<string, never>;
4
+ events: {
5
+ [evt: string]: CustomEvent<any>;
6
+ };
7
+ slots: {};
8
+ };
9
+ export type CodeMarkBtnProps = typeof __propDef.props;
10
+ export type CodeMarkBtnEvents = typeof __propDef.events;
11
+ export type CodeMarkBtnSlots = typeof __propDef.slots;
12
+ export default class CodeMarkBtn extends SvelteComponentTyped<CodeMarkBtnProps, CodeMarkBtnEvents, CodeMarkBtnSlots> {
13
+ }
14
+ export {};
@@ -0,0 +1,99 @@
1
+ <script lang="ts">
2
+ import { isNodeFullySelected } from "../../toolbar-utils";
3
+
4
+ let {
5
+ editor,
6
+ accenSoft = false,
7
+ ariaLabel = "Blockquote",
8
+ fontSize
9
+ } = $props();
10
+
11
+ const aplyToNode = $derived.by(() => {
12
+ return $editor.state.selection.empty || isNodeFullySelected($editor);
13
+ })
14
+
15
+ function decrementFontSize() {
16
+ fontSize = fontSize - 1;
17
+
18
+ if (aplyToNode) {
19
+ $editor
20
+ .chain()
21
+ .focus()
22
+ .setNodeFontSize(fontSize + "px")
23
+ .run();
24
+ } else {
25
+ $editor
26
+ .chain()
27
+ .focus()
28
+ .setFontSize(fontSize + "px")
29
+ .run();
30
+ }
31
+ }
32
+
33
+ function incrementFontSize() {
34
+ fontSize = Number(fontSize) + 1;
35
+
36
+ if (aplyToNode) {
37
+ $editor
38
+ .chain()
39
+ .focus()
40
+ .setNodeFontSize(fontSize + "px")
41
+ .run();
42
+ } else {
43
+ $editor
44
+ .chain()
45
+ .focus()
46
+ .setFontSize(fontSize + "px")
47
+ .run();
48
+ }
49
+ }
50
+
51
+ </script>
52
+
53
+ <div class="fl-font-size-editor">
54
+ <button
55
+ type="button"
56
+ aria-label="Decrease font size"
57
+ onclick={decrementFontSize}
58
+ class="fl-font-size-editor-button"
59
+ >
60
+ <svg
61
+ xmlns="http://www.w3.org/2000/svg"
62
+ width="24"
63
+ height="24"
64
+ viewBox="0 0 24 24"
65
+ fill="none"
66
+ stroke="currentColor"
67
+ stroke-width="2"
68
+ stroke-linecap="round"
69
+ stroke-linejoin="round"
70
+ class="icon icon-tabler icons-tabler-outline icon-tabler-minus"
71
+ ><path stroke="none" d="M0 0h24v24H0z" fill="none" /><path
72
+ d="M5 12l14 0"
73
+ /></svg
74
+ >
75
+ </button>
76
+ <input type="text" bind:value={fontSize} />
77
+ <button
78
+ type="button"
79
+ aria-label="Increase font size"
80
+ onclick={incrementFontSize}
81
+ class="fl-font-size-editor-button"
82
+ >
83
+ <svg
84
+ xmlns="http://www.w3.org/2000/svg"
85
+ width="24"
86
+ height="24"
87
+ viewBox="0 0 24 24"
88
+ fill="none"
89
+ stroke="currentColor"
90
+ stroke-width="2"
91
+ stroke-linecap="round"
92
+ stroke-linejoin="round"
93
+ class="icon icon-tabler icons-tabler-outline icon-tabler-plus"
94
+ ><path stroke="none" d="M0 0h24v24H0z" fill="none" /><path
95
+ d="M12 5l0 14"
96
+ /><path d="M5 12l14 0" /></svg
97
+ >
98
+ </button>
99
+ </div>