@mzeahmed/rich-editor 0.0.0-stage → 0.1.0
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/CHANGELOG.md +65 -0
- package/LICENSE +21 -0
- package/README.md +301 -2
- package/dist/Editor.d.ts +273 -0
- package/dist/Editor.js +959 -0
- package/dist/EmojiPicker.d.ts +33 -0
- package/dist/EmojiPicker.js +268 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +5 -0
- package/dist/messages.d.ts +61 -0
- package/dist/messages.js +111 -0
- package/dist/security.d.ts +20 -0
- package/dist/security.js +124 -0
- package/dist/style.css +486 -0
- package/dist/styles.d.ts +22 -0
- package/dist/styles.js +515 -0
- package/dist/types.d.ts +28 -0
- package/dist/types.js +1 -0
- package/package.json +60 -4
package/dist/style.css
ADDED
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
/* @mzeahmed/rich-editor — stylesheet. Load it if you turn injection off: setEditorStyles({inject: false}). */
|
|
2
|
+
.mzre-editor-wrap {
|
|
3
|
+
border: 1px solid #d0cdc6;
|
|
4
|
+
border-radius: 10px;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
background: #fff;
|
|
7
|
+
font-family: sans-serif;
|
|
8
|
+
}
|
|
9
|
+
.mzre-toolbar {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-wrap: wrap;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: 2px;
|
|
14
|
+
padding: 8px 10px;
|
|
15
|
+
border-bottom: 1px solid #e8e5df;
|
|
16
|
+
background: #f7f7f5;
|
|
17
|
+
}
|
|
18
|
+
.mzre-toolbar button {
|
|
19
|
+
background: none;
|
|
20
|
+
border: none;
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
padding: 4px 7px;
|
|
23
|
+
border-radius: 6px;
|
|
24
|
+
font-size: 14px;
|
|
25
|
+
color: #333;
|
|
26
|
+
line-height: 1;
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
min-width: 28px;
|
|
31
|
+
height: 28px;
|
|
32
|
+
transition: background .12s;
|
|
33
|
+
}
|
|
34
|
+
.mzre-toolbar button:hover { background: #e8e5df; }
|
|
35
|
+
.mzre-toolbar button.mzre-active { background: #dbeafe; color: #1d4ed8; }
|
|
36
|
+
.mzre-sep { width: 1px; height: 20px; background: #d0cdc6; margin: 0 4px; flex-shrink: 0; }
|
|
37
|
+
.mzre-toolbar select {
|
|
38
|
+
border: 1px solid #d0cdc6;
|
|
39
|
+
border-radius: 6px;
|
|
40
|
+
padding: 3px 6px;
|
|
41
|
+
font-size: 13px;
|
|
42
|
+
background: #fff;
|
|
43
|
+
color: #333;
|
|
44
|
+
height: 28px;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
}
|
|
47
|
+
.mzre-link-bar {
|
|
48
|
+
display: none;
|
|
49
|
+
align-items: center;
|
|
50
|
+
gap: 6px;
|
|
51
|
+
padding: 6px 10px;
|
|
52
|
+
border-bottom: 1px solid #e8e5df;
|
|
53
|
+
background: #f7f7f5;
|
|
54
|
+
}
|
|
55
|
+
.mzre-link-bar input {
|
|
56
|
+
flex: 1;
|
|
57
|
+
border: 1px solid #d0cdc6;
|
|
58
|
+
border-radius: 6px;
|
|
59
|
+
padding: 4px 8px;
|
|
60
|
+
font-size: 13px;
|
|
61
|
+
background: #fff;
|
|
62
|
+
color: #333;
|
|
63
|
+
outline: none;
|
|
64
|
+
}
|
|
65
|
+
.mzre-link-bar .mzre-btn-insert {
|
|
66
|
+
background: #dbeafe; color: #1d4ed8;
|
|
67
|
+
border: none; border-radius: 6px;
|
|
68
|
+
padding: 4px 10px; font-size: 13px; cursor: pointer;
|
|
69
|
+
}
|
|
70
|
+
.mzre-link-bar .mzre-btn-remove {
|
|
71
|
+
background: none; border: 1px solid #d0cdc6; color: #555;
|
|
72
|
+
border-radius: 6px; padding: 4px 10px; font-size: 13px; cursor: pointer;
|
|
73
|
+
}
|
|
74
|
+
.mzre-link-bar .mzre-btn-close {
|
|
75
|
+
background: none; border: none; cursor: pointer;
|
|
76
|
+
font-size: 18px; line-height: 1; color: #999; padding: 0 4px;
|
|
77
|
+
}
|
|
78
|
+
.mzre-content {
|
|
79
|
+
min-height: 160px;
|
|
80
|
+
padding: 14px 16px;
|
|
81
|
+
outline: none;
|
|
82
|
+
font-size: 15px;
|
|
83
|
+
line-height: 1.75;
|
|
84
|
+
color: #1a1a1a;
|
|
85
|
+
box-sizing: border-box;
|
|
86
|
+
width: 100%;
|
|
87
|
+
}
|
|
88
|
+
.mzre-content:empty::before {
|
|
89
|
+
content: attr(data-placeholder);
|
|
90
|
+
color: #aaa;
|
|
91
|
+
pointer-events: none;
|
|
92
|
+
}
|
|
93
|
+
.mzre-content h2 { font-size: 1.25em; font-weight: 600; margin: .75em 0 .25em; }
|
|
94
|
+
.mzre-content h3 { font-size: 1.1em; font-weight: 600; margin: .6em 0 .2em; }
|
|
95
|
+
.mzre-content ul, .mzre-content ol { padding-left: 1.5em; margin: .3em 0; }
|
|
96
|
+
.mzre-content a { color: #1d4ed8; }
|
|
97
|
+
.mzre-content blockquote {
|
|
98
|
+
border-left: 3px solid #d0cdc6;
|
|
99
|
+
margin: .5em 0; padding: .2em .8em;
|
|
100
|
+
color: #666; font-style: italic;
|
|
101
|
+
}
|
|
102
|
+
.mzre-export-box {
|
|
103
|
+
display: none;
|
|
104
|
+
margin: 0 12px 8px;
|
|
105
|
+
border: 1px solid #e8e5df;
|
|
106
|
+
border-radius: 8px;
|
|
107
|
+
background: #f7f7f5;
|
|
108
|
+
padding: 10px 12px;
|
|
109
|
+
font-size: 12px;
|
|
110
|
+
font-family: monospace;
|
|
111
|
+
color: #555;
|
|
112
|
+
white-space: pre-wrap;
|
|
113
|
+
word-break: break-all;
|
|
114
|
+
max-height: 120px;
|
|
115
|
+
overflow: auto;
|
|
116
|
+
}
|
|
117
|
+
.mzre-footer {
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
justify-content: space-between;
|
|
121
|
+
padding: 6px 12px;
|
|
122
|
+
border-top: 1px solid #e8e5df;
|
|
123
|
+
background: #f7f7f5;
|
|
124
|
+
}
|
|
125
|
+
.mzre-charcount { font-size: 12px; color: #595959; }
|
|
126
|
+
.mzre-footer-actions { display: flex; gap: 6px; }
|
|
127
|
+
.mzre-btn-action {
|
|
128
|
+
border: 1px solid #d0cdc6; background: none;
|
|
129
|
+
border-radius: 6px; padding: 4px 10px;
|
|
130
|
+
font-size: 13px; cursor: pointer; color: #555;
|
|
131
|
+
transition: background .12s;
|
|
132
|
+
}
|
|
133
|
+
.mzre-btn-action:hover { background: #e8e5df; }
|
|
134
|
+
.mzre-btn-action.mzre-active { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
|
|
135
|
+
.mzre-btn-primary {
|
|
136
|
+
border: 1px solid #93c5fd; background: #dbeafe; color: #1d4ed8;
|
|
137
|
+
border-radius: 6px; padding: 4px 12px;
|
|
138
|
+
font-size: 13px; cursor: pointer; font-weight: 500;
|
|
139
|
+
transition: opacity .12s;
|
|
140
|
+
}
|
|
141
|
+
.mzre-btn-primary:hover { opacity: .8; }
|
|
142
|
+
|
|
143
|
+
/* ── Toolbar visibility modes ── */
|
|
144
|
+
.mzre-toolbar-toggle {
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
justify-content: flex-end;
|
|
148
|
+
padding: 4px 8px;
|
|
149
|
+
border-bottom: 1px solid #e8e5df;
|
|
150
|
+
background: #f7f7f5;
|
|
151
|
+
}
|
|
152
|
+
.mzre-toolbar-toggle button {
|
|
153
|
+
background: none;
|
|
154
|
+
border: 1px solid #d0cdc6;
|
|
155
|
+
border-radius: 6px;
|
|
156
|
+
padding: 3px 9px;
|
|
157
|
+
font-size: 12px;
|
|
158
|
+
color: #777;
|
|
159
|
+
cursor: pointer;
|
|
160
|
+
display: flex;
|
|
161
|
+
align-items: center;
|
|
162
|
+
gap: 5px;
|
|
163
|
+
transition: background .12s, color .12s;
|
|
164
|
+
line-height: 1;
|
|
165
|
+
height: 24px;
|
|
166
|
+
}
|
|
167
|
+
.mzre-toolbar-toggle button:hover { background: #e8e5df; color: #333; }
|
|
168
|
+
.mzre-toolbar-toggle button.mzre-active { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
|
|
169
|
+
|
|
170
|
+
/* toolbar hidden by default (on-focus or on-demand mode) */
|
|
171
|
+
.mzre-editor-wrap.mzre-toolbar-hidden .mzre-toolbar,
|
|
172
|
+
.mzre-editor-wrap.mzre-toolbar-hidden .mzre-link-bar {
|
|
173
|
+
display: none !important;
|
|
174
|
+
}
|
|
175
|
+
.mzre-editor-wrap.mzre-toolbar-visible .mzre-toolbar {
|
|
176
|
+
display: flex;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/* appearance animation */
|
|
180
|
+
.mzre-toolbar {
|
|
181
|
+
transition: max-height .18s ease, opacity .18s ease;
|
|
182
|
+
overflow: hidden;
|
|
183
|
+
}
|
|
184
|
+
.mzre-toolbar.mzre-toolbar-anim-hide {
|
|
185
|
+
max-height: 0;
|
|
186
|
+
opacity: 0;
|
|
187
|
+
padding-top: 0;
|
|
188
|
+
padding-bottom: 0;
|
|
189
|
+
border-bottom-width: 0;
|
|
190
|
+
}
|
|
191
|
+
.mzre-toolbar.mzre-toolbar-anim-show {
|
|
192
|
+
max-height: 120px;
|
|
193
|
+
opacity: 1;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* ── Emoji button positioned inside the writing area ── */
|
|
197
|
+
.mzre-content-wrap {
|
|
198
|
+
position: relative;
|
|
199
|
+
}
|
|
200
|
+
.mzre-content-wrap .mzre-emoji-button {
|
|
201
|
+
position: absolute;
|
|
202
|
+
bottom: 8px;
|
|
203
|
+
right: 10px;
|
|
204
|
+
background: none;
|
|
205
|
+
border: none;
|
|
206
|
+
cursor: pointer;
|
|
207
|
+
font-size: 18px;
|
|
208
|
+
color: #aaa;
|
|
209
|
+
padding: 3px 7px;
|
|
210
|
+
border-radius: 6px;
|
|
211
|
+
line-height: 1;
|
|
212
|
+
transition: background .12s, color .12s;
|
|
213
|
+
z-index: 1;
|
|
214
|
+
}
|
|
215
|
+
.mzre-content-wrap .mzre-emoji-button:hover { background: #e8e5df; color: #666; }
|
|
216
|
+
|
|
217
|
+
/* ── Mentions dropdown (positioned fixed via JS on document.body) ── */
|
|
218
|
+
@keyframes mzreMentionIn {
|
|
219
|
+
from { opacity: 0; transform: translateY(8px); }
|
|
220
|
+
to { opacity: 1; transform: translateY(0); }
|
|
221
|
+
}
|
|
222
|
+
.mzre-mentions-dropdown {
|
|
223
|
+
position: fixed;
|
|
224
|
+
background: #fff;
|
|
225
|
+
border-radius: 8px;
|
|
226
|
+
box-shadow: 0 8px 32px rgba(0, 0, 0, .14);
|
|
227
|
+
z-index: 9999;
|
|
228
|
+
overflow: hidden;
|
|
229
|
+
animation: mzreMentionIn .2s ease-out;
|
|
230
|
+
}
|
|
231
|
+
.mzre-mentions-dropdown .mzre-mentions-header {
|
|
232
|
+
display: flex;
|
|
233
|
+
justify-content: flex-end;
|
|
234
|
+
padding: 4px 4px 0;
|
|
235
|
+
}
|
|
236
|
+
.mzre-mentions-dropdown .mzre-mentions-close {
|
|
237
|
+
width: 28px;
|
|
238
|
+
height: 28px;
|
|
239
|
+
border: 0;
|
|
240
|
+
border-radius: 6px;
|
|
241
|
+
background: transparent;
|
|
242
|
+
color: #3b4c7a;
|
|
243
|
+
font: inherit;
|
|
244
|
+
font-size: 20px;
|
|
245
|
+
line-height: 1;
|
|
246
|
+
cursor: pointer;
|
|
247
|
+
}
|
|
248
|
+
.mzre-mentions-dropdown .mzre-mentions-close:hover { background: #f1f2f5; }
|
|
249
|
+
.mzre-mentions-dropdown .mzre-mentions-close:focus-visible {
|
|
250
|
+
outline: 2px solid rgba(59, 130, 246, .3);
|
|
251
|
+
outline-offset: 2px;
|
|
252
|
+
}
|
|
253
|
+
.mzre-mentions-dropdown .mzre-mentions-list {
|
|
254
|
+
max-height: 280px;
|
|
255
|
+
overflow-y: auto;
|
|
256
|
+
overflow-x: hidden;
|
|
257
|
+
padding: 4px;
|
|
258
|
+
}
|
|
259
|
+
.mzre-mentions-dropdown .mzre-mentions-list::-webkit-scrollbar { width: 6px; }
|
|
260
|
+
.mzre-mentions-dropdown .mzre-mentions-list::-webkit-scrollbar-track { background: transparent; }
|
|
261
|
+
.mzre-mentions-dropdown .mzre-mentions-list::-webkit-scrollbar-thumb {
|
|
262
|
+
background: rgba(0, 0, 0, .15);
|
|
263
|
+
border-radius: 3px;
|
|
264
|
+
}
|
|
265
|
+
.mzre-mentions-dropdown .mzre-mention-item {
|
|
266
|
+
display: flex;
|
|
267
|
+
align-items: center;
|
|
268
|
+
gap: 12px;
|
|
269
|
+
padding: 10px 12px;
|
|
270
|
+
border-radius: 6px;
|
|
271
|
+
cursor: pointer;
|
|
272
|
+
transition: background .15s, border-color .15s, transform .15s;
|
|
273
|
+
border: 1px solid transparent;
|
|
274
|
+
}
|
|
275
|
+
.mzre-mentions-dropdown .mzre-sr-only {
|
|
276
|
+
position: absolute;
|
|
277
|
+
width: 1px;
|
|
278
|
+
height: 1px;
|
|
279
|
+
margin: -1px;
|
|
280
|
+
padding: 0;
|
|
281
|
+
overflow: hidden;
|
|
282
|
+
clip: rect(0, 0, 0, 0);
|
|
283
|
+
white-space: nowrap;
|
|
284
|
+
border: 0;
|
|
285
|
+
}
|
|
286
|
+
.mzre-mentions-dropdown .mzre-mention-item[aria-selected="true"],
|
|
287
|
+
.mzre-mentions-dropdown .mzre-mention-item:hover {
|
|
288
|
+
background: rgba(59, 130, 246, .07);
|
|
289
|
+
border-color: rgba(59, 130, 246, .15);
|
|
290
|
+
transform: translateX(2px);
|
|
291
|
+
}
|
|
292
|
+
.mzre-mentions-dropdown .mzre-mention-item:active { transform: scale(.98); }
|
|
293
|
+
.mzre-mentions-dropdown .mzre-mention-item:focus {
|
|
294
|
+
outline: 2px solid rgba(59, 130, 246, .3);
|
|
295
|
+
outline-offset: 2px;
|
|
296
|
+
}
|
|
297
|
+
.mzre-mentions-dropdown .mzre-mention-avatar { position: relative; flex-shrink: 0; }
|
|
298
|
+
.mzre-mentions-dropdown .mzre-mention-avatar img {
|
|
299
|
+
width: 40px;
|
|
300
|
+
height: 40px;
|
|
301
|
+
border-radius: 50%;
|
|
302
|
+
object-fit: cover;
|
|
303
|
+
border: 2px solid rgba(59, 130, 246, .15);
|
|
304
|
+
transition: border-color .2s, transform .2s, box-shadow .2s;
|
|
305
|
+
}
|
|
306
|
+
.mzre-mentions-dropdown .mzre-mention-item:hover .mzre-mention-avatar img {
|
|
307
|
+
border-color: #3b82f6;
|
|
308
|
+
transform: scale(1.05);
|
|
309
|
+
box-shadow: 0 4px 12px rgba(59, 130, 246, .2);
|
|
310
|
+
}
|
|
311
|
+
.mzre-mentions-dropdown .mzre-mention-avatar-fallback {
|
|
312
|
+
display: flex;
|
|
313
|
+
align-items: center;
|
|
314
|
+
justify-content: center;
|
|
315
|
+
width: 40px;
|
|
316
|
+
height: 40px;
|
|
317
|
+
border-radius: 50%;
|
|
318
|
+
background: #e5e7eb;
|
|
319
|
+
color: #3b4c7a;
|
|
320
|
+
font-size: 14px;
|
|
321
|
+
font-weight: 600;
|
|
322
|
+
}
|
|
323
|
+
.mzre-mentions-dropdown .mzre-mention-info { flex: 1; min-width: 0; }
|
|
324
|
+
.mzre-mentions-dropdown .mzre-mention-name {
|
|
325
|
+
display: block;
|
|
326
|
+
font-size: 15px;
|
|
327
|
+
font-weight: 500;
|
|
328
|
+
color: #1a1a1a;
|
|
329
|
+
white-space: nowrap;
|
|
330
|
+
overflow: hidden;
|
|
331
|
+
text-overflow: ellipsis;
|
|
332
|
+
transition: color .15s;
|
|
333
|
+
}
|
|
334
|
+
.mzre-mentions-dropdown .mzre-mention-item[aria-selected="true"] .mzre-mention-name,
|
|
335
|
+
.mzre-mentions-dropdown .mzre-mention-item:hover .mzre-mention-name { color: #3b82f6; }
|
|
336
|
+
.mzre-mentions-dropdown .mzre-mention-item[aria-selected="true"] {
|
|
337
|
+
outline: 2px solid #3b82f6;
|
|
338
|
+
outline-offset: -2px;
|
|
339
|
+
}
|
|
340
|
+
.mzre-mentions-dropdown .mzre-mentions-empty {
|
|
341
|
+
display: flex;
|
|
342
|
+
flex-direction: column;
|
|
343
|
+
align-items: center;
|
|
344
|
+
justify-content: center;
|
|
345
|
+
padding: 28px 20px;
|
|
346
|
+
text-align: center;
|
|
347
|
+
color: #aaa;
|
|
348
|
+
}
|
|
349
|
+
.mzre-mentions-dropdown .mzre-mentions-empty-icon {
|
|
350
|
+
width: 44px;
|
|
351
|
+
height: 44px;
|
|
352
|
+
margin-bottom: 10px;
|
|
353
|
+
opacity: .4;
|
|
354
|
+
stroke-width: 1.5;
|
|
355
|
+
}
|
|
356
|
+
.mzre-mentions-dropdown .mzre-mentions-empty-text { font-size: 14px; }
|
|
357
|
+
|
|
358
|
+
/* ── Inline mention tag in the content ── */
|
|
359
|
+
.mzre-content a.mention {
|
|
360
|
+
display: inline-flex;
|
|
361
|
+
align-items: center;
|
|
362
|
+
padding: 2px 8px;
|
|
363
|
+
background: rgba(59, 130, 246, .1);
|
|
364
|
+
color: #2563eb;
|
|
365
|
+
border-radius: 4px;
|
|
366
|
+
font-weight: 500;
|
|
367
|
+
text-decoration: none;
|
|
368
|
+
border: 1px solid rgba(59, 130, 246, .2);
|
|
369
|
+
transition: background .15s, border-color .15s, transform .15s;
|
|
370
|
+
}
|
|
371
|
+
.mzre-content a.mention:hover {
|
|
372
|
+
background: rgba(59, 130, 246, .16);
|
|
373
|
+
border-color: rgba(59, 130, 246, .35);
|
|
374
|
+
transform: translateY(-1px);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
/* U and S buttons of the toolbar: styled through a class (an inline style attribute would be blocked by a strict CSP) */
|
|
378
|
+
.mzre-toolbar button.mzre-btn-underline { text-decoration: underline; }
|
|
379
|
+
.mzre-toolbar button.mzre-btn-strike { text-decoration: line-through; }
|
|
380
|
+
|
|
381
|
+
.mzre-emoji-picker[hidden] { display: none; }
|
|
382
|
+
.mzre-emoji-picker {
|
|
383
|
+
position: fixed;
|
|
384
|
+
inset: 0;
|
|
385
|
+
z-index: 10000;
|
|
386
|
+
display: grid;
|
|
387
|
+
place-items: center;
|
|
388
|
+
padding: 20px;
|
|
389
|
+
background: rgba(35, 45, 85, .42);
|
|
390
|
+
}
|
|
391
|
+
.mzre-emoji-picker__dialog {
|
|
392
|
+
width: min(620px, 100%);
|
|
393
|
+
max-height: min(680px, calc(100vh - 40px));
|
|
394
|
+
display: flex;
|
|
395
|
+
flex-direction: column;
|
|
396
|
+
overflow: hidden;
|
|
397
|
+
border: 1px solid #dedfe5;
|
|
398
|
+
border-radius: 14px;
|
|
399
|
+
background: #fff;
|
|
400
|
+
box-shadow: 0 18px 48px rgba(35, 45, 85, .2);
|
|
401
|
+
animation: mzreEmojiPickerIn .16s ease-out;
|
|
402
|
+
}
|
|
403
|
+
.mzre-emoji-picker__header {
|
|
404
|
+
display: flex;
|
|
405
|
+
align-items: center;
|
|
406
|
+
justify-content: space-between;
|
|
407
|
+
gap: 16px;
|
|
408
|
+
padding: 16px 18px;
|
|
409
|
+
border-bottom: 1px solid #e7e8ec;
|
|
410
|
+
flex-shrink: 0;
|
|
411
|
+
}
|
|
412
|
+
.mzre-emoji-picker__title { margin: 0; color: #232d55; font: 600 18px/1.3 sans-serif; }
|
|
413
|
+
.mzre-emoji-picker__close,
|
|
414
|
+
.mzre-emoji-picker__tab,
|
|
415
|
+
.mzre-emoji-picker__status {
|
|
416
|
+
grid-column: 1 / -1;
|
|
417
|
+
margin: 0;
|
|
418
|
+
padding: 48px 0;
|
|
419
|
+
color: #3b4c7a;
|
|
420
|
+
font: 14px/1.4 sans-serif;
|
|
421
|
+
text-align: center;
|
|
422
|
+
}
|
|
423
|
+
.mzre-emoji-picker__item { font: inherit; cursor: pointer; }
|
|
424
|
+
.mzre-emoji-picker__close {
|
|
425
|
+
width: 36px;
|
|
426
|
+
height: 36px;
|
|
427
|
+
border: 0;
|
|
428
|
+
border-radius: 8px;
|
|
429
|
+
background: transparent;
|
|
430
|
+
color: #3b4c7a;
|
|
431
|
+
font-size: 24px;
|
|
432
|
+
}
|
|
433
|
+
.mzre-emoji-picker__close:hover { background: #f1f2f5; }
|
|
434
|
+
.mzre-emoji-picker__tabs {
|
|
435
|
+
display: flex;
|
|
436
|
+
flex-shrink: 0;
|
|
437
|
+
gap: 4px;
|
|
438
|
+
overflow-x: auto;
|
|
439
|
+
padding: 10px 12px;
|
|
440
|
+
border-bottom: 1px solid #e7e8ec;
|
|
441
|
+
scrollbar-width: thin;
|
|
442
|
+
}
|
|
443
|
+
.mzre-emoji-picker__tab {
|
|
444
|
+
flex: 0 0 auto;
|
|
445
|
+
padding: 7px 10px;
|
|
446
|
+
border: 0;
|
|
447
|
+
border-radius: 8px;
|
|
448
|
+
background: transparent;
|
|
449
|
+
color: #59617a;
|
|
450
|
+
font: 500 13px/1.2 sans-serif;
|
|
451
|
+
white-space: nowrap;
|
|
452
|
+
}
|
|
453
|
+
.mzre-emoji-picker__tab:hover { background: #f1f7f5; color: #232d55; }
|
|
454
|
+
.mzre-emoji-picker__tab[aria-selected="true"] { background: #dff2ec; color: #232d55; }
|
|
455
|
+
.mzre-emoji-picker__panel {
|
|
456
|
+
display: grid;
|
|
457
|
+
grid-template-columns: repeat(10, minmax(36px, 1fr));
|
|
458
|
+
gap: 3px;
|
|
459
|
+
min-height: 280px;
|
|
460
|
+
overflow-y: auto;
|
|
461
|
+
padding: 12px;
|
|
462
|
+
}
|
|
463
|
+
.mzre-emoji-picker__item {
|
|
464
|
+
aspect-ratio: 1;
|
|
465
|
+
min-width: 36px;
|
|
466
|
+
border: 0;
|
|
467
|
+
border-radius: 8px;
|
|
468
|
+
background: transparent;
|
|
469
|
+
font-size: 24px;
|
|
470
|
+
line-height: 1;
|
|
471
|
+
}
|
|
472
|
+
.mzre-emoji-picker__item:hover { background: #edf8f5; transform: scale(1.08); }
|
|
473
|
+
.mzre-emoji-picker :focus-visible { outline: 3px solid #6fc4ad; outline-offset: 2px; }
|
|
474
|
+
@keyframes mzreEmojiPickerIn {
|
|
475
|
+
from { opacity: 0; transform: translateY(8px) scale(.99); }
|
|
476
|
+
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
477
|
+
}
|
|
478
|
+
@media (max-width: 640px) {
|
|
479
|
+
.mzre-emoji-picker { align-items: end; padding: 0; }
|
|
480
|
+
.mzre-emoji-picker__dialog { width: 100%; max-height: 78vh; border-radius: 16px 16px 0 0; }
|
|
481
|
+
.mzre-emoji-picker__panel { grid-template-columns: repeat(8, minmax(34px, 1fr)); }
|
|
482
|
+
}
|
|
483
|
+
@media (prefers-reduced-motion: reduce) {
|
|
484
|
+
.mzre-emoji-picker__dialog { animation: none; }
|
|
485
|
+
.mzre-emoji-picker__item:hover { transform: none; }
|
|
486
|
+
}
|
package/dist/styles.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stylesheets of the package. Single source: they are injected into the page at runtime
|
|
3
|
+
* (see `injectStyleSheet`) and written to `dist/style.css` at build time (`scripts/build-css.mjs`),
|
|
4
|
+
* for applications whose CSP forbids injected `<style>` tags.
|
|
5
|
+
*/
|
|
6
|
+
export declare const EDITOR_CSS = "\n.mzre-editor-wrap {\n border: 1px solid #d0cdc6;\n border-radius: 10px;\n overflow: hidden;\n background: #fff;\n font-family: sans-serif;\n}\n.mzre-toolbar {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 2px;\n padding: 8px 10px;\n border-bottom: 1px solid #e8e5df;\n background: #f7f7f5;\n}\n.mzre-toolbar button {\n background: none;\n border: none;\n cursor: pointer;\n padding: 4px 7px;\n border-radius: 6px;\n font-size: 14px;\n color: #333;\n line-height: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n min-width: 28px;\n height: 28px;\n transition: background .12s;\n}\n.mzre-toolbar button:hover { background: #e8e5df; }\n.mzre-toolbar button.mzre-active { background: #dbeafe; color: #1d4ed8; }\n.mzre-sep { width: 1px; height: 20px; background: #d0cdc6; margin: 0 4px; flex-shrink: 0; }\n.mzre-toolbar select {\n border: 1px solid #d0cdc6;\n border-radius: 6px;\n padding: 3px 6px;\n font-size: 13px;\n background: #fff;\n color: #333;\n height: 28px;\n cursor: pointer;\n}\n.mzre-link-bar {\n display: none;\n align-items: center;\n gap: 6px;\n padding: 6px 10px;\n border-bottom: 1px solid #e8e5df;\n background: #f7f7f5;\n}\n.mzre-link-bar input {\n flex: 1;\n border: 1px solid #d0cdc6;\n border-radius: 6px;\n padding: 4px 8px;\n font-size: 13px;\n background: #fff;\n color: #333;\n outline: none;\n}\n.mzre-link-bar .mzre-btn-insert {\n background: #dbeafe; color: #1d4ed8;\n border: none; border-radius: 6px;\n padding: 4px 10px; font-size: 13px; cursor: pointer;\n}\n.mzre-link-bar .mzre-btn-remove {\n background: none; border: 1px solid #d0cdc6; color: #555;\n border-radius: 6px; padding: 4px 10px; font-size: 13px; cursor: pointer;\n}\n.mzre-link-bar .mzre-btn-close {\n background: none; border: none; cursor: pointer;\n font-size: 18px; line-height: 1; color: #999; padding: 0 4px;\n}\n.mzre-content {\n min-height: 160px;\n padding: 14px 16px;\n outline: none;\n font-size: 15px;\n line-height: 1.75;\n color: #1a1a1a;\n box-sizing: border-box;\n width: 100%;\n}\n.mzre-content:empty::before {\n content: attr(data-placeholder);\n color: #aaa;\n pointer-events: none;\n}\n.mzre-content h2 { font-size: 1.25em; font-weight: 600; margin: .75em 0 .25em; }\n.mzre-content h3 { font-size: 1.1em; font-weight: 600; margin: .6em 0 .2em; }\n.mzre-content ul, .mzre-content ol { padding-left: 1.5em; margin: .3em 0; }\n.mzre-content a { color: #1d4ed8; }\n.mzre-content blockquote {\n border-left: 3px solid #d0cdc6;\n margin: .5em 0; padding: .2em .8em;\n color: #666; font-style: italic;\n}\n.mzre-export-box {\n display: none;\n margin: 0 12px 8px;\n border: 1px solid #e8e5df;\n border-radius: 8px;\n background: #f7f7f5;\n padding: 10px 12px;\n font-size: 12px;\n font-family: monospace;\n color: #555;\n white-space: pre-wrap;\n word-break: break-all;\n max-height: 120px;\n overflow: auto;\n}\n.mzre-footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 6px 12px;\n border-top: 1px solid #e8e5df;\n background: #f7f7f5;\n}\n.mzre-charcount { font-size: 12px; color: #595959; }\n.mzre-footer-actions { display: flex; gap: 6px; }\n.mzre-btn-action {\n border: 1px solid #d0cdc6; background: none;\n border-radius: 6px; padding: 4px 10px;\n font-size: 13px; cursor: pointer; color: #555;\n transition: background .12s;\n}\n.mzre-btn-action:hover { background: #e8e5df; }\n.mzre-btn-action.mzre-active { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }\n.mzre-btn-primary {\n border: 1px solid #93c5fd; background: #dbeafe; color: #1d4ed8;\n border-radius: 6px; padding: 4px 12px;\n font-size: 13px; cursor: pointer; font-weight: 500;\n transition: opacity .12s;\n}\n.mzre-btn-primary:hover { opacity: .8; }\n\n/* \u2500\u2500 Toolbar visibility modes \u2500\u2500 */\n.mzre-toolbar-toggle {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n padding: 4px 8px;\n border-bottom: 1px solid #e8e5df;\n background: #f7f7f5;\n}\n.mzre-toolbar-toggle button {\n background: none;\n border: 1px solid #d0cdc6;\n border-radius: 6px;\n padding: 3px 9px;\n font-size: 12px;\n color: #777;\n cursor: pointer;\n display: flex;\n align-items: center;\n gap: 5px;\n transition: background .12s, color .12s;\n line-height: 1;\n height: 24px;\n}\n.mzre-toolbar-toggle button:hover { background: #e8e5df; color: #333; }\n.mzre-toolbar-toggle button.mzre-active { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }\n\n/* toolbar hidden by default (on-focus or on-demand mode) */\n.mzre-editor-wrap.mzre-toolbar-hidden .mzre-toolbar,\n.mzre-editor-wrap.mzre-toolbar-hidden .mzre-link-bar {\n display: none !important;\n}\n.mzre-editor-wrap.mzre-toolbar-visible .mzre-toolbar {\n display: flex;\n}\n\n/* appearance animation */\n.mzre-toolbar {\n transition: max-height .18s ease, opacity .18s ease;\n overflow: hidden;\n}\n.mzre-toolbar.mzre-toolbar-anim-hide {\n max-height: 0;\n opacity: 0;\n padding-top: 0;\n padding-bottom: 0;\n border-bottom-width: 0;\n}\n.mzre-toolbar.mzre-toolbar-anim-show {\n max-height: 120px;\n opacity: 1;\n}\n\n/* \u2500\u2500 Emoji button positioned inside the writing area \u2500\u2500 */\n.mzre-content-wrap {\n position: relative;\n}\n.mzre-content-wrap .mzre-emoji-button {\n position: absolute;\n bottom: 8px;\n right: 10px;\n background: none;\n border: none;\n cursor: pointer;\n font-size: 18px;\n color: #aaa;\n padding: 3px 7px;\n border-radius: 6px;\n line-height: 1;\n transition: background .12s, color .12s;\n z-index: 1;\n}\n.mzre-content-wrap .mzre-emoji-button:hover { background: #e8e5df; color: #666; }\n\n/* \u2500\u2500 Mentions dropdown (positioned fixed via JS on document.body) \u2500\u2500 */\n@keyframes mzreMentionIn {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n}\n.mzre-mentions-dropdown {\n position: fixed;\n background: #fff;\n border-radius: 8px;\n box-shadow: 0 8px 32px rgba(0, 0, 0, .14);\n z-index: 9999;\n overflow: hidden;\n animation: mzreMentionIn .2s ease-out;\n}\n.mzre-mentions-dropdown .mzre-mentions-header {\n display: flex;\n justify-content: flex-end;\n padding: 4px 4px 0;\n}\n.mzre-mentions-dropdown .mzre-mentions-close {\n width: 28px;\n height: 28px;\n border: 0;\n border-radius: 6px;\n background: transparent;\n color: #3b4c7a;\n font: inherit;\n font-size: 20px;\n line-height: 1;\n cursor: pointer;\n}\n.mzre-mentions-dropdown .mzre-mentions-close:hover { background: #f1f2f5; }\n.mzre-mentions-dropdown .mzre-mentions-close:focus-visible {\n outline: 2px solid rgba(59, 130, 246, .3);\n outline-offset: 2px;\n}\n.mzre-mentions-dropdown .mzre-mentions-list {\n max-height: 280px;\n overflow-y: auto;\n overflow-x: hidden;\n padding: 4px;\n}\n.mzre-mentions-dropdown .mzre-mentions-list::-webkit-scrollbar { width: 6px; }\n.mzre-mentions-dropdown .mzre-mentions-list::-webkit-scrollbar-track { background: transparent; }\n.mzre-mentions-dropdown .mzre-mentions-list::-webkit-scrollbar-thumb {\n background: rgba(0, 0, 0, .15);\n border-radius: 3px;\n}\n.mzre-mentions-dropdown .mzre-mention-item {\n display: flex;\n align-items: center;\n gap: 12px;\n padding: 10px 12px;\n border-radius: 6px;\n cursor: pointer;\n transition: background .15s, border-color .15s, transform .15s;\n border: 1px solid transparent;\n}\n.mzre-mentions-dropdown .mzre-sr-only {\n position: absolute;\n width: 1px;\n height: 1px;\n margin: -1px;\n padding: 0;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n}\n.mzre-mentions-dropdown .mzre-mention-item[aria-selected=\"true\"],\n.mzre-mentions-dropdown .mzre-mention-item:hover {\n background: rgba(59, 130, 246, .07);\n border-color: rgba(59, 130, 246, .15);\n transform: translateX(2px);\n}\n.mzre-mentions-dropdown .mzre-mention-item:active { transform: scale(.98); }\n.mzre-mentions-dropdown .mzre-mention-item:focus {\n outline: 2px solid rgba(59, 130, 246, .3);\n outline-offset: 2px;\n}\n.mzre-mentions-dropdown .mzre-mention-avatar { position: relative; flex-shrink: 0; }\n.mzre-mentions-dropdown .mzre-mention-avatar img {\n width: 40px;\n height: 40px;\n border-radius: 50%;\n object-fit: cover;\n border: 2px solid rgba(59, 130, 246, .15);\n transition: border-color .2s, transform .2s, box-shadow .2s;\n}\n.mzre-mentions-dropdown .mzre-mention-item:hover .mzre-mention-avatar img {\n border-color: #3b82f6;\n transform: scale(1.05);\n box-shadow: 0 4px 12px rgba(59, 130, 246, .2);\n}\n.mzre-mentions-dropdown .mzre-mention-avatar-fallback {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 40px;\n height: 40px;\n border-radius: 50%;\n background: #e5e7eb;\n color: #3b4c7a;\n font-size: 14px;\n font-weight: 600;\n}\n.mzre-mentions-dropdown .mzre-mention-info { flex: 1; min-width: 0; }\n.mzre-mentions-dropdown .mzre-mention-name {\n display: block;\n font-size: 15px;\n font-weight: 500;\n color: #1a1a1a;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n transition: color .15s;\n}\n.mzre-mentions-dropdown .mzre-mention-item[aria-selected=\"true\"] .mzre-mention-name,\n.mzre-mentions-dropdown .mzre-mention-item:hover .mzre-mention-name { color: #3b82f6; }\n.mzre-mentions-dropdown .mzre-mention-item[aria-selected=\"true\"] {\n outline: 2px solid #3b82f6;\n outline-offset: -2px;\n}\n.mzre-mentions-dropdown .mzre-mentions-empty {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n padding: 28px 20px;\n text-align: center;\n color: #aaa;\n}\n.mzre-mentions-dropdown .mzre-mentions-empty-icon {\n width: 44px;\n height: 44px;\n margin-bottom: 10px;\n opacity: .4;\n stroke-width: 1.5;\n}\n.mzre-mentions-dropdown .mzre-mentions-empty-text { font-size: 14px; }\n\n/* \u2500\u2500 Inline mention tag in the content \u2500\u2500 */\n.mzre-content a.mention {\n display: inline-flex;\n align-items: center;\n padding: 2px 8px;\n background: rgba(59, 130, 246, .1);\n color: #2563eb;\n border-radius: 4px;\n font-weight: 500;\n text-decoration: none;\n border: 1px solid rgba(59, 130, 246, .2);\n transition: background .15s, border-color .15s, transform .15s;\n}\n.mzre-content a.mention:hover {\n background: rgba(59, 130, 246, .16);\n border-color: rgba(59, 130, 246, .35);\n transform: translateY(-1px);\n}\n\n/* U and S buttons of the toolbar: styled through a class (an inline style attribute would be blocked by a strict CSP) */\n.mzre-toolbar button.mzre-btn-underline { text-decoration: underline; }\n.mzre-toolbar button.mzre-btn-strike { text-decoration: line-through; }\n";
|
|
7
|
+
export declare const EMOJI_PICKER_CSS = "\n.mzre-emoji-picker[hidden] { display: none; }\n.mzre-emoji-picker {\n position: fixed;\n inset: 0;\n z-index: 10000;\n display: grid;\n place-items: center;\n padding: 20px;\n background: rgba(35, 45, 85, .42);\n}\n.mzre-emoji-picker__dialog {\n width: min(620px, 100%);\n max-height: min(680px, calc(100vh - 40px));\n display: flex;\n flex-direction: column;\n overflow: hidden;\n border: 1px solid #dedfe5;\n border-radius: 14px;\n background: #fff;\n box-shadow: 0 18px 48px rgba(35, 45, 85, .2);\n animation: mzreEmojiPickerIn .16s ease-out;\n}\n.mzre-emoji-picker__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 16px;\n padding: 16px 18px;\n border-bottom: 1px solid #e7e8ec;\n flex-shrink: 0;\n}\n.mzre-emoji-picker__title { margin: 0; color: #232d55; font: 600 18px/1.3 sans-serif; }\n.mzre-emoji-picker__close,\n.mzre-emoji-picker__tab,\n.mzre-emoji-picker__status {\n grid-column: 1 / -1;\n margin: 0;\n padding: 48px 0;\n color: #3b4c7a;\n font: 14px/1.4 sans-serif;\n text-align: center;\n}\n.mzre-emoji-picker__item { font: inherit; cursor: pointer; }\n.mzre-emoji-picker__close {\n width: 36px;\n height: 36px;\n border: 0;\n border-radius: 8px;\n background: transparent;\n color: #3b4c7a;\n font-size: 24px;\n}\n.mzre-emoji-picker__close:hover { background: #f1f2f5; }\n.mzre-emoji-picker__tabs {\n display: flex;\n flex-shrink: 0;\n gap: 4px;\n overflow-x: auto;\n padding: 10px 12px;\n border-bottom: 1px solid #e7e8ec;\n scrollbar-width: thin;\n}\n.mzre-emoji-picker__tab {\n flex: 0 0 auto;\n padding: 7px 10px;\n border: 0;\n border-radius: 8px;\n background: transparent;\n color: #59617a;\n font: 500 13px/1.2 sans-serif;\n white-space: nowrap;\n}\n.mzre-emoji-picker__tab:hover { background: #f1f7f5; color: #232d55; }\n.mzre-emoji-picker__tab[aria-selected=\"true\"] { background: #dff2ec; color: #232d55; }\n.mzre-emoji-picker__panel {\n display: grid;\n grid-template-columns: repeat(10, minmax(36px, 1fr));\n gap: 3px;\n min-height: 280px;\n overflow-y: auto;\n padding: 12px;\n}\n.mzre-emoji-picker__item {\n aspect-ratio: 1;\n min-width: 36px;\n border: 0;\n border-radius: 8px;\n background: transparent;\n font-size: 24px;\n line-height: 1;\n}\n.mzre-emoji-picker__item:hover { background: #edf8f5; transform: scale(1.08); }\n.mzre-emoji-picker :focus-visible { outline: 3px solid #6fc4ad; outline-offset: 2px; }\n@keyframes mzreEmojiPickerIn {\n from { opacity: 0; transform: translateY(8px) scale(.99); }\n to { opacity: 1; transform: translateY(0) scale(1); }\n}\n@media (max-width: 640px) {\n .mzre-emoji-picker { align-items: end; padding: 0; }\n .mzre-emoji-picker__dialog { width: 100%; max-height: 78vh; border-radius: 16px 16px 0 0; }\n .mzre-emoji-picker__panel { grid-template-columns: repeat(8, minmax(34px, 1fr)); }\n}\n@media (prefers-reduced-motion: reduce) {\n .mzre-emoji-picker__dialog { animation: none; }\n .mzre-emoji-picker__item:hover { transform: none; }\n}\n";
|
|
8
|
+
/**
|
|
9
|
+
* Style injection setting, global to the page (like the language).
|
|
10
|
+
*
|
|
11
|
+
* - `inject: false`: the package adds no `<style>` tag; then load
|
|
12
|
+
* `@mzeahmed/rich-editor/style.css` yourself (required under a CSP without `'unsafe-inline'`).
|
|
13
|
+
* - `nonce`: your CSP nonce, set on the injected `<style>` tags (`style-src 'nonce-…'`).
|
|
14
|
+
*/
|
|
15
|
+
export interface StyleOptions {
|
|
16
|
+
inject?: boolean;
|
|
17
|
+
nonce?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function setEditorStyles(options: StyleOptions): void;
|
|
20
|
+
/** Adds the `css` stylesheet to `<head>` under the id `id` (only once), unless injection is off. */
|
|
21
|
+
export declare function injectStyleSheet(id: string, css: string): void;
|
|
22
|
+
export declare function removeStyleSheet(id: string): void;
|