@ecodev/natural-editor 41.2.0 → 42.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/{esm2015/ecodev-natural-editor.js → esm2020/ecodev-natural-editor.mjs} +0 -0
- package/esm2020/lib/editor/editor.component.mjs +213 -0
- package/{esm2015/lib/editor.module.js → esm2020/lib/editor.module.mjs} +4 -4
- package/{esm2015/lib/link-dialog/link-dialog.component.js → esm2020/lib/link-dialog/link-dialog.component.mjs} +5 -8
- package/esm2020/lib/utils/image.mjs +81 -0
- package/esm2020/lib/utils/inputrules.mjs +70 -0
- package/esm2020/lib/utils/item.mjs +39 -0
- package/esm2020/lib/utils/keymap.mjs +115 -0
- package/esm2020/lib/utils/menu.mjs +184 -0
- package/esm2020/lib/utils/paragraph-with-alignment.mjs +43 -0
- package/esm2020/lib/utils/schema.mjs +51 -0
- package/{esm2015/lib/utils/table.js → esm2020/lib/utils/table.mjs} +2 -2
- package/esm2020/lib/utils/text-align-item.mjs +81 -0
- package/{esm2015/public-api.js → esm2020/public-api.mjs} +0 -0
- package/fesm2015/ecodev-natural-editor.mjs +995 -0
- package/fesm2015/ecodev-natural-editor.mjs.map +1 -0
- package/fesm2020/ecodev-natural-editor.mjs +1001 -0
- package/fesm2020/ecodev-natural-editor.mjs.map +1 -0
- package/lib/editor/editor.component.d.ts +1 -0
- package/lib/utils/inputrules.d.ts +7 -0
- package/lib/utils/item.d.ts +30 -0
- package/lib/utils/keymap.d.ts +32 -0
- package/lib/utils/menu.d.ts +2 -31
- package/lib/utils/paragraph-with-alignment.d.ts +2 -0
- package/lib/utils/text-align-item.d.ts +6 -0
- package/package.json +31 -10
- package/src/lib/editor/_editor.theme.scss +1 -1
- package/theming/_natural-editor.theme.scss +1 -1
- package/bundles/ecodev-natural-editor.umd.js +0 -1026
- package/bundles/ecodev-natural-editor.umd.js.map +0 -1
- package/esm2015/lib/editor/editor.component.js +0 -200
- package/esm2015/lib/utils/image.js +0 -81
- package/esm2015/lib/utils/menu.js +0 -207
- package/esm2015/lib/utils/schema.js +0 -46
- package/fesm2015/ecodev-natural-editor.js +0 -673
- package/fesm2015/ecodev-natural-editor.js.map +0 -1
|
@@ -0,0 +1,995 @@
|
|
|
1
|
+
import '@angular/localize/init';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { Injectable, Inject, Component, EventEmitter, ElementRef, Optional, Self, ViewChild, Output, Input, NgModule } from '@angular/core';
|
|
4
|
+
import { DecorationSet, Decoration, EditorView } from 'prosemirror-view';
|
|
5
|
+
import { Plugin, TextSelection, AllSelection, EditorState } from 'prosemirror-state';
|
|
6
|
+
import { Schema, DOMSerializer, DOMParser } from 'prosemirror-model';
|
|
7
|
+
import * as i6 from '@angular/common';
|
|
8
|
+
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
9
|
+
import { tableNodes, tableNodeTypes, addColumnBefore, addColumnAfter, deleteColumn, addRowBefore, addRowAfter, deleteRow, deleteTable, mergeCells, splitCell, toggleHeaderColumn, toggleHeaderRow, toggleHeaderCell, columnResizing, tableEditing, goToNextCell } from 'prosemirror-tables';
|
|
10
|
+
import { keymap } from 'prosemirror-keymap';
|
|
11
|
+
import { nodes, marks } from 'prosemirror-schema-basic';
|
|
12
|
+
import { addListNodes, wrapInList, splitListItem, liftListItem, sinkListItem } from 'prosemirror-schema-list';
|
|
13
|
+
import { joinUpItem, liftItem, selectParentNodeItem, undoItem, redoItem, wrapItem, blockTypeItem } from 'prosemirror-menu';
|
|
14
|
+
import { toggleMark, joinUp, joinDown, lift, selectParentNode, wrapIn, chainCommands, exitCode, setBlockType, baseKeymap } from 'prosemirror-commands';
|
|
15
|
+
import * as i1 from '@angular/material/dialog';
|
|
16
|
+
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
17
|
+
import * as i4 from '@angular/forms';
|
|
18
|
+
import { FormControl, Validators, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
19
|
+
import * as i11 from '@ecodev/natural';
|
|
20
|
+
import { ifValid, NaturalFileModule } from '@ecodev/natural';
|
|
21
|
+
import * as i2 from '@angular/material/form-field';
|
|
22
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
23
|
+
import * as i3 from '@angular/material/button';
|
|
24
|
+
import { MatButtonModule } from '@angular/material/button';
|
|
25
|
+
import * as i5 from '@angular/material/input';
|
|
26
|
+
import { MatInputModule } from '@angular/material/input';
|
|
27
|
+
import { undo, redo, history } from 'prosemirror-history';
|
|
28
|
+
import { dropCursor } from 'prosemirror-dropcursor';
|
|
29
|
+
import { gapCursor } from 'prosemirror-gapcursor';
|
|
30
|
+
import { wrappingInputRule, textblockTypeInputRule, ellipsis, emDash, inputRules, undoInputRule } from 'prosemirror-inputrules';
|
|
31
|
+
import * as i5$1 from '@angular/material/icon';
|
|
32
|
+
import { MatIconModule } from '@angular/material/icon';
|
|
33
|
+
import * as i6$1 from '@angular/material/button-toggle';
|
|
34
|
+
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
35
|
+
import * as i7 from '@angular/material/menu';
|
|
36
|
+
import { MatMenuModule } from '@angular/material/menu';
|
|
37
|
+
import * as i8 from '@angular/material/divider';
|
|
38
|
+
import { MatDividerModule } from '@angular/material/divider';
|
|
39
|
+
import * as i10 from '@angular/material/tooltip';
|
|
40
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
41
|
+
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
42
|
+
|
|
43
|
+
class ImagePlugin {
|
|
44
|
+
constructor(document) {
|
|
45
|
+
this.document = document;
|
|
46
|
+
this.plugin = new Plugin({
|
|
47
|
+
state: {
|
|
48
|
+
init() {
|
|
49
|
+
return DecorationSet.empty;
|
|
50
|
+
},
|
|
51
|
+
apply(tr, set) {
|
|
52
|
+
// Adjust decoration positions to changes made by the transaction
|
|
53
|
+
set = set.map(tr.mapping, tr.doc);
|
|
54
|
+
// See if the transaction adds or removes any placeholders
|
|
55
|
+
const action = tr.getMeta(this);
|
|
56
|
+
if (action && action.add) {
|
|
57
|
+
const widget = document.createElement('placeholder');
|
|
58
|
+
const deco = Decoration.widget(action.add.pos, widget, { id: action.add.id });
|
|
59
|
+
set = set.add(tr.doc, [deco]);
|
|
60
|
+
}
|
|
61
|
+
else if (action && action.remove) {
|
|
62
|
+
set = set.remove(set.find(undefined, undefined, spec => spec.id === action.remove.id));
|
|
63
|
+
}
|
|
64
|
+
return set;
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
props: {
|
|
68
|
+
decorations(state) {
|
|
69
|
+
return this.getState(state);
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
findPlaceholder(state, id) {
|
|
75
|
+
const decorators = this.plugin.getState(state);
|
|
76
|
+
const found = decorators.find(undefined, undefined, spec => spec.id === id);
|
|
77
|
+
return found.length ? found[0].from : null;
|
|
78
|
+
}
|
|
79
|
+
startImageUpload(view, file, uploader, schema) {
|
|
80
|
+
// A fresh object to act as the ID for this upload
|
|
81
|
+
const id = {};
|
|
82
|
+
// Replace the selection with a placeholder
|
|
83
|
+
const tr = view.state.tr;
|
|
84
|
+
if (!tr.selection.empty) {
|
|
85
|
+
tr.deleteSelection();
|
|
86
|
+
}
|
|
87
|
+
tr.setMeta(this.plugin, { add: { id, pos: tr.selection.from } });
|
|
88
|
+
view.dispatch(tr);
|
|
89
|
+
uploader(file).subscribe({
|
|
90
|
+
next: url => {
|
|
91
|
+
const pos = this.findPlaceholder(view.state, id);
|
|
92
|
+
// If the content around the placeholder has been deleted, drop
|
|
93
|
+
// the image
|
|
94
|
+
if (pos === null) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
// Otherwise, insert it at the placeholder's position, and remove
|
|
98
|
+
// the placeholder
|
|
99
|
+
view.dispatch(view.state.tr
|
|
100
|
+
.replaceWith(pos, pos, schema.nodes.image.create({ src: url }))
|
|
101
|
+
.setMeta(this.plugin, { remove: { id } }));
|
|
102
|
+
},
|
|
103
|
+
error: () => {
|
|
104
|
+
// On failure, just clean up the placeholder
|
|
105
|
+
view === null || view === void 0 ? void 0 : view.dispatch(tr.setMeta(this.plugin, { remove: { id } }));
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
ImagePlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: ImagePlugin, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
111
|
+
ImagePlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: ImagePlugin });
|
|
112
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: ImagePlugin, decorators: [{
|
|
113
|
+
type: Injectable
|
|
114
|
+
}], ctorParameters: function () {
|
|
115
|
+
return [{ type: Document, decorators: [{
|
|
116
|
+
type: Inject,
|
|
117
|
+
args: [DOCUMENT]
|
|
118
|
+
}] }];
|
|
119
|
+
} });
|
|
120
|
+
|
|
121
|
+
const ALIGN_PATTERN = /(left|right|center|justify)/;
|
|
122
|
+
// https://github.com/ProseMirror/prosemirror-schema-basic/blob/master/src/schema-basic.js
|
|
123
|
+
// :: NodeSpec A plain paragraph textblock. Represented in the DOM
|
|
124
|
+
// as a `<p>` element.
|
|
125
|
+
const paragraphWithAlignment = {
|
|
126
|
+
attrs: {
|
|
127
|
+
align: { default: null },
|
|
128
|
+
id: { default: null },
|
|
129
|
+
},
|
|
130
|
+
content: 'inline*',
|
|
131
|
+
group: 'block',
|
|
132
|
+
parseDOM: [
|
|
133
|
+
{
|
|
134
|
+
tag: 'p',
|
|
135
|
+
getAttrs: (dom) => {
|
|
136
|
+
if (!(dom instanceof HTMLElement)) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const { textAlign } = dom.style;
|
|
140
|
+
let align = dom.getAttribute('align') || textAlign || '';
|
|
141
|
+
align = ALIGN_PATTERN.test(align) ? align : null;
|
|
142
|
+
const id = dom.getAttribute('id') || '';
|
|
143
|
+
return { align, id };
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
toDOM: node => {
|
|
148
|
+
const { align, id } = node.attrs;
|
|
149
|
+
const attrs = {};
|
|
150
|
+
let style = '';
|
|
151
|
+
if (align && align !== 'left') {
|
|
152
|
+
style += `text-align: ${align};`;
|
|
153
|
+
}
|
|
154
|
+
if (style) {
|
|
155
|
+
attrs.style = style;
|
|
156
|
+
}
|
|
157
|
+
if (id) {
|
|
158
|
+
attrs.id = id;
|
|
159
|
+
}
|
|
160
|
+
return ['p', attrs, 0];
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
const basicNodes = {
|
|
165
|
+
heading: nodes.heading,
|
|
166
|
+
doc: nodes.doc,
|
|
167
|
+
paragraph: nodes.paragraph,
|
|
168
|
+
text: nodes.text,
|
|
169
|
+
hard_break: nodes.hard_break,
|
|
170
|
+
};
|
|
171
|
+
const basicMarks = {
|
|
172
|
+
link: marks.link,
|
|
173
|
+
em: marks.em,
|
|
174
|
+
strong: marks.strong,
|
|
175
|
+
};
|
|
176
|
+
const tmpSchema = new Schema({ nodes: basicNodes, marks: basicMarks });
|
|
177
|
+
const basicSchema = new Schema({
|
|
178
|
+
nodes: addListNodes(tmpSchema.spec.nodes, 'paragraph block*', 'block'),
|
|
179
|
+
marks: tmpSchema.spec.marks,
|
|
180
|
+
});
|
|
181
|
+
const tmpSchema2 = new Schema({
|
|
182
|
+
nodes: Object.assign(Object.assign(Object.assign({}, nodes), tableNodes({
|
|
183
|
+
tableGroup: 'block',
|
|
184
|
+
cellContent: 'block+',
|
|
185
|
+
cellAttributes: {
|
|
186
|
+
background: {
|
|
187
|
+
default: null,
|
|
188
|
+
getFromDOM(dom) {
|
|
189
|
+
return dom.style.backgroundColor || null;
|
|
190
|
+
},
|
|
191
|
+
setDOMAttr(value, attrs) {
|
|
192
|
+
if (value) {
|
|
193
|
+
attrs.style = (attrs.style || '') + `background-color: ${value};`;
|
|
194
|
+
}
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
})), { paragraph: paragraphWithAlignment }),
|
|
199
|
+
marks: basicMarks,
|
|
200
|
+
});
|
|
201
|
+
const advancedSchema = new Schema({
|
|
202
|
+
nodes: addListNodes(tmpSchema2.spec.nodes, 'paragraph block*', 'block'),
|
|
203
|
+
marks: basicMarks,
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
class LinkDialogComponent {
|
|
207
|
+
constructor(data, dialogRef) {
|
|
208
|
+
this.dialogRef = dialogRef;
|
|
209
|
+
this.hrefControl = new FormControl('', Validators.required);
|
|
210
|
+
this.titleControl = new FormControl('');
|
|
211
|
+
this.form = new FormGroup({
|
|
212
|
+
href: this.hrefControl,
|
|
213
|
+
title: this.titleControl,
|
|
214
|
+
});
|
|
215
|
+
this.form.setValue(data);
|
|
216
|
+
}
|
|
217
|
+
maybeConfirm() {
|
|
218
|
+
ifValid(this.form).subscribe(() => this.confirm());
|
|
219
|
+
}
|
|
220
|
+
confirm() {
|
|
221
|
+
this.dialogRef.close(this.form.value);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
LinkDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: LinkDialogComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
225
|
+
LinkDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.5", type: LinkDialogComponent, selector: "ng-component", ngImport: i0, template: "<h2 i18n mat-dialog-title>Ins\u00E9rer un lien</h2>\n\n<mat-dialog-content [formGroup]=\"form\">\n <mat-form-field>\n <mat-label i18n>URL</mat-label>\n <input matInput [formControl]=\"hrefControl\" (keydown.enter)=\"maybeConfirm()\" />\n <mat-error *ngIf=\"hrefControl.hasError('required')\" i18n>Ce champ est requis</mat-error>\n </mat-form-field>\n <mat-form-field>\n <mat-label i18n>Titre</mat-label>\n <input matInput [formControl]=\"titleControl\" (keydown.enter)=\"maybeConfirm()\" />\n </mat-form-field>\n</mat-dialog-content>\n\n<mat-dialog-actions>\n <button mat-button [mat-dialog-close] i18n>Annuler</button>\n <button mat-stroked-button (click)=\"maybeConfirm()\" [disabled]=\"!form.valid\"><span i18n>Valider</span></button>\n</mat-dialog-actions>\n", styles: ["mat-dialog-actions{display:flex;flex-direction:row;justify-content:flex-end}mat-dialog-content{width:70vw;max-width:60em;display:grid}\n"], components: [{ type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i1.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2.MatLabel, selector: "mat-label" }, { type: i5.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2.MatError, selector: "mat-error", inputs: ["id"] }, { type: i1.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i1.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }] });
|
|
226
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: LinkDialogComponent, decorators: [{
|
|
227
|
+
type: Component,
|
|
228
|
+
args: [{ template: "<h2 i18n mat-dialog-title>Ins\u00E9rer un lien</h2>\n\n<mat-dialog-content [formGroup]=\"form\">\n <mat-form-field>\n <mat-label i18n>URL</mat-label>\n <input matInput [formControl]=\"hrefControl\" (keydown.enter)=\"maybeConfirm()\" />\n <mat-error *ngIf=\"hrefControl.hasError('required')\" i18n>Ce champ est requis</mat-error>\n </mat-form-field>\n <mat-form-field>\n <mat-label i18n>Titre</mat-label>\n <input matInput [formControl]=\"titleControl\" (keydown.enter)=\"maybeConfirm()\" />\n </mat-form-field>\n</mat-dialog-content>\n\n<mat-dialog-actions>\n <button mat-button [mat-dialog-close] i18n>Annuler</button>\n <button mat-stroked-button (click)=\"maybeConfirm()\" [disabled]=\"!form.valid\"><span i18n>Valider</span></button>\n</mat-dialog-actions>\n", styles: ["mat-dialog-actions{display:flex;flex-direction:row;justify-content:flex-end}mat-dialog-content{width:70vw;max-width:60em;display:grid}\n"] }]
|
|
229
|
+
}], ctorParameters: function () {
|
|
230
|
+
return [{ type: undefined, decorators: [{
|
|
231
|
+
type: Inject,
|
|
232
|
+
args: [MAT_DIALOG_DATA]
|
|
233
|
+
}] }, { type: i1.MatDialogRef }];
|
|
234
|
+
} });
|
|
235
|
+
|
|
236
|
+
function createCell(cellType, cellContent) {
|
|
237
|
+
return cellContent ? cellType.createChecked(null, cellContent) : cellType.createAndFill();
|
|
238
|
+
}
|
|
239
|
+
function createTable(state, rowsCount, colsCount, withHeaderRow, cellContent) {
|
|
240
|
+
const types = tableNodeTypes(state.schema);
|
|
241
|
+
const headerCells = [];
|
|
242
|
+
const cells = [];
|
|
243
|
+
for (let index = 0; index < colsCount; index += 1) {
|
|
244
|
+
const cell = createCell(types.cell, cellContent);
|
|
245
|
+
if (cell) {
|
|
246
|
+
cells.push(cell);
|
|
247
|
+
}
|
|
248
|
+
if (withHeaderRow) {
|
|
249
|
+
const headerCell = createCell(types.header_cell, cellContent);
|
|
250
|
+
if (headerCell) {
|
|
251
|
+
headerCells.push(headerCell);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
const rows = [];
|
|
256
|
+
for (let index = 0; index < rowsCount; index += 1) {
|
|
257
|
+
rows.push(types.row.createChecked(null, withHeaderRow && index === 0 ? headerCells : cells));
|
|
258
|
+
}
|
|
259
|
+
return types.table.createChecked(null, rows);
|
|
260
|
+
}
|
|
261
|
+
function addTable(state, dispatch, { rowsCount = 3, colsCount = 3, withHeaderRow = true, cellContent, } = {}) {
|
|
262
|
+
const offset = state.tr.selection.anchor + 1;
|
|
263
|
+
const nodes = createTable(state, rowsCount, colsCount, withHeaderRow, cellContent);
|
|
264
|
+
const tr = state.tr.replaceSelectionWith(nodes).scrollIntoView();
|
|
265
|
+
const resolvedPos = tr.doc.resolve(offset);
|
|
266
|
+
// move cursor into table
|
|
267
|
+
tr.setSelection(TextSelection.near(resolvedPos));
|
|
268
|
+
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* One item of the menu.
|
|
273
|
+
*
|
|
274
|
+
* This is the equivalent of `MenuItem` but without all the rendering logic since we use Angular
|
|
275
|
+
* templates for rendering. Also it caches the state of the item everytime the editor state changes,
|
|
276
|
+
* so Angular can query the state as often as needed without performance hit.
|
|
277
|
+
*/
|
|
278
|
+
class Item {
|
|
279
|
+
constructor(spec) {
|
|
280
|
+
this.spec = spec;
|
|
281
|
+
/**
|
|
282
|
+
* Whether the item is 'active' (for example, the item for toggling the strong mark might be active when the cursor is in strong text).
|
|
283
|
+
*/
|
|
284
|
+
this.active = false;
|
|
285
|
+
/**
|
|
286
|
+
* Button is shown but disabled, because the item cannot be (un-)applied
|
|
287
|
+
*/
|
|
288
|
+
this.disabled = false;
|
|
289
|
+
/**
|
|
290
|
+
* Whether the item is shown at the moment
|
|
291
|
+
*/
|
|
292
|
+
this.show = true;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Update the item state according to the editor state
|
|
296
|
+
*/
|
|
297
|
+
update(view, state) {
|
|
298
|
+
if (this.spec.active) {
|
|
299
|
+
this.active = this.spec.active(state);
|
|
300
|
+
}
|
|
301
|
+
if (this.spec.enable) {
|
|
302
|
+
this.disabled = !this.spec.enable(state);
|
|
303
|
+
}
|
|
304
|
+
if (this.spec.select) {
|
|
305
|
+
this.show = this.spec.select(state);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function setTextAlign(tr, schema, alignment) {
|
|
311
|
+
console.log('setTextAlign', alignment);
|
|
312
|
+
const { selection, doc } = tr;
|
|
313
|
+
if (!selection || !doc) {
|
|
314
|
+
return tr;
|
|
315
|
+
}
|
|
316
|
+
const { from, to } = selection;
|
|
317
|
+
const { nodes } = schema;
|
|
318
|
+
const tasks = [];
|
|
319
|
+
alignment = alignment || null;
|
|
320
|
+
const allowedNodeTypes = new Set([
|
|
321
|
+
nodes.paragraph,
|
|
322
|
+
// nodes['blockquote'],
|
|
323
|
+
// nodes['listItem'],
|
|
324
|
+
// nodes['heading'],
|
|
325
|
+
]);
|
|
326
|
+
doc.nodesBetween(from, to, (node, pos) => {
|
|
327
|
+
const nodeType = node.type;
|
|
328
|
+
const align = node.attrs.align || null;
|
|
329
|
+
if (align !== alignment && allowedNodeTypes.has(nodeType)) {
|
|
330
|
+
tasks.push({
|
|
331
|
+
node,
|
|
332
|
+
pos,
|
|
333
|
+
nodeType,
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
return true;
|
|
337
|
+
});
|
|
338
|
+
if (!tasks.length) {
|
|
339
|
+
return tr;
|
|
340
|
+
}
|
|
341
|
+
tasks.forEach(job => {
|
|
342
|
+
const { node, pos, nodeType } = job;
|
|
343
|
+
const newAttrs = Object.assign(Object.assign({}, node.attrs), { align: alignment ? alignment : null });
|
|
344
|
+
console.log('newAttrs', newAttrs);
|
|
345
|
+
tr = tr.setNodeMarkup(pos, nodeType, newAttrs, node.marks);
|
|
346
|
+
});
|
|
347
|
+
return tr;
|
|
348
|
+
}
|
|
349
|
+
class TextAlignItem extends Item {
|
|
350
|
+
constructor(alignment) {
|
|
351
|
+
super({
|
|
352
|
+
active: state => {
|
|
353
|
+
const { selection, doc } = state;
|
|
354
|
+
const { from, to } = selection;
|
|
355
|
+
let keepLooking = true;
|
|
356
|
+
let active = false;
|
|
357
|
+
doc.nodesBetween(from, to, node => {
|
|
358
|
+
if (keepLooking && node.attrs.align === alignment) {
|
|
359
|
+
keepLooking = false;
|
|
360
|
+
active = true;
|
|
361
|
+
}
|
|
362
|
+
return keepLooking;
|
|
363
|
+
});
|
|
364
|
+
return active;
|
|
365
|
+
},
|
|
366
|
+
enable: state => {
|
|
367
|
+
const { selection } = state;
|
|
368
|
+
return selection instanceof TextSelection || selection instanceof AllSelection;
|
|
369
|
+
},
|
|
370
|
+
run: (state, dispatch) => {
|
|
371
|
+
const { schema, selection } = state;
|
|
372
|
+
console.log(this);
|
|
373
|
+
const tr = setTextAlign(state.tr.setSelection(selection), schema, this.active ? null : alignment);
|
|
374
|
+
if (tr.docChanged) {
|
|
375
|
+
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr);
|
|
376
|
+
return true;
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Convert built-in `MenuItem` into our Angular specific `Item`
|
|
388
|
+
*/
|
|
389
|
+
function toItem(item) {
|
|
390
|
+
return new Item(item.spec);
|
|
391
|
+
}
|
|
392
|
+
function canInsert(state, nodeType) {
|
|
393
|
+
const $from = state.selection.$from;
|
|
394
|
+
for (let d = $from.depth; d >= 0; d--) {
|
|
395
|
+
const index = $from.index(d);
|
|
396
|
+
if ($from.node(d).canReplaceWith(index, index, nodeType)) {
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
return false;
|
|
401
|
+
}
|
|
402
|
+
function cmdItem(cmd, options = {}, useEnable = false) {
|
|
403
|
+
const passedOptions = Object.assign({ run: cmd }, options);
|
|
404
|
+
if ((!options.enable || useEnable) && !options.select) {
|
|
405
|
+
passedOptions[options.enable ? 'enable' : 'select'] = (state) => cmd(state);
|
|
406
|
+
}
|
|
407
|
+
return new Item(passedOptions);
|
|
408
|
+
}
|
|
409
|
+
function markActive(state, type) {
|
|
410
|
+
const { from, $from, to, empty } = state.selection;
|
|
411
|
+
if (empty) {
|
|
412
|
+
return !!type.isInSet(state.storedMarks || $from.marks());
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
return state.doc.rangeHasMark(from, to, type);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
function markItem(markType, options = {}) {
|
|
419
|
+
const passedOptions = Object.assign({ active(state) {
|
|
420
|
+
return markActive(state, markType);
|
|
421
|
+
} }, options);
|
|
422
|
+
return cmdItem(toggleMark(markType), passedOptions, true);
|
|
423
|
+
}
|
|
424
|
+
function linkItem(markType, dialog) {
|
|
425
|
+
return new Item({
|
|
426
|
+
active(state) {
|
|
427
|
+
return markActive(state, markType);
|
|
428
|
+
},
|
|
429
|
+
enable(state) {
|
|
430
|
+
return !state.selection.empty;
|
|
431
|
+
},
|
|
432
|
+
run(state, dispatch, view) {
|
|
433
|
+
if (markActive(state, markType)) {
|
|
434
|
+
toggleMark(markType)(state, dispatch);
|
|
435
|
+
return true;
|
|
436
|
+
}
|
|
437
|
+
dialog
|
|
438
|
+
.open(LinkDialogComponent, {
|
|
439
|
+
data: {
|
|
440
|
+
href: '',
|
|
441
|
+
title: '',
|
|
442
|
+
},
|
|
443
|
+
})
|
|
444
|
+
.afterClosed()
|
|
445
|
+
.subscribe(result => {
|
|
446
|
+
if (result) {
|
|
447
|
+
if (!result.title) {
|
|
448
|
+
delete result.title;
|
|
449
|
+
}
|
|
450
|
+
toggleMark(markType, result)(view.state, view.dispatch);
|
|
451
|
+
}
|
|
452
|
+
view.focus();
|
|
453
|
+
});
|
|
454
|
+
},
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
function wrapListItem(nodeType) {
|
|
458
|
+
return cmdItem(wrapInList(nodeType));
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Given a schema, look for default mark and node types in it and
|
|
462
|
+
* return an object with relevant menu items relating to those marks:
|
|
463
|
+
*/
|
|
464
|
+
function buildMenuItems(schema, dialog) {
|
|
465
|
+
const r = {
|
|
466
|
+
joinUp: toItem(joinUpItem),
|
|
467
|
+
lift: toItem(liftItem),
|
|
468
|
+
selectParentNode: toItem(selectParentNodeItem),
|
|
469
|
+
undo: toItem(undoItem),
|
|
470
|
+
redo: toItem(redoItem),
|
|
471
|
+
};
|
|
472
|
+
let type;
|
|
473
|
+
type = schema.marks.strong;
|
|
474
|
+
if (type) {
|
|
475
|
+
r.toggleStrong = markItem(type);
|
|
476
|
+
}
|
|
477
|
+
type = schema.marks.em;
|
|
478
|
+
if (type) {
|
|
479
|
+
r.toggleEm = markItem(type);
|
|
480
|
+
}
|
|
481
|
+
type = schema.marks.code;
|
|
482
|
+
if (type) {
|
|
483
|
+
r.toggleCode = markItem(type);
|
|
484
|
+
}
|
|
485
|
+
type = schema.marks.link;
|
|
486
|
+
if (type) {
|
|
487
|
+
r.toggleLink = linkItem(type, dialog);
|
|
488
|
+
}
|
|
489
|
+
type = schema.nodes.bullet_list;
|
|
490
|
+
if (type) {
|
|
491
|
+
r.wrapBulletList = wrapListItem(type);
|
|
492
|
+
}
|
|
493
|
+
type = schema.nodes.ordered_list;
|
|
494
|
+
if (type) {
|
|
495
|
+
r.wrapOrderedList = wrapListItem(type);
|
|
496
|
+
}
|
|
497
|
+
type = schema.nodes.blockquote;
|
|
498
|
+
if (type) {
|
|
499
|
+
r.wrapBlockQuote = toItem(wrapItem(type, {}));
|
|
500
|
+
}
|
|
501
|
+
type = schema.nodes.paragraph;
|
|
502
|
+
if (type) {
|
|
503
|
+
r.makeParagraph = toItem(blockTypeItem(type, {}));
|
|
504
|
+
if (type.spec === paragraphWithAlignment) {
|
|
505
|
+
r.alignLeft = new TextAlignItem('left');
|
|
506
|
+
r.alignRight = new TextAlignItem('right');
|
|
507
|
+
r.alignCenter = new TextAlignItem('center');
|
|
508
|
+
r.alignJustify = new TextAlignItem('justify');
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
type = schema.nodes.code_block;
|
|
512
|
+
if (type) {
|
|
513
|
+
r.makeCodeBlock = toItem(blockTypeItem(type, {}));
|
|
514
|
+
}
|
|
515
|
+
type = schema.nodes.heading;
|
|
516
|
+
if (type) {
|
|
517
|
+
r.makeHead1 = toItem(blockTypeItem(type, { attrs: { level: 1 } }));
|
|
518
|
+
r.makeHead2 = toItem(blockTypeItem(type, { attrs: { level: 2 } }));
|
|
519
|
+
r.makeHead3 = toItem(blockTypeItem(type, { attrs: { level: 3 } }));
|
|
520
|
+
r.makeHead4 = toItem(blockTypeItem(type, { attrs: { level: 4 } }));
|
|
521
|
+
r.makeHead5 = toItem(blockTypeItem(type, { attrs: { level: 5 } }));
|
|
522
|
+
r.makeHead6 = toItem(blockTypeItem(type, { attrs: { level: 6 } }));
|
|
523
|
+
}
|
|
524
|
+
type = schema.nodes.horizontal_rule;
|
|
525
|
+
if (type) {
|
|
526
|
+
const hr = type;
|
|
527
|
+
r.insertHorizontalRule = new Item({
|
|
528
|
+
enable(state) {
|
|
529
|
+
return canInsert(state, hr);
|
|
530
|
+
},
|
|
531
|
+
run(state, dispatch) {
|
|
532
|
+
dispatch(state.tr.replaceSelectionWith(hr.create()));
|
|
533
|
+
},
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
type = schema.nodes.table;
|
|
537
|
+
if (type) {
|
|
538
|
+
r.insertTable = new Item({ run: (e, tr) => addTable(e, tr) });
|
|
539
|
+
r.addColumnBefore = new Item({ run: addColumnBefore });
|
|
540
|
+
r.addColumnAfter = new Item({ run: addColumnAfter });
|
|
541
|
+
r.deleteColumn = new Item({ run: deleteColumn });
|
|
542
|
+
r.addRowBefore = new Item({ run: addRowBefore });
|
|
543
|
+
r.addRowAfter = new Item({ run: addRowAfter });
|
|
544
|
+
r.deleteRow = new Item({ run: deleteRow });
|
|
545
|
+
r.deleteTable = new Item({ run: deleteTable });
|
|
546
|
+
r.mergeCells = new Item({ run: mergeCells });
|
|
547
|
+
r.splitCell = new Item({ run: splitCell });
|
|
548
|
+
r.toggleHeaderColumn = new Item({ run: toggleHeaderColumn });
|
|
549
|
+
r.toggleHeaderRow = new Item({ run: toggleHeaderRow });
|
|
550
|
+
r.toggleHeaderCell = new Item({ run: toggleHeaderCell });
|
|
551
|
+
}
|
|
552
|
+
return r;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Given a blockquote node type, returns an input rule that turns `"> "`
|
|
557
|
+
* at the start of a textblock into a blockquote.
|
|
558
|
+
*/
|
|
559
|
+
function blockQuoteRule(nodeType) {
|
|
560
|
+
return wrappingInputRule(/^\s*>\s$/, nodeType);
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Given a list node type, returns an input rule that turns a number
|
|
564
|
+
* followed by a dot at the start of a textblock into an ordered list.
|
|
565
|
+
*/
|
|
566
|
+
function orderedListRule(nodeType) {
|
|
567
|
+
return wrappingInputRule(/^(\d+)\.\s$/, nodeType, match => ({ order: +match[1] }), (match, node) => node.childCount + node.attrs.order === +match[1]);
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Given a list node type, returns an input rule that turns a bullet
|
|
571
|
+
* (dash, plush, or asterisk) at the start of a textblock into a
|
|
572
|
+
* bullet list.
|
|
573
|
+
*/
|
|
574
|
+
function bulletListRule(nodeType) {
|
|
575
|
+
return wrappingInputRule(/^\s*([-+*])\s$/, nodeType);
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Given a code block node type, returns an input rule that turns a
|
|
579
|
+
* textblock starting with three backticks into a code block.
|
|
580
|
+
*/
|
|
581
|
+
function codeBlockRule(nodeType) {
|
|
582
|
+
return textblockTypeInputRule(/^```$/, nodeType);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Given a node type and a maximum level, creates an input rule that
|
|
586
|
+
* turns up to that number of `#` characters followed by a space at
|
|
587
|
+
* the start of a textblock into a heading whose level corresponds to
|
|
588
|
+
* the number of `#` signs.
|
|
589
|
+
*/
|
|
590
|
+
function headingRule(nodeType, maxLevel) {
|
|
591
|
+
return textblockTypeInputRule(new RegExp('^(#{1,' + maxLevel + '})\\s$'), nodeType, match => ({
|
|
592
|
+
level: match[1].length,
|
|
593
|
+
}));
|
|
594
|
+
}
|
|
595
|
+
/**
|
|
596
|
+
* A set of input rules for creating the basic block quotes, lists,
|
|
597
|
+
* code blocks, and heading.
|
|
598
|
+
*/
|
|
599
|
+
function buildInputRules(schema) {
|
|
600
|
+
const rules = [ellipsis, emDash];
|
|
601
|
+
let type = schema.nodes.blockquote;
|
|
602
|
+
if (type) {
|
|
603
|
+
rules.push(blockQuoteRule(type));
|
|
604
|
+
}
|
|
605
|
+
type = schema.nodes.ordered_list;
|
|
606
|
+
if (type) {
|
|
607
|
+
rules.push(orderedListRule(type));
|
|
608
|
+
}
|
|
609
|
+
type = schema.nodes.bullet_list;
|
|
610
|
+
if (type) {
|
|
611
|
+
rules.push(bulletListRule(type));
|
|
612
|
+
}
|
|
613
|
+
type = schema.nodes.code_block;
|
|
614
|
+
if (type) {
|
|
615
|
+
rules.push(codeBlockRule(type));
|
|
616
|
+
}
|
|
617
|
+
type = schema.nodes.heading;
|
|
618
|
+
if (type) {
|
|
619
|
+
rules.push(headingRule(type, 6));
|
|
620
|
+
}
|
|
621
|
+
return inputRules({ rules });
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Inspect the given schema looking for marks and nodes from the
|
|
626
|
+
* basic schema, and if found, add key bindings related to them.
|
|
627
|
+
* This will add:
|
|
628
|
+
*
|
|
629
|
+
* * **Mod-b** for toggling [strong](#schema-basic.StrongMark)
|
|
630
|
+
* * **Mod-i** for toggling [emphasis](#schema-basic.EmMark)
|
|
631
|
+
* * **Mod-`** for toggling [code font](#schema-basic.CodeMark)
|
|
632
|
+
* * **Ctrl-Shift-0** for making the current textblock a paragraph
|
|
633
|
+
* * **Ctrl-Shift-1** to **Ctrl-Shift-Digit6** for making the current
|
|
634
|
+
* textblock a heading of the corresponding level
|
|
635
|
+
* * **Ctrl-Shift-Backslash** to make the current textblock a code block
|
|
636
|
+
* * **Ctrl-Shift-8** to wrap the selection in an ordered list
|
|
637
|
+
* * **Ctrl-Shift-9** to wrap the selection in a bullet list
|
|
638
|
+
* * **Ctrl->** to wrap the selection in a block quote
|
|
639
|
+
* * **Enter** to split a non-empty textblock in a list item while at
|
|
640
|
+
* the same time splitting the list item
|
|
641
|
+
* * **Mod-Enter** to insert a hard break
|
|
642
|
+
* * **Mod-_** to insert a horizontal rule
|
|
643
|
+
* * **Backspace** to undo an input rule
|
|
644
|
+
* * **Alt-ArrowUp** to `joinUp`
|
|
645
|
+
* * **Alt-ArrowDown** to `joinDown`
|
|
646
|
+
* * **Mod-BracketLeft** to `lift`
|
|
647
|
+
* * **Escape** to `selectParentNode`
|
|
648
|
+
*
|
|
649
|
+
* You can suppress or map these bindings by passing a `mapKeys`
|
|
650
|
+
* argument, which maps key names (say `"Mod-B"` to either `false`, to
|
|
651
|
+
* remove the binding, or a new key name string.
|
|
652
|
+
*/
|
|
653
|
+
function buildKeymap(schema, isMac) {
|
|
654
|
+
const keys = {};
|
|
655
|
+
keys['Mod-z'] = undo;
|
|
656
|
+
keys['Shift-Mod-z'] = redo;
|
|
657
|
+
keys['Backspace'] = undoInputRule;
|
|
658
|
+
if (!isMac) {
|
|
659
|
+
keys['Mod-y'] = redo;
|
|
660
|
+
}
|
|
661
|
+
keys['Alt-ArrowUp'] = joinUp;
|
|
662
|
+
keys['Alt-ArrowDown'] = joinDown;
|
|
663
|
+
keys['Mod-BracketLeft'] = lift;
|
|
664
|
+
keys['Escape'] = selectParentNode;
|
|
665
|
+
let type = schema.marks.strong;
|
|
666
|
+
if (type) {
|
|
667
|
+
keys['Mod-b'] = toggleMark(type);
|
|
668
|
+
keys['Mod-B'] = toggleMark(type);
|
|
669
|
+
}
|
|
670
|
+
type = schema.marks.em;
|
|
671
|
+
if (type) {
|
|
672
|
+
keys['Mod-i'] = toggleMark(type);
|
|
673
|
+
keys['Mod-I'] = toggleMark(type);
|
|
674
|
+
}
|
|
675
|
+
type = schema.marks.code;
|
|
676
|
+
if (type) {
|
|
677
|
+
keys['Mod-`'] = toggleMark(type);
|
|
678
|
+
}
|
|
679
|
+
type = schema.nodes.bullet_list;
|
|
680
|
+
if (type) {
|
|
681
|
+
keys['Shift-Ctrl-8'] = wrapInList(type);
|
|
682
|
+
}
|
|
683
|
+
type = schema.nodes.ordered_list;
|
|
684
|
+
if (type) {
|
|
685
|
+
keys['Shift-Ctrl-9'] = wrapInList(type);
|
|
686
|
+
}
|
|
687
|
+
type = schema.nodes.blockquote;
|
|
688
|
+
if (type) {
|
|
689
|
+
keys['Ctrl->'] = wrapIn(type);
|
|
690
|
+
}
|
|
691
|
+
type = schema.nodes.hard_break;
|
|
692
|
+
if (type) {
|
|
693
|
+
const br = type;
|
|
694
|
+
const cmd = chainCommands(exitCode, (state, dispatch) => {
|
|
695
|
+
dispatch === null || dispatch === void 0 ? void 0 : dispatch(state.tr.replaceSelectionWith(br.create()).scrollIntoView());
|
|
696
|
+
return true;
|
|
697
|
+
});
|
|
698
|
+
keys['Mod-Enter'] = cmd;
|
|
699
|
+
keys['Shift-Enter'] = cmd;
|
|
700
|
+
if (isMac) {
|
|
701
|
+
keys['Ctrl-Enter'] = cmd;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
type = schema.nodes.list_item;
|
|
705
|
+
if (type) {
|
|
706
|
+
keys['Enter'] = splitListItem(type);
|
|
707
|
+
keys['Mod-['] = liftListItem(type);
|
|
708
|
+
keys['Mod-]'] = sinkListItem(type);
|
|
709
|
+
}
|
|
710
|
+
type = schema.nodes.paragraph;
|
|
711
|
+
if (type) {
|
|
712
|
+
keys['Shift-Ctrl-0'] = setBlockType(type);
|
|
713
|
+
}
|
|
714
|
+
type = schema.nodes.code_block;
|
|
715
|
+
if (type) {
|
|
716
|
+
keys['Shift-Ctrl-\\'] = setBlockType(type);
|
|
717
|
+
}
|
|
718
|
+
type = schema.nodes.heading;
|
|
719
|
+
if (type) {
|
|
720
|
+
for (let i = 1; i <= 6; i++) {
|
|
721
|
+
keys['Shift-Ctrl-' + i] = setBlockType(type, { level: i });
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
type = schema.nodes.horizontal_rule;
|
|
725
|
+
if (type) {
|
|
726
|
+
const hr = type;
|
|
727
|
+
keys['Mod-_'] = (state, dispatch) => {
|
|
728
|
+
dispatch === null || dispatch === void 0 ? void 0 : dispatch(state.tr.replaceSelectionWith(hr.create()).scrollIntoView());
|
|
729
|
+
return true;
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
return keys;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Prosemirror component
|
|
737
|
+
*
|
|
738
|
+
* Usage :
|
|
739
|
+
*
|
|
740
|
+
* ```html
|
|
741
|
+
* <natural-editor [(ngModel)]="htmlString"></natural-editor>
|
|
742
|
+
* ```
|
|
743
|
+
*/
|
|
744
|
+
// @dynamic
|
|
745
|
+
class NaturalEditorComponent {
|
|
746
|
+
constructor(ngControl, document, dialog, imagePlugin) {
|
|
747
|
+
this.ngControl = ngControl;
|
|
748
|
+
this.document = document;
|
|
749
|
+
this.dialog = dialog;
|
|
750
|
+
this.imagePlugin = imagePlugin;
|
|
751
|
+
this.view = null;
|
|
752
|
+
this.contentChange = new EventEmitter();
|
|
753
|
+
/**
|
|
754
|
+
* Callback to upload an image.
|
|
755
|
+
*
|
|
756
|
+
* If given it will enable advanced schema, including image and tables.
|
|
757
|
+
* It must be given on initialization and cannot be changed later on.
|
|
758
|
+
*/
|
|
759
|
+
this.imageUploader = null;
|
|
760
|
+
this.schema = basicSchema;
|
|
761
|
+
/**
|
|
762
|
+
* HTML string
|
|
763
|
+
*/
|
|
764
|
+
this.content = '';
|
|
765
|
+
this.menu = null;
|
|
766
|
+
/**
|
|
767
|
+
* If subscribed to, then the save button will be shown and click events forwarded
|
|
768
|
+
*/
|
|
769
|
+
this.save = new EventEmitter();
|
|
770
|
+
if (this.ngControl !== null) {
|
|
771
|
+
this.ngControl.valueAccessor = this;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
ngOnInit() {
|
|
775
|
+
this.schema = this.imageUploader ? advancedSchema : basicSchema;
|
|
776
|
+
this.menu = buildMenuItems(this.schema, this.dialog);
|
|
777
|
+
const serializer = DOMSerializer.fromSchema(this.schema);
|
|
778
|
+
const state = this.createState();
|
|
779
|
+
this.view = new EditorView(this.editor.nativeElement, {
|
|
780
|
+
state: state,
|
|
781
|
+
dispatchTransaction: (transaction) => {
|
|
782
|
+
if (!this.view) {
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
785
|
+
const newState = this.view.state.apply(transaction);
|
|
786
|
+
this.view.updateState(newState);
|
|
787
|
+
// Transform doc into HTML string
|
|
788
|
+
const dom = serializer.serializeFragment(this.view.state.doc);
|
|
789
|
+
const el = this.document.createElement('_');
|
|
790
|
+
el.appendChild(dom);
|
|
791
|
+
const newContent = el.innerHTML;
|
|
792
|
+
if (this.content === newContent) {
|
|
793
|
+
return;
|
|
794
|
+
}
|
|
795
|
+
this.content = el.innerHTML;
|
|
796
|
+
if (this.onChange) {
|
|
797
|
+
this.onChange(this.content);
|
|
798
|
+
}
|
|
799
|
+
this.contentChange.emit(this.content);
|
|
800
|
+
},
|
|
801
|
+
});
|
|
802
|
+
this.update();
|
|
803
|
+
}
|
|
804
|
+
writeValue(val) {
|
|
805
|
+
if (typeof val === 'string' && val !== this.content) {
|
|
806
|
+
this.content = val;
|
|
807
|
+
}
|
|
808
|
+
if (this.view !== null) {
|
|
809
|
+
const state = this.createState();
|
|
810
|
+
this.view.updateState(state);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
createState() {
|
|
814
|
+
const template = this.document.createElement('_');
|
|
815
|
+
template.innerHTML = '<div>' + this.content + '</div>';
|
|
816
|
+
if (!template.firstChild) {
|
|
817
|
+
throw new Error('child of template element could not be created');
|
|
818
|
+
}
|
|
819
|
+
const parser = DOMParser.fromSchema(this.schema);
|
|
820
|
+
const doc = parser.parse(template.firstChild);
|
|
821
|
+
return EditorState.create({
|
|
822
|
+
doc: doc,
|
|
823
|
+
plugins: this.createPlugins(),
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
createPlugins() {
|
|
827
|
+
var _a;
|
|
828
|
+
const isMac = !!((_a = this.document.defaultView) === null || _a === void 0 ? void 0 : _a.navigator.platform.match(/Mac/));
|
|
829
|
+
const plugins = [
|
|
830
|
+
buildInputRules(this.schema),
|
|
831
|
+
keymap(buildKeymap(this.schema, isMac)),
|
|
832
|
+
keymap(baseKeymap),
|
|
833
|
+
dropCursor(),
|
|
834
|
+
gapCursor(),
|
|
835
|
+
history(),
|
|
836
|
+
new Plugin({
|
|
837
|
+
props: {
|
|
838
|
+
attributes: { class: 'ProseMirror-example-setup-style' },
|
|
839
|
+
},
|
|
840
|
+
}),
|
|
841
|
+
new Plugin({
|
|
842
|
+
view: () => this,
|
|
843
|
+
}),
|
|
844
|
+
];
|
|
845
|
+
if (this.schema === advancedSchema) {
|
|
846
|
+
plugins.push(this.imagePlugin.plugin, columnResizing(undefined), tableEditing(), keymap({
|
|
847
|
+
Tab: goToNextCell(1),
|
|
848
|
+
'Shift-Tab': goToNextCell(-1),
|
|
849
|
+
}));
|
|
850
|
+
}
|
|
851
|
+
return plugins;
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* Called by Prosemirror whenever the editor state changes. So we update our menu states.
|
|
855
|
+
*/
|
|
856
|
+
update() {
|
|
857
|
+
if (!this.view || !this.menu) {
|
|
858
|
+
return;
|
|
859
|
+
}
|
|
860
|
+
for (const item of Object.values(this.menu)) {
|
|
861
|
+
item.update(this.view, this.view.state);
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
registerOnChange(fn) {
|
|
865
|
+
this.onChange = fn;
|
|
866
|
+
}
|
|
867
|
+
registerOnTouched(fn) { }
|
|
868
|
+
setDisabledState(isDisabled) {
|
|
869
|
+
// TODO disable editor ?
|
|
870
|
+
}
|
|
871
|
+
ngOnDestroy() {
|
|
872
|
+
if (this.view) {
|
|
873
|
+
this.view.destroy();
|
|
874
|
+
this.view = null;
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
run(event, key) {
|
|
878
|
+
if (!this.view || !this.menu) {
|
|
879
|
+
return;
|
|
880
|
+
}
|
|
881
|
+
const item = this.menu[key];
|
|
882
|
+
if (!item || item.disabled || !item.show) {
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
item.spec.run(this.view.state, this.view.dispatch, this.view, event);
|
|
886
|
+
this.view.focus();
|
|
887
|
+
}
|
|
888
|
+
upload(file) {
|
|
889
|
+
if (!this.view || !this.imageUploader) {
|
|
890
|
+
return;
|
|
891
|
+
}
|
|
892
|
+
if (this.view.state.selection.$from.parent.inlineContent) {
|
|
893
|
+
this.imagePlugin.startImageUpload(this.view, file, this.imageUploader, this.schema);
|
|
894
|
+
}
|
|
895
|
+
this.view.focus();
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
NaturalEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NaturalEditorComponent, deps: [{ token: i4.NgControl, optional: true, self: true }, { token: DOCUMENT }, { token: i1.MatDialog }, { token: ImagePlugin }], target: i0.ɵɵFactoryTarget.Component });
|
|
899
|
+
NaturalEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.5", type: NaturalEditorComponent, selector: "natural-editor", inputs: { imageUploader: "imageUploader" }, outputs: { contentChange: "contentChange", save: "save" }, providers: [ImagePlugin], viewQueries: [{ propertyName: "editor", first: true, predicate: ["editor"], descendants: true, read: ElementRef, static: true }], ngImport: i0, template: "<div class=\"menu-container\" *ngIf=\"menu\">\n <div class=\"menu\">\n <button mat-button *ngIf=\"save.observed\" (click)=\"save.emit()\" i18n-matTooltip matTooltip=\"Enregistrer\">\n <mat-icon>save</mat-icon>\n </button>\n\n <mat-button-toggle-group multiple>\n <mat-button-toggle\n *ngIf=\"menu.toggleStrong\"\n [disabled]=\"menu.toggleStrong.disabled\"\n [checked]=\"menu.toggleStrong.active\"\n (click)=\"run($event, 'toggleStrong')\"\n i18n-matTooltip\n matTooltip=\"Gras\"\n >\n <mat-icon>format_bold</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.toggleEm\"\n [disabled]=\"menu.toggleEm.disabled\"\n [checked]=\"menu.toggleEm.active\"\n (click)=\"run($event, 'toggleEm')\"\n i18n-matTooltip\n matTooltip=\"Italique\"\n >\n <mat-icon>format_italic</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.toggleCode\"\n [disabled]=\"menu.toggleCode.disabled\"\n [checked]=\"menu.toggleCode.active\"\n (click)=\"run($event, 'toggleCode')\"\n i18n-matTooltip\n matTooltip=\"Code\"\n >\n <mat-icon>code</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.toggleLink\"\n [disabled]=\"menu.toggleLink.disabled\"\n [checked]=\"menu.toggleLink.active\"\n (click)=\"run($event, 'toggleLink')\"\n i18n-matTooltip\n matTooltip=\"Ins\u00E9rer un lien...\"\n >\n <mat-icon>insert_link</mat-icon>\n </mat-button-toggle>\n </mat-button-toggle-group>\n\n <button mat-button [matMenuTriggerFor]=\"blockMenu\">\n <span i18n>Type</span>\n <mat-icon>arrow_drop_down</mat-icon>\n </button>\n\n <mat-menu #blockMenu=\"matMenu\">\n <button\n mat-menu-item\n *ngIf=\"menu.makeParagraph\"\n [disabled]=\"menu.makeParagraph.disabled\"\n (click)=\"run($event, 'makeParagraph')\"\n i18n\n >Paragraphe\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeCodeBlock\"\n [disabled]=\"menu.makeCodeBlock.disabled\"\n (click)=\"run($event, 'makeCodeBlock')\"\n i18n\n >Code\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead1\"\n [disabled]=\"menu.makeHead1.disabled\"\n (click)=\"run($event, 'makeHead1')\"\n i18n\n >Titre 1\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead2\"\n [disabled]=\"menu.makeHead2.disabled\"\n (click)=\"run($event, 'makeHead2')\"\n i18n\n >Titre 2\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead3\"\n [disabled]=\"menu.makeHead3.disabled\"\n (click)=\"run($event, 'makeHead3')\"\n i18n\n >Titre 3\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead4\"\n [disabled]=\"menu.makeHead4.disabled\"\n (click)=\"run($event, 'makeHead4')\"\n i18n\n >Titre 4\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead5\"\n [disabled]=\"menu.makeHead5.disabled\"\n (click)=\"run($event, 'makeHead5')\"\n i18n\n >Titre 5\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead6\"\n [disabled]=\"menu.makeHead6.disabled\"\n (click)=\"run($event, 'makeHead6')\"\n i18n\n >Titre 6\n </button>\n </mat-menu>\n\n <button mat-button [matMenuTriggerFor]=\"tableMenu\" *ngIf=\"menu.addColumnBefore\">\n <span i18n>Tableau</span>\n <mat-icon>arrow_drop_down</mat-icon>\n </button>\n\n <mat-menu #tableMenu=\"matMenu\">\n <button\n mat-menu-item\n *ngIf=\"menu.insertTable\"\n [disabled]=\"menu.insertTable.disabled\"\n (click)=\"run($event, 'insertTable')\"\n i18n\n >Ins\u00E9rer un tableau\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.deleteTable\"\n [disabled]=\"menu.deleteTable.disabled\"\n (click)=\"run($event, 'deleteTable')\"\n i18n\n >Supprimer le tableau\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.mergeCells\"\n [disabled]=\"menu.mergeCells.disabled\"\n (click)=\"run($event, 'mergeCells')\"\n i18n\n >Fusionner les cellules\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.splitCell\"\n [disabled]=\"menu.splitCell.disabled\"\n (click)=\"run($event, 'splitCell')\"\n i18n\n >Scinder les cellules\n </button>\n\n <mat-divider></mat-divider>\n\n <button\n mat-menu-item\n *ngIf=\"menu.addColumnBefore\"\n [disabled]=\"menu.addColumnBefore.disabled\"\n (click)=\"run($event, 'addColumnBefore')\"\n i18n\n >Ins\u00E9rer une colonne avant\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.addColumnAfter\"\n [disabled]=\"menu.addColumnAfter.disabled\"\n (click)=\"run($event, 'addColumnAfter')\"\n i18n\n >Ins\u00E9rer une colonne apr\u00E8s\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.deleteColumn\"\n [disabled]=\"menu.deleteColumn.disabled\"\n (click)=\"run($event, 'deleteColumn')\"\n i18n\n >Supprimer la colonne\n </button>\n\n <mat-divider></mat-divider>\n\n <button\n mat-menu-item\n *ngIf=\"menu.addRowBefore\"\n [disabled]=\"menu.addRowBefore.disabled\"\n (click)=\"run($event, 'addRowBefore')\"\n i18n\n >Ins\u00E9rer une ligne avant\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.addRowAfter\"\n [disabled]=\"menu.addRowAfter.disabled\"\n (click)=\"run($event, 'addRowAfter')\"\n i18n\n >Ins\u00E9rer une ligne apr\u00E8s\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.deleteRow\"\n [disabled]=\"menu.deleteRow.disabled\"\n (click)=\"run($event, 'deleteRow')\"\n i18n\n >Supprimer la ligne\n </button>\n\n <mat-divider></mat-divider>\n\n <button\n mat-menu-item\n *ngIf=\"menu.toggleHeaderColumn\"\n [disabled]=\"menu.toggleHeaderColumn.disabled\"\n (click)=\"run($event, 'toggleHeaderColumn')\"\n i18n\n >Ent\u00EAte de colonne\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.toggleHeaderRow\"\n [disabled]=\"menu.toggleHeaderRow.disabled\"\n (click)=\"run($event, 'toggleHeaderRow')\"\n i18n\n >Ent\u00EAte de ligne\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.toggleHeaderCell\"\n [disabled]=\"menu.toggleHeaderCell.disabled\"\n (click)=\"run($event, 'toggleHeaderCell')\"\n i18n\n >Ent\u00EAte de cellule\n </button>\n </mat-menu>\n\n <button\n mat-button\n *ngIf=\"imageUploader\"\n naturalFileDrop\n [selectable]=\"true\"\n [broadcast]=\"false\"\n i18n-matTooltip\n matTooltip=\"Ins\u00E9rer une image\"\n (fileChange)=\"upload($event)\"\n >\n <mat-icon>insert_photo</mat-icon>\n </button>\n\n <mat-button-toggle-group *ngIf=\"menu.alignLeft\">\n <mat-button-toggle\n *ngIf=\"menu.alignLeft\"\n [disabled]=\"menu.alignLeft.disabled\"\n [checked]=\"menu.alignLeft.active\"\n (click)=\"run($event, 'alignLeft')\"\n i18n-matTooltip\n matTooltip=\"Aligner gauche\"\n >\n <mat-icon>format_align_left</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.alignCenter\"\n [disabled]=\"menu.alignCenter.disabled\"\n [checked]=\"menu.alignCenter.active\"\n (click)=\"run($event, 'alignCenter')\"\n i18n-matTooltip\n matTooltip=\"Centrer\"\n >\n <mat-icon>format_align_center</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.alignRight\"\n [disabled]=\"menu.alignRight.disabled\"\n [checked]=\"menu.alignRight.active\"\n (click)=\"run($event, 'alignRight')\"\n i18n-matTooltip\n matTooltip=\"Aligner droite\"\n >\n <mat-icon>format_align_right</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.alignJustify\"\n [disabled]=\"menu.alignJustify.disabled\"\n [checked]=\"menu.alignJustify.active\"\n (click)=\"run($event, 'alignJustify')\"\n i18n-matTooltip\n matTooltip=\"Justifier\"\n >\n <mat-icon>format_align_justify</mat-icon>\n </mat-button-toggle>\n </mat-button-toggle-group>\n\n <button\n mat-button\n *ngIf=\"menu.undo\"\n [disabled]=\"menu.undo.disabled\"\n (click)=\"run($event, 'undo')\"\n i18n-matTooltip\n matTooltip=\"Annuler\"\n >\n <mat-icon>undo</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.redo\"\n [disabled]=\"menu.redo.disabled\"\n (click)=\"run($event, 'redo')\"\n i18n-matTooltip\n matTooltip=\"Refaire\"\n >\n <mat-icon>redo</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.wrapBulletList && menu.wrapBulletList.show\"\n [disabled]=\"menu.wrapBulletList.disabled\"\n (click)=\"run($event, 'wrapBulletList')\"\n i18n-matTooltip\n matTooltip=\"Liste \u00E0 puce\"\n >\n <mat-icon>format_list_bulleted</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.wrapOrderedList && menu.wrapOrderedList.show\"\n [disabled]=\"menu.wrapOrderedList.disabled\"\n (click)=\"run($event, 'wrapOrderedList')\"\n i18n-matTooltip\n matTooltip=\"Liste \u00E0 num\u00E9ro\"\n >\n <mat-icon>format_list_numbered</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.wrapBlockQuote && menu.wrapBlockQuote.show\"\n [disabled]=\"menu.wrapBlockQuote.disabled\"\n (click)=\"run($event, 'wrapBlockQuote')\"\n i18n-matTooltip\n matTooltip=\"Citation\"\n >\n <mat-icon>format_quote</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.joinUp && menu.joinUp.show\"\n [disabled]=\"menu.joinUp.disabled\"\n (click)=\"run($event, 'joinUp')\"\n i18n-matTooltip\n matTooltip=\"Fusionner avec l'\u00E9l\u00E9ment du haut\"\n >\n <mat-icon>move_up</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.lift && menu.lift.show\"\n [disabled]=\"menu.lift.disabled\"\n (click)=\"run($event, 'lift')\"\n i18n-matTooltip\n matTooltip=\"D\u00E9sindenter\"\n >\n <mat-icon>format_indent_decrease</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.selectParentNode && menu.selectParentNode.show\"\n [disabled]=\"menu.selectParentNode.disabled\"\n (click)=\"run($event, 'selectParentNode')\"\n i18n-matTooltip\n matTooltip=\"S\u00E9lectionner l'\u00E9l\u00E9ment parent\"\n >\n <mat-icon>select_all</mat-icon>\n </button>\n </div>\n</div>\n<div #editor></div>\n", styles: [".menu{border-bottom:1px solid;display:flex;flex-wrap:wrap;padding:10px 18px}.menu-container{position:sticky;top:-20px;z-index:999}::ng-deep .ProseMirror{position:relative}::ng-deep .ProseMirror{word-wrap:break-word;white-space:pre-wrap;-webkit-font-variant-ligatures:none;font-feature-settings:none;font-variant-ligatures:none}::ng-deep .ProseMirror pre{white-space:pre-wrap}::ng-deep .ProseMirror li{position:relative}::ng-deep .ProseMirror-hideselection *::selection{background:transparent}::ng-deep .ProseMirror-hideselection *::-moz-selection{background:transparent}::ng-deep .ProseMirror-hideselection{caret-color:transparent}::ng-deep .ProseMirror-selectednode{outline:2px solid #8cf}::ng-deep li.ProseMirror-selectednode{outline:none}::ng-deep li.ProseMirror-selectednode:after{content:\"\";position:absolute;left:-32px;right:-2px;top:-2px;bottom:-2px;border:2px solid #8cf;pointer-events:none}::ng-deep .ProseMirror-gapcursor{display:none;pointer-events:none;position:absolute}::ng-deep .ProseMirror-gapcursor:after{content:\"\";display:block;position:absolute;top:-2px;width:20px;border-top:1px solid black;animation:ProseMirror-cursor-blink 1.1s steps(2,start) infinite}@keyframes ProseMirror-cursor-blink{to{visibility:hidden}}::ng-deep .ProseMirror-focused .ProseMirror-gapcursor{display:block}::ng-deep .ProseMirror-example-setup-style hr{padding:2px 10px;border:none;margin:1em 0}::ng-deep .ProseMirror-example-setup-style hr:after{content:\"\";display:block;height:1px;background-color:silver;line-height:2px}::ng-deep .ProseMirror ul,::ng-deep .ProseMirror ol{padding-left:30px}::ng-deep .ProseMirror blockquote{padding-left:1em;border-left:3px solid #eee;margin-left:0;margin-right:0}::ng-deep .ProseMirror-example-setup-style img{cursor:default}::ng-deep .ProseMirror p:first-child,::ng-deep .ProseMirror h1:first-child,::ng-deep .ProseMirror h2:first-child,::ng-deep .ProseMirror h3:first-child,::ng-deep .ProseMirror h4:first-child,::ng-deep .ProseMirror h5:first-child,::ng-deep .ProseMirror h6:first-child{margin-top:10px}::ng-deep .ProseMirror{padding:4px 8px 4px 14px;line-height:1.2;outline:none}::ng-deep .ProseMirror p{margin-bottom:1em}::ng-deep .ProseMirror .tableWrapper{overflow-x:auto}::ng-deep .ProseMirror table{border-collapse:collapse;table-layout:fixed;width:100%;overflow:hidden}::ng-deep .ProseMirror td,::ng-deep .ProseMirror th{vertical-align:top;box-sizing:border-box;position:relative}::ng-deep .ProseMirror .column-resize-handle{position:absolute;right:-2px;top:0;bottom:0;width:4px;z-index:20;background-color:#adf;pointer-events:none}::ng-deep .ProseMirror.resize-cursor{cursor:col-resize}::ng-deep .ProseMirror .selectedCell:after{z-index:2;position:absolute;content:\"\";left:0;right:0;top:0;bottom:0;background:rgba(200,200,255,.4);pointer-events:none}::ng-deep .ProseMirror table{margin:0}::ng-deep .ProseMirror th,::ng-deep .ProseMirror td{min-width:1em;border:1px solid #ddd;padding:3px 5px}::ng-deep .ProseMirror .tableWrapper{margin:1em 0}::ng-deep .ProseMirror th{font-weight:700;text-align:left}::ng-deep placeholder{display:block;width:50px;height:50px;background-size:500% 100%!important;animation:gradient 3s none infinite}@keyframes gradient{0%{background-position:100% 100%}to{background-position:0 0}}\n"], components: [{ type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i5$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i6$1.MatButtonToggle, selector: "mat-button-toggle", inputs: ["disableRipple", "aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "appearance", "checked", "disabled"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { type: i7.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { type: i7.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { type: i8.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i6$1.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { type: i7.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { type: i11.NaturalFileDropDirective, selector: ":not([naturalFileSelect])[naturalFileDrop]", outputs: ["fileOver"] }] });
|
|
900
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NaturalEditorComponent, decorators: [{
|
|
901
|
+
type: Component,
|
|
902
|
+
args: [{ selector: 'natural-editor', providers: [ImagePlugin], template: "<div class=\"menu-container\" *ngIf=\"menu\">\n <div class=\"menu\">\n <button mat-button *ngIf=\"save.observed\" (click)=\"save.emit()\" i18n-matTooltip matTooltip=\"Enregistrer\">\n <mat-icon>save</mat-icon>\n </button>\n\n <mat-button-toggle-group multiple>\n <mat-button-toggle\n *ngIf=\"menu.toggleStrong\"\n [disabled]=\"menu.toggleStrong.disabled\"\n [checked]=\"menu.toggleStrong.active\"\n (click)=\"run($event, 'toggleStrong')\"\n i18n-matTooltip\n matTooltip=\"Gras\"\n >\n <mat-icon>format_bold</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.toggleEm\"\n [disabled]=\"menu.toggleEm.disabled\"\n [checked]=\"menu.toggleEm.active\"\n (click)=\"run($event, 'toggleEm')\"\n i18n-matTooltip\n matTooltip=\"Italique\"\n >\n <mat-icon>format_italic</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.toggleCode\"\n [disabled]=\"menu.toggleCode.disabled\"\n [checked]=\"menu.toggleCode.active\"\n (click)=\"run($event, 'toggleCode')\"\n i18n-matTooltip\n matTooltip=\"Code\"\n >\n <mat-icon>code</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.toggleLink\"\n [disabled]=\"menu.toggleLink.disabled\"\n [checked]=\"menu.toggleLink.active\"\n (click)=\"run($event, 'toggleLink')\"\n i18n-matTooltip\n matTooltip=\"Ins\u00E9rer un lien...\"\n >\n <mat-icon>insert_link</mat-icon>\n </mat-button-toggle>\n </mat-button-toggle-group>\n\n <button mat-button [matMenuTriggerFor]=\"blockMenu\">\n <span i18n>Type</span>\n <mat-icon>arrow_drop_down</mat-icon>\n </button>\n\n <mat-menu #blockMenu=\"matMenu\">\n <button\n mat-menu-item\n *ngIf=\"menu.makeParagraph\"\n [disabled]=\"menu.makeParagraph.disabled\"\n (click)=\"run($event, 'makeParagraph')\"\n i18n\n >Paragraphe\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeCodeBlock\"\n [disabled]=\"menu.makeCodeBlock.disabled\"\n (click)=\"run($event, 'makeCodeBlock')\"\n i18n\n >Code\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead1\"\n [disabled]=\"menu.makeHead1.disabled\"\n (click)=\"run($event, 'makeHead1')\"\n i18n\n >Titre 1\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead2\"\n [disabled]=\"menu.makeHead2.disabled\"\n (click)=\"run($event, 'makeHead2')\"\n i18n\n >Titre 2\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead3\"\n [disabled]=\"menu.makeHead3.disabled\"\n (click)=\"run($event, 'makeHead3')\"\n i18n\n >Titre 3\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead4\"\n [disabled]=\"menu.makeHead4.disabled\"\n (click)=\"run($event, 'makeHead4')\"\n i18n\n >Titre 4\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead5\"\n [disabled]=\"menu.makeHead5.disabled\"\n (click)=\"run($event, 'makeHead5')\"\n i18n\n >Titre 5\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead6\"\n [disabled]=\"menu.makeHead6.disabled\"\n (click)=\"run($event, 'makeHead6')\"\n i18n\n >Titre 6\n </button>\n </mat-menu>\n\n <button mat-button [matMenuTriggerFor]=\"tableMenu\" *ngIf=\"menu.addColumnBefore\">\n <span i18n>Tableau</span>\n <mat-icon>arrow_drop_down</mat-icon>\n </button>\n\n <mat-menu #tableMenu=\"matMenu\">\n <button\n mat-menu-item\n *ngIf=\"menu.insertTable\"\n [disabled]=\"menu.insertTable.disabled\"\n (click)=\"run($event, 'insertTable')\"\n i18n\n >Ins\u00E9rer un tableau\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.deleteTable\"\n [disabled]=\"menu.deleteTable.disabled\"\n (click)=\"run($event, 'deleteTable')\"\n i18n\n >Supprimer le tableau\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.mergeCells\"\n [disabled]=\"menu.mergeCells.disabled\"\n (click)=\"run($event, 'mergeCells')\"\n i18n\n >Fusionner les cellules\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.splitCell\"\n [disabled]=\"menu.splitCell.disabled\"\n (click)=\"run($event, 'splitCell')\"\n i18n\n >Scinder les cellules\n </button>\n\n <mat-divider></mat-divider>\n\n <button\n mat-menu-item\n *ngIf=\"menu.addColumnBefore\"\n [disabled]=\"menu.addColumnBefore.disabled\"\n (click)=\"run($event, 'addColumnBefore')\"\n i18n\n >Ins\u00E9rer une colonne avant\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.addColumnAfter\"\n [disabled]=\"menu.addColumnAfter.disabled\"\n (click)=\"run($event, 'addColumnAfter')\"\n i18n\n >Ins\u00E9rer une colonne apr\u00E8s\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.deleteColumn\"\n [disabled]=\"menu.deleteColumn.disabled\"\n (click)=\"run($event, 'deleteColumn')\"\n i18n\n >Supprimer la colonne\n </button>\n\n <mat-divider></mat-divider>\n\n <button\n mat-menu-item\n *ngIf=\"menu.addRowBefore\"\n [disabled]=\"menu.addRowBefore.disabled\"\n (click)=\"run($event, 'addRowBefore')\"\n i18n\n >Ins\u00E9rer une ligne avant\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.addRowAfter\"\n [disabled]=\"menu.addRowAfter.disabled\"\n (click)=\"run($event, 'addRowAfter')\"\n i18n\n >Ins\u00E9rer une ligne apr\u00E8s\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.deleteRow\"\n [disabled]=\"menu.deleteRow.disabled\"\n (click)=\"run($event, 'deleteRow')\"\n i18n\n >Supprimer la ligne\n </button>\n\n <mat-divider></mat-divider>\n\n <button\n mat-menu-item\n *ngIf=\"menu.toggleHeaderColumn\"\n [disabled]=\"menu.toggleHeaderColumn.disabled\"\n (click)=\"run($event, 'toggleHeaderColumn')\"\n i18n\n >Ent\u00EAte de colonne\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.toggleHeaderRow\"\n [disabled]=\"menu.toggleHeaderRow.disabled\"\n (click)=\"run($event, 'toggleHeaderRow')\"\n i18n\n >Ent\u00EAte de ligne\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.toggleHeaderCell\"\n [disabled]=\"menu.toggleHeaderCell.disabled\"\n (click)=\"run($event, 'toggleHeaderCell')\"\n i18n\n >Ent\u00EAte de cellule\n </button>\n </mat-menu>\n\n <button\n mat-button\n *ngIf=\"imageUploader\"\n naturalFileDrop\n [selectable]=\"true\"\n [broadcast]=\"false\"\n i18n-matTooltip\n matTooltip=\"Ins\u00E9rer une image\"\n (fileChange)=\"upload($event)\"\n >\n <mat-icon>insert_photo</mat-icon>\n </button>\n\n <mat-button-toggle-group *ngIf=\"menu.alignLeft\">\n <mat-button-toggle\n *ngIf=\"menu.alignLeft\"\n [disabled]=\"menu.alignLeft.disabled\"\n [checked]=\"menu.alignLeft.active\"\n (click)=\"run($event, 'alignLeft')\"\n i18n-matTooltip\n matTooltip=\"Aligner gauche\"\n >\n <mat-icon>format_align_left</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.alignCenter\"\n [disabled]=\"menu.alignCenter.disabled\"\n [checked]=\"menu.alignCenter.active\"\n (click)=\"run($event, 'alignCenter')\"\n i18n-matTooltip\n matTooltip=\"Centrer\"\n >\n <mat-icon>format_align_center</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.alignRight\"\n [disabled]=\"menu.alignRight.disabled\"\n [checked]=\"menu.alignRight.active\"\n (click)=\"run($event, 'alignRight')\"\n i18n-matTooltip\n matTooltip=\"Aligner droite\"\n >\n <mat-icon>format_align_right</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.alignJustify\"\n [disabled]=\"menu.alignJustify.disabled\"\n [checked]=\"menu.alignJustify.active\"\n (click)=\"run($event, 'alignJustify')\"\n i18n-matTooltip\n matTooltip=\"Justifier\"\n >\n <mat-icon>format_align_justify</mat-icon>\n </mat-button-toggle>\n </mat-button-toggle-group>\n\n <button\n mat-button\n *ngIf=\"menu.undo\"\n [disabled]=\"menu.undo.disabled\"\n (click)=\"run($event, 'undo')\"\n i18n-matTooltip\n matTooltip=\"Annuler\"\n >\n <mat-icon>undo</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.redo\"\n [disabled]=\"menu.redo.disabled\"\n (click)=\"run($event, 'redo')\"\n i18n-matTooltip\n matTooltip=\"Refaire\"\n >\n <mat-icon>redo</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.wrapBulletList && menu.wrapBulletList.show\"\n [disabled]=\"menu.wrapBulletList.disabled\"\n (click)=\"run($event, 'wrapBulletList')\"\n i18n-matTooltip\n matTooltip=\"Liste \u00E0 puce\"\n >\n <mat-icon>format_list_bulleted</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.wrapOrderedList && menu.wrapOrderedList.show\"\n [disabled]=\"menu.wrapOrderedList.disabled\"\n (click)=\"run($event, 'wrapOrderedList')\"\n i18n-matTooltip\n matTooltip=\"Liste \u00E0 num\u00E9ro\"\n >\n <mat-icon>format_list_numbered</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.wrapBlockQuote && menu.wrapBlockQuote.show\"\n [disabled]=\"menu.wrapBlockQuote.disabled\"\n (click)=\"run($event, 'wrapBlockQuote')\"\n i18n-matTooltip\n matTooltip=\"Citation\"\n >\n <mat-icon>format_quote</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.joinUp && menu.joinUp.show\"\n [disabled]=\"menu.joinUp.disabled\"\n (click)=\"run($event, 'joinUp')\"\n i18n-matTooltip\n matTooltip=\"Fusionner avec l'\u00E9l\u00E9ment du haut\"\n >\n <mat-icon>move_up</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.lift && menu.lift.show\"\n [disabled]=\"menu.lift.disabled\"\n (click)=\"run($event, 'lift')\"\n i18n-matTooltip\n matTooltip=\"D\u00E9sindenter\"\n >\n <mat-icon>format_indent_decrease</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.selectParentNode && menu.selectParentNode.show\"\n [disabled]=\"menu.selectParentNode.disabled\"\n (click)=\"run($event, 'selectParentNode')\"\n i18n-matTooltip\n matTooltip=\"S\u00E9lectionner l'\u00E9l\u00E9ment parent\"\n >\n <mat-icon>select_all</mat-icon>\n </button>\n </div>\n</div>\n<div #editor></div>\n", styles: [".menu{border-bottom:1px solid;display:flex;flex-wrap:wrap;padding:10px 18px}.menu-container{position:sticky;top:-20px;z-index:999}::ng-deep .ProseMirror{position:relative}::ng-deep .ProseMirror{word-wrap:break-word;white-space:pre-wrap;-webkit-font-variant-ligatures:none;font-feature-settings:none;font-variant-ligatures:none}::ng-deep .ProseMirror pre{white-space:pre-wrap}::ng-deep .ProseMirror li{position:relative}::ng-deep .ProseMirror-hideselection *::selection{background:transparent}::ng-deep .ProseMirror-hideselection *::-moz-selection{background:transparent}::ng-deep .ProseMirror-hideselection{caret-color:transparent}::ng-deep .ProseMirror-selectednode{outline:2px solid #8cf}::ng-deep li.ProseMirror-selectednode{outline:none}::ng-deep li.ProseMirror-selectednode:after{content:\"\";position:absolute;left:-32px;right:-2px;top:-2px;bottom:-2px;border:2px solid #8cf;pointer-events:none}::ng-deep .ProseMirror-gapcursor{display:none;pointer-events:none;position:absolute}::ng-deep .ProseMirror-gapcursor:after{content:\"\";display:block;position:absolute;top:-2px;width:20px;border-top:1px solid black;animation:ProseMirror-cursor-blink 1.1s steps(2,start) infinite}@keyframes ProseMirror-cursor-blink{to{visibility:hidden}}::ng-deep .ProseMirror-focused .ProseMirror-gapcursor{display:block}::ng-deep .ProseMirror-example-setup-style hr{padding:2px 10px;border:none;margin:1em 0}::ng-deep .ProseMirror-example-setup-style hr:after{content:\"\";display:block;height:1px;background-color:silver;line-height:2px}::ng-deep .ProseMirror ul,::ng-deep .ProseMirror ol{padding-left:30px}::ng-deep .ProseMirror blockquote{padding-left:1em;border-left:3px solid #eee;margin-left:0;margin-right:0}::ng-deep .ProseMirror-example-setup-style img{cursor:default}::ng-deep .ProseMirror p:first-child,::ng-deep .ProseMirror h1:first-child,::ng-deep .ProseMirror h2:first-child,::ng-deep .ProseMirror h3:first-child,::ng-deep .ProseMirror h4:first-child,::ng-deep .ProseMirror h5:first-child,::ng-deep .ProseMirror h6:first-child{margin-top:10px}::ng-deep .ProseMirror{padding:4px 8px 4px 14px;line-height:1.2;outline:none}::ng-deep .ProseMirror p{margin-bottom:1em}::ng-deep .ProseMirror .tableWrapper{overflow-x:auto}::ng-deep .ProseMirror table{border-collapse:collapse;table-layout:fixed;width:100%;overflow:hidden}::ng-deep .ProseMirror td,::ng-deep .ProseMirror th{vertical-align:top;box-sizing:border-box;position:relative}::ng-deep .ProseMirror .column-resize-handle{position:absolute;right:-2px;top:0;bottom:0;width:4px;z-index:20;background-color:#adf;pointer-events:none}::ng-deep .ProseMirror.resize-cursor{cursor:col-resize}::ng-deep .ProseMirror .selectedCell:after{z-index:2;position:absolute;content:\"\";left:0;right:0;top:0;bottom:0;background:rgba(200,200,255,.4);pointer-events:none}::ng-deep .ProseMirror table{margin:0}::ng-deep .ProseMirror th,::ng-deep .ProseMirror td{min-width:1em;border:1px solid #ddd;padding:3px 5px}::ng-deep .ProseMirror .tableWrapper{margin:1em 0}::ng-deep .ProseMirror th{font-weight:700;text-align:left}::ng-deep placeholder{display:block;width:50px;height:50px;background-size:500% 100%!important;animation:gradient 3s none infinite}@keyframes gradient{0%{background-position:100% 100%}to{background-position:0 0}}\n"] }]
|
|
903
|
+
}], ctorParameters: function () {
|
|
904
|
+
return [{ type: i4.NgControl, decorators: [{
|
|
905
|
+
type: Optional
|
|
906
|
+
}, {
|
|
907
|
+
type: Self
|
|
908
|
+
}] }, { type: Document, decorators: [{
|
|
909
|
+
type: Inject,
|
|
910
|
+
args: [DOCUMENT]
|
|
911
|
+
}] }, { type: i1.MatDialog }, { type: ImagePlugin }];
|
|
912
|
+
}, propDecorators: { editor: [{
|
|
913
|
+
type: ViewChild,
|
|
914
|
+
args: ['editor', { read: ElementRef, static: true }]
|
|
915
|
+
}], contentChange: [{
|
|
916
|
+
type: Output
|
|
917
|
+
}], imageUploader: [{
|
|
918
|
+
type: Input
|
|
919
|
+
}], save: [{
|
|
920
|
+
type: Output
|
|
921
|
+
}] } });
|
|
922
|
+
|
|
923
|
+
const imports = [
|
|
924
|
+
CommonModule,
|
|
925
|
+
MatButtonModule,
|
|
926
|
+
MatButtonToggleModule,
|
|
927
|
+
MatDialogModule,
|
|
928
|
+
MatFormFieldModule,
|
|
929
|
+
MatIconModule,
|
|
930
|
+
MatInputModule,
|
|
931
|
+
MatMenuModule,
|
|
932
|
+
MatToolbarModule,
|
|
933
|
+
MatTooltipModule,
|
|
934
|
+
ReactiveFormsModule,
|
|
935
|
+
NaturalFileModule,
|
|
936
|
+
MatDividerModule,
|
|
937
|
+
];
|
|
938
|
+
class NaturalEditorModule {
|
|
939
|
+
}
|
|
940
|
+
NaturalEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NaturalEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
941
|
+
NaturalEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NaturalEditorModule, declarations: [NaturalEditorComponent, LinkDialogComponent], imports: [CommonModule,
|
|
942
|
+
MatButtonModule,
|
|
943
|
+
MatButtonToggleModule,
|
|
944
|
+
MatDialogModule,
|
|
945
|
+
MatFormFieldModule,
|
|
946
|
+
MatIconModule,
|
|
947
|
+
MatInputModule,
|
|
948
|
+
MatMenuModule,
|
|
949
|
+
MatToolbarModule,
|
|
950
|
+
MatTooltipModule,
|
|
951
|
+
ReactiveFormsModule,
|
|
952
|
+
NaturalFileModule,
|
|
953
|
+
MatDividerModule], exports: [CommonModule,
|
|
954
|
+
MatButtonModule,
|
|
955
|
+
MatButtonToggleModule,
|
|
956
|
+
MatDialogModule,
|
|
957
|
+
MatFormFieldModule,
|
|
958
|
+
MatIconModule,
|
|
959
|
+
MatInputModule,
|
|
960
|
+
MatMenuModule,
|
|
961
|
+
MatToolbarModule,
|
|
962
|
+
MatTooltipModule,
|
|
963
|
+
ReactiveFormsModule,
|
|
964
|
+
NaturalFileModule,
|
|
965
|
+
MatDividerModule, NaturalEditorComponent] });
|
|
966
|
+
NaturalEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NaturalEditorModule, imports: [[...imports], CommonModule,
|
|
967
|
+
MatButtonModule,
|
|
968
|
+
MatButtonToggleModule,
|
|
969
|
+
MatDialogModule,
|
|
970
|
+
MatFormFieldModule,
|
|
971
|
+
MatIconModule,
|
|
972
|
+
MatInputModule,
|
|
973
|
+
MatMenuModule,
|
|
974
|
+
MatToolbarModule,
|
|
975
|
+
MatTooltipModule,
|
|
976
|
+
ReactiveFormsModule,
|
|
977
|
+
NaturalFileModule,
|
|
978
|
+
MatDividerModule] });
|
|
979
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImport: i0, type: NaturalEditorModule, decorators: [{
|
|
980
|
+
type: NgModule,
|
|
981
|
+
args: [{
|
|
982
|
+
declarations: [NaturalEditorComponent, LinkDialogComponent],
|
|
983
|
+
imports: [...imports],
|
|
984
|
+
exports: [...imports, NaturalEditorComponent],
|
|
985
|
+
}]
|
|
986
|
+
}] });
|
|
987
|
+
|
|
988
|
+
// Load `$localize` onto the global scope - to be able to use that function to translate strings in components/services.
|
|
989
|
+
|
|
990
|
+
/**
|
|
991
|
+
* Generated bundle index. Do not edit.
|
|
992
|
+
*/
|
|
993
|
+
|
|
994
|
+
export { NaturalEditorComponent, NaturalEditorModule };
|
|
995
|
+
//# sourceMappingURL=ecodev-natural-editor.mjs.map
|