@flexiui/svelte-rich-text 0.0.14 → 0.0.16
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/RichText.svelte +868 -186
- package/dist/styles.css +15 -3
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +22 -5
- package/package.json +5 -2
package/dist/styles.css
CHANGED
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/* Heading styles */
|
|
22
|
-
h1,
|
|
22
|
+
/* h1,
|
|
23
23
|
h2,
|
|
24
24
|
h3,
|
|
25
25
|
h4,
|
|
26
26
|
h5,
|
|
27
27
|
h6 {
|
|
28
|
-
line-height: 1.
|
|
28
|
+
line-height: 1.3;
|
|
29
29
|
margin-top: 1.5rem;
|
|
30
30
|
text-wrap: pretty;
|
|
31
31
|
}
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
h5,
|
|
53
53
|
h6 {
|
|
54
54
|
font-size: 1rem;
|
|
55
|
-
}
|
|
55
|
+
} */
|
|
56
56
|
|
|
57
57
|
/* Code and preformatted text styles */
|
|
58
58
|
code {
|
|
@@ -195,3 +195,15 @@
|
|
|
195
195
|
min-width: 160px
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
|
+
|
|
199
|
+
.tiptap-mathematics-render {
|
|
200
|
+
padding: 2px 4px;
|
|
201
|
+
border-radius: 4px;
|
|
202
|
+
background-color: transparent;
|
|
203
|
+
transition: background-color 0.2s ease-in-out;
|
|
204
|
+
cursor: pointer;
|
|
205
|
+
|
|
206
|
+
&:hover {
|
|
207
|
+
background-color: #d4d6ff3c;
|
|
208
|
+
}
|
|
209
|
+
}
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -152,26 +152,43 @@ export const HEADINGS = [
|
|
|
152
152
|
{
|
|
153
153
|
level: 2,
|
|
154
154
|
ariaLabel: "H2",
|
|
155
|
-
icon: `<svg width="
|
|
155
|
+
icon: `<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path 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"></path></svg>`
|
|
156
156
|
},
|
|
157
157
|
{
|
|
158
158
|
level: 3,
|
|
159
159
|
ariaLabel: "H3",
|
|
160
|
-
icon: `<svg width="
|
|
160
|
+
icon: `<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path 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"></path></svg>`
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
163
|
level: 4,
|
|
164
164
|
ariaLabel: "H4",
|
|
165
|
-
icon: `<svg width="
|
|
165
|
+
icon: `<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM22 8V16H23.5V18H22V20H20V18H14.5V16.66L19.5 8H22ZM20 11.133L17.19 16H20V11.133Z"></path></svg>`
|
|
166
166
|
},
|
|
167
167
|
{
|
|
168
168
|
level: 5,
|
|
169
169
|
ariaLabel: "H5",
|
|
170
|
-
icon: `<svg width="
|
|
170
|
+
icon: `<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path 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"></path></svg>`
|
|
171
171
|
},
|
|
172
172
|
{
|
|
173
173
|
level: 6,
|
|
174
174
|
ariaLabel: "H6",
|
|
175
|
-
icon: `<svg width="
|
|
175
|
+
icon: `<svg width="16" height="16" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path 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"></path></svg>`
|
|
176
176
|
}
|
|
177
177
|
];
|
|
178
|
+
export function rgbToHex(str) {
|
|
179
|
+
if (isHex(str))
|
|
180
|
+
return str;
|
|
181
|
+
if (!str) {
|
|
182
|
+
return '#ffffff';
|
|
183
|
+
}
|
|
184
|
+
else if (/#[0-9a-f]{3,8}\b/i.test(str)) {
|
|
185
|
+
return str;
|
|
186
|
+
}
|
|
187
|
+
return str.replace(/rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)/gi, (match) => {
|
|
188
|
+
const [r, g, b] = match.match(/\d+/g).map(Number);
|
|
189
|
+
return '#' + [r, g, b].map((x) => x.toString(16).padStart(2, '0')).join('');
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function isHex(str) {
|
|
193
|
+
return /^#([0-9a-f]{3}){1,2}$/i.test(str);
|
|
194
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flexiui/svelte-rich-text",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "A lightweight and flexible rich text editor component for Svelte",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"svelte",
|
|
@@ -43,11 +43,14 @@
|
|
|
43
43
|
"@floating-ui/dom": "^1.7.4",
|
|
44
44
|
"@tiptap/core": "^3.0.9",
|
|
45
45
|
"@tiptap/extension-highlight": "^3.6.6",
|
|
46
|
+
"@tiptap/extension-mathematics": "^3.14.0",
|
|
46
47
|
"@tiptap/extension-text-align": "^3.6.6",
|
|
47
48
|
"@tiptap/extension-text-style": "^3.0.9",
|
|
49
|
+
"@tiptap/html": "^3.14.0",
|
|
48
50
|
"@tiptap/pm": "^3.0.9",
|
|
49
51
|
"@tiptap/starter-kit": "^3.0.9",
|
|
50
|
-
"@tiptap/static-renderer": "^3.0
|
|
52
|
+
"@tiptap/static-renderer": "^3.14.0",
|
|
53
|
+
"katex": "^0.16.27",
|
|
51
54
|
"svelte-tiptap": "^3.0.0"
|
|
52
55
|
}
|
|
53
56
|
}
|