@mzeahmed/rich-editor 0.1.2 → 0.2.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 +14 -0
- package/README.md +83 -0
- package/dist/Editor.d.ts +6 -1
- package/dist/Editor.js +33 -2
- package/dist/index.d.ts +1 -1
- package/dist/style.css +14 -14
- package/dist/styles.d.ts +1 -1
- package/dist/styles.js +14 -14
- package/dist/types.d.ts +23 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,20 @@ Before a release, the pending entries below `[Unreleased]` are moved under a hea
|
|
|
11
11
|
|
|
12
12
|
## [Unreleased]
|
|
13
13
|
|
|
14
|
+
## [0.2.0] - 2026-11-20
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- The colors of the mention bubble and of the mention link are customizable, per editor, with the new
|
|
19
|
+
`mentionColors` option (`active`, `activeBackground`, `activeBorder` for the hovered or chosen user;
|
|
20
|
+
`link`, `linkBackground`, `linkBorder`, `linkHoverBackground`, `linkHoverBorder` for the link in the
|
|
21
|
+
editor) and the exported `MentionColors` type. The values are applied through the CSSOM, so they work
|
|
22
|
+
under a strict CSP.
|
|
23
|
+
- The same colors are CSS custom properties (`--mzre-mention-active-color`, `--mzre-mention-active-bg`,
|
|
24
|
+
`--mzre-mention-active-border`, `--mzre-mention-color`, `--mzre-mention-bg`, `--mzre-mention-border`,
|
|
25
|
+
`--mzre-mention-hover-bg`, `--mzre-mention-hover-border`) to style every editor of a page from your
|
|
26
|
+
stylesheet. The defaults are the previous blue, so nothing changes unless you set them.
|
|
27
|
+
|
|
14
28
|
## [0.1.2] - 2026-11-20
|
|
15
29
|
|
|
16
30
|
### Fixed
|
package/README.md
CHANGED
|
@@ -62,6 +62,7 @@ Passed as the second argument of `Editor.mount()` / `Editor.init()`.
|
|
|
62
62
|
| `emoji` | `boolean` | `false` | Adds an inline emoji button that opens the built-in picker. |
|
|
63
63
|
| `mention` | `boolean` | `false` | Enables `@mentions`. Requires `integrations.mentions`. |
|
|
64
64
|
| `locale` | `'en' \| 'fr'` | `'en'` | Language of the interface and of the emojis. Page-wide setting. |
|
|
65
|
+
| `mentionColors` | `MentionColors` | – | Colors of the mention bubble and of the mention link, for this editor. See [Mention colors](#mention-colors). |
|
|
65
66
|
| `styles` | `{inject?: boolean; nonce?: string}` | `{inject: true}` | How styles reach the page. See [Styles and CSP](#styles-and-csp). Page-wide setting. |
|
|
66
67
|
| `onChange` | `(change: EditorChange) => void` | – | Called on every change and once at mount. |
|
|
67
68
|
|
|
@@ -226,6 +227,88 @@ handler**. It was verified in a browser under `default-src 'none'; script-src 's
|
|
|
226
227
|
style-src 'self'` (no violation); with the default injection and no nonce, that policy blocks the
|
|
227
228
|
styles. If your CSP restricts `img-src`, allow the origin of your users' avatars.
|
|
228
229
|
|
|
230
|
+
## Mention colors
|
|
231
|
+
|
|
232
|
+
### At mount (per editor)
|
|
233
|
+
|
|
234
|
+
Pass the colors you want in the `mentionColors` option. Any CSS color works (`#0f9d7a`, `rgb(…)`,
|
|
235
|
+
`hsl(…)`, a name, or `var(--brand)`); what you leave out keeps its default.
|
|
236
|
+
|
|
237
|
+
```ts
|
|
238
|
+
import Editor from '@mzeahmed/rich-editor';
|
|
239
|
+
|
|
240
|
+
declare const textarea: HTMLTextAreaElement;
|
|
241
|
+
declare const mentions: import('@mzeahmed/rich-editor').EditorMentionIntegration;
|
|
242
|
+
|
|
243
|
+
Editor.mount(textarea, {
|
|
244
|
+
mention: true,
|
|
245
|
+
mentionColors: {
|
|
246
|
+
// Hovered or chosen user in the bubble
|
|
247
|
+
active: '#0f9d7a',
|
|
248
|
+
activeBackground: 'rgba(15, 157, 122, .08)',
|
|
249
|
+
activeBorder: 'rgba(15, 157, 122, .25)',
|
|
250
|
+
// Mention link inside the editor
|
|
251
|
+
link: '#0b7a5f',
|
|
252
|
+
linkBackground: 'rgba(15, 157, 122, .1)',
|
|
253
|
+
linkBorder: 'rgba(15, 157, 122, .3)',
|
|
254
|
+
linkHoverBackground: 'rgba(15, 157, 122, .18)',
|
|
255
|
+
linkHoverBorder: 'rgba(15, 157, 122, .4)',
|
|
256
|
+
},
|
|
257
|
+
}, {mentions});
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
| Option | Used for |
|
|
261
|
+
| --- | --- |
|
|
262
|
+
| `active` | Name, avatar border and outline of the **hovered / chosen user** in the bubble |
|
|
263
|
+
| `activeBackground` | Background of the hovered / chosen user |
|
|
264
|
+
| `activeBorder` | Border of the hovered / chosen user, avatar border, keyboard focus ring |
|
|
265
|
+
| `link` | Text color of the mention link in the editor |
|
|
266
|
+
| `linkBackground` | Background of the mention link |
|
|
267
|
+
| `linkBorder` | Border of the mention link |
|
|
268
|
+
| `linkHoverBackground` | Background of the mention link on hover |
|
|
269
|
+
| `linkHoverBorder` | Border of the mention link on hover |
|
|
270
|
+
|
|
271
|
+
Each editor keeps its own colors: two editors on the same page can look different. The colors are
|
|
272
|
+
applied through the CSSOM (`style.setProperty`), so they work under a strict CSP. Empty and
|
|
273
|
+
non-string values are ignored.
|
|
274
|
+
|
|
275
|
+
### With CSS (for the whole page)
|
|
276
|
+
|
|
277
|
+
Behind the option, the colors are CSS custom properties. You can set them yourself in your
|
|
278
|
+
stylesheet to style every editor of the page at once; an editor's `mentionColors` wins over them.
|
|
279
|
+
Nothing is set by the package, so your values always win over the defaults, which are the blue below.
|
|
280
|
+
|
|
281
|
+
| Variable | Used for | Default |
|
|
282
|
+
| --- | --- | --- |
|
|
283
|
+
| `--mzre-mention-active-color` | Name, avatar border and outline of the **hovered / chosen user** in the bubble | `#3b82f6` |
|
|
284
|
+
| `--mzre-mention-active-bg` | Background of the hovered / chosen user | `rgba(59, 130, 246, .07)` |
|
|
285
|
+
| `--mzre-mention-active-border` | Border of the hovered / chosen user, avatar border, keyboard focus ring | `rgba(59, 130, 246, .15)` |
|
|
286
|
+
| `--mzre-mention-color` | Text color of the mention link in the editor | `#2563eb` |
|
|
287
|
+
| `--mzre-mention-bg` | Background of the mention link | `rgba(59, 130, 246, .1)` |
|
|
288
|
+
| `--mzre-mention-border` | Border of the mention link | `rgba(59, 130, 246, .2)` |
|
|
289
|
+
| `--mzre-mention-hover-bg` | Background of the mention link on hover | `rgba(59, 130, 246, .16)` |
|
|
290
|
+
| `--mzre-mention-hover-border` | Border of the mention link on hover | `rgba(59, 130, 246, .35)` |
|
|
291
|
+
|
|
292
|
+
```css
|
|
293
|
+
:root {
|
|
294
|
+
--mzre-mention-active-color: #0f9d7a;
|
|
295
|
+
--mzre-mention-active-bg: rgba(15, 157, 122, .08);
|
|
296
|
+
--mzre-mention-active-border: rgba(15, 157, 122, .25);
|
|
297
|
+
--mzre-mention-color: #0b7a5f;
|
|
298
|
+
--mzre-mention-bg: rgba(15, 157, 122, .1);
|
|
299
|
+
--mzre-mention-border: rgba(15, 157, 122, .25);
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
The bubble is appended to `<body>`, outside of your editor's container: with CSS, set the
|
|
304
|
+
`--mzre-mention-active-*` variables on `:root` or `body` (or on an ancestor of both), not on the
|
|
305
|
+
editor's wrapper. The `--mzre-mention-*` variables of the link can also be set on any ancestor of the
|
|
306
|
+
editor. (The `mentionColors` option has no such constraint: the package puts each value where it
|
|
307
|
+
belongs.)
|
|
308
|
+
|
|
309
|
+
They work under a strict CSP, and they can be changed at any time from JavaScript, for example for a
|
|
310
|
+
dark theme: `document.documentElement.style.setProperty('--mzre-mention-color', '#7dd3fc')`.
|
|
311
|
+
|
|
229
312
|
## Security
|
|
230
313
|
|
|
231
314
|
- **Output escaping.** Names, ids, URLs and every localized text are escaped before being rendered.
|
package/dist/Editor.d.ts
CHANGED
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
*/
|
|
166
166
|
import type { StyleOptions } from './styles.js';
|
|
167
167
|
import type { EditorLocale } from './messages.js';
|
|
168
|
-
import type { EditorIntegrations } from './types.js';
|
|
168
|
+
import type { EditorIntegrations, MentionColors } from './types.js';
|
|
169
169
|
/** Content state, passed to `onChange` on every change and once at mount. */
|
|
170
170
|
export interface EditorChange {
|
|
171
171
|
html: string;
|
|
@@ -189,6 +189,11 @@ export interface EditorOptions {
|
|
|
189
189
|
mention?: boolean;
|
|
190
190
|
/** Language of the interface and of the emojis: 'en' (default) or 'fr'. Page-wide setting. */
|
|
191
191
|
locale?: EditorLocale;
|
|
192
|
+
/**
|
|
193
|
+
* Colors of the mention bubble and of the mention link, for this editor only (see `MentionColors`).
|
|
194
|
+
* They win over the `--mzre-mention-*` CSS variables of the page.
|
|
195
|
+
*/
|
|
196
|
+
mentionColors?: MentionColors;
|
|
192
197
|
/**
|
|
193
198
|
* Style injection (page-wide setting): `{inject: false}` to load
|
|
194
199
|
* `@mzeahmed/rich-editor/style.css` yourself, `{nonce}` for a nonce-based CSP. See `setEditorStyles()`.
|
package/dist/Editor.js
CHANGED
|
@@ -170,6 +170,34 @@ import { message as t, setEditorLocale, setEditorMessages } from './messages.js'
|
|
|
170
170
|
/** Interface text, escaped so it can be inserted into HTML. */
|
|
171
171
|
const te = (key) => escapeHtml(t(key));
|
|
172
172
|
let mentionBubbleCount = 0;
|
|
173
|
+
/** CSS custom property behind each color of `MentionColors` (see the "Mention colors" README section). */
|
|
174
|
+
const MENTION_COLOR_VARIABLES = {
|
|
175
|
+
active: '--mzre-mention-active-color',
|
|
176
|
+
activeBackground: '--mzre-mention-active-bg',
|
|
177
|
+
activeBorder: '--mzre-mention-active-border',
|
|
178
|
+
link: '--mzre-mention-color',
|
|
179
|
+
linkBackground: '--mzre-mention-bg',
|
|
180
|
+
linkBorder: '--mzre-mention-border',
|
|
181
|
+
linkHoverBackground: '--mzre-mention-hover-bg',
|
|
182
|
+
linkHoverBorder: '--mzre-mention-hover-border'
|
|
183
|
+
};
|
|
184
|
+
/** The link is inside the editor, the chosen-user colors belong to the bubble (appended to `<body>`). */
|
|
185
|
+
const MENTION_LINK_COLORS = ['link', 'linkBackground', 'linkBorder', 'linkHoverBackground', 'linkHoverBorder'];
|
|
186
|
+
const MENTION_BUBBLE_COLORS = ['active', 'activeBackground', 'activeBorder'];
|
|
187
|
+
/**
|
|
188
|
+
* Sets the given colors on `element` as custom properties. It goes through the CSSOM
|
|
189
|
+
* (`style.setProperty`), which a strict CSP allows, unlike an inline `style` attribute in the markup.
|
|
190
|
+
* Empty and non-string values are ignored.
|
|
191
|
+
*/
|
|
192
|
+
function applyMentionColors(element, colors, keys) {
|
|
193
|
+
if (!colors)
|
|
194
|
+
return;
|
|
195
|
+
for (const key of keys) {
|
|
196
|
+
const value = colors[key];
|
|
197
|
+
if (typeof value === 'string' && value.trim() !== '')
|
|
198
|
+
element.style.setProperty(MENTION_COLOR_VARIABLES[key], value.trim());
|
|
199
|
+
}
|
|
200
|
+
}
|
|
173
201
|
/**
|
|
174
202
|
* ARIA attributes carried by the writing area (`textbox` role) while the mention bubble is
|
|
175
203
|
* open. Only those this role accepts: `aria-expanded` and `aria-haspopup` are not allowed.
|
|
@@ -295,6 +323,7 @@ export default class Editor {
|
|
|
295
323
|
wrap.className = 'mzre-editor-wrap';
|
|
296
324
|
// Accessible name of the writing area: the textarea's aria-label, else its placeholder.
|
|
297
325
|
wrap.innerHTML = Editor.buildEditorHTML(placeholder, toolbarMode, textarea.getAttribute('aria-label') ?? '');
|
|
326
|
+
applyMentionColors(wrap, opts.mentionColors, MENTION_LINK_COLORS);
|
|
298
327
|
textarea.parentNode.insertBefore(wrap, textarea);
|
|
299
328
|
textarea.style.display = 'none';
|
|
300
329
|
const content = wrap.querySelector('.mzre-content');
|
|
@@ -526,7 +555,7 @@ export default class Editor {
|
|
|
526
555
|
if (opts.mention) {
|
|
527
556
|
if (!integrations.mentions)
|
|
528
557
|
throw new Error('Editor requires a mention integration.');
|
|
529
|
-
Editor._setupMentions(content, integrations.mentions);
|
|
558
|
+
Editor._setupMentions(content, integrations.mentions, opts.mentionColors);
|
|
530
559
|
}
|
|
531
560
|
}
|
|
532
561
|
/* ─────────────────────────────────────────
|
|
@@ -588,7 +617,7 @@ export default class Editor {
|
|
|
588
617
|
/* ─────────────────────────────────────────
|
|
589
618
|
Mentions
|
|
590
619
|
───────────────────────────────────────── */
|
|
591
|
-
static _setupMentions(content, integration) {
|
|
620
|
+
static _setupMentions(content, integration, colors) {
|
|
592
621
|
const state = {
|
|
593
622
|
isSearch: false,
|
|
594
623
|
atNode: null,
|
|
@@ -601,6 +630,7 @@ export default class Editor {
|
|
|
601
630
|
stopOutsideClose: null,
|
|
602
631
|
dismissed: null,
|
|
603
632
|
stopFollow: null,
|
|
633
|
+
colors,
|
|
604
634
|
};
|
|
605
635
|
// In capture phase: before the editor's handler (otherwise Tab inserts spaces).
|
|
606
636
|
content.addEventListener('keydown', (e) => {
|
|
@@ -677,6 +707,7 @@ export default class Editor {
|
|
|
677
707
|
dropdown.setAttribute('role', 'region');
|
|
678
708
|
dropdown.setAttribute('aria-label', t('mentionSuggestions'));
|
|
679
709
|
dropdown.hidden = true;
|
|
710
|
+
applyMentionColors(dropdown, state.colors, MENTION_BUBBLE_COLORS);
|
|
680
711
|
state.listId = `mzre-mentions-list-${++mentionBubbleCount}`;
|
|
681
712
|
dropdown.innerHTML = `
|
|
682
713
|
<div class="mzre-mentions-header">
|
package/dist/index.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export { messagesEn, messagesFr, setEditorLocale, setEditorMessages } from './me
|
|
|
6
6
|
export type { EditorLocale, EditorMessages } from './messages.js';
|
|
7
7
|
export { setEditorStyles } from './styles.js';
|
|
8
8
|
export type { StyleOptions } from './styles.js';
|
|
9
|
-
export type { EmojiPickerOptions, EditorIntegrations, EditorLoader, EditorMentionIntegration, EditorUser, } from './types.js';
|
|
9
|
+
export type { EmojiPickerOptions, EditorIntegrations, EditorLoader, EditorMentionIntegration, EditorUser, MentionColors, } from './types.js';
|
package/dist/style.css
CHANGED
|
@@ -247,7 +247,7 @@
|
|
|
247
247
|
}
|
|
248
248
|
.mzre-mentions-dropdown .mzre-mentions-close:hover { background: #f1f2f5; }
|
|
249
249
|
.mzre-mentions-dropdown .mzre-mentions-close:focus-visible {
|
|
250
|
-
outline: 2px solid rgba(59, 130, 246, .3);
|
|
250
|
+
outline: 2px solid var(--mzre-mention-active-border, rgba(59, 130, 246, .3));
|
|
251
251
|
outline-offset: 2px;
|
|
252
252
|
}
|
|
253
253
|
.mzre-mentions-dropdown .mzre-mentions-list {
|
|
@@ -285,13 +285,13 @@
|
|
|
285
285
|
}
|
|
286
286
|
.mzre-mentions-dropdown .mzre-mention-item[aria-selected="true"],
|
|
287
287
|
.mzre-mentions-dropdown .mzre-mention-item:hover {
|
|
288
|
-
background: rgba(59, 130, 246, .07);
|
|
289
|
-
border-color: rgba(59, 130, 246, .15);
|
|
288
|
+
background: var(--mzre-mention-active-bg, rgba(59, 130, 246, .07));
|
|
289
|
+
border-color: var(--mzre-mention-active-border, rgba(59, 130, 246, .15));
|
|
290
290
|
transform: translateX(2px);
|
|
291
291
|
}
|
|
292
292
|
.mzre-mentions-dropdown .mzre-mention-item:active { transform: scale(.98); }
|
|
293
293
|
.mzre-mentions-dropdown .mzre-mention-item:focus {
|
|
294
|
-
outline: 2px solid rgba(59, 130, 246, .3);
|
|
294
|
+
outline: 2px solid var(--mzre-mention-active-border, rgba(59, 130, 246, .3));
|
|
295
295
|
outline-offset: 2px;
|
|
296
296
|
}
|
|
297
297
|
.mzre-mentions-dropdown .mzre-mention-avatar { position: relative; flex-shrink: 0; }
|
|
@@ -300,13 +300,13 @@
|
|
|
300
300
|
height: 40px;
|
|
301
301
|
border-radius: 50%;
|
|
302
302
|
object-fit: cover;
|
|
303
|
-
border: 2px solid rgba(59, 130, 246, .15);
|
|
303
|
+
border: 2px solid var(--mzre-mention-active-border, rgba(59, 130, 246, .15));
|
|
304
304
|
transition: border-color .2s, transform .2s, box-shadow .2s;
|
|
305
305
|
}
|
|
306
306
|
.mzre-mentions-dropdown .mzre-mention-item:hover .mzre-mention-avatar img {
|
|
307
|
-
border-color: #3b82f6;
|
|
307
|
+
border-color: var(--mzre-mention-active-color, #3b82f6);
|
|
308
308
|
transform: scale(1.05);
|
|
309
|
-
box-shadow: 0 4px 12px rgba(59, 130, 246, .2);
|
|
309
|
+
box-shadow: 0 4px 12px var(--mzre-mention-active-border, rgba(59, 130, 246, .2));
|
|
310
310
|
}
|
|
311
311
|
.mzre-mentions-dropdown .mzre-mention-avatar-fallback {
|
|
312
312
|
display: flex;
|
|
@@ -332,9 +332,9 @@
|
|
|
332
332
|
transition: color .15s;
|
|
333
333
|
}
|
|
334
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; }
|
|
335
|
+
.mzre-mentions-dropdown .mzre-mention-item:hover .mzre-mention-name { color: var(--mzre-mention-active-color, #3b82f6); }
|
|
336
336
|
.mzre-mentions-dropdown .mzre-mention-item[aria-selected="true"] {
|
|
337
|
-
outline: 2px solid #3b82f6;
|
|
337
|
+
outline: 2px solid var(--mzre-mention-active-color, #3b82f6);
|
|
338
338
|
outline-offset: -2px;
|
|
339
339
|
}
|
|
340
340
|
.mzre-mentions-dropdown .mzre-mentions-empty {
|
|
@@ -360,17 +360,17 @@
|
|
|
360
360
|
display: inline-flex;
|
|
361
361
|
align-items: center;
|
|
362
362
|
padding: 2px 8px;
|
|
363
|
-
background: rgba(59, 130, 246, .1);
|
|
364
|
-
color: #2563eb;
|
|
363
|
+
background: var(--mzre-mention-bg, rgba(59, 130, 246, .1));
|
|
364
|
+
color: var(--mzre-mention-color, #2563eb);
|
|
365
365
|
border-radius: 4px;
|
|
366
366
|
font-weight: 500;
|
|
367
367
|
text-decoration: none;
|
|
368
|
-
border: 1px solid rgba(59, 130, 246, .2);
|
|
368
|
+
border: 1px solid var(--mzre-mention-border, rgba(59, 130, 246, .2));
|
|
369
369
|
transition: background .15s, border-color .15s, transform .15s;
|
|
370
370
|
}
|
|
371
371
|
.mzre-content a.mention:hover {
|
|
372
|
-
background: rgba(59, 130, 246, .16);
|
|
373
|
-
border-color: rgba(59, 130, 246, .35);
|
|
372
|
+
background: var(--mzre-mention-hover-bg, rgba(59, 130, 246, .16));
|
|
373
|
+
border-color: var(--mzre-mention-hover-border, rgba(59, 130, 246, .35));
|
|
374
374
|
transform: translateY(-1px);
|
|
375
375
|
}
|
|
376
376
|
|
package/dist/styles.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* (see `injectStyleSheet`) and written to `dist/style.css` at build time (`scripts/build-css.mjs`),
|
|
4
4
|
* for applications whose CSP forbids injected `<style>` tags.
|
|
5
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";
|
|
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 var(--mzre-mention-active-border, 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: var(--mzre-mention-active-bg, rgba(59, 130, 246, .07));\n border-color: var(--mzre-mention-active-border, 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 var(--mzre-mention-active-border, 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 var(--mzre-mention-active-border, 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: var(--mzre-mention-active-color, #3b82f6);\n transform: scale(1.05);\n box-shadow: 0 4px 12px var(--mzre-mention-active-border, 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: var(--mzre-mention-active-color, #3b82f6); }\n.mzre-mentions-dropdown .mzre-mention-item[aria-selected=\"true\"] {\n outline: 2px solid var(--mzre-mention-active-color, #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: var(--mzre-mention-bg, rgba(59, 130, 246, .1));\n color: var(--mzre-mention-color, #2563eb);\n border-radius: 4px;\n font-weight: 500;\n text-decoration: none;\n border: 1px solid var(--mzre-mention-border, rgba(59, 130, 246, .2));\n transition: background .15s, border-color .15s, transform .15s;\n}\n.mzre-content a.mention:hover {\n background: var(--mzre-mention-hover-bg, rgba(59, 130, 246, .16));\n border-color: var(--mzre-mention-hover-border, 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
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
8
|
/**
|
|
9
9
|
* Style injection setting, global to the page (like the language).
|
package/dist/styles.js
CHANGED
|
@@ -252,7 +252,7 @@ export const EDITOR_CSS = `
|
|
|
252
252
|
}
|
|
253
253
|
.mzre-mentions-dropdown .mzre-mentions-close:hover { background: #f1f2f5; }
|
|
254
254
|
.mzre-mentions-dropdown .mzre-mentions-close:focus-visible {
|
|
255
|
-
outline: 2px solid rgba(59, 130, 246, .3);
|
|
255
|
+
outline: 2px solid var(--mzre-mention-active-border, rgba(59, 130, 246, .3));
|
|
256
256
|
outline-offset: 2px;
|
|
257
257
|
}
|
|
258
258
|
.mzre-mentions-dropdown .mzre-mentions-list {
|
|
@@ -290,13 +290,13 @@ export const EDITOR_CSS = `
|
|
|
290
290
|
}
|
|
291
291
|
.mzre-mentions-dropdown .mzre-mention-item[aria-selected="true"],
|
|
292
292
|
.mzre-mentions-dropdown .mzre-mention-item:hover {
|
|
293
|
-
background: rgba(59, 130, 246, .07);
|
|
294
|
-
border-color: rgba(59, 130, 246, .15);
|
|
293
|
+
background: var(--mzre-mention-active-bg, rgba(59, 130, 246, .07));
|
|
294
|
+
border-color: var(--mzre-mention-active-border, rgba(59, 130, 246, .15));
|
|
295
295
|
transform: translateX(2px);
|
|
296
296
|
}
|
|
297
297
|
.mzre-mentions-dropdown .mzre-mention-item:active { transform: scale(.98); }
|
|
298
298
|
.mzre-mentions-dropdown .mzre-mention-item:focus {
|
|
299
|
-
outline: 2px solid rgba(59, 130, 246, .3);
|
|
299
|
+
outline: 2px solid var(--mzre-mention-active-border, rgba(59, 130, 246, .3));
|
|
300
300
|
outline-offset: 2px;
|
|
301
301
|
}
|
|
302
302
|
.mzre-mentions-dropdown .mzre-mention-avatar { position: relative; flex-shrink: 0; }
|
|
@@ -305,13 +305,13 @@ export const EDITOR_CSS = `
|
|
|
305
305
|
height: 40px;
|
|
306
306
|
border-radius: 50%;
|
|
307
307
|
object-fit: cover;
|
|
308
|
-
border: 2px solid rgba(59, 130, 246, .15);
|
|
308
|
+
border: 2px solid var(--mzre-mention-active-border, rgba(59, 130, 246, .15));
|
|
309
309
|
transition: border-color .2s, transform .2s, box-shadow .2s;
|
|
310
310
|
}
|
|
311
311
|
.mzre-mentions-dropdown .mzre-mention-item:hover .mzre-mention-avatar img {
|
|
312
|
-
border-color: #3b82f6;
|
|
312
|
+
border-color: var(--mzre-mention-active-color, #3b82f6);
|
|
313
313
|
transform: scale(1.05);
|
|
314
|
-
box-shadow: 0 4px 12px rgba(59, 130, 246, .2);
|
|
314
|
+
box-shadow: 0 4px 12px var(--mzre-mention-active-border, rgba(59, 130, 246, .2));
|
|
315
315
|
}
|
|
316
316
|
.mzre-mentions-dropdown .mzre-mention-avatar-fallback {
|
|
317
317
|
display: flex;
|
|
@@ -337,9 +337,9 @@ export const EDITOR_CSS = `
|
|
|
337
337
|
transition: color .15s;
|
|
338
338
|
}
|
|
339
339
|
.mzre-mentions-dropdown .mzre-mention-item[aria-selected="true"] .mzre-mention-name,
|
|
340
|
-
.mzre-mentions-dropdown .mzre-mention-item:hover .mzre-mention-name { color: #3b82f6; }
|
|
340
|
+
.mzre-mentions-dropdown .mzre-mention-item:hover .mzre-mention-name { color: var(--mzre-mention-active-color, #3b82f6); }
|
|
341
341
|
.mzre-mentions-dropdown .mzre-mention-item[aria-selected="true"] {
|
|
342
|
-
outline: 2px solid #3b82f6;
|
|
342
|
+
outline: 2px solid var(--mzre-mention-active-color, #3b82f6);
|
|
343
343
|
outline-offset: -2px;
|
|
344
344
|
}
|
|
345
345
|
.mzre-mentions-dropdown .mzre-mentions-empty {
|
|
@@ -365,17 +365,17 @@ export const EDITOR_CSS = `
|
|
|
365
365
|
display: inline-flex;
|
|
366
366
|
align-items: center;
|
|
367
367
|
padding: 2px 8px;
|
|
368
|
-
background: rgba(59, 130, 246, .1);
|
|
369
|
-
color: #2563eb;
|
|
368
|
+
background: var(--mzre-mention-bg, rgba(59, 130, 246, .1));
|
|
369
|
+
color: var(--mzre-mention-color, #2563eb);
|
|
370
370
|
border-radius: 4px;
|
|
371
371
|
font-weight: 500;
|
|
372
372
|
text-decoration: none;
|
|
373
|
-
border: 1px solid rgba(59, 130, 246, .2);
|
|
373
|
+
border: 1px solid var(--mzre-mention-border, rgba(59, 130, 246, .2));
|
|
374
374
|
transition: background .15s, border-color .15s, transform .15s;
|
|
375
375
|
}
|
|
376
376
|
.mzre-content a.mention:hover {
|
|
377
|
-
background: rgba(59, 130, 246, .16);
|
|
378
|
-
border-color: rgba(59, 130, 246, .35);
|
|
377
|
+
background: var(--mzre-mention-hover-bg, rgba(59, 130, 246, .16));
|
|
378
|
+
border-color: var(--mzre-mention-hover-border, rgba(59, 130, 246, .35));
|
|
379
379
|
transform: translateY(-1px);
|
|
380
380
|
}
|
|
381
381
|
|
package/dist/types.d.ts
CHANGED
|
@@ -26,3 +26,26 @@ export interface EditorIntegrations {
|
|
|
26
26
|
messages?: Partial<EditorMessages>;
|
|
27
27
|
mentions?: EditorMentionIntegration;
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Colors of the mention bubble and of the mention link, set when the editor is mounted. Any CSS
|
|
31
|
+
* color (`#0f9d7a`, `rgb(…)`, `hsl(…)`, a named color or `var(--brand)`). What is not given keeps its
|
|
32
|
+
* default (or the value of the matching `--mzre-mention-*` CSS variable of your page).
|
|
33
|
+
*/
|
|
34
|
+
export interface MentionColors {
|
|
35
|
+
/** Name, avatar border and outline of the hovered or chosen user in the bubble. */
|
|
36
|
+
active?: string;
|
|
37
|
+
/** Background of the hovered or chosen user. */
|
|
38
|
+
activeBackground?: string;
|
|
39
|
+
/** Border of the hovered or chosen user, and keyboard focus ring. */
|
|
40
|
+
activeBorder?: string;
|
|
41
|
+
/** Text color of the mention link in the editor. */
|
|
42
|
+
link?: string;
|
|
43
|
+
/** Background of the mention link. */
|
|
44
|
+
linkBackground?: string;
|
|
45
|
+
/** Border of the mention link. */
|
|
46
|
+
linkBorder?: string;
|
|
47
|
+
/** Background of the mention link on hover. */
|
|
48
|
+
linkHoverBackground?: string;
|
|
49
|
+
/** Border of the mention link on hover. */
|
|
50
|
+
linkHoverBorder?: string;
|
|
51
|
+
}
|