@phuong-tran-redoc/document-engine-angular 0.0.32 → 0.0.34
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';
|
|
@@ -638,9 +638,69 @@ declare class FooterComponent {
|
|
|
638
638
|
static ɵcmp: i0.ɵɵComponentDeclaration<FooterComponent, "document-engine-footer", never, { "editor": { "alias": "editor"; "required": false; }; "config": { "alias": "config"; "required": false; }; }, {}, never, never, true, never>;
|
|
639
639
|
}
|
|
640
640
|
|
|
641
|
+
/**
|
|
642
|
+
* Type definition for HTML preprocessor function.
|
|
643
|
+
* Allows clients to transform HTML content before it's set into the editor.
|
|
644
|
+
*
|
|
645
|
+
* @param html - The raw HTML string to be processed
|
|
646
|
+
* @returns The processed HTML string that will be set into the editor
|
|
647
|
+
*
|
|
648
|
+
* @example
|
|
649
|
+
* ```typescript
|
|
650
|
+
* const myPreprocessor: EditorHtmlPreprocessor = (html: string) => {
|
|
651
|
+
* // Remove all script tags for security
|
|
652
|
+
* return html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
|
|
653
|
+
* };
|
|
654
|
+
* ```
|
|
655
|
+
*/
|
|
656
|
+
type EditorHtmlPreprocessor = (html: string) => string;
|
|
657
|
+
/**
|
|
658
|
+
* Injection token for HTML preprocessor function.
|
|
659
|
+
* Use this token to provide a custom function that processes HTML content
|
|
660
|
+
* before it's set into the TipTap editor.
|
|
661
|
+
*
|
|
662
|
+
* This is optional - if not provided, the editor will use the HTML content as-is.
|
|
663
|
+
*
|
|
664
|
+
* @example
|
|
665
|
+
* ```typescript
|
|
666
|
+
* // In your component or module providers
|
|
667
|
+
* {
|
|
668
|
+
* provide: EDITOR_HTML_PREPROCESSOR,
|
|
669
|
+
* useValue: (html: string) => {
|
|
670
|
+
* // Your custom preprocessing logic
|
|
671
|
+
* return html.replace(/old/g, 'new');
|
|
672
|
+
* }
|
|
673
|
+
* }
|
|
674
|
+
* ```
|
|
675
|
+
*/
|
|
676
|
+
declare const EDITOR_HTML_PREPROCESSOR: InjectionToken<EditorHtmlPreprocessor>;
|
|
677
|
+
|
|
678
|
+
declare class TiptapEditorDirective implements OnInit, AfterViewInit, ControlValueAccessor {
|
|
679
|
+
protected elRef: ElementRef<HTMLElement>;
|
|
680
|
+
protected renderer: Renderer2;
|
|
681
|
+
protected changeDetectorRef: ChangeDetectorRef;
|
|
682
|
+
protected htmlPreprocessor: EditorHtmlPreprocessor | null;
|
|
683
|
+
private _editor?;
|
|
684
|
+
private initialEditableState?;
|
|
685
|
+
set editor(editor: Editor);
|
|
686
|
+
get editor(): Editor;
|
|
687
|
+
outputFormat: 'json' | 'html';
|
|
688
|
+
protected onChange: (value: Content) => void;
|
|
689
|
+
protected onTouched: () => void;
|
|
690
|
+
writeValue(value: Content): void;
|
|
691
|
+
registerOnChange(fn: () => void): void;
|
|
692
|
+
registerOnTouched(fn: () => void): void;
|
|
693
|
+
setDisabledState(isDisabled: boolean): void;
|
|
694
|
+
protected handleChange: ({ editor, transaction }: EditorEvents["transaction"]) => void;
|
|
695
|
+
ngOnInit(): void;
|
|
696
|
+
ngAfterViewInit(): void;
|
|
697
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<TiptapEditorDirective, never>;
|
|
698
|
+
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>;
|
|
699
|
+
}
|
|
700
|
+
|
|
641
701
|
declare class DocumentEditorModule {
|
|
642
702
|
static ɵfac: i0.ɵɵFactoryDeclaration<DocumentEditorModule, never>;
|
|
643
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<DocumentEditorModule, [typeof DocumentEditorComponent], [typeof i2.CommonModule, typeof ToolbarComponent, typeof FooterComponent], [typeof DocumentEditorComponent]>;
|
|
703
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<DocumentEditorModule, [typeof DocumentEditorComponent], [typeof i2.CommonModule, typeof ToolbarComponent, typeof FooterComponent, typeof TiptapEditorDirective], [typeof DocumentEditorComponent, typeof TiptapEditorDirective]>;
|
|
644
704
|
static ɵinj: i0.ɵɵInjectorDeclaration<DocumentEditorModule>;
|
|
645
705
|
}
|
|
646
706
|
|
|
@@ -735,66 +795,6 @@ declare class TiptapDraggableDirective {
|
|
|
735
795
|
static ɵdir: i0.ɵɵDirectiveDeclaration<TiptapDraggableDirective, "[tiptapDraggable]", never, {}, {}, never, never, true, never>;
|
|
736
796
|
}
|
|
737
797
|
|
|
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
798
|
declare class TiptapFloatingMenuDirective implements OnInit, OnDestroy {
|
|
799
799
|
private elRef;
|
|
800
800
|
constructor(elRef: ElementRef<HTMLElement>);
|
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.34",
|
|
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.34"
|
|
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;
|