@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.
- package/README.md +388 -185
- package/dist/RichText.svelte +389 -2075
- package/dist/RichText.svelte.d.ts +29 -0
- package/dist/Toolbar/RenderToolbarButton.svelte +147 -0
- package/dist/Toolbar/RenderToolbarButton.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/ClearFormatting.svelte +31 -0
- package/dist/Toolbar/action-buttons/ClearFormatting.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/ClearNodes.svelte +15 -0
- package/dist/Toolbar/action-buttons/ClearNodes.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/MergeCellsBtn.svelte +31 -0
- package/dist/Toolbar/action-buttons/MergeCellsBtn.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/Redo.svelte +26 -0
- package/dist/Toolbar/action-buttons/Redo.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/SplitCellBtn.svelte +31 -0
- package/dist/Toolbar/action-buttons/SplitCellBtn.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/Undo.svelte +30 -0
- package/dist/Toolbar/action-buttons/Undo.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/marks/Bold.svelte +29 -0
- package/dist/Toolbar/action-buttons/marks/Bold.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/marks/CodeMarkBtn.svelte +33 -0
- package/dist/Toolbar/action-buttons/marks/CodeMarkBtn.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/marks/FontSize.svelte +99 -0
- package/dist/Toolbar/action-buttons/marks/FontSize.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/marks/Italic.svelte +27 -0
- package/dist/Toolbar/action-buttons/marks/Italic.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/marks/LinkBtn.svelte +64 -0
- package/dist/Toolbar/action-buttons/marks/LinkBtn.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/marks/SpecialBox.svelte +21 -0
- package/dist/Toolbar/action-buttons/marks/SpecialBox.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/marks/Strike.svelte +30 -0
- package/dist/Toolbar/action-buttons/marks/Strike.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/marks/TextAlign.svelte +66 -0
- package/dist/Toolbar/action-buttons/marks/TextAlign.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/marks/Underline.svelte +29 -0
- package/dist/Toolbar/action-buttons/marks/Underline.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/nodes/Audio.svelte +60 -0
- package/dist/Toolbar/action-buttons/nodes/Audio.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/nodes/Blockquote.svelte +25 -0
- package/dist/Toolbar/action-buttons/nodes/Blockquote.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/nodes/CodeBlock.svelte +37 -0
- package/dist/Toolbar/action-buttons/nodes/CodeBlock.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/nodes/HardBreakBtn.svelte +26 -0
- package/dist/Toolbar/action-buttons/nodes/HardBreakBtn.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/nodes/HeadingBtn.svelte +78 -0
- package/dist/Toolbar/action-buttons/nodes/HeadingBtn.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/nodes/HorizontalRule.svelte +24 -0
- package/dist/Toolbar/action-buttons/nodes/HorizontalRule.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/nodes/Image.svelte +60 -0
- package/dist/Toolbar/action-buttons/nodes/Image.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/nodes/InlineMath.svelte +50 -0
- package/dist/Toolbar/action-buttons/nodes/InlineMath.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/nodes/ListBtn.svelte +43 -0
- package/dist/Toolbar/action-buttons/nodes/ListBtn.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/nodes/MediaGridBtn.svelte +58 -0
- package/dist/Toolbar/action-buttons/nodes/MediaGridBtn.svelte.d.ts +14 -0
- package/dist/Toolbar/action-buttons/nodes/Table.svelte +60 -0
- package/dist/Toolbar/action-buttons/nodes/Table.svelte.d.ts +14 -0
- package/dist/Toolbar/bubble-menus/BubbleMenuImage.svelte +139 -0
- package/dist/Toolbar/bubble-menus/BubbleMenuImage.svelte.d.ts +14 -0
- package/dist/Toolbar/dropdown-buttons/HeadingsDropdownBtn.svelte +64 -0
- package/dist/Toolbar/dropdown-buttons/HeadingsDropdownBtn.svelte.d.ts +14 -0
- package/dist/Toolbar/dropdown-buttons/HighlightDropdownBtn.svelte +45 -0
- package/dist/Toolbar/dropdown-buttons/HighlightDropdownBtn.svelte.d.ts +14 -0
- package/dist/Toolbar/dropdown-buttons/LineHeightDropdownBtn.svelte +18 -0
- package/dist/Toolbar/dropdown-buttons/LineHeightDropdownBtn.svelte.d.ts +14 -0
- package/dist/Toolbar/dropdown-buttons/ListsDropdownBtn.svelte +188 -0
- package/dist/Toolbar/dropdown-buttons/ListsDropdownBtn.svelte.d.ts +14 -0
- package/dist/Toolbar/dropdown-buttons/TextColorDropdownBtn.svelte +37 -0
- package/dist/Toolbar/dropdown-buttons/TextColorDropdownBtn.svelte.d.ts +14 -0
- package/dist/Toolbar/dropdowns/LineHeightDropdown.svelte +26 -0
- package/dist/Toolbar/dropdowns/LineHeightDropdown.svelte.d.ts +14 -0
- package/dist/Toolbar/toolbar-utils.d.ts +1 -0
- package/dist/Toolbar/toolbar-utils.js +15 -0
- package/dist/extensions/NodeFontSize.d.ts +10 -0
- package/dist/extensions/NodeFontSize.js +53 -0
- package/dist/extensions/SemanticHeadings.d.ts +10 -0
- package/dist/extensions/SemanticHeadings.js +124 -0
- package/dist/extensions/Table/TableCellNodeView.svelte +0 -4
- package/dist/getExtensions.d.ts +7 -0
- package/dist/getExtensions.js +13 -2
- package/dist/styles.css +71 -27
- package/package.json +1 -1
package/dist/getExtensions.js
CHANGED
|
@@ -9,15 +9,23 @@ import { Mathematics } from "@tiptap/extension-mathematics";
|
|
|
9
9
|
import { TableKit } from "@tiptap/extension-table";
|
|
10
10
|
import { Audio } from "./extensions/Audio";
|
|
11
11
|
import { NodeLineHeight } from "./extensions/NodeLineHeight";
|
|
12
|
+
import { NodeFontSize } from "./extensions/NodeFontSize";
|
|
12
13
|
import { MediaGridExtension } from "./extensions/MediaGrid/MediaGrid";
|
|
13
14
|
import { MediaGridItemExtension } from "./extensions/MediaGrid/MediaGridItem";
|
|
14
15
|
import { CustomTableCell } from "./extensions/Table/CustomTableCell";
|
|
15
16
|
import { CustomTableHeader } from "./extensions/Table/CustomTableHeader";
|
|
16
17
|
import { EnhancedLink } from "./extensions/EnhancedLink";
|
|
18
|
+
import { SemanticHeadings } from "./extensions/SemanticHeadings";
|
|
17
19
|
import { Heading } from "@tiptap/extension-heading";
|
|
18
20
|
const DocHeading = Heading.extend({
|
|
19
21
|
name: "h1",
|
|
20
|
-
|
|
22
|
+
addCommands() {
|
|
23
|
+
return {
|
|
24
|
+
toggleH1: () => ({ commands }) => {
|
|
25
|
+
return commands.toggleNode('h1', 'paragraph');
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
},
|
|
21
29
|
}).configure({ levels: [1] });
|
|
22
30
|
export function getRichTextExtensions(options) {
|
|
23
31
|
const { editable = false, customExtensions = [] } = options ?? {};
|
|
@@ -25,7 +33,9 @@ export function getRichTextExtensions(options) {
|
|
|
25
33
|
DocHeading,
|
|
26
34
|
Heading.configure({ levels: [2, 3, 4, 5, 6] }),
|
|
27
35
|
Highlight.configure({ multicolor: true }),
|
|
28
|
-
TextStyleKit
|
|
36
|
+
TextStyleKit.configure({
|
|
37
|
+
// fontSize: false
|
|
38
|
+
}),
|
|
29
39
|
StarterKit.configure({
|
|
30
40
|
trailingNode: false,
|
|
31
41
|
link: false,
|
|
@@ -52,6 +62,7 @@ export function getRichTextExtensions(options) {
|
|
|
52
62
|
],
|
|
53
63
|
}),
|
|
54
64
|
NodeLineHeight,
|
|
65
|
+
NodeFontSize,
|
|
55
66
|
MediaGridExtension,
|
|
56
67
|
MediaGridItemExtension,
|
|
57
68
|
TableKit.configure({
|
package/dist/styles.css
CHANGED
|
@@ -12,10 +12,16 @@
|
|
|
12
12
|
--fl-toolbar-sticky-position: 0;
|
|
13
13
|
--fl-toolbar-z-index: 10;
|
|
14
14
|
--fl-toolbar-padding: 6px;
|
|
15
|
+
--fl-toolbar-justify-content: center;
|
|
15
16
|
--fl-toolbar-gap: 5px;
|
|
16
17
|
--fl-toolbar-bg: #242424;
|
|
17
18
|
--fl-toolbar-text-color: currentColor;
|
|
18
19
|
|
|
20
|
+
--fl-toolbar-btn-padding: 0 9px;
|
|
21
|
+
--fl-toolbar-btn-radius: 9px;
|
|
22
|
+
--fl-toolbar-btn-min-height: 34px;
|
|
23
|
+
--fl-toolbar-btn-min-width: var(--fl-toolbar-btn-min-height);
|
|
24
|
+
|
|
19
25
|
--fl-doc-max-width: 1032px;
|
|
20
26
|
--fl-doc-padding: 2rem;
|
|
21
27
|
--fl-doc-bg: transparent;
|
|
@@ -39,6 +45,12 @@
|
|
|
39
45
|
width: 100%;
|
|
40
46
|
}
|
|
41
47
|
|
|
48
|
+
.fl-rich-text-content {
|
|
49
|
+
img {
|
|
50
|
+
max-width: 100%;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
42
54
|
.fl-rich-text-doc {
|
|
43
55
|
padding: var(--fl-doc-padding, 2rem);
|
|
44
56
|
background: var(--fl-doc-bg, transparent);
|
|
@@ -92,6 +104,7 @@
|
|
|
92
104
|
background-color: var(--fl-editor-bg, #242424);
|
|
93
105
|
box-sizing: border-box;
|
|
94
106
|
border-radius: var(--fl-editor-radius);
|
|
107
|
+
position: relative;
|
|
95
108
|
|
|
96
109
|
.fl-editor-image-url-input {
|
|
97
110
|
white-space: nowrap;
|
|
@@ -112,11 +125,11 @@
|
|
|
112
125
|
backdrop-filter: blur(16px);
|
|
113
126
|
border-radius: 14px;
|
|
114
127
|
display: flex;
|
|
115
|
-
gap:
|
|
128
|
+
gap: 5px;
|
|
116
129
|
position: relative;
|
|
117
130
|
z-index: 9;
|
|
118
131
|
|
|
119
|
-
button {
|
|
132
|
+
.fl-bubble-menu-mark-button {
|
|
120
133
|
border-radius: 9px;
|
|
121
134
|
border: none;
|
|
122
135
|
display: flex;
|
|
@@ -174,7 +187,7 @@
|
|
|
174
187
|
flex-wrap: nowrap;
|
|
175
188
|
overflow: auto;
|
|
176
189
|
align-items: center;
|
|
177
|
-
justify-content:
|
|
190
|
+
justify-content: var(--fl-toolbar-justify-content);
|
|
178
191
|
gap: var(--fl-toolbar-gap);
|
|
179
192
|
padding: var(--fl-toolbar-padding);
|
|
180
193
|
position: sticky;
|
|
@@ -183,6 +196,7 @@
|
|
|
183
196
|
background: var(--fl-toolbar-bg, #242424);
|
|
184
197
|
color: var(--fl-toolbar-text-color);
|
|
185
198
|
border-radius: var(--fl-editor-radius);
|
|
199
|
+
margin-bottom: calc(var(--fl-toolbar-padding) * -1);
|
|
186
200
|
}
|
|
187
201
|
|
|
188
202
|
.fl-rich-text-toolbar-container {
|
|
@@ -197,11 +211,11 @@
|
|
|
197
211
|
gap: var(--fl-toolbar-gap);
|
|
198
212
|
|
|
199
213
|
button {
|
|
200
|
-
padding:
|
|
214
|
+
padding: var(--fl-toolbar-btn-padding, 0 9px);
|
|
201
215
|
flex: auto;
|
|
202
216
|
border: none;
|
|
203
217
|
background: rgba(255, 255, 255, 0.1);
|
|
204
|
-
border-radius:
|
|
218
|
+
border-radius: var(--fl-toolbar-btn-radius, 9px);
|
|
205
219
|
color: currentColor;
|
|
206
220
|
font-size: 14px;
|
|
207
221
|
display: flex;
|
|
@@ -211,7 +225,8 @@
|
|
|
211
225
|
gap: 2px;
|
|
212
226
|
cursor: pointer;
|
|
213
227
|
line-height: 1;
|
|
214
|
-
min-height:
|
|
228
|
+
min-height: var(--fl-toolbar-btn-min-height, 34px);
|
|
229
|
+
min-width: var(--fl-toolbar-btn-min-width, var(--fl-toolbar-btn-min-height, 34px));
|
|
215
230
|
|
|
216
231
|
&.fl-font-size-button {
|
|
217
232
|
font-size: 14px;
|
|
@@ -360,14 +375,23 @@ button {
|
|
|
360
375
|
}
|
|
361
376
|
}
|
|
362
377
|
|
|
378
|
+
.fl-bubble-menu {
|
|
379
|
+
.fl-font-size-editor {
|
|
380
|
+
min-width: 30px;
|
|
381
|
+
min-height: 30px;
|
|
382
|
+
padding-inline: 6px;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
363
386
|
.fl-font-size-editor {
|
|
364
387
|
display: flex;
|
|
365
388
|
align-items: center;
|
|
366
389
|
gap: 4px;
|
|
367
|
-
padding: 0 6px;
|
|
368
|
-
border-radius:
|
|
390
|
+
padding: var(--fl-toolbar-btn-padding, 0 6px);
|
|
391
|
+
border-radius: var(--fl-toolbar-btn-radius, 9px);
|
|
369
392
|
background: rgba(255, 255, 255, 0.1);
|
|
370
|
-
min-height:
|
|
393
|
+
min-height: var(--fl-toolbar-btn-min-height, 34px);
|
|
394
|
+
min-width: var(--fl-toolbar-btn-min-width, var(--fl-toolbar-btn-min-height, 34px));
|
|
371
395
|
|
|
372
396
|
& button {
|
|
373
397
|
border: none;
|
|
@@ -492,29 +516,59 @@ button {
|
|
|
492
516
|
|
|
493
517
|
/* Node limit styles */
|
|
494
518
|
.fl-node-limit-warning {
|
|
495
|
-
position:
|
|
496
|
-
bottom:
|
|
497
|
-
|
|
519
|
+
position: absolute;
|
|
520
|
+
bottom: 48px;
|
|
521
|
+
left: 50%;
|
|
522
|
+
transform: translateX(-50%);
|
|
498
523
|
background: #ff4444;
|
|
499
524
|
color: white;
|
|
500
|
-
padding: 12px
|
|
525
|
+
padding: 4px 12px;
|
|
501
526
|
border-radius: 8px;
|
|
502
527
|
font-size: 14px;
|
|
503
528
|
font-weight: 500;
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
529
|
+
animation: slideInTop 0.3s ease-out;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
@keyframes slideInTop {
|
|
533
|
+
from {
|
|
534
|
+
transform: translateX(-50%) translateY(15px);
|
|
535
|
+
opacity: 0;
|
|
536
|
+
}
|
|
537
|
+
to {
|
|
538
|
+
transform: translateX(-50%) translateY(0);
|
|
539
|
+
opacity: 1;
|
|
540
|
+
}
|
|
507
541
|
}
|
|
508
542
|
|
|
509
543
|
.fl-node-count-bar {
|
|
510
544
|
background: var(--fl-toolbar-bg, #242424);
|
|
511
545
|
border-top: 1px solid #333;
|
|
512
|
-
padding:
|
|
546
|
+
padding: 9px 12px;
|
|
513
547
|
display: flex;
|
|
514
548
|
align-items: center;
|
|
515
549
|
gap: 12px;
|
|
516
550
|
font-size: 12px;
|
|
517
551
|
color: var(--fl-toolbar-text-color, currentColor);
|
|
552
|
+
border-bottom-left-radius: inherit;
|
|
553
|
+
border-bottom-right-radius: inherit;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
.fl-character-count {
|
|
557
|
+
display: flex;
|
|
558
|
+
align-items: center;
|
|
559
|
+
gap: 8px;
|
|
560
|
+
|
|
561
|
+
svg {
|
|
562
|
+
color: var(--fl-editor-accent-color);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
&.fl-character-count--warning {
|
|
566
|
+
color: #ff5c33;
|
|
567
|
+
|
|
568
|
+
svg {
|
|
569
|
+
color: currentColor;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
518
572
|
}
|
|
519
573
|
|
|
520
574
|
.fl-node-count-text {
|
|
@@ -537,16 +591,6 @@ button {
|
|
|
537
591
|
border-radius: 2px;
|
|
538
592
|
}
|
|
539
593
|
|
|
540
|
-
@keyframes slideInRight {
|
|
541
|
-
from {
|
|
542
|
-
transform: translateX(100%);
|
|
543
|
-
opacity: 0;
|
|
544
|
-
}
|
|
545
|
-
to {
|
|
546
|
-
transform: translateX(0);
|
|
547
|
-
opacity: 1;
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
594
|
|
|
551
595
|
.media-grid-item-view-content > div {
|
|
552
596
|
display: flex;
|