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