@ecodev/natural-editor 63.9.0 → 64.0.0
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/fesm2022/ecodev-natural-editor.mjs +48 -49
- package/fesm2022/ecodev-natural-editor.mjs.map +1 -1
- package/index.d.ts +130 -3
- package/package.json +5 -5
- package/lib/class-dialog/class-dialog.component.d.ts +0 -25
- package/lib/color-dialog/color-dialog.component.d.ts +0 -27
- package/lib/custom-css/custom-css.directive.d.ts +0 -28
- package/lib/editor/editor.component.d.ts +0 -72
- package/lib/id-dialog/id-dialog.component.d.ts +0 -25
- package/lib/link-dialog/link-dialog.component.d.ts +0 -20
- package/lib/utils/image.d.ts +0 -14
- package/lib/utils/inputrules.d.ts +0 -7
- package/lib/utils/items/cell-background-color-item.d.ts +0 -5
- package/lib/utils/items/class-item.d.ts +0 -5
- package/lib/utils/items/horizontal-rule-item.d.ts +0 -5
- package/lib/utils/items/id-item.d.ts +0 -5
- package/lib/utils/items/item.d.ts +0 -30
- package/lib/utils/items/link-item.d.ts +0 -6
- package/lib/utils/items/table-item.d.ts +0 -4
- package/lib/utils/items/text-align-item.d.ts +0 -6
- package/lib/utils/items/text-color-item.d.ts +0 -6
- package/lib/utils/items/utils.d.ts +0 -18
- package/lib/utils/items/wrap-list-item.d.ts +0 -3
- package/lib/utils/keymap.d.ts +0 -34
- package/lib/utils/menu.d.ts +0 -10
- package/lib/utils/schema/heading.d.ts +0 -8
- package/lib/utils/schema/paragraph-with-alignment.d.ts +0 -8
- package/lib/utils/schema/schema.d.ts +0 -3
- package/lib/utils/schema/table.d.ts +0 -9
- package/lib/utils/schema/text-color.d.ts +0 -2
- package/public-api.d.ts +0 -3
package/index.d.ts
CHANGED
|
@@ -1,5 +1,132 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { OnDestroy, OnInit } from '@angular/core';
|
|
3
|
+
import { ControlValueAccessor } from '@angular/forms';
|
|
4
|
+
import { Observable, Subject } from 'rxjs';
|
|
5
|
+
import { MenuItemSpec } from 'prosemirror-menu';
|
|
6
|
+
import { EditorState } from 'prosemirror-state';
|
|
7
|
+
import { EditorView } from 'prosemirror-view';
|
|
8
|
+
|
|
1
9
|
/**
|
|
2
|
-
*
|
|
10
|
+
* Inject custom CSS into component and scope the CSS only to this component
|
|
11
|
+
*
|
|
12
|
+
* Usage :
|
|
13
|
+
*
|
|
14
|
+
* ```html
|
|
15
|
+
* <div [naturalCustomCss]=".my-class {background: red}">
|
|
16
|
+
* <p class="my-class">foo bar</p>
|
|
17
|
+
* </div>
|
|
18
|
+
* ```
|
|
3
19
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
20
|
+
declare class NaturalCustomCssDirective implements OnDestroy {
|
|
21
|
+
private readonly document;
|
|
22
|
+
private style;
|
|
23
|
+
protected readonly id: string;
|
|
24
|
+
readonly naturalCustomCss: i0.InputSignal<string | undefined>;
|
|
25
|
+
constructor();
|
|
26
|
+
ngOnDestroy(): void;
|
|
27
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalCustomCssDirective, never>;
|
|
28
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NaturalCustomCssDirective, "[naturalCustomCss]", never, { "naturalCustomCss": { "alias": "naturalCustomCss"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type ImageUploader = (file: File) => Observable<string>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* One item of the menu.
|
|
35
|
+
*
|
|
36
|
+
* This is the equivalent of `MenuItem` but without all the rendering logic since we use Angular
|
|
37
|
+
* templates for rendering. Also it caches the state of the item everytime the editor state changes,
|
|
38
|
+
* so Angular can query the state as often as needed without performance hit.
|
|
39
|
+
*/
|
|
40
|
+
declare class Item {
|
|
41
|
+
readonly spec: MenuItemSpec;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the item is 'active' (for example, the item for toggling the strong mark might be active when the cursor is in strong text).
|
|
44
|
+
*/
|
|
45
|
+
active: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Button is shown but disabled, because the item cannot be (un-)applied
|
|
48
|
+
*/
|
|
49
|
+
disabled: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Whether the item is shown at the moment
|
|
52
|
+
*/
|
|
53
|
+
show: boolean;
|
|
54
|
+
constructor(spec: MenuItemSpec);
|
|
55
|
+
/**
|
|
56
|
+
* Update the item state according to the editor state
|
|
57
|
+
*/
|
|
58
|
+
update(view: EditorView, state: EditorState): void;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
type Key = 'toggleStrong' | 'toggleEm' | 'toggleCode' | 'toggleLink' | 'textColor' | 'wrapBulletList' | 'wrapOrderedList' | 'wrapBlockQuote' | 'makeParagraph' | 'makeCodeBlock' | 'makeHead1' | 'makeHead2' | 'makeHead3' | 'makeHead4' | 'makeHead5' | 'makeHead6' | 'alignLeft' | 'alignRight' | 'alignCenter' | 'alignJustify' | 'insertHorizontalRule' | 'joinUp' | 'lift' | 'selectParentNode' | 'undo' | 'redo' | 'insertTable' | 'addColumnBefore' | 'addColumnAfter' | 'deleteColumn' | 'addRowBefore' | 'addRowAfter' | 'deleteRow' | 'deleteTable' | 'mergeCells' | 'splitCell' | 'toggleHeaderColumn' | 'toggleHeaderRow' | 'toggleHeaderCell' | 'cellBackgroundColor' | 'tableClass' | 'tableId' | 'blockClass' | 'blockId';
|
|
62
|
+
type MenuItems = Partial<Record<Key, Item>>;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Prosemirror component
|
|
66
|
+
*
|
|
67
|
+
* Usage :
|
|
68
|
+
*
|
|
69
|
+
* ```html
|
|
70
|
+
* <natural-editor [(ngModel)]="htmlString" />
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
declare class NaturalEditorComponent implements OnInit, OnDestroy, ControlValueAccessor {
|
|
74
|
+
private readonly ngControl;
|
|
75
|
+
private readonly document;
|
|
76
|
+
private readonly dialog;
|
|
77
|
+
private readonly imagePlugin;
|
|
78
|
+
private view;
|
|
79
|
+
private readonly editor;
|
|
80
|
+
readonly contentChange: i0.OutputEmitterRef<string>;
|
|
81
|
+
/**
|
|
82
|
+
* Callback to upload an image.
|
|
83
|
+
*
|
|
84
|
+
* If given it will enable advanced schema, including image and tables.
|
|
85
|
+
* It must be given on initialization and cannot be changed later on.
|
|
86
|
+
*/
|
|
87
|
+
readonly imageUploader: i0.InputSignal<ImageUploader | null>;
|
|
88
|
+
/**
|
|
89
|
+
* Mode must be set on initialization. Later changes will have no effect. Possible values are:
|
|
90
|
+
*
|
|
91
|
+
* - `basic`, the default, only offers minimal formatting options
|
|
92
|
+
* - `advanced`, adds text colors, headings, alignments, and tables. If `imageUploader` is given, it will force `advanced` mode.
|
|
93
|
+
*/
|
|
94
|
+
readonly mode: i0.InputSignal<"basic" | "advanced">;
|
|
95
|
+
private schema;
|
|
96
|
+
/**
|
|
97
|
+
* Interface with ControlValueAccessor
|
|
98
|
+
* Notifies parent model / form controller
|
|
99
|
+
*/
|
|
100
|
+
private onChange?;
|
|
101
|
+
/**
|
|
102
|
+
* HTML string
|
|
103
|
+
*/
|
|
104
|
+
private content;
|
|
105
|
+
menu: MenuItems | null;
|
|
106
|
+
protected readonly save$: Subject<void>;
|
|
107
|
+
/**
|
|
108
|
+
* If subscribed to, then the save button will be shown and click events forwarded
|
|
109
|
+
*/
|
|
110
|
+
readonly save: i0.OutputRef<void>;
|
|
111
|
+
disabled: boolean;
|
|
112
|
+
constructor();
|
|
113
|
+
ngOnInit(): void;
|
|
114
|
+
writeValue(val: string | undefined): void;
|
|
115
|
+
private createState;
|
|
116
|
+
private createPlugins;
|
|
117
|
+
/**
|
|
118
|
+
* Called by Prosemirror whenever the editor state changes. So we update our menu states.
|
|
119
|
+
*/
|
|
120
|
+
update(): void;
|
|
121
|
+
registerOnChange(fn: any): void;
|
|
122
|
+
registerOnTouched(): void;
|
|
123
|
+
setDisabledState(isDisabled: boolean): void;
|
|
124
|
+
ngOnDestroy(): void;
|
|
125
|
+
run(event: Event, key: Key): void;
|
|
126
|
+
upload(file: File): void;
|
|
127
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalEditorComponent, never>;
|
|
128
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalEditorComponent, "natural-editor", never, { "imageUploader": { "alias": "imageUploader"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; }, { "contentChange": "contentChange"; "save": "save"; }, never, never, true, never>;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export { NaturalCustomCssDirective, NaturalEditorComponent };
|
|
132
|
+
export type { ImageUploader };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecodev/natural-editor",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "64.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": "github:Ecodev/natural",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -31,10 +31,10 @@
|
|
|
31
31
|
"tslib": "^2.8.1"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
|
-
"@angular/common": "^
|
|
35
|
-
"@angular/core": "^
|
|
36
|
-
"@angular/forms": "^
|
|
37
|
-
"@angular/material": "^
|
|
34
|
+
"@angular/common": "^20.3.0",
|
|
35
|
+
"@angular/core": "^20.3.0",
|
|
36
|
+
"@angular/forms": "^20.3.0",
|
|
37
|
+
"@angular/material": "^20.3.0",
|
|
38
38
|
"@ecodev/natural": ">50.0"
|
|
39
39
|
},
|
|
40
40
|
"module": "fesm2022/ecodev-natural-editor.mjs",
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { FormControl, FormGroup } from '@angular/forms';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export type ClassDialogData = {
|
|
4
|
-
/**
|
|
5
|
-
* CSS class names
|
|
6
|
-
*
|
|
7
|
-
* Eg:
|
|
8
|
-
*
|
|
9
|
-
* - `""`
|
|
10
|
-
* - `"my-class my-other-class"`
|
|
11
|
-
*/
|
|
12
|
-
class: string;
|
|
13
|
-
};
|
|
14
|
-
export declare class ClassDialogComponent {
|
|
15
|
-
private dialogRef;
|
|
16
|
-
readonly classControl: FormControl<string>;
|
|
17
|
-
readonly form: FormGroup<{
|
|
18
|
-
class: FormControl<string>;
|
|
19
|
-
}>;
|
|
20
|
-
constructor();
|
|
21
|
-
maybeConfirm(): void;
|
|
22
|
-
private confirm;
|
|
23
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ClassDialogComponent, never>;
|
|
24
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ClassDialogComponent, "natural-editor-class-dialog", never, {}, {}, never, never, true, never>;
|
|
25
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { FormControl, FormGroup } from '@angular/forms';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export type ColorDialogData = {
|
|
4
|
-
/**
|
|
5
|
-
* Empty string means no color set at all. Anything else must be a valid CSS color in hexa format.
|
|
6
|
-
*
|
|
7
|
-
* Eg:
|
|
8
|
-
*
|
|
9
|
-
* - `""`
|
|
10
|
-
* - `"#ff4000"`
|
|
11
|
-
*/
|
|
12
|
-
color: string;
|
|
13
|
-
};
|
|
14
|
-
export declare class ColorDialogComponent {
|
|
15
|
-
private dialogRef;
|
|
16
|
-
readonly colors: string[][];
|
|
17
|
-
readonly colorControl: FormControl<string>;
|
|
18
|
-
readonly form: FormGroup<{
|
|
19
|
-
color: FormControl<string>;
|
|
20
|
-
}>;
|
|
21
|
-
constructor();
|
|
22
|
-
maybeConfirm(): void;
|
|
23
|
-
private confirm;
|
|
24
|
-
selectColor(color: string): void;
|
|
25
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ColorDialogComponent, never>;
|
|
26
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<ColorDialogComponent, "natural-editor-color-dialog", never, {}, {}, never, never, true, never>;
|
|
27
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { OnDestroy } from '@angular/core';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
/**
|
|
4
|
-
* Prefix all CSS selectors with the given selector
|
|
5
|
-
*
|
|
6
|
-
* This is meant to be relatively simple and might not cover advanced CSS syntax
|
|
7
|
-
*/
|
|
8
|
-
export declare function prefixCss(prefix: string, css: string): string;
|
|
9
|
-
/**
|
|
10
|
-
* Inject custom CSS into component and scope the CSS only to this component
|
|
11
|
-
*
|
|
12
|
-
* Usage :
|
|
13
|
-
*
|
|
14
|
-
* ```html
|
|
15
|
-
* <div [naturalCustomCss]=".my-class {background: red}">
|
|
16
|
-
* <p class="my-class">foo bar</p>
|
|
17
|
-
* </div>
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export declare class NaturalCustomCssDirective implements OnDestroy {
|
|
21
|
-
private readonly document;
|
|
22
|
-
private style;
|
|
23
|
-
protected readonly id: string;
|
|
24
|
-
set naturalCustomCss(value: string | undefined);
|
|
25
|
-
ngOnDestroy(): void;
|
|
26
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalCustomCssDirective, never>;
|
|
27
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<NaturalCustomCssDirective, "[naturalCustomCss]", never, { "naturalCustomCss": { "alias": "naturalCustomCss"; "required": true; }; }, {}, never, never, true, never>;
|
|
28
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { OnDestroy, OnInit } from '@angular/core';
|
|
2
|
-
import { ControlValueAccessor } from '@angular/forms';
|
|
3
|
-
import { ImageUploader } from '../utils/image';
|
|
4
|
-
import { Key, MenuItems } from '../utils/menu';
|
|
5
|
-
import { Subject } from 'rxjs';
|
|
6
|
-
import * as i0 from "@angular/core";
|
|
7
|
-
/**
|
|
8
|
-
* Prosemirror component
|
|
9
|
-
*
|
|
10
|
-
* Usage :
|
|
11
|
-
*
|
|
12
|
-
* ```html
|
|
13
|
-
* <natural-editor [(ngModel)]="htmlString" />
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export declare class NaturalEditorComponent implements OnInit, OnDestroy, ControlValueAccessor {
|
|
17
|
-
private readonly ngControl;
|
|
18
|
-
private readonly document;
|
|
19
|
-
private readonly dialog;
|
|
20
|
-
private readonly imagePlugin;
|
|
21
|
-
private view;
|
|
22
|
-
private readonly editor;
|
|
23
|
-
readonly contentChange: import("@angular/core").OutputEmitterRef<string>;
|
|
24
|
-
/**
|
|
25
|
-
* Callback to upload an image.
|
|
26
|
-
*
|
|
27
|
-
* If given it will enable advanced schema, including image and tables.
|
|
28
|
-
* It must be given on initialization and cannot be changed later on.
|
|
29
|
-
*/
|
|
30
|
-
imageUploader: ImageUploader | null;
|
|
31
|
-
/**
|
|
32
|
-
* Mode must be set on initialization. Later changes will have no effect. Possible values are:
|
|
33
|
-
*
|
|
34
|
-
* - `basic`, the default, only offers minimal formatting options
|
|
35
|
-
* - `advanced`, adds text colors, headings, alignments, and tables. If `imageUploader` is given, it will force `advanced` mode.
|
|
36
|
-
*/
|
|
37
|
-
readonly mode: import("@angular/core").InputSignal<"basic" | "advanced">;
|
|
38
|
-
private schema;
|
|
39
|
-
/**
|
|
40
|
-
* Interface with ControlValueAccessor
|
|
41
|
-
* Notifies parent model / form controller
|
|
42
|
-
*/
|
|
43
|
-
private onChange?;
|
|
44
|
-
/**
|
|
45
|
-
* HTML string
|
|
46
|
-
*/
|
|
47
|
-
private content;
|
|
48
|
-
menu: MenuItems | null;
|
|
49
|
-
protected readonly save$: Subject<void>;
|
|
50
|
-
/**
|
|
51
|
-
* If subscribed to, then the save button will be shown and click events forwarded
|
|
52
|
-
*/
|
|
53
|
-
readonly save: import("@angular/core").OutputRef<void>;
|
|
54
|
-
disabled: boolean;
|
|
55
|
-
constructor();
|
|
56
|
-
ngOnInit(): void;
|
|
57
|
-
writeValue(val: string | undefined): void;
|
|
58
|
-
private createState;
|
|
59
|
-
private createPlugins;
|
|
60
|
-
/**
|
|
61
|
-
* Called by Prosemirror whenever the editor state changes. So we update our menu states.
|
|
62
|
-
*/
|
|
63
|
-
update(): void;
|
|
64
|
-
registerOnChange(fn: any): void;
|
|
65
|
-
registerOnTouched(): void;
|
|
66
|
-
setDisabledState(isDisabled: boolean): void;
|
|
67
|
-
ngOnDestroy(): void;
|
|
68
|
-
run(event: Event, key: Key): void;
|
|
69
|
-
upload(file: File): void;
|
|
70
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<NaturalEditorComponent, never>;
|
|
71
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<NaturalEditorComponent, "natural-editor", never, { "imageUploader": { "alias": "imageUploader"; "required": false; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; }, { "contentChange": "contentChange"; "save": "save"; }, never, never, true, never>;
|
|
72
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { FormControl, FormGroup } from '@angular/forms';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export type IdDialogData = {
|
|
4
|
-
/**
|
|
5
|
-
* ID name
|
|
6
|
-
*
|
|
7
|
-
* Eg:
|
|
8
|
-
*
|
|
9
|
-
* - `""`
|
|
10
|
-
* - `"my-id"`
|
|
11
|
-
*/
|
|
12
|
-
id: string;
|
|
13
|
-
};
|
|
14
|
-
export declare class IdDialogComponent {
|
|
15
|
-
private dialogRef;
|
|
16
|
-
readonly idControl: FormControl<string>;
|
|
17
|
-
readonly form: FormGroup<{
|
|
18
|
-
id: FormControl<string>;
|
|
19
|
-
}>;
|
|
20
|
-
constructor();
|
|
21
|
-
maybeConfirm(): void;
|
|
22
|
-
private confirm;
|
|
23
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<IdDialogComponent, never>;
|
|
24
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<IdDialogComponent, "natural-editor-id-dialog", never, {}, {}, never, never, true, never>;
|
|
25
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { FormControl, FormGroup } from '@angular/forms';
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export type LinkDialogData = {
|
|
4
|
-
href: string;
|
|
5
|
-
title?: string;
|
|
6
|
-
};
|
|
7
|
-
export declare class LinkDialogComponent {
|
|
8
|
-
private dialogRef;
|
|
9
|
-
readonly hrefControl: FormControl<string>;
|
|
10
|
-
readonly titleControl: FormControl<string>;
|
|
11
|
-
readonly form: FormGroup<{
|
|
12
|
-
href: FormControl<string>;
|
|
13
|
-
title: FormControl<string>;
|
|
14
|
-
}>;
|
|
15
|
-
constructor();
|
|
16
|
-
maybeConfirm(): void;
|
|
17
|
-
private confirm;
|
|
18
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<LinkDialogComponent, never>;
|
|
19
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<LinkDialogComponent, "natural-editor-link-dialog", never, {}, {}, never, never, true, never>;
|
|
20
|
-
}
|
package/lib/utils/image.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { DecorationSet, EditorView } from 'prosemirror-view';
|
|
2
|
-
import { Plugin } from 'prosemirror-state';
|
|
3
|
-
import { Observable } from 'rxjs';
|
|
4
|
-
import { Schema } from 'prosemirror-model';
|
|
5
|
-
import * as i0 from "@angular/core";
|
|
6
|
-
export type ImageUploader = (file: File) => Observable<string>;
|
|
7
|
-
export declare class ImagePlugin {
|
|
8
|
-
readonly plugin: Plugin<DecorationSet>;
|
|
9
|
-
constructor();
|
|
10
|
-
private findPlaceholder;
|
|
11
|
-
startImageUpload(view: EditorView, file: File, uploader: ImageUploader, schema: Schema): void;
|
|
12
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<ImagePlugin, never>;
|
|
13
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<ImagePlugin>;
|
|
14
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { MenuItemSpec } from 'prosemirror-menu';
|
|
2
|
-
import { EditorState } from 'prosemirror-state';
|
|
3
|
-
import { EditorView } from 'prosemirror-view';
|
|
4
|
-
/**
|
|
5
|
-
* One item of the menu.
|
|
6
|
-
*
|
|
7
|
-
* This is the equivalent of `MenuItem` but without all the rendering logic since we use Angular
|
|
8
|
-
* templates for rendering. Also it caches the state of the item everytime the editor state changes,
|
|
9
|
-
* so Angular can query the state as often as needed without performance hit.
|
|
10
|
-
*/
|
|
11
|
-
export declare class Item {
|
|
12
|
-
readonly spec: MenuItemSpec;
|
|
13
|
-
/**
|
|
14
|
-
* Whether the item is 'active' (for example, the item for toggling the strong mark might be active when the cursor is in strong text).
|
|
15
|
-
*/
|
|
16
|
-
active: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Button is shown but disabled, because the item cannot be (un-)applied
|
|
19
|
-
*/
|
|
20
|
-
disabled: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Whether the item is shown at the moment
|
|
23
|
-
*/
|
|
24
|
-
show: boolean;
|
|
25
|
-
constructor(spec: MenuItemSpec);
|
|
26
|
-
/**
|
|
27
|
-
* Update the item state according to the editor state
|
|
28
|
-
*/
|
|
29
|
-
update(view: EditorView, state: EditorState): void;
|
|
30
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Command, EditorState } from 'prosemirror-state';
|
|
2
|
-
import { MarkType } from 'prosemirror-model';
|
|
3
|
-
import { MenuItem, MenuItemSpec } from 'prosemirror-menu';
|
|
4
|
-
import { Item } from './item';
|
|
5
|
-
export declare function markActive(state: EditorState, type: MarkType): boolean;
|
|
6
|
-
/**
|
|
7
|
-
* Convert built-in `MenuItem` into our Angular specific `Item`
|
|
8
|
-
*/
|
|
9
|
-
export declare function menuItemToItem(item: MenuItem): Item;
|
|
10
|
-
/**
|
|
11
|
-
* From a `Command`, creates a new `Item` that will have an automatic `enable` spec
|
|
12
|
-
*/
|
|
13
|
-
export declare function cmdToItem(cmd: Command, options?: Partial<MenuItemSpec>): Item;
|
|
14
|
-
/**
|
|
15
|
-
* From a `MarkType`, creates a new `Item` that will have an automatic `active` and `enable` spec
|
|
16
|
-
*/
|
|
17
|
-
export declare function markTypeToItem(markType: MarkType): Item;
|
|
18
|
-
export declare function selectionContainsNodeType(state: EditorState, allowedNodeTypes: string[]): boolean;
|
package/lib/utils/keymap.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'prosemirror-model';
|
|
2
|
-
import { Command } from 'prosemirror-state';
|
|
3
|
-
type Keymap = Record<string, Command>;
|
|
4
|
-
/**
|
|
5
|
-
* Inspect the given schema looking for marks and nodes from the
|
|
6
|
-
* basic schema, and if found, add key bindings related to them.
|
|
7
|
-
* This will add:
|
|
8
|
-
*
|
|
9
|
-
* * **Mod-b** for toggling [strong](#schema-basic.StrongMark)
|
|
10
|
-
* * **Mod-i** for toggling [emphasis](#schema-basic.EmMark)
|
|
11
|
-
* * **Mod-`** for toggling [code font](#schema-basic.CodeMark)
|
|
12
|
-
* * **Ctrl-Shift-0** for making the current textblock a paragraph
|
|
13
|
-
* * **Ctrl-Shift-1** to **Ctrl-Shift-Digit6** for making the current
|
|
14
|
-
* textblock a heading of the corresponding level
|
|
15
|
-
* * **Ctrl-Shift-Backslash** to make the current textblock a code block
|
|
16
|
-
* * **Ctrl-Shift-8** to wrap the selection in an ordered list
|
|
17
|
-
* * **Ctrl-Shift-9** to wrap the selection in a bullet list
|
|
18
|
-
* * **Ctrl->** to wrap the selection in a block quote
|
|
19
|
-
* * **Enter** to split a non-empty textblock in a list item while at
|
|
20
|
-
* the same time splitting the list item
|
|
21
|
-
* * **Mod-Enter** to insert a hard break
|
|
22
|
-
* * **Mod-_** to insert a horizontal rule
|
|
23
|
-
* * **Backspace** to undo an input rule
|
|
24
|
-
* * **Alt-ArrowUp** to `joinUp`
|
|
25
|
-
* * **Alt-ArrowDown** to `joinDown`
|
|
26
|
-
* * **Mod-BracketLeft** to `lift`
|
|
27
|
-
* * **Escape** to `selectParentNode`
|
|
28
|
-
*
|
|
29
|
-
* You can suppress or map these bindings by passing a `mapKeys`
|
|
30
|
-
* argument, which maps key names (say `"Mod-B"` to either `false`, to
|
|
31
|
-
* remove the binding, or a new key name string.
|
|
32
|
-
*/
|
|
33
|
-
export declare function buildKeymap(schema: Schema, isMac: boolean): Keymap;
|
|
34
|
-
export {};
|
package/lib/utils/menu.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'prosemirror-model';
|
|
2
|
-
import { MatDialog } from '@angular/material/dialog';
|
|
3
|
-
import { Item } from './items/item';
|
|
4
|
-
export type Key = 'toggleStrong' | 'toggleEm' | 'toggleCode' | 'toggleLink' | 'textColor' | 'wrapBulletList' | 'wrapOrderedList' | 'wrapBlockQuote' | 'makeParagraph' | 'makeCodeBlock' | 'makeHead1' | 'makeHead2' | 'makeHead3' | 'makeHead4' | 'makeHead5' | 'makeHead6' | 'alignLeft' | 'alignRight' | 'alignCenter' | 'alignJustify' | 'insertHorizontalRule' | 'joinUp' | 'lift' | 'selectParentNode' | 'undo' | 'redo' | 'insertTable' | 'addColumnBefore' | 'addColumnAfter' | 'deleteColumn' | 'addRowBefore' | 'addRowAfter' | 'deleteRow' | 'deleteTable' | 'mergeCells' | 'splitCell' | 'toggleHeaderColumn' | 'toggleHeaderRow' | 'toggleHeaderCell' | 'cellBackgroundColor' | 'tableClass' | 'tableId' | 'blockClass' | 'blockId';
|
|
5
|
-
export type MenuItems = Partial<Record<Key, Item>>;
|
|
6
|
-
/**
|
|
7
|
-
* Given a schema, look for default mark and node types in it and
|
|
8
|
-
* return an object with relevant menu items relating to those marks:
|
|
9
|
-
*/
|
|
10
|
-
export declare function buildMenuItems(schema: Schema, dialog: MatDialog): MenuItems;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { NodeSpec } from 'prosemirror-model';
|
|
2
|
-
/**
|
|
3
|
-
* A heading textblock, with a `level` attribute that should hold the number 1 to 6,
|
|
4
|
-
* with optional ID and class attributes. Parsed and serialized as `<h1>` to <h6>`
|
|
5
|
-
*
|
|
6
|
-
* https://github.com/ProseMirror/prosemirror-schema-basic/blob/master/src/schema-basic.js
|
|
7
|
-
*/
|
|
8
|
-
export declare const heading: NodeSpec;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { NodeSpec } from 'prosemirror-model';
|
|
2
|
-
/**
|
|
3
|
-
* A plain paragraph textblock. Represented in the DOM
|
|
4
|
-
* as a `<p>` element.
|
|
5
|
-
*
|
|
6
|
-
* https://github.com/ProseMirror/prosemirror-schema-basic/blob/master/src/schema-basic.js
|
|
7
|
-
*/
|
|
8
|
-
export declare const paragraphWithAlignment: NodeSpec;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Schema } from 'prosemirror-model';
|
|
2
|
-
export declare const basicSchema: Schema<keyof import("orderedmap").default<import("prosemirror-model").NodeSpec>, keyof import("orderedmap").default<import("prosemirror-model").MarkSpec>>;
|
|
3
|
-
export declare const advancedSchema: Schema<keyof import("orderedmap").default<import("prosemirror-model").NodeSpec>, "em" | "link" | "strong" | "textColor">;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { TableNodes, TableNodesOptions } from 'prosemirror-tables';
|
|
2
|
-
/**
|
|
3
|
-
* This function creates a set of [node
|
|
4
|
-
* specs](http://prosemirror.net/docs/ref/#model.SchemaSpec.nodes) for
|
|
5
|
-
* `table`, `table_row`, and `table_cell` nodes types.
|
|
6
|
-
*
|
|
7
|
-
* It is very directly inspired by prosemirror-table
|
|
8
|
-
*/
|
|
9
|
-
export declare function tableNodes(options: TableNodesOptions): TableNodes;
|
package/public-api.d.ts
DELETED