@mdaemon/html-editor 1.0.5 → 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/dist/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  import { Editor } from '@tiptap/core';
2
2
  import { Extension } from '@tiptap/core';
3
+ import { Node as Node_2 } from '@tiptap/core';
4
+
5
+ /** List of all supported locale codes */
6
+ export declare const availableLocales: string[];
3
7
 
4
8
  declare type BlurCallback = () => void;
5
9
 
@@ -51,6 +55,26 @@ export declare interface ColorOption {
51
55
  label?: string;
52
56
  }
53
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
+
65
+ /**
66
+ * Create a TranslateFunction for a given language code.
67
+ * Returns a function that looks up keys in the locale map,
68
+ * falling back to the key itself if not found.
69
+ */
70
+ export declare function createTranslateFunction(code: string): TranslateFunction;
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
+
54
78
  declare type DirtyCallback = (dirty: boolean) => void;
55
79
 
56
80
  /**
@@ -88,6 +112,8 @@ export declare interface EditorConfig {
88
112
  images_upload_url?: string;
89
113
  images_upload_credentials?: boolean;
90
114
  images_upload_base_path?: string;
115
+ images_upload_max_size?: number;
116
+ images_upload_headers?: Record<string, string>;
91
117
  font_family_formats?: string;
92
118
  font_size_formats?: string;
93
119
  fontName?: string;
@@ -95,10 +121,12 @@ export declare interface EditorConfig {
95
121
  directionality?: 'ltr' | 'rtl';
96
122
  language?: string;
97
123
  height?: string | number;
124
+ min_height?: string | number;
125
+ max_height?: string | number;
98
126
  auto_focus?: string;
99
127
  setFocus?: string;
100
- skin?: 'oxide' | 'oxide-dark';
101
- content_css?: 'default' | 'dark';
128
+ skin?: 'oxide' | 'oxide-dark' | 'confab' | 'confab-dark';
129
+ content_css?: 'default' | 'dark' | 'confab' | 'confab-dark';
102
130
  content_style?: string;
103
131
  toolbar?: string;
104
132
  toolbar_mode?: 'sliding' | 'floating' | 'wrap';
@@ -124,6 +152,8 @@ export declare interface EditorEventMap {
124
152
  change: ChangeCallback;
125
153
  focus: FocusCallback;
126
154
  blur: BlurCallback;
155
+ languagechange: LanguageChangeCallback;
156
+ templatechange: TemplateChangeCallback;
127
157
  }
128
158
 
129
159
  export declare interface EditorEvents {
@@ -185,6 +215,12 @@ declare interface FontSizeOptions {
185
215
  */
186
216
  export declare function getGetFileSrc(): (path: string) => string;
187
217
 
218
+ /**
219
+ * Get the locale string map for a given language code.
220
+ * Falls back to English if the code is not found.
221
+ */
222
+ export declare function getLocale(code: string): Record<string, string>;
223
+
188
224
  /**
189
225
  * Get global translation function
190
226
  */
@@ -215,9 +251,13 @@ export declare class HTMLEditor implements MDHTMLEditor {
215
251
  private customButtons;
216
252
  private eventListeners;
217
253
  private changeTimeout;
254
+ private imageUploadHelper;
218
255
  constructor(container: HTMLElement, config?: EditorConfig);
219
256
  private normalizeConfig;
220
257
  private createEditor;
258
+ private getImageUploadHelper;
259
+ private setupImageHandlers;
260
+ private handleImageFileUpload;
221
261
  private buildExtensions;
222
262
  private handleChange;
223
263
  getContent(): string;
@@ -233,6 +273,10 @@ export declare class HTMLEditor implements MDHTMLEditor {
233
273
  fire<K extends keyof EditorEventMap>(event: K, ...args: Parameters<EditorEventMap[K]>): void;
234
274
  destroy(): void;
235
275
  getTipTap(): Editor | null;
276
+ /**
277
+ * Set the UI language, updating all toolbar and dialog translations.
278
+ */
279
+ setLanguage(code: string): void;
236
280
  /**
237
281
  * Get the editor config
238
282
  */
@@ -243,6 +287,12 @@ export declare class HTMLEditor implements MDHTMLEditor {
243
287
  isBasicEditor(): boolean;
244
288
  }
245
289
 
290
+ /**
291
+ * MDHTMLEditor Icon Sets
292
+ * Skin-specific icon registries for toolbar buttons
293
+ */
294
+ export declare type IconSet = Record<string, string>;
295
+
246
296
  /**
247
297
  * Image upload handler
248
298
  */
@@ -263,6 +313,8 @@ export declare interface ImageUploadResult {
263
313
  */
264
314
  declare type InitCallback = (editor: MDHTMLEditor) => void;
265
315
 
316
+ export declare type LanguageChangeCallback = (code: string) => void;
317
+
266
318
  export declare const LineHeight: Extension<LineHeightOptions, any>;
267
319
 
268
320
  declare interface LineHeightOptions {
@@ -290,9 +342,17 @@ export declare interface MDHTMLEditor {
290
342
  off<K extends keyof EditorEventMap>(event: K, callback: EditorEventMap[K]): void;
291
343
  fire<K extends keyof EditorEventMap>(event: K, ...args: Parameters<EditorEventMap[K]>): void;
292
344
  destroy(): void;
345
+ setLanguage(code: string): void;
293
346
  getTipTap(): Editor | null;
294
347
  }
295
348
 
349
+ /**
350
+ * Reset the global translation function to the default identity function.
351
+ * This also clears the customized flag so that the next editor created
352
+ * will auto-apply the built-in locale based on its language config.
353
+ */
354
+ export declare function resetTranslate(): void;
355
+
296
356
  export declare class SearchReplace {
297
357
  private options;
298
358
  private overlay;
@@ -342,6 +402,8 @@ export declare function setGetFileSrc(fn: (path: string) => string): void;
342
402
  */
343
403
  export declare function setTranslate(fn: TranslateFunction): void;
344
404
 
405
+ export declare const SignatureBlock: Node_2<any, any>;
406
+
345
407
  /**
346
408
  * Template object for email templates
347
409
  */
@@ -352,6 +414,8 @@ export declare interface Template {
352
414
  content: string;
353
415
  }
354
416
 
417
+ declare type TemplateChangeCallback = (template: Template) => void;
418
+
355
419
  export declare const TextDirection: Extension<TextDirectionOptions, any>;
356
420
 
357
421
  declare interface TextDirectionOptions {
@@ -367,12 +431,21 @@ export declare class Toolbar {
367
431
  private dropdowns;
368
432
  private charMap;
369
433
  private emojiPicker;
434
+ private imageUpload;
370
435
  private searchReplace;
371
436
  private updateInterval;
437
+ private boundClickHandler;
438
+ private boundKeydownHandler;
439
+ private overflowEl;
440
+ private toggleBtn;
372
441
  constructor(container: HTMLElement, options: ToolbarOptions);
373
442
  private get tiptap();
374
443
  private get trans();
444
+ private icon;
375
445
  private render;
446
+ private renderGroups;
447
+ private createToggleButton;
448
+ private toggleOverflow;
376
449
  private createButton;
377
450
  private createActionButton;
378
451
  private createCustomButton;
@@ -383,6 +456,7 @@ export declare class Toolbar {
383
456
  private createDropdown;
384
457
  private createColorPicker;
385
458
  private bindEvents;
459
+ private unbindEvents;
386
460
  private closeAllDropdowns;
387
461
  private startStateUpdates;
388
462
  private updateButtonStates;
@@ -394,6 +468,7 @@ export declare class Toolbar {
394
468
  private openSourceCode;
395
469
  private openPreview;
396
470
  private toggleFullscreen;
471
+ rebuild(): void;
397
472
  destroy(): void;
398
473
  }
399
474
 
@@ -423,6 +498,7 @@ declare interface ToolbarOptions {
423
498
  sticky: boolean;
424
499
  customButtons: Map<string, ToolbarButtonSpec>;
425
500
  config: EditorConfig;
501
+ iconSet: IconSet;
426
502
  }
427
503
 
428
504
  /**
@@ -430,6 +506,9 @@ declare interface ToolbarOptions {
430
506
  */
431
507
  export declare type TranslateFunction = (key: string) => string;
432
508
 
509
+ /** All translation keys used by the editor */
510
+ export declare const TRANSLATION_KEYS: string[];
511
+
433
512
  /**
434
513
  * UI Registry for custom buttons (TinyMCE-compatible)
435
514
  */