@flexiui/svelte-rich-text 0.0.32 → 0.0.33

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.
@@ -50,6 +50,21 @@
50
50
  onSelectionUpdate?: (params: any) => void;
51
51
  onPaste?: (params: any) => void;
52
52
  };
53
+ config?: {
54
+ editorBgColor?: string;
55
+ editorRadius?: string;
56
+ toolbarStickyPosition?: number;
57
+ toolbarZIndex?: number;
58
+ toolbarBgColor?: string;
59
+ toolbarPadding?: string;
60
+ toolbarGap?: string;
61
+ docMaxWidth?: string;
62
+ docPadding?: string;
63
+ docBg?: string;
64
+ docMarginInline?: string;
65
+ docMarginBlock?: string;
66
+ docRadius?: string;
67
+ }
53
68
  }
54
69
 
55
70
  let {
@@ -72,9 +87,30 @@
72
87
  onSelectionUpdate: () => {},
73
88
  onPaste: () => {},
74
89
  },
90
+ config,
75
91
  }: Props = $props();
76
92
 
77
93
  let editor = $state() as Readable<Editor>;
94
+ const defaultEditorConfig = {
95
+ editorBgColor: 'transparent',
96
+ editorRadius: '12px',
97
+ toolbarStickyPosition: 0,
98
+ toolbarBgColor: '#242424',
99
+ toolbarZIndex: 10,
100
+ toolbarPadding: '8px',
101
+ toolbarGap: '5px',
102
+ docMaxWidth: '1024px',
103
+ docPadding: '2rem',
104
+ docBg: 'transparent',
105
+ docMarginInline: 'auto',
106
+ docMarginBlock: '2rem',
107
+ docRadius: '0',
108
+ };
109
+
110
+ let editorConfig = $state({
111
+ ...defaultEditorConfig,
112
+ ...(config ?? {})
113
+ });
78
114
 
79
115
  const extensions = [
80
116
  // Color.configure({ types: [TextStyle.name, ListItem.name] }),
@@ -540,7 +576,24 @@
540
576
  }
541
577
  </script>
542
578
 
543
- <div class="fl-rich-text {className}" class:editable>
579
+ <div
580
+ class="fl-rich-text {className}" class:editable
581
+ style="
582
+ --fl-editor-radius: {editorConfig.editorRadius};
583
+ --fl-editor-bg: {editorConfig.editorBgColor};
584
+ --fl-toolbar-sticky-position: {editorConfig.toolbarStickyPosition}px;
585
+ --fl-toolbar-z-index: {editorConfig.toolbarZIndex};
586
+ --fl-toolbar-padding: {editorConfig.toolbarPadding};
587
+ --fl-toolbar-gap: {editorConfig.toolbarGap};
588
+ --fl-toolbar-bg: {editorConfig.toolbarBgColor};
589
+ --fl-doc-max-width: {editorConfig.docMaxWidth};
590
+ --fl-doc-padding: {editorConfig.docPadding};
591
+ --fl-doc-bg: {editorConfig.docBg};
592
+ --fl-doc-margin-inline: {editorConfig.docMarginInline};
593
+ --fl-doc-margin-block: {editorConfig.docMarginBlock};
594
+ --fl-doc-radius: {editorConfig.docRadius};
595
+ "
596
+ >
544
597
 
545
598
  {#if editor}
546
599
  <header class="fl-rich-text-toolbar">
package/dist/styles.css CHANGED
@@ -6,9 +6,21 @@
6
6
  --gray-1: #f0f0f0;
7
7
  --gray-2: #e0e0e0;
8
8
  --gray-3: #c0c0c0;
9
- --toolbar-gap: 5px;
10
- --toolbar-padding: 6px;
9
+
11
10
  --fl-editor-radius: 12px;
11
+ --fl-editor-bg: #242424;
12
+ --fl-toolbar-sticky-position: 0;
13
+ --fl-toolbar-z-index: 10;
14
+ --fl-toolbar-padding: 6px;
15
+ --fl-toolbar-gap: 5px;
16
+ --fl-toolbar-bg: #242424;
17
+
18
+ --fl-doc-max-width: 1024px;
19
+ --fl-doc-padding: 2rem;
20
+ --fl-doc-bg: transparent;
21
+ --fl-doc-margin-inline: auto;
22
+ --fl-doc-margin-block: 2rem;
23
+ --fl-doc-radius: 0;
12
24
  }
13
25
 
14
26
  /* Basic editor styles */
@@ -252,9 +264,14 @@
252
264
  flex-direction: column;
253
265
  text-align: left;
254
266
  min-height: 56px;
255
- padding: 2rem;
256
- background: #242424;
257
- border-radius: 0 0 var(--fl-editor-radius) var(--fl-editor-radius);
267
+ border-radius: var(--fl-doc-radius, 12px);
268
+ box-sizing: border-box;
269
+ max-width: var(--fl-doc-max-width, 1024px);
270
+ padding: var(--fl-doc-padding, 2rem);
271
+ background: var(--fl-doc-bg, transparent);
272
+ margin-inline: var(--fl-doc-margin-inline, auto);
273
+ margin-block: var(--fl-doc-margin-block, 2rem);
274
+
258
275
  }
259
276
 
260
277
  .fl-toolbar-dropdown-panel {
@@ -265,7 +282,7 @@
265
282
  backdrop-filter: blur(42px);
266
283
  border-radius: 14px;
267
284
  min-width: auto;
268
- z-index: 10;
285
+ z-index: 1000;
269
286
  box-sizing: border-box;
270
287
 
271
288
  &.fl-toolbar-dropdown-panel--table {
@@ -296,7 +313,7 @@
296
313
  width: 100%;
297
314
  height: 100%;
298
315
  min-height: 56px;
299
- background-color: var(--fl-bg-color, #242424);
316
+ background-color: var(--fl-editor-bg, #242424);
300
317
  color: var(--text-color);
301
318
  box-sizing: border-box;
302
319
  border-radius: var(--fl-editor-radius);
@@ -307,10 +324,10 @@
307
324
  flex-wrap: nowrap;
308
325
  overflow: auto;
309
326
  align-items: center;
310
- gap: var(--toolbar-gap);
311
- padding: var(--toolbar-padding);
327
+ gap: var(--fl-toolbar-gap);
328
+ padding: var(--fl-toolbar-padding);
312
329
  position: sticky;
313
- top: var(--sticky-position, 0);
330
+ top: var(--fl-toolbar-sticky-position, 0);
314
331
  z-index: var(--fl-toolbar-z-index, 10);
315
332
  background: var(--fl-toolbar-bg, #242424);
316
333
  border-radius: var(--fl-editor-radius);
@@ -319,7 +336,7 @@
319
336
  .fl-rich-text-toolbar-group {
320
337
  display: flex;
321
338
  flex-wrap: nowrap;
322
- gap: var(--toolbar-gap);
339
+ gap: var(--fl-toolbar-gap);
323
340
 
324
341
  button {
325
342
  padding: 8px 8px;
@@ -374,7 +391,7 @@
374
391
  font-weight: 500;
375
392
  border: none;
376
393
  padding: 0px;
377
- font-size: 12px;
394
+ font-size: 11px;
378
395
  border-radius: 3px;
379
396
  outline: 1px dashed #818181;
380
397
  scale: 1.1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flexiui/svelte-rich-text",
3
- "version": "0.0.32",
3
+ "version": "0.0.33",
4
4
  "description": "A lightweight and flexible rich text editor component for Svelte",
5
5
  "keywords": [
6
6
  "svelte",