@ecodev/natural-editor 42.0.0 → 42.1.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/esm2020/lib/class-dialog/class-dialog.component.mjs +37 -0
- package/esm2020/lib/color-dialog/color-dialog.component.mjs +184 -0
- package/esm2020/lib/custom-css/custom-css.directive.mjs +71 -0
- package/esm2020/lib/editor/editor.component.mjs +8 -8
- package/esm2020/lib/editor.module.mjs +24 -16
- package/esm2020/lib/link-dialog/link-dialog.component.mjs +3 -3
- package/esm2020/lib/utils/image.mjs +3 -3
- package/esm2020/lib/utils/items/cell-background-color-item.mjs +55 -0
- package/esm2020/lib/utils/items/class-item.mjs +86 -0
- package/esm2020/lib/utils/items/horizontal-rule-item.mjs +24 -0
- package/esm2020/lib/utils/items/item.mjs +39 -0
- package/esm2020/lib/utils/items/link-item.mjs +40 -0
- package/esm2020/lib/utils/items/table-item.mjs +43 -0
- package/esm2020/lib/utils/items/text-align-item.mjs +78 -0
- package/esm2020/lib/utils/items/utils.mjs +41 -0
- package/esm2020/lib/utils/items/wrap-list-item.mjs +6 -0
- package/esm2020/lib/utils/menu.mjs +45 -128
- package/esm2020/lib/utils/schema/paragraph-with-alignment.mjs +50 -0
- package/esm2020/lib/utils/schema/schema.mjs +51 -0
- package/esm2020/lib/utils/schema/table.mjs +113 -0
- package/esm2020/public-api.mjs +2 -1
- package/fesm2015/ecodev-natural-editor.mjs +747 -194
- package/fesm2015/ecodev-natural-editor.mjs.map +1 -1
- package/fesm2020/ecodev-natural-editor.mjs +741 -196
- package/fesm2020/ecodev-natural-editor.mjs.map +1 -1
- package/lib/class-dialog/class-dialog.component.d.ts +24 -0
- package/lib/color-dialog/color-dialog.component.d.ts +26 -0
- package/lib/custom-css/custom-css.directive.d.ts +29 -0
- package/lib/editor.module.d.ts +19 -16
- package/lib/utils/items/cell-background-color-item.d.ts +5 -0
- package/lib/utils/items/class-item.d.ts +6 -0
- package/lib/utils/items/horizontal-rule-item.d.ts +5 -0
- package/lib/utils/{item.d.ts → items/item.d.ts} +0 -0
- package/lib/utils/items/link-item.d.ts +6 -0
- package/lib/utils/items/table-item.d.ts +4 -0
- package/lib/utils/{text-align-item.d.ts → items/text-align-item.d.ts} +0 -0
- package/lib/utils/items/utils.d.ts +18 -0
- package/lib/utils/items/wrap-list-item.d.ts +3 -0
- package/lib/utils/menu.d.ts +2 -2
- package/lib/utils/schema/paragraph-with-alignment.d.ts +8 -0
- package/lib/utils/{schema.d.ts → schema/schema.d.ts} +0 -0
- package/lib/utils/schema/table.d.ts +9 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
- package/esm2020/lib/utils/item.mjs +0 -39
- package/esm2020/lib/utils/paragraph-with-alignment.mjs +0 -43
- package/esm2020/lib/utils/schema.mjs +0 -51
- package/esm2020/lib/utils/table.mjs +0 -37
- package/esm2020/lib/utils/text-align-item.mjs +0 -81
- package/lib/utils/paragraph-with-alignment.d.ts +0 -2
- package/lib/utils/table.d.ts +0 -8
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import '@angular/localize/init';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import {
|
|
3
|
+
import { Directive, Inject, HostBinding, Input, Injectable, Component, EventEmitter, ElementRef, Optional, Self, ViewChild, Output, NgModule } from '@angular/core';
|
|
4
|
+
import * as i6 from '@angular/common';
|
|
5
|
+
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
4
6
|
import { DecorationSet, Decoration, EditorView } from 'prosemirror-view';
|
|
5
7
|
import { Plugin, TextSelection, AllSelection, EditorState } from 'prosemirror-state';
|
|
6
8
|
import { Schema, DOMSerializer, DOMParser } from 'prosemirror-model';
|
|
7
|
-
import
|
|
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';
|
|
9
|
+
import { setCellAttr, isInTable, selectionCell, CellSelection, tableNodeTypes, addColumnBefore, addColumnAfter, deleteColumn, addRowBefore, addRowAfter, deleteRow, deleteTable, mergeCells, splitCell, toggleHeaderColumn, toggleHeaderRow, toggleHeaderCell, tableEditing, goToNextCell } from 'prosemirror-tables';
|
|
10
10
|
import { keymap } from 'prosemirror-keymap';
|
|
11
11
|
import { nodes, marks } from 'prosemirror-schema-basic';
|
|
12
12
|
import { addListNodes, wrapInList, splitListItem, liftListItem, sinkListItem } from 'prosemirror-schema-list';
|
|
13
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
14
|
import * as i1 from '@angular/material/dialog';
|
|
16
15
|
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
17
16
|
import * as i4 from '@angular/forms';
|
|
18
17
|
import { FormControl, Validators, FormGroup, ReactiveFormsModule } from '@angular/forms';
|
|
19
|
-
import * as
|
|
20
|
-
import { ifValid, NaturalFileModule } from '@ecodev/natural';
|
|
21
|
-
import * as i2 from '@angular/material/form-field';
|
|
22
|
-
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
18
|
+
import * as i3$1 from '@ecodev/natural';
|
|
19
|
+
import { ifValid, NaturalFileModule, NaturalIconModule } from '@ecodev/natural';
|
|
23
20
|
import * as i3 from '@angular/material/button';
|
|
24
21
|
import { MatButtonModule } from '@angular/material/button';
|
|
22
|
+
import * as i2 from '@angular/material/form-field';
|
|
23
|
+
import { MatFormFieldModule } from '@angular/material/form-field';
|
|
25
24
|
import * as i5 from '@angular/material/input';
|
|
26
25
|
import { MatInputModule } from '@angular/material/input';
|
|
26
|
+
import { toggleMark, joinUp, joinDown, lift, selectParentNode, wrapIn, chainCommands, exitCode, setBlockType, baseKeymap } from 'prosemirror-commands';
|
|
27
27
|
import { undo, redo, history } from 'prosemirror-history';
|
|
28
28
|
import { dropCursor } from 'prosemirror-dropcursor';
|
|
29
29
|
import { gapCursor } from 'prosemirror-gapcursor';
|
|
@@ -40,6 +40,77 @@ import * as i10 from '@angular/material/tooltip';
|
|
|
40
40
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
41
41
|
import { MatToolbarModule } from '@angular/material/toolbar';
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Prefix all CSS selectors with the given selector
|
|
45
|
+
*
|
|
46
|
+
* This is meant to be relatively simple and might not cover advanced CSS syntax
|
|
47
|
+
*/
|
|
48
|
+
function prefixCss(prefix, css) {
|
|
49
|
+
prefix = '\n' + prefix + ' ';
|
|
50
|
+
return css
|
|
51
|
+
.replace(/([^{}]*){/gs, selectors => selectors
|
|
52
|
+
.split(',')
|
|
53
|
+
.map(selector => prefix + selector.trim())
|
|
54
|
+
.join(','))
|
|
55
|
+
.trim();
|
|
56
|
+
}
|
|
57
|
+
let uniqueId = 0;
|
|
58
|
+
let componentCount = 0;
|
|
59
|
+
/**
|
|
60
|
+
* Inject custom CSS into component and scope the CSS only to this component
|
|
61
|
+
*
|
|
62
|
+
* Usage :
|
|
63
|
+
*
|
|
64
|
+
* ```html
|
|
65
|
+
* <div [naturalCustomCss]=".my-class {background: red}">
|
|
66
|
+
* <p class="my-class">foo bar</p>
|
|
67
|
+
* </div>
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
class NaturalCustomCssDirective {
|
|
71
|
+
constructor(document) {
|
|
72
|
+
this.document = document;
|
|
73
|
+
this.style = null;
|
|
74
|
+
this.id = 'n' + ++uniqueId;
|
|
75
|
+
}
|
|
76
|
+
set naturalCustomCss(value) {
|
|
77
|
+
if (value && !this.style) {
|
|
78
|
+
this.style = this.document.createElement('style');
|
|
79
|
+
this.document.head.appendChild(this.style);
|
|
80
|
+
}
|
|
81
|
+
if (this.style) {
|
|
82
|
+
this.style.innerHTML = value ? prefixCss(`[data-natural-id=${this.id}]`, value) : '';
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
ngOnDestroy() {
|
|
86
|
+
var _a;
|
|
87
|
+
(_a = this.style) === null || _a === void 0 ? void 0 : _a.remove();
|
|
88
|
+
// Reset uniqueId if we have no component alive anymore, so that we never reach max int
|
|
89
|
+
componentCount--;
|
|
90
|
+
if (componentCount <= 0) {
|
|
91
|
+
uniqueId = 0;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
NaturalCustomCssDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: NaturalCustomCssDirective, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive });
|
|
96
|
+
NaturalCustomCssDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "13.3.0", type: NaturalCustomCssDirective, selector: "[naturalCustomCss]", inputs: { naturalCustomCss: "naturalCustomCss" }, host: { properties: { "attr.data-natural-id": "this.id" } }, ngImport: i0 });
|
|
97
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: NaturalCustomCssDirective, decorators: [{
|
|
98
|
+
type: Directive,
|
|
99
|
+
args: [{
|
|
100
|
+
selector: '[naturalCustomCss]',
|
|
101
|
+
}]
|
|
102
|
+
}], ctorParameters: function () {
|
|
103
|
+
return [{ type: Document, decorators: [{
|
|
104
|
+
type: Inject,
|
|
105
|
+
args: [DOCUMENT]
|
|
106
|
+
}] }];
|
|
107
|
+
}, propDecorators: { id: [{
|
|
108
|
+
type: HostBinding,
|
|
109
|
+
args: ['attr.data-natural-id']
|
|
110
|
+
}], naturalCustomCss: [{
|
|
111
|
+
type: Input
|
|
112
|
+
}] } });
|
|
113
|
+
|
|
43
114
|
class ImagePlugin {
|
|
44
115
|
constructor(document) {
|
|
45
116
|
this.document = document;
|
|
@@ -107,9 +178,9 @@ class ImagePlugin {
|
|
|
107
178
|
});
|
|
108
179
|
}
|
|
109
180
|
}
|
|
110
|
-
ImagePlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
111
|
-
ImagePlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.
|
|
112
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.
|
|
181
|
+
ImagePlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: ImagePlugin, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
182
|
+
ImagePlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: ImagePlugin });
|
|
183
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: ImagePlugin, decorators: [{
|
|
113
184
|
type: Injectable
|
|
114
185
|
}], ctorParameters: function () {
|
|
115
186
|
return [{ type: Document, decorators: [{
|
|
@@ -119,12 +190,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImpor
|
|
|
119
190
|
} });
|
|
120
191
|
|
|
121
192
|
const ALIGN_PATTERN = /(left|right|center|justify)/;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
193
|
+
/**
|
|
194
|
+
* A plain paragraph textblock. Represented in the DOM
|
|
195
|
+
* as a `<p>` element.
|
|
196
|
+
*
|
|
197
|
+
* https://github.com/ProseMirror/prosemirror-schema-basic/blob/master/src/schema-basic.js
|
|
198
|
+
*/
|
|
125
199
|
const paragraphWithAlignment = {
|
|
126
200
|
attrs: {
|
|
127
201
|
align: { default: null },
|
|
202
|
+
class: { default: null },
|
|
128
203
|
id: { default: null },
|
|
129
204
|
},
|
|
130
205
|
content: 'inline*',
|
|
@@ -140,7 +215,7 @@ const paragraphWithAlignment = {
|
|
|
140
215
|
let align = dom.getAttribute('align') || textAlign || '';
|
|
141
216
|
align = ALIGN_PATTERN.test(align) ? align : null;
|
|
142
217
|
const id = dom.getAttribute('id') || '';
|
|
143
|
-
return { align, id };
|
|
218
|
+
return { align, class: dom.className, id };
|
|
144
219
|
},
|
|
145
220
|
},
|
|
146
221
|
],
|
|
@@ -157,10 +232,126 @@ const paragraphWithAlignment = {
|
|
|
157
232
|
if (id) {
|
|
158
233
|
attrs.id = id;
|
|
159
234
|
}
|
|
235
|
+
if (node.attrs.class) {
|
|
236
|
+
attrs.class = node.attrs.class;
|
|
237
|
+
}
|
|
160
238
|
return ['p', attrs, 0];
|
|
161
239
|
},
|
|
162
240
|
};
|
|
163
241
|
|
|
242
|
+
function getCellAttrs(dom, extraAttrs) {
|
|
243
|
+
if (!(dom instanceof HTMLElement)) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const widthAttr = dom.getAttribute('data-colwidth');
|
|
247
|
+
const widths = widthAttr && /^\d+(,\d+)*$/.test(widthAttr) ? widthAttr.split(',').map(s => Number(s)) : null;
|
|
248
|
+
const colspan = Number(dom.getAttribute('colspan') || 1);
|
|
249
|
+
const result = {
|
|
250
|
+
colspan,
|
|
251
|
+
rowspan: Number(dom.getAttribute('rowspan') || 1),
|
|
252
|
+
colwidth: widths && widths.length == colspan ? widths : null,
|
|
253
|
+
};
|
|
254
|
+
for (const prop in extraAttrs) {
|
|
255
|
+
const getter = extraAttrs[prop].getFromDOM;
|
|
256
|
+
const value = getter && getter(dom);
|
|
257
|
+
if (value != null)
|
|
258
|
+
result[prop] = value;
|
|
259
|
+
}
|
|
260
|
+
return result;
|
|
261
|
+
}
|
|
262
|
+
function setCellAttrs(node, extraAttrs) {
|
|
263
|
+
const attrs = {};
|
|
264
|
+
if (node.attrs.colspan != 1)
|
|
265
|
+
attrs.colspan = node.attrs.colspan;
|
|
266
|
+
if (node.attrs.rowspan != 1)
|
|
267
|
+
attrs.rowspan = node.attrs.rowspan;
|
|
268
|
+
if (node.attrs.colwidth)
|
|
269
|
+
attrs['data-colwidth'] = node.attrs.colwidth.join(',');
|
|
270
|
+
for (const prop in extraAttrs) {
|
|
271
|
+
const setter = extraAttrs[prop].setDOMAttr;
|
|
272
|
+
if (setter)
|
|
273
|
+
setter(node.attrs[prop], attrs);
|
|
274
|
+
}
|
|
275
|
+
return attrs;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* This function creates a set of [node
|
|
279
|
+
* specs](http://prosemirror.net/docs/ref/#model.SchemaSpec.nodes) for
|
|
280
|
+
* `table`, `table_row`, and `table_cell` nodes types.
|
|
281
|
+
*
|
|
282
|
+
* It is very directly inspired by prosemirror-table
|
|
283
|
+
*/
|
|
284
|
+
function tableNodes(options) {
|
|
285
|
+
const extraAttrs = options.cellAttributes || {};
|
|
286
|
+
const cellAttrs = {
|
|
287
|
+
colspan: { default: 1 },
|
|
288
|
+
rowspan: { default: 1 },
|
|
289
|
+
colwidth: { default: null },
|
|
290
|
+
};
|
|
291
|
+
for (const prop in extraAttrs) {
|
|
292
|
+
cellAttrs[prop] = {
|
|
293
|
+
default: extraAttrs[prop].default,
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
return {
|
|
297
|
+
table: {
|
|
298
|
+
attrs: {
|
|
299
|
+
class: { default: null },
|
|
300
|
+
},
|
|
301
|
+
content: 'table_row+',
|
|
302
|
+
tableRole: 'table',
|
|
303
|
+
isolating: true,
|
|
304
|
+
group: options.tableGroup,
|
|
305
|
+
parseDOM: [
|
|
306
|
+
{
|
|
307
|
+
tag: 'table',
|
|
308
|
+
getAttrs: (dom) => {
|
|
309
|
+
if (!(dom instanceof HTMLElement)) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
return { class: dom.className };
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
],
|
|
316
|
+
toDOM: node => {
|
|
317
|
+
const attrs = {};
|
|
318
|
+
if (node.attrs.class) {
|
|
319
|
+
attrs.class = node.attrs.class;
|
|
320
|
+
}
|
|
321
|
+
return ['table', attrs, ['tbody', 0]];
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
table_row: {
|
|
325
|
+
content: '(table_cell | table_header)*',
|
|
326
|
+
tableRole: 'row',
|
|
327
|
+
parseDOM: [{ tag: 'tr' }],
|
|
328
|
+
toDOM: () => {
|
|
329
|
+
return ['tr', 0];
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
table_cell: {
|
|
333
|
+
content: options.cellContent,
|
|
334
|
+
attrs: cellAttrs,
|
|
335
|
+
tableRole: 'cell',
|
|
336
|
+
isolating: true,
|
|
337
|
+
parseDOM: [{ tag: 'td', getAttrs: dom => getCellAttrs(dom, extraAttrs) }],
|
|
338
|
+
toDOM: node => {
|
|
339
|
+
return ['td', setCellAttrs(node, extraAttrs), 0];
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
table_header: {
|
|
343
|
+
content: options.cellContent,
|
|
344
|
+
attrs: cellAttrs,
|
|
345
|
+
tableRole: 'header_cell',
|
|
346
|
+
isolating: true,
|
|
347
|
+
parseDOM: [{ tag: 'th', getAttrs: dom => getCellAttrs(dom, extraAttrs) }],
|
|
348
|
+
toDOM: node => {
|
|
349
|
+
return ['th', setCellAttrs(node, extraAttrs), 0];
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
|
|
164
355
|
const basicNodes = {
|
|
165
356
|
heading: nodes.heading,
|
|
166
357
|
doc: nodes.doc,
|
|
@@ -203,71 +394,6 @@ const advancedSchema = new Schema({
|
|
|
203
394
|
marks: basicMarks,
|
|
204
395
|
});
|
|
205
396
|
|
|
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
397
|
/**
|
|
272
398
|
* One item of the menu.
|
|
273
399
|
*
|
|
@@ -308,7 +434,6 @@ class Item {
|
|
|
308
434
|
}
|
|
309
435
|
|
|
310
436
|
function setTextAlign(tr, schema, alignment) {
|
|
311
|
-
console.log('setTextAlign', alignment);
|
|
312
437
|
const { selection, doc } = tr;
|
|
313
438
|
if (!selection || !doc) {
|
|
314
439
|
return tr;
|
|
@@ -341,7 +466,6 @@ function setTextAlign(tr, schema, alignment) {
|
|
|
341
466
|
tasks.forEach(job => {
|
|
342
467
|
const { node, pos, nodeType } = job;
|
|
343
468
|
const newAttrs = Object.assign(Object.assign({}, node.attrs), { align: alignment ? alignment : null });
|
|
344
|
-
console.log('newAttrs', newAttrs);
|
|
345
469
|
tr = tr.setNodeMarkup(pos, nodeType, newAttrs, node.marks);
|
|
346
470
|
});
|
|
347
471
|
return tr;
|
|
@@ -369,7 +493,6 @@ class TextAlignItem extends Item {
|
|
|
369
493
|
},
|
|
370
494
|
run: (state, dispatch) => {
|
|
371
495
|
const { schema, selection } = state;
|
|
372
|
-
console.log(this);
|
|
373
496
|
const tr = setTextAlign(state.tr.setSelection(selection), schema, this.active ? null : alignment);
|
|
374
497
|
if (tr.docChanged) {
|
|
375
498
|
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr);
|
|
@@ -383,12 +506,335 @@ class TextAlignItem extends Item {
|
|
|
383
506
|
}
|
|
384
507
|
}
|
|
385
508
|
|
|
509
|
+
class ColorDialogComponent {
|
|
510
|
+
constructor(data, dialogRef) {
|
|
511
|
+
this.dialogRef = dialogRef;
|
|
512
|
+
this.colors = [
|
|
513
|
+
[
|
|
514
|
+
'#000000',
|
|
515
|
+
'#111111',
|
|
516
|
+
'#1c1c1c',
|
|
517
|
+
'#333333',
|
|
518
|
+
'#666666',
|
|
519
|
+
'#808080',
|
|
520
|
+
'#999999',
|
|
521
|
+
'#b2b2b2',
|
|
522
|
+
'#cccccc',
|
|
523
|
+
'#dddddd',
|
|
524
|
+
'#eeeeee',
|
|
525
|
+
'#ffffff',
|
|
526
|
+
],
|
|
527
|
+
[
|
|
528
|
+
'#ffff00',
|
|
529
|
+
'#ffbf00',
|
|
530
|
+
'#ff8000',
|
|
531
|
+
'#ff4000',
|
|
532
|
+
'#ff0000',
|
|
533
|
+
'#bf0041',
|
|
534
|
+
'#800080',
|
|
535
|
+
'#55308d',
|
|
536
|
+
'#2a6099',
|
|
537
|
+
'#158466',
|
|
538
|
+
'#00a933',
|
|
539
|
+
'#81d41a',
|
|
540
|
+
],
|
|
541
|
+
[
|
|
542
|
+
'#ffffd7',
|
|
543
|
+
'#fff5ce',
|
|
544
|
+
'#ffdbb6',
|
|
545
|
+
'#ffd8ce',
|
|
546
|
+
'#ffd7d7',
|
|
547
|
+
'#f7d1d5',
|
|
548
|
+
'#e0c2cd',
|
|
549
|
+
'#dedce6',
|
|
550
|
+
'#dee6ef',
|
|
551
|
+
'#dee7e5',
|
|
552
|
+
'#dde8cb',
|
|
553
|
+
'#f6f9d4',
|
|
554
|
+
],
|
|
555
|
+
[
|
|
556
|
+
'#ffffa6',
|
|
557
|
+
'#ffe994',
|
|
558
|
+
'#ffb66c',
|
|
559
|
+
'#ffaa95',
|
|
560
|
+
'#ffa6a6',
|
|
561
|
+
'#ec9ba4',
|
|
562
|
+
'#bf819e',
|
|
563
|
+
'#b7b3ca',
|
|
564
|
+
'#b4c7dc',
|
|
565
|
+
'#b3cac7',
|
|
566
|
+
'#afd095',
|
|
567
|
+
'#e8f2a1',
|
|
568
|
+
],
|
|
569
|
+
[
|
|
570
|
+
'#ffff6d',
|
|
571
|
+
'#ffde59',
|
|
572
|
+
'#ff972f',
|
|
573
|
+
'#ff7b59',
|
|
574
|
+
'#ff6d6d',
|
|
575
|
+
'#e16173',
|
|
576
|
+
'#a1467e',
|
|
577
|
+
'#8e86ae',
|
|
578
|
+
'#729fcf',
|
|
579
|
+
'#81aca6',
|
|
580
|
+
'#77bc65',
|
|
581
|
+
'#d4ea6b',
|
|
582
|
+
],
|
|
583
|
+
[
|
|
584
|
+
'#ffff38',
|
|
585
|
+
'#ffd428',
|
|
586
|
+
'#ff860d',
|
|
587
|
+
'#ff5429',
|
|
588
|
+
'#ff3838',
|
|
589
|
+
'#d62e4e',
|
|
590
|
+
'#8d1d75',
|
|
591
|
+
'#6b5e9b',
|
|
592
|
+
'#5983b0',
|
|
593
|
+
'#50938a',
|
|
594
|
+
'#3faf46',
|
|
595
|
+
'#bbe33d',
|
|
596
|
+
],
|
|
597
|
+
[
|
|
598
|
+
'#e6e905',
|
|
599
|
+
'#e8a202',
|
|
600
|
+
'#ea7500',
|
|
601
|
+
'#ed4c05',
|
|
602
|
+
'#f10d0c',
|
|
603
|
+
'#a7074b',
|
|
604
|
+
'#780373',
|
|
605
|
+
'#5b277d',
|
|
606
|
+
'#3465a4',
|
|
607
|
+
'#168253',
|
|
608
|
+
'#069a2e',
|
|
609
|
+
'#5eb91e',
|
|
610
|
+
],
|
|
611
|
+
[
|
|
612
|
+
'#acb20c',
|
|
613
|
+
'#b47804',
|
|
614
|
+
'#b85c00',
|
|
615
|
+
'#be480a',
|
|
616
|
+
'#c9211e',
|
|
617
|
+
'#861141',
|
|
618
|
+
'#650953',
|
|
619
|
+
'#55215b',
|
|
620
|
+
'#355269',
|
|
621
|
+
'#1e6a39',
|
|
622
|
+
'#127622',
|
|
623
|
+
'#468a1a',
|
|
624
|
+
],
|
|
625
|
+
[
|
|
626
|
+
'#706e0c',
|
|
627
|
+
'#784b04',
|
|
628
|
+
'#7b3d00',
|
|
629
|
+
'#813709',
|
|
630
|
+
'#8d281e',
|
|
631
|
+
'#611729',
|
|
632
|
+
'#4e102d',
|
|
633
|
+
'#481d32',
|
|
634
|
+
'#383d3c',
|
|
635
|
+
'#28471f',
|
|
636
|
+
'#224b12',
|
|
637
|
+
'#395511',
|
|
638
|
+
],
|
|
639
|
+
[
|
|
640
|
+
'#443205',
|
|
641
|
+
'#472702',
|
|
642
|
+
'#492300',
|
|
643
|
+
'#4b2204',
|
|
644
|
+
'#50200c',
|
|
645
|
+
'#41190d',
|
|
646
|
+
'#3b160e',
|
|
647
|
+
'#3a1a0f',
|
|
648
|
+
'#362413',
|
|
649
|
+
'#302709',
|
|
650
|
+
'#2e2706',
|
|
651
|
+
'#342a06',
|
|
652
|
+
],
|
|
653
|
+
];
|
|
654
|
+
this.colorControl = new FormControl('', Validators.pattern(/^#\p{Hex_Digit}{6}/u));
|
|
655
|
+
this.form = new FormGroup({
|
|
656
|
+
color: this.colorControl,
|
|
657
|
+
});
|
|
658
|
+
this.form.setValue(data);
|
|
659
|
+
}
|
|
660
|
+
maybeConfirm() {
|
|
661
|
+
ifValid(this.form).subscribe(() => this.confirm());
|
|
662
|
+
}
|
|
663
|
+
confirm() {
|
|
664
|
+
this.dialogRef.close(this.form.value);
|
|
665
|
+
}
|
|
666
|
+
selectColor(color) {
|
|
667
|
+
this.colorControl.setValue(color);
|
|
668
|
+
this.maybeConfirm();
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
ColorDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: ColorDialogComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
672
|
+
ColorDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.0", type: ColorDialogComponent, selector: "ng-component", ngImport: i0, template: "<h2 i18n mat-dialog-title>S\u00E9lectionner une couleur</h2>\n\n<mat-dialog-content [formGroup]=\"form\">\n <div>\n <div *ngFor=\"let row of colors\">\n <div\n *ngFor=\"let color of row\"\n class=\"color\"\n [style]=\"{backgroundColor: color}\"\n (click)=\"selectColor(color)\"\n >\n </div>\n </div>\n </div>\n\n <div>\n <button mat-button (click)=\"selectColor('')\">\n <natural-icon name=\"format_color_reset\"></natural-icon>\n <span i18n>Transparent</span></button\n >\n </div>\n\n <mat-form-field>\n <mat-label i18n>Couleur</mat-label>\n <input matInput [formControl]=\"colorControl\" (keydown.enter)=\"maybeConfirm()\" cdkFocusInitial />\n <div class=\"sample\" matSuffix [style]=\"{backgroundColor: colorControl.valid ? colorControl.value : ''}\"></div>\n <mat-error *ngIf=\"colorControl.hasError('pattern')\" i18n\n >Doit \u00EAtre le format hexadecimal. Par exemple: #ff4000\n </mat-error>\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:30em;display:grid;justify-content:center;row-gap:25px}.color{display:inline-block;width:25px;height:25px;margin:3px;cursor:pointer}.color:hover{padding:3px;margin:0}.sample{width:27px;height:27px}\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: i3$1.NaturalIconComponent, selector: "natural-icon", inputs: ["label", "labelColor", "labelPosition", "name", "size"] }, { type: i2.MatFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }], 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: i6.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { 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: i2.MatSuffix, selector: "[matSuffix]" }, { 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"] }] });
|
|
673
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: ColorDialogComponent, decorators: [{
|
|
674
|
+
type: Component,
|
|
675
|
+
args: [{ template: "<h2 i18n mat-dialog-title>S\u00E9lectionner une couleur</h2>\n\n<mat-dialog-content [formGroup]=\"form\">\n <div>\n <div *ngFor=\"let row of colors\">\n <div\n *ngFor=\"let color of row\"\n class=\"color\"\n [style]=\"{backgroundColor: color}\"\n (click)=\"selectColor(color)\"\n >\n </div>\n </div>\n </div>\n\n <div>\n <button mat-button (click)=\"selectColor('')\">\n <natural-icon name=\"format_color_reset\"></natural-icon>\n <span i18n>Transparent</span></button\n >\n </div>\n\n <mat-form-field>\n <mat-label i18n>Couleur</mat-label>\n <input matInput [formControl]=\"colorControl\" (keydown.enter)=\"maybeConfirm()\" cdkFocusInitial />\n <div class=\"sample\" matSuffix [style]=\"{backgroundColor: colorControl.valid ? colorControl.value : ''}\"></div>\n <mat-error *ngIf=\"colorControl.hasError('pattern')\" i18n\n >Doit \u00EAtre le format hexadecimal. Par exemple: #ff4000\n </mat-error>\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:30em;display:grid;justify-content:center;row-gap:25px}.color{display:inline-block;width:25px;height:25px;margin:3px;cursor:pointer}.color:hover{padding:3px;margin:0}.sample{width:27px;height:27px}\n"] }]
|
|
676
|
+
}], ctorParameters: function () {
|
|
677
|
+
return [{ type: undefined, decorators: [{
|
|
678
|
+
type: Inject,
|
|
679
|
+
args: [MAT_DIALOG_DATA]
|
|
680
|
+
}] }, { type: i1.MatDialogRef }];
|
|
681
|
+
} });
|
|
682
|
+
|
|
683
|
+
const setCellBackgroundColor = setCellAttr.bind(null, 'background');
|
|
684
|
+
function findFirstClassInSelection$1(state) {
|
|
685
|
+
var _a, _b;
|
|
686
|
+
if (!isInTable(state)) {
|
|
687
|
+
return '';
|
|
688
|
+
}
|
|
689
|
+
// For single cell selection
|
|
690
|
+
const $cell = selectionCell(state);
|
|
691
|
+
let foundColor = (_b = (_a = $cell === null || $cell === void 0 ? void 0 : $cell.nodeAfter) === null || _a === void 0 ? void 0 : _a.attrs.background) !== null && _b !== void 0 ? _b : '';
|
|
692
|
+
if (foundColor) {
|
|
693
|
+
return foundColor;
|
|
694
|
+
}
|
|
695
|
+
// For multiple cells selection
|
|
696
|
+
let keepLooking = true;
|
|
697
|
+
if (state.selection instanceof CellSelection) {
|
|
698
|
+
state.selection.forEachCell(node => {
|
|
699
|
+
const color = node.attrs.background;
|
|
700
|
+
if (keepLooking && color) {
|
|
701
|
+
keepLooking = false;
|
|
702
|
+
foundColor = color;
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
return foundColor;
|
|
707
|
+
}
|
|
708
|
+
class CellBackgroundColorItem extends Item {
|
|
709
|
+
constructor(dialog) {
|
|
710
|
+
super({
|
|
711
|
+
enable(state) {
|
|
712
|
+
// Pretend to set a unique color that is not already set, to test if we can any color at all
|
|
713
|
+
const cmd = setCellBackgroundColor('#000001');
|
|
714
|
+
return cmd(state);
|
|
715
|
+
},
|
|
716
|
+
run(state, dispatch, view) {
|
|
717
|
+
dialog
|
|
718
|
+
.open(ColorDialogComponent, {
|
|
719
|
+
data: {
|
|
720
|
+
color: findFirstClassInSelection$1(state),
|
|
721
|
+
},
|
|
722
|
+
})
|
|
723
|
+
.afterClosed()
|
|
724
|
+
.subscribe(result => {
|
|
725
|
+
if (dispatch && result) {
|
|
726
|
+
const cmd = setCellBackgroundColor(result.color);
|
|
727
|
+
cmd(state, dispatch);
|
|
728
|
+
}
|
|
729
|
+
view.focus();
|
|
730
|
+
});
|
|
731
|
+
},
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
class LinkDialogComponent {
|
|
737
|
+
constructor(data, dialogRef) {
|
|
738
|
+
this.dialogRef = dialogRef;
|
|
739
|
+
this.hrefControl = new FormControl('', Validators.required);
|
|
740
|
+
this.titleControl = new FormControl('');
|
|
741
|
+
this.form = new FormGroup({
|
|
742
|
+
href: this.hrefControl,
|
|
743
|
+
title: this.titleControl,
|
|
744
|
+
});
|
|
745
|
+
this.form.setValue(data);
|
|
746
|
+
}
|
|
747
|
+
maybeConfirm() {
|
|
748
|
+
ifValid(this.form).subscribe(() => this.confirm());
|
|
749
|
+
}
|
|
750
|
+
confirm() {
|
|
751
|
+
this.dialogRef.close(this.form.value);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
LinkDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: LinkDialogComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
755
|
+
LinkDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.0", 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"] }] });
|
|
756
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: LinkDialogComponent, decorators: [{
|
|
757
|
+
type: Component,
|
|
758
|
+
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"] }]
|
|
759
|
+
}], ctorParameters: function () {
|
|
760
|
+
return [{ type: undefined, decorators: [{
|
|
761
|
+
type: Inject,
|
|
762
|
+
args: [MAT_DIALOG_DATA]
|
|
763
|
+
}] }, { type: i1.MatDialogRef }];
|
|
764
|
+
} });
|
|
765
|
+
|
|
766
|
+
function markActive(state, type) {
|
|
767
|
+
const { from, $from, to, empty } = state.selection;
|
|
768
|
+
if (empty) {
|
|
769
|
+
return !!type.isInSet(state.storedMarks || $from.marks());
|
|
770
|
+
}
|
|
771
|
+
else {
|
|
772
|
+
return state.doc.rangeHasMark(from, to, type);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
386
775
|
/**
|
|
387
776
|
* Convert built-in `MenuItem` into our Angular specific `Item`
|
|
388
777
|
*/
|
|
389
|
-
function
|
|
778
|
+
function menuItemToItem(item) {
|
|
390
779
|
return new Item(item.spec);
|
|
391
780
|
}
|
|
781
|
+
/**
|
|
782
|
+
* From a `Command`, creates a new `Item` that will have an automatic `enable` spec
|
|
783
|
+
*/
|
|
784
|
+
function cmdToItem(cmd, options = {}) {
|
|
785
|
+
const passedOptions = Object.assign({ run: cmd }, options);
|
|
786
|
+
if (!options.enable && !options.select) {
|
|
787
|
+
passedOptions.enable = state => cmd(state);
|
|
788
|
+
}
|
|
789
|
+
return new Item(passedOptions);
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* From a `MarkType`, creates a new `Item` that will have an automatic `active` and `enable` spec
|
|
793
|
+
*/
|
|
794
|
+
function markTypeToItem(markType) {
|
|
795
|
+
return cmdToItem(toggleMark(markType), {
|
|
796
|
+
active(state) {
|
|
797
|
+
return markActive(state, markType);
|
|
798
|
+
},
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
class LinkItem extends Item {
|
|
803
|
+
constructor(markType, dialog) {
|
|
804
|
+
super({
|
|
805
|
+
active(state) {
|
|
806
|
+
return markActive(state, markType);
|
|
807
|
+
},
|
|
808
|
+
enable(state) {
|
|
809
|
+
return !state.selection.empty;
|
|
810
|
+
},
|
|
811
|
+
run(state, dispatch, view) {
|
|
812
|
+
if (markActive(state, markType)) {
|
|
813
|
+
toggleMark(markType)(state, dispatch);
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
816
|
+
dialog
|
|
817
|
+
.open(LinkDialogComponent, {
|
|
818
|
+
data: {
|
|
819
|
+
href: '',
|
|
820
|
+
title: '',
|
|
821
|
+
},
|
|
822
|
+
})
|
|
823
|
+
.afterClosed()
|
|
824
|
+
.subscribe(result => {
|
|
825
|
+
if (result) {
|
|
826
|
+
if (!result.title) {
|
|
827
|
+
delete result.title;
|
|
828
|
+
}
|
|
829
|
+
toggleMark(markType, result)(view.state, view.dispatch);
|
|
830
|
+
}
|
|
831
|
+
view.focus();
|
|
832
|
+
});
|
|
833
|
+
},
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
392
838
|
function canInsert(state, nodeType) {
|
|
393
839
|
const $from = state.selection.$from;
|
|
394
840
|
for (let d = $from.depth; d >= 0; d--) {
|
|
@@ -399,92 +845,199 @@ function canInsert(state, nodeType) {
|
|
|
399
845
|
}
|
|
400
846
|
return false;
|
|
401
847
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
848
|
+
class HorizontalRuleItem extends Item {
|
|
849
|
+
constructor(hr) {
|
|
850
|
+
super({
|
|
851
|
+
enable(state) {
|
|
852
|
+
return canInsert(state, hr);
|
|
853
|
+
},
|
|
854
|
+
run(state, dispatch) {
|
|
855
|
+
dispatch(state.tr.replaceSelectionWith(hr.create()));
|
|
856
|
+
},
|
|
857
|
+
});
|
|
406
858
|
}
|
|
407
|
-
return new Item(passedOptions);
|
|
408
859
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
860
|
+
|
|
861
|
+
function wrapListItem(nodeType) {
|
|
862
|
+
return cmdToItem(wrapInList(nodeType));
|
|
863
|
+
}
|
|
864
|
+
|
|
865
|
+
class ClassDialogComponent {
|
|
866
|
+
constructor(data, dialogRef) {
|
|
867
|
+
this.dialogRef = dialogRef;
|
|
868
|
+
this.classControl = new FormControl('', Validators.pattern(/(^\s*(-?[_a-zA-Z]+[_a-zA-Z0-9-]*\s*)+)/));
|
|
869
|
+
this.form = new FormGroup({
|
|
870
|
+
class: this.classControl,
|
|
871
|
+
});
|
|
872
|
+
this.form.setValue(data);
|
|
413
873
|
}
|
|
414
|
-
|
|
415
|
-
|
|
874
|
+
maybeConfirm() {
|
|
875
|
+
ifValid(this.form).subscribe(() => this.confirm());
|
|
876
|
+
}
|
|
877
|
+
confirm() {
|
|
878
|
+
this.dialogRef.close(this.form.value);
|
|
416
879
|
}
|
|
417
880
|
}
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
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();
|
|
881
|
+
ClassDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: ClassDialogComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: i1.MatDialogRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
882
|
+
ClassDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.0", type: ClassDialogComponent, selector: "ng-component", ngImport: i0, template: "<h2 i18n mat-dialog-title>Saisir les classes CSS</h2>\n\n<mat-dialog-content [formGroup]=\"form\">\n <mat-form-field>\n <mat-label i18n>Classes CSS</mat-label>\n <input matInput [formControl]=\"classControl\" (keydown.enter)=\"maybeConfirm()\" cdkFocusInitial />\n <div class=\"sample\" matSuffix [style]=\"{backgroundClass: classControl.valid ? classControl.value : ''}\"></div>\n <mat-error *ngIf=\"classControl.hasError('pattern')\" i18n>Doit \u00EAtre un ou plusieurs nom de classe CSS</mat-error>\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:30em;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: i2.MatSuffix, selector: "[matSuffix]" }, { 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"] }] });
|
|
883
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: ClassDialogComponent, decorators: [{
|
|
884
|
+
type: Component,
|
|
885
|
+
args: [{ template: "<h2 i18n mat-dialog-title>Saisir les classes CSS</h2>\n\n<mat-dialog-content [formGroup]=\"form\">\n <mat-form-field>\n <mat-label i18n>Classes CSS</mat-label>\n <input matInput [formControl]=\"classControl\" (keydown.enter)=\"maybeConfirm()\" cdkFocusInitial />\n <div class=\"sample\" matSuffix [style]=\"{backgroundClass: classControl.valid ? classControl.value : ''}\"></div>\n <mat-error *ngIf=\"classControl.hasError('pattern')\" i18n>Doit \u00EAtre un ou plusieurs nom de classe CSS</mat-error>\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:30em;display:grid}\n"] }]
|
|
886
|
+
}], ctorParameters: function () {
|
|
887
|
+
return [{ type: undefined, decorators: [{
|
|
888
|
+
type: Inject,
|
|
889
|
+
args: [MAT_DIALOG_DATA]
|
|
890
|
+
}] }, { type: i1.MatDialogRef }];
|
|
891
|
+
} });
|
|
892
|
+
|
|
893
|
+
function setClass(tr, classValue, allowedNodeType) {
|
|
894
|
+
const { selection, doc } = tr;
|
|
895
|
+
if (!selection || !doc) {
|
|
896
|
+
return tr;
|
|
897
|
+
}
|
|
898
|
+
const { from, to } = selection;
|
|
899
|
+
const tasks = [];
|
|
900
|
+
doc.nodesBetween(from, to, (node, pos) => {
|
|
901
|
+
const nodeType = node.type;
|
|
902
|
+
const currentClass = node.attrs.class || null;
|
|
903
|
+
if (currentClass !== classValue && allowedNodeType === nodeType) {
|
|
904
|
+
tasks.push({
|
|
905
|
+
node,
|
|
906
|
+
pos,
|
|
907
|
+
nodeType,
|
|
453
908
|
});
|
|
454
|
-
}
|
|
909
|
+
}
|
|
910
|
+
return true;
|
|
911
|
+
});
|
|
912
|
+
if (!tasks.length) {
|
|
913
|
+
return tr;
|
|
914
|
+
}
|
|
915
|
+
tasks.forEach(job => {
|
|
916
|
+
const { node, pos, nodeType } = job;
|
|
917
|
+
const newAttrs = Object.assign(Object.assign({}, node.attrs), { class: classValue ? classValue : null });
|
|
918
|
+
tr = tr.setNodeMarkup(pos, nodeType, newAttrs, node.marks);
|
|
455
919
|
});
|
|
920
|
+
return tr;
|
|
456
921
|
}
|
|
457
|
-
|
|
458
|
-
|
|
922
|
+
/**
|
|
923
|
+
* Returns the first `class` attribute that is non-empty in the selection.
|
|
924
|
+
* If not found, return empty string.
|
|
925
|
+
*/
|
|
926
|
+
function findFirstClassInSelection(state, allowedNodeType) {
|
|
927
|
+
const { selection, doc } = state;
|
|
928
|
+
const { from, to } = selection;
|
|
929
|
+
let keepLooking = true;
|
|
930
|
+
let foundClass = '';
|
|
931
|
+
doc.nodesBetween(from, to, node => {
|
|
932
|
+
if (keepLooking && node.type === allowedNodeType && node.attrs.class) {
|
|
933
|
+
keepLooking = false;
|
|
934
|
+
foundClass = node.attrs.class;
|
|
935
|
+
}
|
|
936
|
+
return keepLooking;
|
|
937
|
+
});
|
|
938
|
+
return foundClass;
|
|
939
|
+
}
|
|
940
|
+
class ClassItem extends Item {
|
|
941
|
+
constructor(dialog, nodeType) {
|
|
942
|
+
super({
|
|
943
|
+
active: state => {
|
|
944
|
+
return !!findFirstClassInSelection(state, nodeType);
|
|
945
|
+
},
|
|
946
|
+
enable: state => {
|
|
947
|
+
const { selection } = state;
|
|
948
|
+
return selection instanceof TextSelection || selection instanceof AllSelection;
|
|
949
|
+
},
|
|
950
|
+
run: (state, dispatch, view) => {
|
|
951
|
+
dialog
|
|
952
|
+
.open(ClassDialogComponent, {
|
|
953
|
+
data: {
|
|
954
|
+
class: findFirstClassInSelection(state, nodeType),
|
|
955
|
+
},
|
|
956
|
+
})
|
|
957
|
+
.afterClosed()
|
|
958
|
+
.subscribe(result => {
|
|
959
|
+
if (dispatch && result) {
|
|
960
|
+
const { selection } = state;
|
|
961
|
+
const tr = setClass(state.tr.setSelection(selection), result.class, nodeType);
|
|
962
|
+
if (tr.docChanged) {
|
|
963
|
+
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
view.focus();
|
|
967
|
+
});
|
|
968
|
+
},
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
function createCell(cellType, cellContent) {
|
|
974
|
+
return cellContent ? cellType.createChecked(null, cellContent) : cellType.createAndFill();
|
|
975
|
+
}
|
|
976
|
+
function createTable(state, rowsCount, colsCount, withHeaderRow, cellContent) {
|
|
977
|
+
const types = tableNodeTypes(state.schema);
|
|
978
|
+
const headerCells = [];
|
|
979
|
+
const cells = [];
|
|
980
|
+
for (let index = 0; index < colsCount; index += 1) {
|
|
981
|
+
const cell = createCell(types.cell, cellContent);
|
|
982
|
+
if (cell) {
|
|
983
|
+
cells.push(cell);
|
|
984
|
+
}
|
|
985
|
+
if (withHeaderRow) {
|
|
986
|
+
const headerCell = createCell(types.header_cell, cellContent);
|
|
987
|
+
if (headerCell) {
|
|
988
|
+
headerCells.push(headerCell);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
const rows = [];
|
|
993
|
+
for (let index = 0; index < rowsCount; index += 1) {
|
|
994
|
+
rows.push(types.row.createChecked(null, withHeaderRow && index === 0 ? headerCells : cells));
|
|
995
|
+
}
|
|
996
|
+
return types.table.createChecked(null, rows);
|
|
459
997
|
}
|
|
998
|
+
function addTable(state, dispatch, { rowsCount = 3, colsCount = 3, withHeaderRow = true, cellContent, } = {}) {
|
|
999
|
+
const offset = state.tr.selection.anchor + 1;
|
|
1000
|
+
const nodes = createTable(state, rowsCount, colsCount, withHeaderRow, cellContent);
|
|
1001
|
+
const tr = state.tr.replaceSelectionWith(nodes).scrollIntoView();
|
|
1002
|
+
const resolvedPos = tr.doc.resolve(offset);
|
|
1003
|
+
// move cursor into table
|
|
1004
|
+
tr.setSelection(TextSelection.near(resolvedPos));
|
|
1005
|
+
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr);
|
|
1006
|
+
}
|
|
1007
|
+
class AddTableItem extends Item {
|
|
1008
|
+
constructor() {
|
|
1009
|
+
super({ run: (editor, tr) => addTable(editor, tr) });
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
|
|
460
1013
|
/**
|
|
461
1014
|
* Given a schema, look for default mark and node types in it and
|
|
462
1015
|
* return an object with relevant menu items relating to those marks:
|
|
463
1016
|
*/
|
|
464
1017
|
function buildMenuItems(schema, dialog) {
|
|
465
1018
|
const r = {
|
|
466
|
-
joinUp:
|
|
467
|
-
lift:
|
|
468
|
-
selectParentNode:
|
|
469
|
-
undo:
|
|
470
|
-
redo:
|
|
1019
|
+
joinUp: menuItemToItem(joinUpItem),
|
|
1020
|
+
lift: menuItemToItem(liftItem),
|
|
1021
|
+
selectParentNode: menuItemToItem(selectParentNodeItem),
|
|
1022
|
+
undo: menuItemToItem(undoItem),
|
|
1023
|
+
redo: menuItemToItem(redoItem),
|
|
471
1024
|
};
|
|
472
1025
|
let type;
|
|
473
1026
|
type = schema.marks.strong;
|
|
474
1027
|
if (type) {
|
|
475
|
-
r.toggleStrong =
|
|
1028
|
+
r.toggleStrong = markTypeToItem(type);
|
|
476
1029
|
}
|
|
477
1030
|
type = schema.marks.em;
|
|
478
1031
|
if (type) {
|
|
479
|
-
r.toggleEm =
|
|
1032
|
+
r.toggleEm = markTypeToItem(type);
|
|
480
1033
|
}
|
|
481
1034
|
type = schema.marks.code;
|
|
482
1035
|
if (type) {
|
|
483
|
-
r.toggleCode =
|
|
1036
|
+
r.toggleCode = markTypeToItem(type);
|
|
484
1037
|
}
|
|
485
1038
|
type = schema.marks.link;
|
|
486
1039
|
if (type) {
|
|
487
|
-
r.toggleLink =
|
|
1040
|
+
r.toggleLink = new LinkItem(type, dialog);
|
|
488
1041
|
}
|
|
489
1042
|
type = schema.nodes.bullet_list;
|
|
490
1043
|
if (type) {
|
|
@@ -496,58 +1049,53 @@ function buildMenuItems(schema, dialog) {
|
|
|
496
1049
|
}
|
|
497
1050
|
type = schema.nodes.blockquote;
|
|
498
1051
|
if (type) {
|
|
499
|
-
r.wrapBlockQuote =
|
|
1052
|
+
r.wrapBlockQuote = menuItemToItem(wrapItem(type, {}));
|
|
500
1053
|
}
|
|
501
1054
|
type = schema.nodes.paragraph;
|
|
502
1055
|
if (type) {
|
|
503
|
-
r.makeParagraph =
|
|
1056
|
+
r.makeParagraph = menuItemToItem(blockTypeItem(type, {}));
|
|
504
1057
|
if (type.spec === paragraphWithAlignment) {
|
|
505
1058
|
r.alignLeft = new TextAlignItem('left');
|
|
506
1059
|
r.alignRight = new TextAlignItem('right');
|
|
507
1060
|
r.alignCenter = new TextAlignItem('center');
|
|
508
1061
|
r.alignJustify = new TextAlignItem('justify');
|
|
1062
|
+
r.paragraphClass = new ClassItem(dialog, type);
|
|
509
1063
|
}
|
|
510
1064
|
}
|
|
511
1065
|
type = schema.nodes.code_block;
|
|
512
1066
|
if (type) {
|
|
513
|
-
r.makeCodeBlock =
|
|
1067
|
+
r.makeCodeBlock = menuItemToItem(blockTypeItem(type, {}));
|
|
514
1068
|
}
|
|
515
1069
|
type = schema.nodes.heading;
|
|
516
1070
|
if (type) {
|
|
517
|
-
r.makeHead1 =
|
|
518
|
-
r.makeHead2 =
|
|
519
|
-
r.makeHead3 =
|
|
520
|
-
r.makeHead4 =
|
|
521
|
-
r.makeHead5 =
|
|
522
|
-
r.makeHead6 =
|
|
1071
|
+
r.makeHead1 = menuItemToItem(blockTypeItem(type, { attrs: { level: 1 } }));
|
|
1072
|
+
r.makeHead2 = menuItemToItem(blockTypeItem(type, { attrs: { level: 2 } }));
|
|
1073
|
+
r.makeHead3 = menuItemToItem(blockTypeItem(type, { attrs: { level: 3 } }));
|
|
1074
|
+
r.makeHead4 = menuItemToItem(blockTypeItem(type, { attrs: { level: 4 } }));
|
|
1075
|
+
r.makeHead5 = menuItemToItem(blockTypeItem(type, { attrs: { level: 5 } }));
|
|
1076
|
+
r.makeHead6 = menuItemToItem(blockTypeItem(type, { attrs: { level: 6 } }));
|
|
523
1077
|
}
|
|
524
1078
|
type = schema.nodes.horizontal_rule;
|
|
525
1079
|
if (type) {
|
|
526
|
-
|
|
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
|
-
});
|
|
1080
|
+
r.insertHorizontalRule = new HorizontalRuleItem(type);
|
|
535
1081
|
}
|
|
536
1082
|
type = schema.nodes.table;
|
|
537
1083
|
if (type) {
|
|
538
|
-
r.insertTable = new
|
|
539
|
-
r.addColumnBefore =
|
|
540
|
-
r.addColumnAfter =
|
|
541
|
-
r.deleteColumn =
|
|
542
|
-
r.addRowBefore =
|
|
543
|
-
r.addRowAfter =
|
|
544
|
-
r.deleteRow =
|
|
545
|
-
r.deleteTable =
|
|
546
|
-
r.mergeCells =
|
|
547
|
-
r.splitCell =
|
|
548
|
-
r.toggleHeaderColumn =
|
|
549
|
-
r.toggleHeaderRow =
|
|
550
|
-
r.toggleHeaderCell =
|
|
1084
|
+
r.insertTable = new AddTableItem();
|
|
1085
|
+
r.addColumnBefore = cmdToItem(addColumnBefore);
|
|
1086
|
+
r.addColumnAfter = cmdToItem(addColumnAfter);
|
|
1087
|
+
r.deleteColumn = cmdToItem(deleteColumn);
|
|
1088
|
+
r.addRowBefore = cmdToItem(addRowBefore);
|
|
1089
|
+
r.addRowAfter = cmdToItem(addRowAfter);
|
|
1090
|
+
r.deleteRow = cmdToItem(deleteRow);
|
|
1091
|
+
r.deleteTable = cmdToItem(deleteTable);
|
|
1092
|
+
r.mergeCells = cmdToItem(mergeCells);
|
|
1093
|
+
r.splitCell = cmdToItem(splitCell);
|
|
1094
|
+
r.toggleHeaderColumn = cmdToItem(toggleHeaderColumn);
|
|
1095
|
+
r.toggleHeaderRow = cmdToItem(toggleHeaderRow);
|
|
1096
|
+
r.toggleHeaderCell = cmdToItem(toggleHeaderCell);
|
|
1097
|
+
r.cellBackgroundColor = new CellBackgroundColorItem(dialog);
|
|
1098
|
+
r.tableClass = new ClassItem(dialog, type);
|
|
551
1099
|
}
|
|
552
1100
|
return r;
|
|
553
1101
|
}
|
|
@@ -843,7 +1391,7 @@ class NaturalEditorComponent {
|
|
|
843
1391
|
}),
|
|
844
1392
|
];
|
|
845
1393
|
if (this.schema === advancedSchema) {
|
|
846
|
-
plugins.push(this.imagePlugin.plugin,
|
|
1394
|
+
plugins.push(this.imagePlugin.plugin, tableEditing(), keymap({
|
|
847
1395
|
Tab: goToNextCell(1),
|
|
848
1396
|
'Shift-Tab': goToNextCell(-1),
|
|
849
1397
|
}));
|
|
@@ -895,11 +1443,11 @@ class NaturalEditorComponent {
|
|
|
895
1443
|
this.view.focus();
|
|
896
1444
|
}
|
|
897
1445
|
}
|
|
898
|
-
NaturalEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
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.
|
|
1446
|
+
NaturalEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: NaturalEditorComponent, deps: [{ token: i4.NgControl, optional: true, self: true }, { token: DOCUMENT }, { token: i1.MatDialog }, { token: ImagePlugin }], target: i0.ɵɵFactoryTarget.Component });
|
|
1447
|
+
NaturalEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.3.0", 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\n <mat-divider></mat-divider>\n\n <button\n mat-menu-item\n *ngIf=\"menu.paragraphClass\"\n [disabled]=\"menu.paragraphClass.disabled\"\n (click)=\"run($event, 'paragraphClass')\"\n i18n\n >Classe...\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 <button\n mat-menu-item\n *ngIf=\"menu.cellBackgroundColor\"\n [disabled]=\"menu.cellBackgroundColor.disabled\"\n (click)=\"run($event, 'cellBackgroundColor')\"\n i18n\n >Couleur de fond...\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.tableClass\"\n [disabled]=\"menu.tableClass.disabled\"\n (click)=\"run($event, 'tableClass')\"\n i18n\n >Classe...\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: i3$1.NaturalFileDropDirective, selector: ":not([naturalFileSelect])[naturalFileDrop]", outputs: ["fileOver"] }] });
|
|
1448
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: NaturalEditorComponent, decorators: [{
|
|
901
1449
|
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"] }]
|
|
1450
|
+
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\n <mat-divider></mat-divider>\n\n <button\n mat-menu-item\n *ngIf=\"menu.paragraphClass\"\n [disabled]=\"menu.paragraphClass.disabled\"\n (click)=\"run($event, 'paragraphClass')\"\n i18n\n >Classe...\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 <button\n mat-menu-item\n *ngIf=\"menu.cellBackgroundColor\"\n [disabled]=\"menu.cellBackgroundColor.disabled\"\n (click)=\"run($event, 'cellBackgroundColor')\"\n i18n\n >Couleur de fond...\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.tableClass\"\n [disabled]=\"menu.tableClass.disabled\"\n (click)=\"run($event, 'tableClass')\"\n i18n\n >Classe...\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
1451
|
}], ctorParameters: function () {
|
|
904
1452
|
return [{ type: i4.NgControl, decorators: [{
|
|
905
1453
|
type: Optional
|
|
@@ -925,63 +1473,68 @@ const imports = [
|
|
|
925
1473
|
MatButtonModule,
|
|
926
1474
|
MatButtonToggleModule,
|
|
927
1475
|
MatDialogModule,
|
|
1476
|
+
MatDividerModule,
|
|
928
1477
|
MatFormFieldModule,
|
|
929
1478
|
MatIconModule,
|
|
930
1479
|
MatInputModule,
|
|
931
1480
|
MatMenuModule,
|
|
932
1481
|
MatToolbarModule,
|
|
933
1482
|
MatTooltipModule,
|
|
934
|
-
ReactiveFormsModule,
|
|
935
1483
|
NaturalFileModule,
|
|
936
|
-
|
|
1484
|
+
NaturalIconModule,
|
|
1485
|
+
ReactiveFormsModule,
|
|
937
1486
|
];
|
|
1487
|
+
const declarationsToExport = [NaturalEditorComponent, NaturalCustomCssDirective];
|
|
938
1488
|
class NaturalEditorModule {
|
|
939
1489
|
}
|
|
940
|
-
NaturalEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.
|
|
941
|
-
NaturalEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.
|
|
1490
|
+
NaturalEditorModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: NaturalEditorModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1491
|
+
NaturalEditorModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: NaturalEditorModule, declarations: [ClassDialogComponent, ColorDialogComponent, LinkDialogComponent, NaturalEditorComponent, NaturalCustomCssDirective], imports: [CommonModule,
|
|
942
1492
|
MatButtonModule,
|
|
943
1493
|
MatButtonToggleModule,
|
|
944
1494
|
MatDialogModule,
|
|
1495
|
+
MatDividerModule,
|
|
945
1496
|
MatFormFieldModule,
|
|
946
1497
|
MatIconModule,
|
|
947
1498
|
MatInputModule,
|
|
948
1499
|
MatMenuModule,
|
|
949
1500
|
MatToolbarModule,
|
|
950
1501
|
MatTooltipModule,
|
|
951
|
-
ReactiveFormsModule,
|
|
952
1502
|
NaturalFileModule,
|
|
953
|
-
|
|
1503
|
+
NaturalIconModule,
|
|
1504
|
+
ReactiveFormsModule], exports: [CommonModule,
|
|
954
1505
|
MatButtonModule,
|
|
955
1506
|
MatButtonToggleModule,
|
|
956
1507
|
MatDialogModule,
|
|
1508
|
+
MatDividerModule,
|
|
957
1509
|
MatFormFieldModule,
|
|
958
1510
|
MatIconModule,
|
|
959
1511
|
MatInputModule,
|
|
960
1512
|
MatMenuModule,
|
|
961
1513
|
MatToolbarModule,
|
|
962
1514
|
MatTooltipModule,
|
|
963
|
-
ReactiveFormsModule,
|
|
964
1515
|
NaturalFileModule,
|
|
965
|
-
|
|
966
|
-
|
|
1516
|
+
NaturalIconModule,
|
|
1517
|
+
ReactiveFormsModule, NaturalEditorComponent, NaturalCustomCssDirective] });
|
|
1518
|
+
NaturalEditorModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: NaturalEditorModule, imports: [[...imports], CommonModule,
|
|
967
1519
|
MatButtonModule,
|
|
968
1520
|
MatButtonToggleModule,
|
|
969
1521
|
MatDialogModule,
|
|
1522
|
+
MatDividerModule,
|
|
970
1523
|
MatFormFieldModule,
|
|
971
1524
|
MatIconModule,
|
|
972
1525
|
MatInputModule,
|
|
973
1526
|
MatMenuModule,
|
|
974
1527
|
MatToolbarModule,
|
|
975
1528
|
MatTooltipModule,
|
|
976
|
-
ReactiveFormsModule,
|
|
977
1529
|
NaturalFileModule,
|
|
978
|
-
|
|
979
|
-
|
|
1530
|
+
NaturalIconModule,
|
|
1531
|
+
ReactiveFormsModule] });
|
|
1532
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.3.0", ngImport: i0, type: NaturalEditorModule, decorators: [{
|
|
980
1533
|
type: NgModule,
|
|
981
1534
|
args: [{
|
|
982
|
-
declarations: [
|
|
1535
|
+
declarations: [ClassDialogComponent, ColorDialogComponent, LinkDialogComponent, ...declarationsToExport],
|
|
983
1536
|
imports: [...imports],
|
|
984
|
-
exports: [...imports,
|
|
1537
|
+
exports: [...imports, ...declarationsToExport],
|
|
985
1538
|
}]
|
|
986
1539
|
}] });
|
|
987
1540
|
|
|
@@ -991,5 +1544,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.5", ngImpor
|
|
|
991
1544
|
* Generated bundle index. Do not edit.
|
|
992
1545
|
*/
|
|
993
1546
|
|
|
994
|
-
export { NaturalEditorComponent, NaturalEditorModule };
|
|
1547
|
+
export { NaturalCustomCssDirective, NaturalEditorComponent, NaturalEditorModule };
|
|
995
1548
|
//# sourceMappingURL=ecodev-natural-editor.mjs.map
|