@mythrantic/svelte-rich-text 1.2.0 → 1.2.2
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/dist/components/ValiantRichText/editor.css +71 -1
- package/dist/components/ValiantRichText/headless/editor.svelte +9 -8
- package/dist/components/ValiantRichText/themes/default-light.css +2 -2
- package/dist/components/ValiantRichText/themes/inherit.css +10 -64
- package/dist/components/ValiantRichText/themes/modern-light.css +2 -2
- package/dist/components/ValiantRichText/themes/professional-light.css +2 -2
- package/dist/components/ValiantRichText/types.d.ts +2 -3
- package/package.json +1 -1
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
--border-color: #e2e8f0;
|
|
23
23
|
--border-color-hover: #cbd5e1;
|
|
24
24
|
--code-bg: #f1f5f9;
|
|
25
|
-
--codeblock-bg: #
|
|
25
|
+
--codeblock-bg: #f8fafc;
|
|
26
26
|
--table-border: #e2e8f0;
|
|
27
27
|
--table-bg-selected: #f0f9ff;
|
|
28
28
|
--table-bg-hover: #f8fafc;
|
|
@@ -529,3 +529,73 @@ input[type='checkbox'] {
|
|
|
529
529
|
color: var(--color-destructive);
|
|
530
530
|
border: 1px solid darkred;
|
|
531
531
|
}
|
|
532
|
+
|
|
533
|
+
/* Code Block UI Controls */
|
|
534
|
+
.code-wrapper-select {
|
|
535
|
+
padding: 0.375rem 0.5rem;
|
|
536
|
+
border-radius: 0.375rem;
|
|
537
|
+
border: 1px solid rgba(0, 0, 0, 0.15);
|
|
538
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
539
|
+
color: inherit;
|
|
540
|
+
font-size: 0.875rem;
|
|
541
|
+
cursor: pointer;
|
|
542
|
+
transition:
|
|
543
|
+
background-color 0.2s ease,
|
|
544
|
+
border-color 0.2s ease;
|
|
545
|
+
font-family: inherit;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
.code-wrapper-select:hover {
|
|
549
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
550
|
+
border-color: rgba(0, 0, 0, 0.2);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
.code-wrapper-select:focus {
|
|
554
|
+
outline: none;
|
|
555
|
+
border-color: var(--color-primary);
|
|
556
|
+
box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.1);
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
/* Copy Button */
|
|
560
|
+
.code-wrapper-copy {
|
|
561
|
+
padding: 0.375rem 0.75rem;
|
|
562
|
+
border-radius: 0.375rem;
|
|
563
|
+
border: 1px solid rgba(0, 0, 0, 0.15);
|
|
564
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
565
|
+
color: inherit;
|
|
566
|
+
font-size: 0.875rem;
|
|
567
|
+
font-weight: 500;
|
|
568
|
+
cursor: pointer;
|
|
569
|
+
transition:
|
|
570
|
+
background-color 0.2s ease,
|
|
571
|
+
border-color 0.2s ease;
|
|
572
|
+
font-family: inherit;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
.code-wrapper-copy:hover {
|
|
576
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
577
|
+
border-color: rgba(0, 0, 0, 0.2);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
.code-wrapper-copy:active {
|
|
581
|
+
background-color: rgba(0, 0, 0, 0.15);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
.code-wrapper-copy-text {
|
|
585
|
+
white-space: nowrap;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
.code-wrapper-copy-text.copied {
|
|
589
|
+
color: var(--color-primary);
|
|
590
|
+
font-weight: 600;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/* Code block text - always dark for readability on light background */
|
|
594
|
+
.code-wrapper {
|
|
595
|
+
color: #1e1e1e;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
.code-wrapper code {
|
|
599
|
+
color: #1e1e1e;
|
|
600
|
+
background-color: transparent;
|
|
601
|
+
}
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
// Reactively update theme classes when theme or themeMode changes
|
|
99
99
|
$effect(() => {
|
|
100
100
|
if (element) {
|
|
101
|
-
// Remove all
|
|
101
|
+
// Remove all theme classes
|
|
102
102
|
element.classList.remove(
|
|
103
103
|
'theme-default-light',
|
|
104
104
|
'theme-default-dark',
|
|
@@ -109,12 +109,13 @@
|
|
|
109
109
|
'theme-inherit'
|
|
110
110
|
);
|
|
111
111
|
|
|
112
|
-
// Add
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
112
|
+
// Add appropriate theme class
|
|
113
|
+
// For specific themes, add the full theme class
|
|
114
|
+
// For inherit, add theme-inherit class which provides fallback values
|
|
115
|
+
// but parent's CSS variables will cascade through and override them
|
|
116
|
+
element.classList.add(`theme-${theme}${theme === 'inherit' ? '' : `-${themeMode}`}`);
|
|
117
|
+
element.setAttribute('data-theme', theme);
|
|
118
|
+
element.setAttribute('data-mode', themeMode);
|
|
118
119
|
}
|
|
119
120
|
});
|
|
120
121
|
|
|
@@ -160,5 +161,5 @@
|
|
|
160
161
|
focusEditor(editor, event);
|
|
161
162
|
}
|
|
162
163
|
}}
|
|
163
|
-
class={`edra-editor ${className}`}
|
|
164
|
+
class={`edra-editor valiant-editor ${className}`}
|
|
164
165
|
></div>
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
--border-color: #e2e8f0;
|
|
24
24
|
--border-color-hover: #cbd5e1;
|
|
25
25
|
--code-bg: #f1f5f9;
|
|
26
|
-
--codeblock-bg: #
|
|
26
|
+
--codeblock-bg: #f8fafc;
|
|
27
27
|
--table-border: #e2e8f0;
|
|
28
28
|
--table-bg-selected: #f0f9ff;
|
|
29
29
|
--table-bg-hover: #f8fafc;
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
--border-color: #e2e8f0;
|
|
57
57
|
--border-color-hover: #cbd5e1;
|
|
58
58
|
--code-bg: #f1f5f9;
|
|
59
|
-
--codeblock-bg: #
|
|
59
|
+
--codeblock-bg: #f8fafc;
|
|
60
60
|
--table-border: #e2e8f0;
|
|
61
61
|
--table-bg-selected: #f0f9ff;
|
|
62
62
|
--table-bg-hover: #f8fafc;
|
|
@@ -1,67 +1,13 @@
|
|
|
1
|
-
/* Inherit Theme - Inherits from
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
--color-primary-light: var(--host-primary-light, #60a5fa);
|
|
10
|
-
--color-primary-dark: var(--host-primary-dark, #1d4ed8);
|
|
11
|
-
--color-secondary: var(--host-secondary, #f5f5f5);
|
|
12
|
-
--color-secondary-foreground: var(--host-secondary-fg, #000000);
|
|
13
|
-
--color-accent: var(--host-accent, #3b82f6);
|
|
14
|
-
--color-accent-light: var(--host-accent-light, #60a5fa);
|
|
15
|
-
--color-accent-dark: var(--host-accent-dark, #1d4ed8);
|
|
16
|
-
--color-destructive: var(--host-destructive, #ef4444);
|
|
17
|
-
--color-input: var(--host-input, #f0f0f0);
|
|
18
|
-
--color-border: var(--host-border, #e0e0e0);
|
|
19
|
-
|
|
20
|
-
/* Semantic colors */
|
|
21
|
-
--blockquote-color: var(--host-blockquote, #666666);
|
|
22
|
-
--blockquote-border: var(--host-blockquote-border, #3b82f6);
|
|
23
|
-
--border-color: var(--host-border, #e0e0e0);
|
|
24
|
-
--border-color-hover: var(--host-border-hover, #ccc);
|
|
25
|
-
--code-bg: var(--host-code-bg, #f5f5f5);
|
|
26
|
-
--codeblock-bg: var(--host-codeblock-bg, #1e1e1e);
|
|
27
|
-
--table-border: var(--host-table-border, #e0e0e0);
|
|
28
|
-
--table-bg-selected: var(--host-table-selected, #e3f2fd);
|
|
29
|
-
--table-bg-hover: var(--host-table-hover, #f5f5f5);
|
|
30
|
-
--highlight-color: var(--host-highlight, #fffacd);
|
|
31
|
-
--highlight-border: var(--host-highlight-border, #ffd700);
|
|
32
|
-
--search-result-bg: var(--host-search-result, #ffeb3b);
|
|
33
|
-
--search-result-current-bg: var(--host-search-result-current, #ffd700);
|
|
34
|
-
--task-completed-color: var(--host-task-complete, #999999);
|
|
35
|
-
}
|
|
1
|
+
/* Inherit Theme - Inherits CSS variables from parent container */
|
|
2
|
+
/* This theme class provides NO hardcoded values, allowing parent CSS variables to cascade through */
|
|
3
|
+
/* Parent must define these CSS variables for proper styling:
|
|
4
|
+
- --color-background, --color-foreground
|
|
5
|
+
- --color-primary, --color-secondary
|
|
6
|
+
- --color-border, --codeblock-bg
|
|
7
|
+
- And other theme variables as needed
|
|
8
|
+
*/
|
|
36
9
|
|
|
37
10
|
.valiant-editor.theme-inherit {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
--color-muted: var(--host-muted, #f5f5f5);
|
|
41
|
-
--color-muted-foreground: var(--host-muted-fg, #666666);
|
|
42
|
-
--color-primary: var(--host-primary, #3b82f6);
|
|
43
|
-
--color-primary-light: var(--host-primary-light, #60a5fa);
|
|
44
|
-
--color-primary-dark: var(--host-primary-dark, #1d4ed8);
|
|
45
|
-
--color-secondary: var(--host-secondary, #f5f5f5);
|
|
46
|
-
--color-secondary-foreground: var(--host-secondary-fg, #000000);
|
|
47
|
-
--color-accent: var(--host-accent, #3b82f6);
|
|
48
|
-
--color-accent-light: var(--host-accent-light, #60a5fa);
|
|
49
|
-
--color-accent-dark: var(--host-accent-dark, #1d4ed8);
|
|
50
|
-
--color-destructive: var(--host-destructive, #ef4444);
|
|
51
|
-
--color-input: var(--host-input, #f0f0f0);
|
|
52
|
-
--color-border: var(--host-border, #e0e0e0);
|
|
53
|
-
--blockquote-color: var(--host-blockquote, #666666);
|
|
54
|
-
--blockquote-border: var(--host-blockquote-border, #3b82f6);
|
|
55
|
-
--border-color: var(--host-border, #e0e0e0);
|
|
56
|
-
--border-color-hover: var(--host-border-hover, #ccc);
|
|
57
|
-
--code-bg: var(--host-code-bg, #f5f5f5);
|
|
58
|
-
--codeblock-bg: var(--host-codeblock-bg, #1e1e1e);
|
|
59
|
-
--table-border: var(--host-table-border, #e0e0e0);
|
|
60
|
-
--table-bg-selected: var(--host-table-selected, #e3f2fd);
|
|
61
|
-
--table-bg-hover: var(--host-table-hover, #f5f5f5);
|
|
62
|
-
--highlight-color: var(--host-highlight, #fffacd);
|
|
63
|
-
--highlight-border: var(--host-highlight-border, #ffd700);
|
|
64
|
-
--search-result-bg: var(--host-search-result, #ffeb3b);
|
|
65
|
-
--search-result-current-bg: var(--host-search-result-current, #ffd700);
|
|
66
|
-
--task-completed-color: var(--host-task-complete, #999999);
|
|
11
|
+
/* Empty - relies entirely on parent CSS variables cascading down */
|
|
12
|
+
/* Fallback values are provided by :root variables in editor.css */
|
|
67
13
|
}
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
--border-color: #e5e5e5;
|
|
24
24
|
--border-color-hover: #d0d0d0;
|
|
25
25
|
--code-bg: #f5f5f5;
|
|
26
|
-
--codeblock-bg: #
|
|
26
|
+
--codeblock-bg: #f5f5f5;
|
|
27
27
|
--table-border: #e5e5e5;
|
|
28
28
|
--table-bg-selected: #fce7f3;
|
|
29
29
|
--table-bg-hover: #fef2f8;
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
--border-color: #e5e5e5;
|
|
56
56
|
--border-color-hover: #d0d0d0;
|
|
57
57
|
--code-bg: #f5f5f5;
|
|
58
|
-
--codeblock-bg: #
|
|
58
|
+
--codeblock-bg: #f5f5f5;
|
|
59
59
|
--table-border: #e5e5e5;
|
|
60
60
|
--table-bg-selected: #fce7f3;
|
|
61
61
|
--table-bg-hover: #fef2f8;
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
--border-color: #e5e7eb;
|
|
24
24
|
--border-color-hover: #d1d5db;
|
|
25
25
|
--code-bg: #f3f4f6;
|
|
26
|
-
--codeblock-bg: #
|
|
26
|
+
--codeblock-bg: #f3f4f6;
|
|
27
27
|
--table-border: #e5e7eb;
|
|
28
28
|
--table-bg-selected: #dbeafe;
|
|
29
29
|
--table-bg-hover: #f0f9ff;
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
--border-color: #e5e7eb;
|
|
56
56
|
--border-color-hover: #d1d5db;
|
|
57
57
|
--code-bg: #f3f4f6;
|
|
58
|
-
--codeblock-bg: #
|
|
58
|
+
--codeblock-bg: #f3f4f6;
|
|
59
59
|
--table-border: #e5e7eb;
|
|
60
60
|
--table-bg-selected: #dbeafe;
|
|
61
61
|
--table-bg-hover: #f0f9ff;
|
|
@@ -2,7 +2,6 @@ import type { Content, Editor } from '@tiptap/core';
|
|
|
2
2
|
import type { EditorState } from '@tiptap/pm/state';
|
|
3
3
|
import type { EditorView } from '@tiptap/pm/view';
|
|
4
4
|
import type { Snippet } from 'svelte';
|
|
5
|
-
import type { Theme, ThemeMode } from '../../stores/theme.js';
|
|
6
5
|
export interface EdraEditorProps {
|
|
7
6
|
content?: Content;
|
|
8
7
|
editable?: boolean;
|
|
@@ -10,8 +9,8 @@ export interface EdraEditorProps {
|
|
|
10
9
|
autofocus?: boolean;
|
|
11
10
|
onUpdate?: () => void;
|
|
12
11
|
class?: string;
|
|
13
|
-
theme?:
|
|
14
|
-
themeMode?:
|
|
12
|
+
theme?: 'default' | 'modern' | 'professional' | 'inherit';
|
|
13
|
+
themeMode?: 'light' | 'dark';
|
|
15
14
|
}
|
|
16
15
|
export interface EdraToolbarProps {
|
|
17
16
|
editor: Editor;
|