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