@mdaemon/html-editor 1.0.6 → 1.0.7
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/README.md +46 -4
- package/dist/index.d.ts +28 -2
- package/dist/index.js +446 -86
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +446 -86
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +327 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -89,10 +89,12 @@ const editor = new HTMLEditor(container, {
|
|
|
89
89
|
| `fontSize` | string | - | Default font size |
|
|
90
90
|
| `directionality` | 'ltr' \| 'rtl' | 'ltr' | Text direction |
|
|
91
91
|
| `language` | string | 'en' | UI language code (built-in translations for 31 languages) |
|
|
92
|
-
| `height` | string \| number | 300 | Editor height |
|
|
92
|
+
| `height` | string \| number | 300 | Editor height (fixed) |
|
|
93
|
+
| `min_height` | string \| number | - | Minimum editor height |
|
|
94
|
+
| `max_height` | string \| number | - | Maximum editor height |
|
|
93
95
|
| `auto_focus` | string | - | Auto-focus the editor on init |
|
|
94
|
-
| `skin` | 'oxide' \| 'oxide-dark' | 'oxide' | Theme |
|
|
95
|
-
| `content_css` | 'default' \| 'dark' | 'default' | Content area styling |
|
|
96
|
+
| `skin` | 'oxide' \| 'oxide-dark' \| 'confab' \| 'confab-dark' | 'oxide' | Theme (see Theming section) |
|
|
97
|
+
| `content_css` | 'default' \| 'dark' \| 'confab' \| 'confab-dark' | 'default' | Content area styling |
|
|
96
98
|
| `content_style` | string | - | Custom CSS injected into the content area |
|
|
97
99
|
| `toolbar` | string | *(see Toolbar section)* | Custom toolbar button layout |
|
|
98
100
|
| `toolbar_mode` | 'sliding' \| 'floating' \| 'wrap' | 'wrap' | Toolbar overflow behavior |
|
|
@@ -482,6 +484,45 @@ const editor = new HTMLEditor(container, {
|
|
|
482
484
|
});
|
|
483
485
|
```
|
|
484
486
|
|
|
487
|
+
### Confab skin
|
|
488
|
+
|
|
489
|
+
The `confab` and `confab-dark` skins integrate with the WorldClient theming system. They use CSS custom properties from the host application so the editor automatically adapts when the app theme changes.
|
|
490
|
+
|
|
491
|
+
The confab skins also replace the default text/emoji toolbar icons with clean SVG line icons for a more polished look.
|
|
492
|
+
|
|
493
|
+
```typescript
|
|
494
|
+
// Light mode
|
|
495
|
+
const editor = new HTMLEditor(container, {
|
|
496
|
+
skin: 'confab',
|
|
497
|
+
content_css: 'confab',
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
// Dark mode
|
|
501
|
+
const editor = new HTMLEditor(container, {
|
|
502
|
+
skin: 'confab-dark',
|
|
503
|
+
content_css: 'confab-dark',
|
|
504
|
+
});
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
The confab skins expect the following CSS custom properties to be defined by the host application:
|
|
508
|
+
|
|
509
|
+
| Variable | Purpose |
|
|
510
|
+
|----------|---------||
|
|
511
|
+
| `--theme-primary` | Primary brand color (buttons, active states) |
|
|
512
|
+
| `--theme-primary-hover` | Hover state for primary color |
|
|
513
|
+
| `--color-confab-gray-50` to `--color-confab-gray-900` | Gray scale for backgrounds, text, borders |
|
|
514
|
+
| `--color-confab-500` | Focus ring color |
|
|
515
|
+
| `--color-dark-bg-primary` | Dark mode primary background |
|
|
516
|
+
| `--color-dark-bg-secondary` | Dark mode toolbar/panel background |
|
|
517
|
+
| `--color-dark-bg-tertiary` | Dark mode inset/recessed background |
|
|
518
|
+
| `--color-dark-bg-hover` | Dark mode hover state |
|
|
519
|
+
| `--color-dark-text-primary` | Dark mode primary text |
|
|
520
|
+
| `--color-dark-text-secondary` | Dark mode secondary text |
|
|
521
|
+
| `--color-dark-text-muted` | Dark mode muted text |
|
|
522
|
+
| `--color-dark-border` | Dark mode border color |
|
|
523
|
+
|
|
524
|
+
All variables include fallback values so the editor remains usable without the host CSS, though colors may not match the intended design.
|
|
525
|
+
|
|
485
526
|
### Custom content styles
|
|
486
527
|
|
|
487
528
|
Inject additional CSS into the editor content area:
|
|
@@ -498,7 +539,8 @@ The editor DOM uses BEM-style classes you can target for further customization:
|
|
|
498
539
|
|
|
499
540
|
- `.md-editor` — outer wrapper
|
|
500
541
|
- `.md-editor-fullscreen` — applied in fullscreen mode
|
|
501
|
-
- `.md-editor-oxide` / `.md-editor-oxide-dark` — theme variant
|
|
542
|
+
- `.md-editor-oxide` / `.md-editor-oxide-dark` — oxide theme variant
|
|
543
|
+
- `.md-editor-confab` / `.md-editor-confab-dark` — confab theme variant
|
|
502
544
|
- `.md-toolbar` — toolbar container
|
|
503
545
|
- `.md-toolbar-sticky` — sticky toolbar
|
|
504
546
|
- `.md-toolbar-primary` / `.md-toolbar-overflow` — primary and collapsible toolbar rows
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Editor } from '@tiptap/core';
|
|
2
2
|
import { Extension } from '@tiptap/core';
|
|
3
|
+
import { Node as Node_2 } from '@tiptap/core';
|
|
3
4
|
|
|
4
5
|
/** List of all supported locale codes */
|
|
5
6
|
export declare const availableLocales: string[];
|
|
@@ -54,6 +55,13 @@ export declare interface ColorOption {
|
|
|
54
55
|
label?: string;
|
|
55
56
|
}
|
|
56
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Confab icon set — clean SVG stroke icons for the confab and confab-dark skins.
|
|
60
|
+
* All icons use viewBox="0 0 24 24", stroke="currentColor", stroke-width="2".
|
|
61
|
+
* Emoticons and charmap keep their emoji/text icons.
|
|
62
|
+
*/
|
|
63
|
+
export declare const CONFAB_ICONS: IconSet;
|
|
64
|
+
|
|
57
65
|
/**
|
|
58
66
|
* Create a TranslateFunction for a given language code.
|
|
59
67
|
* Returns a function that looks up keys in the locale map,
|
|
@@ -61,6 +69,12 @@ export declare interface ColorOption {
|
|
|
61
69
|
*/
|
|
62
70
|
export declare function createTranslateFunction(code: string): TranslateFunction;
|
|
63
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Default icon set — used by oxide and oxide-dark skins.
|
|
74
|
+
* Text characters and emoji for most buttons, inline SVGs for alignment/image/code.
|
|
75
|
+
*/
|
|
76
|
+
export declare const DEFAULT_ICONS: IconSet;
|
|
77
|
+
|
|
64
78
|
declare type DirtyCallback = (dirty: boolean) => void;
|
|
65
79
|
|
|
66
80
|
/**
|
|
@@ -107,10 +121,12 @@ export declare interface EditorConfig {
|
|
|
107
121
|
directionality?: 'ltr' | 'rtl';
|
|
108
122
|
language?: string;
|
|
109
123
|
height?: string | number;
|
|
124
|
+
min_height?: string | number;
|
|
125
|
+
max_height?: string | number;
|
|
110
126
|
auto_focus?: string;
|
|
111
127
|
setFocus?: string;
|
|
112
|
-
skin?: 'oxide' | 'oxide-dark';
|
|
113
|
-
content_css?: 'default' | 'dark';
|
|
128
|
+
skin?: 'oxide' | 'oxide-dark' | 'confab' | 'confab-dark';
|
|
129
|
+
content_css?: 'default' | 'dark' | 'confab' | 'confab-dark';
|
|
114
130
|
content_style?: string;
|
|
115
131
|
toolbar?: string;
|
|
116
132
|
toolbar_mode?: 'sliding' | 'floating' | 'wrap';
|
|
@@ -271,6 +287,12 @@ export declare class HTMLEditor implements MDHTMLEditor {
|
|
|
271
287
|
isBasicEditor(): boolean;
|
|
272
288
|
}
|
|
273
289
|
|
|
290
|
+
/**
|
|
291
|
+
* MDHTMLEditor Icon Sets
|
|
292
|
+
* Skin-specific icon registries for toolbar buttons
|
|
293
|
+
*/
|
|
294
|
+
export declare type IconSet = Record<string, string>;
|
|
295
|
+
|
|
274
296
|
/**
|
|
275
297
|
* Image upload handler
|
|
276
298
|
*/
|
|
@@ -380,6 +402,8 @@ export declare function setGetFileSrc(fn: (path: string) => string): void;
|
|
|
380
402
|
*/
|
|
381
403
|
export declare function setTranslate(fn: TranslateFunction): void;
|
|
382
404
|
|
|
405
|
+
export declare const SignatureBlock: Node_2<any, any>;
|
|
406
|
+
|
|
383
407
|
/**
|
|
384
408
|
* Template object for email templates
|
|
385
409
|
*/
|
|
@@ -417,6 +441,7 @@ export declare class Toolbar {
|
|
|
417
441
|
constructor(container: HTMLElement, options: ToolbarOptions);
|
|
418
442
|
private get tiptap();
|
|
419
443
|
private get trans();
|
|
444
|
+
private icon;
|
|
420
445
|
private render;
|
|
421
446
|
private renderGroups;
|
|
422
447
|
private createToggleButton;
|
|
@@ -473,6 +498,7 @@ declare interface ToolbarOptions {
|
|
|
473
498
|
sticky: boolean;
|
|
474
499
|
customButtons: Map<string, ToolbarButtonSpec>;
|
|
475
500
|
config: EditorConfig;
|
|
501
|
+
iconSet: IconSet;
|
|
476
502
|
}
|
|
477
503
|
|
|
478
504
|
/**
|