@phuong-tran-redoc/document-engine-angular 0.0.33 → 0.0.35
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/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { OnInit, OnChanges, OnDestroy, EventEmitter, SimpleChanges, Type,
|
|
2
|
+
import { OnInit, OnChanges, OnDestroy, EventEmitter, SimpleChanges, Type, InjectionToken, AfterViewInit, ElementRef, Renderer2, ChangeDetectorRef, Injector, AfterContentInit, QueryList } from '@angular/core';
|
|
3
3
|
import { IndentOptions, DynamicFieldOptions, DynamicFieldCategory as DynamicFieldCategory$1, RestrictedEditingOptions, TextCaseType, ListStyleType, Color, 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';
|
|
@@ -321,6 +321,7 @@ declare class EditorCapabilities {
|
|
|
321
321
|
*/
|
|
322
322
|
declare class DocumentEditorComponent implements OnInit, OnChanges, OnDestroy {
|
|
323
323
|
private readonly ngZone;
|
|
324
|
+
private readonly contentWrapperClass;
|
|
324
325
|
config?: Partial<DocumentEngineConfig>;
|
|
325
326
|
editorReady: EventEmitter<Editor>;
|
|
326
327
|
editor: Editor;
|
|
@@ -638,9 +639,84 @@ declare class FooterComponent {
|
|
|
638
639
|
static ɵcmp: i0.ɵɵComponentDeclaration<FooterComponent, "document-engine-footer", never, { "editor": { "alias": "editor"; "required": false; }; "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
|
|
639
640
|
}
|
|
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
|
+
|
|
641
717
|
declare class DocumentEditorModule {
|
|
642
718
|
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentEditorModule, never>;
|
|
643
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<DocumentEditorModule, [typeof DocumentEditorComponent], [typeof i2.CommonModule, typeof ToolbarComponent, typeof FooterComponent], [typeof DocumentEditorComponent]>;
|
|
719
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DocumentEditorModule, [typeof DocumentEditorComponent], [typeof i2.CommonModule, typeof ToolbarComponent, typeof FooterComponent, typeof TiptapEditorDirective], [typeof DocumentEditorComponent, typeof TiptapEditorDirective]>;
|
|
644
720
|
static ɵinj: i0.ɵɵInjectorDeclaration<DocumentEditorModule>;
|
|
645
721
|
}
|
|
646
722
|
|
|
@@ -735,66 +811,6 @@ declare class TiptapDraggableDirective {
|
|
|
735
811
|
static ɵdir: i0.ɵɵDirectiveDeclaration<TiptapDraggableDirective, "[tiptapDraggable]", never, {}, {}, never, never, true, never>;
|
|
736
812
|
}
|
|
737
813
|
|
|
738
|
-
/**
|
|
739
|
-
* Type definition for HTML preprocessor function.
|
|
740
|
-
* Allows clients to transform HTML content before it's set into the editor.
|
|
741
|
-
*
|
|
742
|
-
* @param html - The raw HTML string to be processed
|
|
743
|
-
* @returns The processed HTML string that will be set into the editor
|
|
744
|
-
*
|
|
745
|
-
* @example
|
|
746
|
-
* ```typescript
|
|
747
|
-
* const myPreprocessor: EditorHtmlPreprocessor = (html: string) => {
|
|
748
|
-
* // Remove all script tags for security
|
|
749
|
-
* return html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
|
|
750
|
-
* };
|
|
751
|
-
* ```
|
|
752
|
-
*/
|
|
753
|
-
type EditorHtmlPreprocessor = (html: string) => string;
|
|
754
|
-
/**
|
|
755
|
-
* Injection token for HTML preprocessor function.
|
|
756
|
-
* Use this token to provide a custom function that processes HTML content
|
|
757
|
-
* before it's set into the TipTap editor.
|
|
758
|
-
*
|
|
759
|
-
* This is optional - if not provided, the editor will use the HTML content as-is.
|
|
760
|
-
*
|
|
761
|
-
* @example
|
|
762
|
-
* ```typescript
|
|
763
|
-
* // In your component or module providers
|
|
764
|
-
* {
|
|
765
|
-
* provide: EDITOR_HTML_PREPROCESSOR,
|
|
766
|
-
* useValue: (html: string) => {
|
|
767
|
-
* // Your custom preprocessing logic
|
|
768
|
-
* return html.replace(/old/g, 'new');
|
|
769
|
-
* }
|
|
770
|
-
* }
|
|
771
|
-
* ```
|
|
772
|
-
*/
|
|
773
|
-
declare const EDITOR_HTML_PREPROCESSOR: InjectionToken<EditorHtmlPreprocessor>;
|
|
774
|
-
|
|
775
|
-
declare class TiptapEditorDirective implements OnInit, AfterViewInit, ControlValueAccessor {
|
|
776
|
-
protected elRef: ElementRef<HTMLElement>;
|
|
777
|
-
protected renderer: Renderer2;
|
|
778
|
-
protected changeDetectorRef: ChangeDetectorRef;
|
|
779
|
-
protected htmlPreprocessor: EditorHtmlPreprocessor | null;
|
|
780
|
-
private _editor?;
|
|
781
|
-
private initialEditableState?;
|
|
782
|
-
set editor(editor: Editor);
|
|
783
|
-
get editor(): Editor;
|
|
784
|
-
outputFormat: 'json' | 'html';
|
|
785
|
-
protected onChange: (value: Content) => void;
|
|
786
|
-
protected onTouched: () => void;
|
|
787
|
-
writeValue(value: Content): void;
|
|
788
|
-
registerOnChange(fn: () => void): void;
|
|
789
|
-
registerOnTouched(fn: () => void): void;
|
|
790
|
-
setDisabledState(isDisabled: boolean): void;
|
|
791
|
-
protected handleChange: ({ editor, transaction }: EditorEvents["transaction"]) => void;
|
|
792
|
-
ngOnInit(): void;
|
|
793
|
-
ngAfterViewInit(): void;
|
|
794
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<TiptapEditorDirective, never>;
|
|
795
|
-
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>;
|
|
796
|
-
}
|
|
797
|
-
|
|
798
814
|
declare class TiptapFloatingMenuDirective implements OnInit, OnDestroy {
|
|
799
815
|
private elRef;
|
|
800
816
|
constructor(elRef: ElementRef<HTMLElement>);
|
|
@@ -1740,5 +1756,5 @@ declare class EditorBubbleMenuComponent implements OnInit, AfterViewInit, OnDest
|
|
|
1740
1756
|
static ɵcmp: i0.ɵɵComponentDeclaration<EditorBubbleMenuComponent, "document-engine-editor-bubble-menu", never, { "editor": { "alias": "editor"; "required": false; }; "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
|
|
1741
1757
|
}
|
|
1742
1758
|
|
|
1743
|
-
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_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 };
|
|
1759
|
+
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 };
|
|
1744
1760
|
export type { BubbleMenuProps, BubbleMenuViewConfig, BubbleMenuViewContent, BubbleTarget, ButtonType, DocumentEngineConfig, DynamicFieldCategory, DynamicFieldItem, EditorBubbleMenuConfig, EditorHtmlPreprocessor, HeadingLevel, IconButton, OutsideHandler, SelectButton, SelectOption, TableCreateViewData, TemplateItem, ToolbarBubbleMenuConfig, ToolbarButton, ToolbarState };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phuong-tran-redoc/document-engine-angular",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Duc Phuong (Jack) <tdp99.business@gmail.com>",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"tslib": "^2.3.0",
|
|
28
28
|
"@floating-ui/dom": "^1.7.4",
|
|
29
|
-
"@phuong-tran-redoc/document-engine-core": "0.0.
|
|
29
|
+
"@phuong-tran-redoc/document-engine-core": "0.0.35"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"rxjs": "^7.5.0",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
box-shadow: 0 0 0 3px var(--destructive, hsl(0 84.2% 60.2% / 0.2));
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
@media (prefers-color-scheme: dark) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
39
|
+
// @media (prefers-color-scheme: dark) {
|
|
40
|
+
// &[aria-invalid='true'] {
|
|
41
|
+
// box-shadow: 0 0 0 3px var(--destructive, hsl(0 84.2% 60.2% / 0.4));
|
|
42
|
+
// }
|
|
43
|
+
// }
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// Variant: default (primary)
|
|
@@ -68,13 +68,13 @@
|
|
|
68
68
|
box-shadow: 0 0 0 3px var(--destructive, hsl(0 84.2% 60.2% / 0.2));
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
@media (prefers-color-scheme: dark) {
|
|
72
|
-
|
|
71
|
+
// @media (prefers-color-scheme: dark) {
|
|
72
|
+
// background-color: var(--destructive, hsl(0 84.2% 60.2% / 0.6));
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
74
|
+
// &:focus-visible {
|
|
75
|
+
// box-shadow: 0 0 0 3px var(--destructive, hsl(0 84.2% 60.2% / 0.4));
|
|
76
|
+
// }
|
|
77
|
+
// }
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
// Variant: outline
|
|
@@ -88,14 +88,14 @@
|
|
|
88
88
|
color: var(--accent-foreground, hsl(222.2 47.4% 11.2%));
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
@media (prefers-color-scheme: dark) {
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
// @media (prefers-color-scheme: dark) {
|
|
92
|
+
// background-color: var(--input, hsl(214.3 31.8% 91.4% / 0.3));
|
|
93
|
+
// border-color: var(--input, hsl(214.3 31.8% 91.4%));
|
|
94
94
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}
|
|
95
|
+
// &:hover:not(:disabled) {
|
|
96
|
+
// background-color: var(--input, hsl(214.3 31.8% 91.4% / 0.5));
|
|
97
|
+
// }
|
|
98
|
+
// }
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
// Variant: secondary
|
|
@@ -120,11 +120,11 @@
|
|
|
120
120
|
color: var(--accent-foreground, hsl(222.2 47.4% 11.2%));
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
@media (prefers-color-scheme: dark) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
123
|
+
// @media (prefers-color-scheme: dark) {
|
|
124
|
+
// &:hover:not(:disabled) {
|
|
125
|
+
// background-color: var(--accent, hsl(210 40% 96.1% / 0.5));
|
|
126
|
+
// }
|
|
127
|
+
// }
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
// Variant: link
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
&-group {
|
|
34
34
|
display: inline-flex;
|
|
35
35
|
align-items: center;
|
|
36
|
-
gap: 0.
|
|
36
|
+
gap: 0.25rem;
|
|
37
37
|
flex-shrink: 0;
|
|
38
38
|
|
|
39
39
|
// Auto-add divider after each group (except the last one)
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
content: '';
|
|
44
44
|
width: 1px;
|
|
45
45
|
height: 1.25rem;
|
|
46
|
-
margin-left: 0.
|
|
47
|
-
margin-right:
|
|
46
|
+
margin-left: 0.25rem;
|
|
47
|
+
margin-right: 0.5rem;
|
|
48
48
|
background-color: var(--muted-foreground, #9ca3af);
|
|
49
49
|
align-self: center;
|
|
50
50
|
flex-shrink: 0;
|