@phuong-tran-redoc/document-engine-angular 0.0.41 → 0.1.1
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/LICENSE.md +19 -0
- package/README.md +95 -233
- package/THIRD-PARTY-NOTICES.txt +67 -0
- package/fesm2022/phuong-tran-redoc-document-engine-angular.mjs +241 -130
- package/fesm2022/phuong-tran-redoc-document-engine-angular.mjs.map +1 -1
- package/index.d.ts +284 -224
- package/package.json +47 -38
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { OnInit, OnChanges, OnDestroy, EventEmitter, SimpleChanges,
|
|
3
|
-
import { IndentOptions, DynamicFieldOptions, DynamicFieldCategory as DynamicFieldCategory$1, RestrictedEditingOptions, TextCaseType, ListStyleType,
|
|
2
|
+
import { OnInit, OnChanges, OnDestroy, EventEmitter, SimpleChanges, InjectionToken, AfterViewInit, ElementRef, Renderer2, ChangeDetectorRef, Type, Injector, AfterContentInit, QueryList } from '@angular/core';
|
|
3
|
+
import { IndentOptions, DynamicFieldOptions, DynamicFieldCategory as DynamicFieldCategory$1, RestrictedEditingOptions, Color, TextCaseType, ListStyleType, DynamicFieldItem as DynamicFieldItem$1 } from '@phuong-tran-redoc/document-engine-core';
|
|
4
4
|
import { BlockquoteOptions } from '@tiptap/extension-blockquote';
|
|
5
5
|
import { BoldOptions } from '@tiptap/extension-bold';
|
|
6
6
|
import { CodeOptions } from '@tiptap/extension-code';
|
|
@@ -19,10 +19,9 @@ import { UnderlineOptions } from '@tiptap/extension-underline';
|
|
|
19
19
|
import { UndoRedoOptions, PlaceholderOptions, CharacterCountOptions } from '@tiptap/extensions';
|
|
20
20
|
import { Editor, Content, EditorEvents, Extension } from '@tiptap/core';
|
|
21
21
|
export { Editor } from '@tiptap/core';
|
|
22
|
-
import * as i2 from '@angular/common';
|
|
23
|
-
import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
|
|
24
22
|
import * as _angular_forms from '@angular/forms';
|
|
25
23
|
import { ControlValueAccessor, ValidatorFn, FormControl } from '@angular/forms';
|
|
24
|
+
import { BubbleMenuPluginProps } from '@tiptap/extension-bubble-menu';
|
|
26
25
|
import { FloatingMenuPluginProps } from '@tiptap/extension-floating-menu';
|
|
27
26
|
import { Placement } from '@floating-ui/dom';
|
|
28
27
|
import { SafeHtml } from '@angular/platform-browser';
|
|
@@ -55,6 +54,43 @@ type SelectButton = {
|
|
|
55
54
|
};
|
|
56
55
|
type ToolbarButton = IconButton | SelectButton;
|
|
57
56
|
|
|
57
|
+
/**
|
|
58
|
+
* The result a consumer's media picker resolves to.
|
|
59
|
+
*
|
|
60
|
+
* Returned by the async `image.onPick` config hook. The shape is intentionally
|
|
61
|
+
* minimal and presentation-light: `id` is the opaque media reference (inserted as
|
|
62
|
+
* an `image-ref` node when that node is enabled), `url` is the resolved address
|
|
63
|
+
* (used for a plain image fallback), and `alt` is an optional text hint.
|
|
64
|
+
*/
|
|
65
|
+
interface MediaResult {
|
|
66
|
+
/** Opaque media id — inserted as an `image-ref` node when available. */
|
|
67
|
+
id: string;
|
|
68
|
+
/** Resolved image URL — used for a plain `<img>` fallback. */
|
|
69
|
+
url: string;
|
|
70
|
+
/** Optional alternative text. */
|
|
71
|
+
alt?: string;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Async hook a consumer provides via `image.onPick` to supply images from its own
|
|
75
|
+
* media library. Resolving `null`/`undefined` (or rejecting) is treated as a
|
|
76
|
+
* cancel — the editor inserts nothing and stays usable.
|
|
77
|
+
*/
|
|
78
|
+
type ImagePickHook = () => Promise<MediaResult | null | undefined>;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Image options plus the optional async `onPick` media-picker hook. When `onPick`
|
|
82
|
+
* is provided, the image insert view delegates selection to the consumer's picker
|
|
83
|
+
* instead of asking for a raw URL.
|
|
84
|
+
*/
|
|
85
|
+
type ImageConfig = Partial<ImageOptions> & {
|
|
86
|
+
/**
|
|
87
|
+
* Async hook that supplies an image from the consumer's own media library.
|
|
88
|
+
* When set, the insert view calls it and inserts the result (an `image-ref`
|
|
89
|
+
* node when that node is enabled, else a plain image). Resolving nothing or
|
|
90
|
+
* rejecting is a no-op.
|
|
91
|
+
*/
|
|
92
|
+
onPick?: ImagePickHook;
|
|
93
|
+
};
|
|
58
94
|
/**
|
|
59
95
|
* Định nghĩa cấu hình đầy đủ cho DocumentEngineKit (Factory của bạn).
|
|
60
96
|
* Hầu hết các tùy chọn đều là:
|
|
@@ -164,10 +200,17 @@ interface DocumentEngineConfig {
|
|
|
164
200
|
*/
|
|
165
201
|
blockquote: Partial<BlockquoteOptions> | boolean;
|
|
166
202
|
/**
|
|
167
|
-
*
|
|
203
|
+
* Options for @tiptap/extension-image. May include `onPick` to delegate image
|
|
204
|
+
* selection to the consumer's own media picker.
|
|
168
205
|
* @default {}
|
|
169
206
|
*/
|
|
170
|
-
image?:
|
|
207
|
+
image?: ImageConfig | boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Enable the URL-free `image-ref` node (`<figure data-block="image-ref" data-image-id>`).
|
|
210
|
+
* Stores an opaque media id; the consumer resolves the real responsive image.
|
|
211
|
+
* @default false
|
|
212
|
+
*/
|
|
213
|
+
imageRef?: boolean;
|
|
171
214
|
/**
|
|
172
215
|
* Cấu hình cho @tiptap/extension-table (StyledTableKit)
|
|
173
216
|
* @default false
|
|
@@ -343,7 +386,93 @@ declare class DocumentEditorComponent implements OnInit, OnChanges, OnDestroy {
|
|
|
343
386
|
*/
|
|
344
387
|
private mergeConfig;
|
|
345
388
|
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentEditorComponent, never>;
|
|
346
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<DocumentEditorComponent, "document-engine-editor", never, { "config": { "alias": "config"; "required": false; }; }, { "editorReady": "editorReady"; }, never, ["*"],
|
|
389
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<DocumentEditorComponent, "document-engine-editor", never, { "config": { "alias": "config"; "required": false; }; }, { "editorReady": "editorReady"; }, never, ["*"], true, never>;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Type definition for HTML preprocessor function.
|
|
394
|
+
* Allows clients to transform HTML content before it's set into the editor.
|
|
395
|
+
*
|
|
396
|
+
* @param html - The raw HTML string to be processed
|
|
397
|
+
* @returns The processed HTML string that will be set into the editor
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* ```typescript
|
|
401
|
+
* const myPreprocessor: EditorHtmlPreprocessor = (html: string) => {
|
|
402
|
+
* // Remove all script tags for security
|
|
403
|
+
* return html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
|
|
404
|
+
* };
|
|
405
|
+
* ```
|
|
406
|
+
*/
|
|
407
|
+
type EditorHtmlPreprocessor = (html: string) => string;
|
|
408
|
+
/**
|
|
409
|
+
* Injection token for HTML preprocessor function.
|
|
410
|
+
* Use this token to provide a custom function that processes HTML content
|
|
411
|
+
* before it's set into the TipTap editor.
|
|
412
|
+
*
|
|
413
|
+
* This is optional - if not provided, the editor will use the HTML content as-is.
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* ```typescript
|
|
417
|
+
* // In your component or module providers
|
|
418
|
+
* {
|
|
419
|
+
* provide: EDITOR_HTML_PREPROCESSOR,
|
|
420
|
+
* useValue: (html: string) => {
|
|
421
|
+
* // Your custom preprocessing logic
|
|
422
|
+
* return html.replace(/old/g, 'new');
|
|
423
|
+
* }
|
|
424
|
+
* }
|
|
425
|
+
* ```
|
|
426
|
+
*/
|
|
427
|
+
declare const EDITOR_HTML_PREPROCESSOR: InjectionToken<EditorHtmlPreprocessor>;
|
|
428
|
+
/**
|
|
429
|
+
* Injection token for content wrapper class.
|
|
430
|
+
* Use this token to provide a custom class name for the content wrapper element.
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* ```typescript
|
|
434
|
+
* // In your component or module providers
|
|
435
|
+
* {
|
|
436
|
+
* provide: EDITOR_CONTENT_WRAPPER_CLASS,
|
|
437
|
+
* useValue: 'my-content-wrapper'
|
|
438
|
+
* }
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
441
|
+
declare const EDITOR_CONTENT_WRAPPER_CLASS: InjectionToken<string | null>;
|
|
442
|
+
|
|
443
|
+
declare class TiptapEditorDirective implements OnInit, AfterViewInit, ControlValueAccessor {
|
|
444
|
+
protected elRef: ElementRef<HTMLElement>;
|
|
445
|
+
protected renderer: Renderer2;
|
|
446
|
+
protected changeDetectorRef: ChangeDetectorRef;
|
|
447
|
+
protected htmlPreprocessor: EditorHtmlPreprocessor | null;
|
|
448
|
+
protected contentWrapperClass: string | null;
|
|
449
|
+
private _editor?;
|
|
450
|
+
private initialEditableState?;
|
|
451
|
+
set editor(editor: Editor);
|
|
452
|
+
get editor(): Editor;
|
|
453
|
+
outputFormat: 'json' | 'html';
|
|
454
|
+
protected onChange: (value: Content) => void;
|
|
455
|
+
protected onTouched: () => void;
|
|
456
|
+
writeValue(value: Content): void;
|
|
457
|
+
registerOnChange(fn: () => void): void;
|
|
458
|
+
registerOnTouched(fn: () => void): void;
|
|
459
|
+
setDisabledState(isDisabled: boolean): void;
|
|
460
|
+
protected handleChange: ({ editor, transaction }: EditorEvents["transaction"]) => void;
|
|
461
|
+
ngOnInit(): void;
|
|
462
|
+
ngAfterViewInit(): void;
|
|
463
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TiptapEditorDirective, never>;
|
|
464
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<TiptapEditorDirective, "tiptap[editor], [tiptap][editor], tiptap-editor[editor], [tiptapEditor][editor]", never, { "editor": { "alias": "editor"; "required": false; }; "outputFormat": { "alias": "outputFormat"; "required": false; }; }, {}, never, never, true, never>;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Back-compat shim for NgModule-based consumers. `DocumentEditorComponent` is now
|
|
469
|
+
* standalone (and `@defer`-friendly); standalone consumers should import it (and
|
|
470
|
+
* `TiptapEditorDirective`) directly instead of this module.
|
|
471
|
+
*/
|
|
472
|
+
declare class DocumentEditorModule {
|
|
473
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentEditorModule, never>;
|
|
474
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DocumentEditorModule, never, [typeof DocumentEditorComponent, typeof TiptapEditorDirective], [typeof DocumentEditorComponent, typeof TiptapEditorDirective]>;
|
|
475
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<DocumentEditorModule>;
|
|
347
476
|
}
|
|
348
477
|
|
|
349
478
|
type BubbleTarget = {
|
|
@@ -507,219 +636,6 @@ interface ToolbarBubbleMenuConfig {
|
|
|
507
636
|
maxWidth?: string;
|
|
508
637
|
}
|
|
509
638
|
|
|
510
|
-
interface ToolbarState {
|
|
511
|
-
isReadOnly: boolean;
|
|
512
|
-
canUndo: boolean;
|
|
513
|
-
canRedo: boolean;
|
|
514
|
-
canResetFormat: boolean;
|
|
515
|
-
canToggleBold: boolean;
|
|
516
|
-
canToggleItalic: boolean;
|
|
517
|
-
canToggleUnderline: boolean;
|
|
518
|
-
canToggleStrike: boolean;
|
|
519
|
-
canToggleSubscript: boolean;
|
|
520
|
-
canToggleSuperscript: boolean;
|
|
521
|
-
canToggleCode: boolean;
|
|
522
|
-
canToggleLink: boolean;
|
|
523
|
-
canDecreaseIndent: boolean;
|
|
524
|
-
canIncreaseIndent: boolean;
|
|
525
|
-
canToggleBulletList: boolean;
|
|
526
|
-
canToggleBlockquote: boolean;
|
|
527
|
-
canInsertPageBreak: boolean;
|
|
528
|
-
canToggleEditableRegion: boolean;
|
|
529
|
-
canClearContent: boolean;
|
|
530
|
-
}
|
|
531
|
-
declare const DEFAULT_TOOLBAR_STATE: ToolbarState;
|
|
532
|
-
declare function buildToolbarState(editor: Editor, config?: Partial<DocumentEngineConfig>): ToolbarState;
|
|
533
|
-
|
|
534
|
-
/**
|
|
535
|
-
* Toolbar component for document editor
|
|
536
|
-
* Provides toolbar controls for editor actions
|
|
537
|
-
*/
|
|
538
|
-
declare class ToolbarComponent implements OnInit, OnDestroy {
|
|
539
|
-
private readonly cdr;
|
|
540
|
-
private readonly ngZone;
|
|
541
|
-
private readonly toolbarService;
|
|
542
|
-
editor: Editor;
|
|
543
|
-
capabilities: EditorCapabilities;
|
|
544
|
-
config?: Partial<DocumentEngineConfig>;
|
|
545
|
-
readonly action: i0.EventEmitter<string>;
|
|
546
|
-
activeFontSize: string | null;
|
|
547
|
-
activeLineHeight: string | null;
|
|
548
|
-
activeHeading: number | null;
|
|
549
|
-
activeTextAlign: string | null;
|
|
550
|
-
activeTextAlignIcon: string;
|
|
551
|
-
toolbarState: ToolbarState;
|
|
552
|
-
readonly fontSizeOptions: {
|
|
553
|
-
value: string;
|
|
554
|
-
label: string;
|
|
555
|
-
}[];
|
|
556
|
-
readonly lineHeightOptions: ({
|
|
557
|
-
value: null;
|
|
558
|
-
label: string;
|
|
559
|
-
} | {
|
|
560
|
-
value: string;
|
|
561
|
-
label: string;
|
|
562
|
-
})[];
|
|
563
|
-
readonly textCaseOptions: {
|
|
564
|
-
value: TextCaseType;
|
|
565
|
-
label: string;
|
|
566
|
-
}[];
|
|
567
|
-
readonly headingOptions: ({
|
|
568
|
-
value: null;
|
|
569
|
-
label: string;
|
|
570
|
-
class: string;
|
|
571
|
-
} | {
|
|
572
|
-
value: number;
|
|
573
|
-
label: string;
|
|
574
|
-
class: string;
|
|
575
|
-
})[];
|
|
576
|
-
readonly textAlignOptions: {
|
|
577
|
-
value: string;
|
|
578
|
-
label: string;
|
|
579
|
-
icon: string;
|
|
580
|
-
}[];
|
|
581
|
-
readonly listStyleOptions: {
|
|
582
|
-
value: ListStyleType;
|
|
583
|
-
label: string;
|
|
584
|
-
example: string;
|
|
585
|
-
}[];
|
|
586
|
-
private colorBubbleMenu;
|
|
587
|
-
private linkBubbleWrapper;
|
|
588
|
-
private imageBubbleMenu;
|
|
589
|
-
private specialCharsBubbleMenu;
|
|
590
|
-
private dynamicFieldsBubbleMenu;
|
|
591
|
-
private templateBubbleMenu;
|
|
592
|
-
private tableCreateBubbleMenu;
|
|
593
|
-
readonly colorBubbleConfig: ToolbarBubbleMenuConfig;
|
|
594
|
-
readonly linkBubbleConfig: EditorBubbleMenuConfig;
|
|
595
|
-
readonly tableBubbleConfig: EditorBubbleMenuConfig;
|
|
596
|
-
readonly imageBubbleConfig: ToolbarBubbleMenuConfig;
|
|
597
|
-
readonly specialCharsBubbleConfig: ToolbarBubbleMenuConfig;
|
|
598
|
-
readonly dynamicFieldsBubbleConfig: ToolbarBubbleMenuConfig;
|
|
599
|
-
readonly templateBubbleConfig: ToolbarBubbleMenuConfig;
|
|
600
|
-
readonly tableCreateBubbleConfig: ToolbarBubbleMenuConfig;
|
|
601
|
-
private throttleUpdateToolbarState;
|
|
602
|
-
private updateToolbarState;
|
|
603
|
-
ngOnInit(): void;
|
|
604
|
-
ngOnDestroy(): void;
|
|
605
|
-
runAndEmit(actionName: string, chain: () => void): void;
|
|
606
|
-
setFontSize(size: string | null): void;
|
|
607
|
-
setLineHeight(lineHeight: string | null): void;
|
|
608
|
-
setHeading(level: string | null): void;
|
|
609
|
-
setTextAlign(align: string | null): void;
|
|
610
|
-
setListStyle(listStyleType: ListStyleType): void;
|
|
611
|
-
openColorBubble(event: MouseEvent, type: 'text' | 'fill'): void;
|
|
612
|
-
toggleLink(): void;
|
|
613
|
-
insertImage(event: MouseEvent): void;
|
|
614
|
-
openSpecialCharsBubble(event: MouseEvent): void;
|
|
615
|
-
openDynamicFieldsBubble(event: MouseEvent): void;
|
|
616
|
-
openTemplateBubble(event: MouseEvent): void;
|
|
617
|
-
openCreateTableBubble(event: MouseEvent): void;
|
|
618
|
-
trackByValue(index: number, item: {
|
|
619
|
-
value: unknown;
|
|
620
|
-
}): unknown;
|
|
621
|
-
trackByIndex(index: number): number;
|
|
622
|
-
get customToolbarButtons(): ToolbarButton[];
|
|
623
|
-
handleCustomIconButton(button: ToolbarButton): void;
|
|
624
|
-
handleCustomSelectButton(button: ToolbarButton, value: string): void;
|
|
625
|
-
printValue(): void;
|
|
626
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ToolbarComponent, never>;
|
|
627
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ToolbarComponent, "document-engine-toolbar", never, { "editor": { "alias": "editor"; "required": false; }; "capabilities": { "alias": "capabilities"; "required": false; }; "config": { "alias": "config"; "required": false; }; }, { "action": "action"; }, never, never, true, never>;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
/**
|
|
631
|
-
* Footer component for document editor
|
|
632
|
-
* Container for footer components like character count
|
|
633
|
-
*/
|
|
634
|
-
declare class FooterComponent {
|
|
635
|
-
editor: Editor;
|
|
636
|
-
config?: Partial<DocumentEngineConfig>;
|
|
637
|
-
hasCharacterCount(): boolean;
|
|
638
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<FooterComponent, never>;
|
|
639
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<FooterComponent, "document-engine-footer", never, { "editor": { "alias": "editor"; "required": false; }; "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
/**
|
|
643
|
-
* Type definition for HTML preprocessor function.
|
|
644
|
-
* Allows clients to transform HTML content before it's set into the editor.
|
|
645
|
-
*
|
|
646
|
-
* @param html - The raw HTML string to be processed
|
|
647
|
-
* @returns The processed HTML string that will be set into the editor
|
|
648
|
-
*
|
|
649
|
-
* @example
|
|
650
|
-
* ```typescript
|
|
651
|
-
* const myPreprocessor: EditorHtmlPreprocessor = (html: string) => {
|
|
652
|
-
* // Remove all script tags for security
|
|
653
|
-
* return html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
|
|
654
|
-
* };
|
|
655
|
-
* ```
|
|
656
|
-
*/
|
|
657
|
-
type EditorHtmlPreprocessor = (html: string) => string;
|
|
658
|
-
/**
|
|
659
|
-
* Injection token for HTML preprocessor function.
|
|
660
|
-
* Use this token to provide a custom function that processes HTML content
|
|
661
|
-
* before it's set into the TipTap editor.
|
|
662
|
-
*
|
|
663
|
-
* This is optional - if not provided, the editor will use the HTML content as-is.
|
|
664
|
-
*
|
|
665
|
-
* @example
|
|
666
|
-
* ```typescript
|
|
667
|
-
* // In your component or module providers
|
|
668
|
-
* {
|
|
669
|
-
* provide: EDITOR_HTML_PREPROCESSOR,
|
|
670
|
-
* useValue: (html: string) => {
|
|
671
|
-
* // Your custom preprocessing logic
|
|
672
|
-
* return html.replace(/old/g, 'new');
|
|
673
|
-
* }
|
|
674
|
-
* }
|
|
675
|
-
* ```
|
|
676
|
-
*/
|
|
677
|
-
declare const EDITOR_HTML_PREPROCESSOR: InjectionToken<EditorHtmlPreprocessor>;
|
|
678
|
-
/**
|
|
679
|
-
* Injection token for content wrapper class.
|
|
680
|
-
* Use this token to provide a custom class name for the content wrapper element.
|
|
681
|
-
*
|
|
682
|
-
* @example
|
|
683
|
-
* ```typescript
|
|
684
|
-
* // In your component or module providers
|
|
685
|
-
* {
|
|
686
|
-
* provide: EDITOR_CONTENT_WRAPPER_CLASS,
|
|
687
|
-
* useValue: 'my-content-wrapper'
|
|
688
|
-
* }
|
|
689
|
-
* ```
|
|
690
|
-
*/
|
|
691
|
-
declare const EDITOR_CONTENT_WRAPPER_CLASS: InjectionToken<string | null>;
|
|
692
|
-
|
|
693
|
-
declare class TiptapEditorDirective implements OnInit, AfterViewInit, ControlValueAccessor {
|
|
694
|
-
protected elRef: ElementRef<HTMLElement>;
|
|
695
|
-
protected renderer: Renderer2;
|
|
696
|
-
protected changeDetectorRef: ChangeDetectorRef;
|
|
697
|
-
protected htmlPreprocessor: EditorHtmlPreprocessor | null;
|
|
698
|
-
protected contentWrapperClass: string | null;
|
|
699
|
-
private _editor?;
|
|
700
|
-
private initialEditableState?;
|
|
701
|
-
set editor(editor: Editor);
|
|
702
|
-
get editor(): Editor;
|
|
703
|
-
outputFormat: 'json' | 'html';
|
|
704
|
-
protected onChange: (value: Content) => void;
|
|
705
|
-
protected onTouched: () => void;
|
|
706
|
-
writeValue(value: Content): void;
|
|
707
|
-
registerOnChange(fn: () => void): void;
|
|
708
|
-
registerOnTouched(fn: () => void): void;
|
|
709
|
-
setDisabledState(isDisabled: boolean): void;
|
|
710
|
-
protected handleChange: ({ editor, transaction }: EditorEvents["transaction"]) => void;
|
|
711
|
-
ngOnInit(): void;
|
|
712
|
-
ngAfterViewInit(): void;
|
|
713
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<TiptapEditorDirective, never>;
|
|
714
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<TiptapEditorDirective, "tiptap[editor], [tiptap][editor], tiptap-editor[editor], [tiptapEditor][editor]", never, { "editor": { "alias": "editor"; "required": false; }; "outputFormat": { "alias": "outputFormat"; "required": false; }; }, {}, never, never, true, never>;
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
declare class DocumentEditorModule {
|
|
718
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentEditorModule, never>;
|
|
719
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<DocumentEditorModule, [typeof DocumentEditorComponent], [typeof i2.CommonModule, typeof ToolbarComponent, typeof FooterComponent, typeof TiptapEditorDirective], [typeof DocumentEditorComponent, typeof TiptapEditorDirective]>;
|
|
720
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<DocumentEditorModule>;
|
|
721
|
-
}
|
|
722
|
-
|
|
723
639
|
declare class TiptapBubbleMenuDirective implements OnInit, OnDestroy {
|
|
724
640
|
private elRef;
|
|
725
641
|
props: BubbleMenuProps;
|
|
@@ -1094,6 +1010,126 @@ declare class SelectComponent implements AfterContentInit, OnChanges, OnDestroy,
|
|
|
1094
1010
|
static ɵcmp: i0.ɵɵComponentDeclaration<SelectComponent, "document-engine-select", never, { "value": { "alias": "value"; "required": false; }; "disabled": { "alias": "disabled"; "required": false; }; "labelMode": { "alias": "labelMode"; "required": false; }; "variant": { "alias": "variant"; "required": false; }; }, { "valueChange": "valueChange"; }, ["labelDirectives", "options"], ["[documentEngineSelectLabel]", "*"], true, never>;
|
|
1095
1011
|
}
|
|
1096
1012
|
|
|
1013
|
+
interface ToolbarState {
|
|
1014
|
+
isReadOnly: boolean;
|
|
1015
|
+
canUndo: boolean;
|
|
1016
|
+
canRedo: boolean;
|
|
1017
|
+
canResetFormat: boolean;
|
|
1018
|
+
canToggleBold: boolean;
|
|
1019
|
+
canToggleItalic: boolean;
|
|
1020
|
+
canToggleUnderline: boolean;
|
|
1021
|
+
canToggleStrike: boolean;
|
|
1022
|
+
canToggleSubscript: boolean;
|
|
1023
|
+
canToggleSuperscript: boolean;
|
|
1024
|
+
canToggleCode: boolean;
|
|
1025
|
+
canToggleLink: boolean;
|
|
1026
|
+
canDecreaseIndent: boolean;
|
|
1027
|
+
canIncreaseIndent: boolean;
|
|
1028
|
+
canToggleBulletList: boolean;
|
|
1029
|
+
canToggleBlockquote: boolean;
|
|
1030
|
+
canInsertPageBreak: boolean;
|
|
1031
|
+
canToggleEditableRegion: boolean;
|
|
1032
|
+
canClearContent: boolean;
|
|
1033
|
+
}
|
|
1034
|
+
declare const DEFAULT_TOOLBAR_STATE: ToolbarState;
|
|
1035
|
+
declare function buildToolbarState(editor: Editor, config?: Partial<DocumentEngineConfig>): ToolbarState;
|
|
1036
|
+
|
|
1037
|
+
/**
|
|
1038
|
+
* Toolbar component for document editor
|
|
1039
|
+
* Provides toolbar controls for editor actions
|
|
1040
|
+
*/
|
|
1041
|
+
declare class ToolbarComponent implements OnInit, OnDestroy {
|
|
1042
|
+
private readonly cdr;
|
|
1043
|
+
private readonly ngZone;
|
|
1044
|
+
private readonly toolbarService;
|
|
1045
|
+
editor: Editor;
|
|
1046
|
+
capabilities: EditorCapabilities;
|
|
1047
|
+
config?: Partial<DocumentEngineConfig>;
|
|
1048
|
+
readonly action: i0.EventEmitter<string>;
|
|
1049
|
+
activeFontSize: string | null;
|
|
1050
|
+
activeLineHeight: string | null;
|
|
1051
|
+
activeHeading: number | null;
|
|
1052
|
+
activeTextAlign: string | null;
|
|
1053
|
+
activeTextAlignIcon: string;
|
|
1054
|
+
toolbarState: ToolbarState;
|
|
1055
|
+
readonly fontSizeOptions: {
|
|
1056
|
+
value: string;
|
|
1057
|
+
label: string;
|
|
1058
|
+
}[];
|
|
1059
|
+
readonly lineHeightOptions: ({
|
|
1060
|
+
value: null;
|
|
1061
|
+
label: string;
|
|
1062
|
+
} | {
|
|
1063
|
+
value: string;
|
|
1064
|
+
label: string;
|
|
1065
|
+
})[];
|
|
1066
|
+
readonly textCaseOptions: {
|
|
1067
|
+
value: TextCaseType;
|
|
1068
|
+
label: string;
|
|
1069
|
+
}[];
|
|
1070
|
+
readonly headingOptions: ({
|
|
1071
|
+
value: null;
|
|
1072
|
+
label: string;
|
|
1073
|
+
class: string;
|
|
1074
|
+
} | {
|
|
1075
|
+
value: number;
|
|
1076
|
+
label: string;
|
|
1077
|
+
class: string;
|
|
1078
|
+
})[];
|
|
1079
|
+
readonly textAlignOptions: {
|
|
1080
|
+
value: string;
|
|
1081
|
+
label: string;
|
|
1082
|
+
icon: string;
|
|
1083
|
+
}[];
|
|
1084
|
+
readonly listStyleOptions: {
|
|
1085
|
+
value: ListStyleType;
|
|
1086
|
+
label: string;
|
|
1087
|
+
example: string;
|
|
1088
|
+
}[];
|
|
1089
|
+
private colorBubbleMenu;
|
|
1090
|
+
private linkBubbleWrapper;
|
|
1091
|
+
private imageBubbleMenu;
|
|
1092
|
+
private specialCharsBubbleMenu;
|
|
1093
|
+
private dynamicFieldsBubbleMenu;
|
|
1094
|
+
private templateBubbleMenu;
|
|
1095
|
+
private tableCreateBubbleMenu;
|
|
1096
|
+
readonly colorBubbleConfig: ToolbarBubbleMenuConfig;
|
|
1097
|
+
readonly linkBubbleConfig: EditorBubbleMenuConfig;
|
|
1098
|
+
readonly tableBubbleConfig: EditorBubbleMenuConfig;
|
|
1099
|
+
readonly imageBubbleConfig: ToolbarBubbleMenuConfig;
|
|
1100
|
+
readonly specialCharsBubbleConfig: ToolbarBubbleMenuConfig;
|
|
1101
|
+
readonly dynamicFieldsBubbleConfig: ToolbarBubbleMenuConfig;
|
|
1102
|
+
readonly templateBubbleConfig: ToolbarBubbleMenuConfig;
|
|
1103
|
+
readonly tableCreateBubbleConfig: ToolbarBubbleMenuConfig;
|
|
1104
|
+
private throttleUpdateToolbarState;
|
|
1105
|
+
private updateToolbarState;
|
|
1106
|
+
ngOnInit(): void;
|
|
1107
|
+
ngOnDestroy(): void;
|
|
1108
|
+
runAndEmit(actionName: string, chain: () => void): void;
|
|
1109
|
+
setFontSize(size: string | null): void;
|
|
1110
|
+
setLineHeight(lineHeight: string | null): void;
|
|
1111
|
+
setHeading(level: string | null): void;
|
|
1112
|
+
setTextAlign(align: string | null): void;
|
|
1113
|
+
setListStyle(listStyleType: ListStyleType): void;
|
|
1114
|
+
openColorBubble(event: MouseEvent, type: 'text' | 'fill'): void;
|
|
1115
|
+
toggleLink(): void;
|
|
1116
|
+
insertImage(event: MouseEvent): void;
|
|
1117
|
+
openSpecialCharsBubble(event: MouseEvent): void;
|
|
1118
|
+
openDynamicFieldsBubble(event: MouseEvent): void;
|
|
1119
|
+
openTemplateBubble(event: MouseEvent): void;
|
|
1120
|
+
openCreateTableBubble(event: MouseEvent): void;
|
|
1121
|
+
trackByValue(index: number, item: {
|
|
1122
|
+
value: unknown;
|
|
1123
|
+
}): unknown;
|
|
1124
|
+
trackByIndex(index: number): number;
|
|
1125
|
+
get customToolbarButtons(): ToolbarButton[];
|
|
1126
|
+
handleCustomIconButton(button: ToolbarButton): void;
|
|
1127
|
+
handleCustomSelectButton(button: ToolbarButton, value: string): void;
|
|
1128
|
+
printValue(): void;
|
|
1129
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ToolbarComponent, never>;
|
|
1130
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<ToolbarComponent, "document-engine-toolbar", never, { "editor": { "alias": "editor"; "required": false; }; "capabilities": { "alias": "capabilities"; "required": false; }; "config": { "alias": "config"; "required": false; }; }, { "action": "action"; }, never, never, true, never>;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1097
1133
|
/**
|
|
1098
1134
|
* Service to handle toolbar action emissions
|
|
1099
1135
|
*/
|
|
@@ -1113,6 +1149,18 @@ declare class ToolbarService implements OnDestroy {
|
|
|
1113
1149
|
static ɵprov: i0.ɵɵInjectableDeclaration<ToolbarService>;
|
|
1114
1150
|
}
|
|
1115
1151
|
|
|
1152
|
+
/**
|
|
1153
|
+
* Footer component for document editor
|
|
1154
|
+
* Container for footer components like character count
|
|
1155
|
+
*/
|
|
1156
|
+
declare class FooterComponent {
|
|
1157
|
+
editor: Editor;
|
|
1158
|
+
config?: Partial<DocumentEngineConfig>;
|
|
1159
|
+
hasCharacterCount(): boolean;
|
|
1160
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<FooterComponent, never>;
|
|
1161
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<FooterComponent, "document-engine-footer", never, { "editor": { "alias": "editor"; "required": false; }; "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1116
1164
|
/**
|
|
1117
1165
|
* Character Count component for document editor footer
|
|
1118
1166
|
* Displays character/word count with optional limit and color coding
|
|
@@ -1366,9 +1414,13 @@ declare class ColorPickerViewComponent implements BubbleMenuViewContent<Record<s
|
|
|
1366
1414
|
}
|
|
1367
1415
|
|
|
1368
1416
|
/**
|
|
1369
|
-
*
|
|
1370
|
-
*
|
|
1371
|
-
*
|
|
1417
|
+
* Image insert view for the bubble menu.
|
|
1418
|
+
*
|
|
1419
|
+
* Two modes:
|
|
1420
|
+
* - When the editor's `image` config supplies an async `onPick` hook, the view
|
|
1421
|
+
* delegates selection to the consumer's media picker and inserts the result
|
|
1422
|
+
* (an `image-ref` node when that node is enabled, else a plain image).
|
|
1423
|
+
* - Otherwise it falls back to the built-in raw-URL input form.
|
|
1372
1424
|
*/
|
|
1373
1425
|
declare class ImageInsertViewComponent implements BubbleMenuViewContent<Record<string, unknown>> {
|
|
1374
1426
|
private fb;
|
|
@@ -1376,13 +1428,21 @@ declare class ImageInsertViewComponent implements BubbleMenuViewContent<Record<s
|
|
|
1376
1428
|
editor?: Editor;
|
|
1377
1429
|
close?: () => void;
|
|
1378
1430
|
goBack?: (viewId?: string) => void;
|
|
1431
|
+
/** True while the consumer's `onPick` promise is in flight. */
|
|
1432
|
+
loading: boolean;
|
|
1379
1433
|
imageForm: _angular_forms.FormGroup<{
|
|
1380
1434
|
url: _angular_forms.FormControl<string | null>;
|
|
1381
1435
|
alt: _angular_forms.FormControl<string | null>;
|
|
1382
1436
|
}>;
|
|
1437
|
+
/** The consumer's media picker, read off the `image` extension options (if any). */
|
|
1438
|
+
private get onPick();
|
|
1439
|
+
/** Whether to show the picker mode (vs the raw-URL fallback form). */
|
|
1440
|
+
get hasPicker(): boolean;
|
|
1383
1441
|
onActivate(): void;
|
|
1384
1442
|
canInsert(): boolean;
|
|
1385
1443
|
insertImage(): void;
|
|
1444
|
+
/** Delegate selection to the consumer's media picker, then insert the result. */
|
|
1445
|
+
pickImage(): Promise<void>;
|
|
1386
1446
|
cancel(): void;
|
|
1387
1447
|
static ɵfac: i0.ɵɵFactoryDeclaration<ImageInsertViewComponent, never>;
|
|
1388
1448
|
static ɵcmp: i0.ɵɵComponentDeclaration<ImageInsertViewComponent, "document-engine-image-insert-view", never, {}, {}, never, never, true, never>;
|
|
@@ -1757,4 +1817,4 @@ declare class EditorBubbleMenuComponent implements OnInit, AfterViewInit, OnDest
|
|
|
1757
1817
|
}
|
|
1758
1818
|
|
|
1759
1819
|
export { ARCHIVE, ARROW_DROP_DOWN, AngularRenderer, ButtonDirective, CHECK, CLEAR_ALL, CLOSE, CODE, CharacterCountComponent, CheckboxComponent, ColorPickerComponent, ColorPickerViewComponent, DEFAULT, DEFAULT_TOOLBAR_STATE, DESCRIPTION, DYNAMIC_FORM, DocumentEditorComponent, DocumentEditorModule, DocumentEngineKit, DynamicFieldsViewComponent, EDIT, EDITOR_CONTENT_WRAPPER_CLASS, EDITOR_HTML_PREPROCESSOR, EditorBubbleMenuComponent, EditorCapabilities, ErrorMessageComponent, EventManager, FORMAT_ALIGN_CENTER, FORMAT_ALIGN_JUSTIFY, FORMAT_ALIGN_LEFT, FORMAT_ALIGN_RIGHT, FORMAT_BOLD, FORMAT_CLEAR, FORMAT_COLOR_FILL, FORMAT_COLOR_TEXT, FORMAT_INDENT_DECREASE, FORMAT_INDENT_INCREASE, FORMAT_ITALIC, FORMAT_LINE_SPACING, FORMAT_LIST_BULLETED, FORMAT_LIST_NUMBERED, FORMAT_QUOTE, FORMAT_SIZE, FORMAT_STRIKETHROUGH, FORMAT_UNDERLINE, FocusTrapService, FooterComponent, INSERT_PAGE_BREAK, IconComponent, IconRegistryService, ImageInsertViewComponent, InputDirective, LINK, LINK_OFF, LabelDirective, LinkEditViewComponent, LinkMainViewComponent, LinkPropertiesViewComponent, MARKDOWN, MATCH_CASE, PHOTO, PRINT, PopoverDirective, REDO, RESTRICT_EDIT, SEARCH, SEARCH_OFF, SETTINGS, SPECIAL_CHARACTER, SUBSCRIPT, SUPERSCRIPT, SelectComponent, SelectLabelDirective, SelectOptionDirective, SpecialCharactersViewComponent, TABLE_CELL_PROPERTY, TABLE_COLUMN, TABLE_MERGE_CELL, TABLE_PROPERTY, TABLE_ROW, TABLE_ROWS, TableCellStyleViewComponent, TableCreateViewComponent, TableMainViewComponent, TableStyleViewComponent, TemplateViewComponent, TiptapBubbleMenuDirective, TiptapDraggableDirective, TiptapEditorDirective, TiptapFloatingMenuDirective, ToggleGroupComponent, ToggleOptionDirective, ToolbarBubbleMenuComponent, ToolbarComponent, ToolbarService, UNDO, VERTICAL_ALIGN_BOTTOM, VERTICAL_ALIGN_CENTER, VERTICAL_ALIGN_TOP, buildToolbarState, selectionChangeHandler, shouldShowFnFactory, urlValidator };
|
|
1760
|
-
export type { BubbleMenuProps, BubbleMenuViewConfig, BubbleMenuViewContent, BubbleTarget, ButtonType, DocumentEngineConfig, DynamicFieldCategory, DynamicFieldItem, EditorBubbleMenuConfig, EditorHtmlPreprocessor, HeadingLevel, IconButton, OutsideHandler, SelectButton, SelectOption, TableCreateViewData, TemplateItem, ToolbarBubbleMenuConfig, ToolbarButton, ToolbarState };
|
|
1820
|
+
export type { BubbleMenuProps, BubbleMenuViewConfig, BubbleMenuViewContent, BubbleTarget, ButtonType, DocumentEngineConfig, DynamicFieldCategory, DynamicFieldItem, EditorBubbleMenuConfig, EditorHtmlPreprocessor, HeadingLevel, IconButton, ImageConfig, ImagePickHook, MediaResult, OutsideHandler, SelectButton, SelectOption, TableCreateViewData, TemplateItem, ToolbarBubbleMenuConfig, ToolbarButton, ToolbarState };
|