@ecodev/natural-editor 41.0.0 → 41.2.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/bundles/ecodev-natural-editor.umd.js +247 -80
- package/bundles/ecodev-natural-editor.umd.js.map +1 -1
- package/esm2015/lib/editor/editor.component.js +200 -0
- package/esm2015/lib/editor.module.js +15 -5
- package/esm2015/lib/link-dialog/link-dialog.component.js +3 -4
- package/esm2015/lib/utils/image.js +81 -0
- package/esm2015/lib/utils/menu.js +207 -0
- package/esm2015/lib/utils/schema.js +46 -0
- package/esm2015/lib/utils/table.js +37 -0
- package/esm2015/public-api.js +2 -2
- package/fesm2015/ecodev-natural-editor.js +233 -69
- package/fesm2015/ecodev-natural-editor.js.map +1 -1
- package/lib/{editor.component.d.ts → editor/editor.component.d.ts} +19 -4
- package/lib/editor.module.d.ts +4 -2
- package/lib/utils/image.d.ts +15 -0
- package/lib/{menu.d.ts → utils/menu.d.ts} +1 -1
- package/lib/utils/schema.d.ts +3 -0
- package/lib/utils/table.d.ts +8 -0
- package/package.json +3 -1
- package/public-api.d.ts +1 -1
- package/src/lib/editor/_editor.theme.scss +44 -0
- package/theming/_natural-editor.theme.scss +1 -1
- package/esm2015/lib/editor.component.js +0 -160
- package/esm2015/lib/menu.js +0 -222
- package/esm2015/lib/schema.js +0 -21
- package/lib/schema.d.ts +0 -2
- package/src/lib/_editor.theme.scss +0 -23
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/localize/init'), require('@angular/core'), require('prosemirror-view'), require('prosemirror-state'), require('prosemirror-example-setup'), require('prosemirror-model'), require('prosemirror-
|
|
3
|
-
typeof define === 'function' && define.amd ? define('@ecodev/natural-editor', ['exports', '@angular/localize/init', '@angular/core', 'prosemirror-view', 'prosemirror-state', 'prosemirror-example-setup', 'prosemirror-model', 'prosemirror-
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ecodev = global.ecodev || {}, global.ecodev["natural-editor"] = {}), global.ng.localize.init, global.ng.core, global["prosemirror-view"], global["prosemirror-state"], global["prosemirror-example-setup"], global["prosemirror-model"], global["prosemirror-schema-basic"], global["prosemirror-schema-list"], global
|
|
5
|
-
})(this, (function (exports, init, i0, prosemirrorView, prosemirrorState, prosemirrorExampleSetup, prosemirrorModel, prosemirrorSchemaBasic, prosemirrorSchemaList,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/localize/init'), require('@angular/core'), require('prosemirror-view'), require('prosemirror-state'), require('prosemirror-example-setup'), require('prosemirror-model'), require('@angular/common'), require('prosemirror-tables'), require('prosemirror-keymap'), require('prosemirror-schema-basic'), require('prosemirror-schema-list'), require('prosemirror-menu'), require('prosemirror-commands'), require('@angular/material/dialog'), require('@angular/forms'), require('@ecodev/natural'), require('@angular/material/form-field'), require('@angular/material/button'), require('@angular/material/input'), require('@angular/material/icon'), require('@angular/material/button-toggle'), require('@angular/material/menu'), require('@angular/material/divider'), require('@angular/material/tooltip'), require('@angular/material/toolbar')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define('@ecodev/natural-editor', ['exports', '@angular/localize/init', '@angular/core', 'prosemirror-view', 'prosemirror-state', 'prosemirror-example-setup', 'prosemirror-model', '@angular/common', 'prosemirror-tables', 'prosemirror-keymap', 'prosemirror-schema-basic', 'prosemirror-schema-list', 'prosemirror-menu', 'prosemirror-commands', '@angular/material/dialog', '@angular/forms', '@ecodev/natural', '@angular/material/form-field', '@angular/material/button', '@angular/material/input', '@angular/material/icon', '@angular/material/button-toggle', '@angular/material/menu', '@angular/material/divider', '@angular/material/tooltip', '@angular/material/toolbar'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.ecodev = global.ecodev || {}, global.ecodev["natural-editor"] = {}), global.ng.localize.init, global.ng.core, global["prosemirror-view"], global["prosemirror-state"], global["prosemirror-example-setup"], global["prosemirror-model"], global.ng.common, global.prosemirrorTables, global.prosemirrorKeymap, global["prosemirror-schema-basic"], global["prosemirror-schema-list"], global["prosemirror-menu"], global["prosemirror-commands"], global.ng.material.dialog, global.ng.forms, global.i11, global.ng.material.formField, global.ng.material.button, global.ng.material.input, global.ng.material.icon, global.ng.material.buttonToggle, global.ng.material.menu, global.ng.material.divider, global.ng.material.tooltip, global.ng.material.toolbar));
|
|
5
|
+
})(this, (function (exports, init, i0, prosemirrorView, prosemirrorState, prosemirrorExampleSetup, prosemirrorModel, i6, prosemirrorTables, prosemirrorKeymap, prosemirrorSchemaBasic, prosemirrorSchemaList, prosemirrorMenu, prosemirrorCommands, i1, i4, i11, i2, i3, i5, i5$1, i6$1, i7, i8, i10, toolbar) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespace(e) {
|
|
8
8
|
if (e && e.__esModule) return e;
|
|
@@ -26,13 +26,15 @@
|
|
|
26
26
|
var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
|
|
27
27
|
var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
|
|
28
28
|
var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
|
|
29
|
+
var i11__namespace = /*#__PURE__*/_interopNamespace(i11);
|
|
29
30
|
var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
|
|
30
31
|
var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
|
|
31
32
|
var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
|
|
32
|
-
var
|
|
33
|
-
var i4__namespace$1 = /*#__PURE__*/_interopNamespace(i4$1);
|
|
33
|
+
var i5__namespace$1 = /*#__PURE__*/_interopNamespace(i5$1);
|
|
34
34
|
var i6__namespace$1 = /*#__PURE__*/_interopNamespace(i6$1);
|
|
35
|
+
var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
|
|
35
36
|
var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
|
|
37
|
+
var i10__namespace = /*#__PURE__*/_interopNamespace(i10);
|
|
36
38
|
|
|
37
39
|
/*! *****************************************************************************
|
|
38
40
|
Copyright (c) Microsoft Corporation.
|
|
@@ -352,22 +354,126 @@
|
|
|
352
354
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
353
355
|
}
|
|
354
356
|
|
|
355
|
-
var
|
|
357
|
+
var ImagePlugin = /** @class */ (function () {
|
|
358
|
+
function ImagePlugin(document) {
|
|
359
|
+
this.document = document;
|
|
360
|
+
this.plugin = new prosemirrorState.Plugin({
|
|
361
|
+
state: {
|
|
362
|
+
init: function () {
|
|
363
|
+
return prosemirrorView.DecorationSet.empty;
|
|
364
|
+
},
|
|
365
|
+
apply: function (tr, set) {
|
|
366
|
+
// Adjust decoration positions to changes made by the transaction
|
|
367
|
+
set = set.map(tr.mapping, tr.doc);
|
|
368
|
+
// See if the transaction adds or removes any placeholders
|
|
369
|
+
var action = tr.getMeta(this);
|
|
370
|
+
if (action && action.add) {
|
|
371
|
+
var widget = document.createElement('placeholder');
|
|
372
|
+
var deco = prosemirrorView.Decoration.widget(action.add.pos, widget, { id: action.add.id });
|
|
373
|
+
set = set.add(tr.doc, [deco]);
|
|
374
|
+
}
|
|
375
|
+
else if (action && action.remove) {
|
|
376
|
+
set = set.remove(set.find(undefined, undefined, function (spec) { return spec.id === action.remove.id; }));
|
|
377
|
+
}
|
|
378
|
+
return set;
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
props: {
|
|
382
|
+
decorations: function (state) {
|
|
383
|
+
return this.getState(state);
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
ImagePlugin.prototype.findPlaceholder = function (state, id) {
|
|
389
|
+
var decorators = this.plugin.getState(state);
|
|
390
|
+
var found = decorators.find(undefined, undefined, function (spec) { return spec.id === id; });
|
|
391
|
+
return found.length ? found[0].from : null;
|
|
392
|
+
};
|
|
393
|
+
ImagePlugin.prototype.startImageUpload = function (view, file, uploader, schema) {
|
|
394
|
+
var _this = this;
|
|
395
|
+
// A fresh object to act as the ID for this upload
|
|
396
|
+
var id = {};
|
|
397
|
+
// Replace the selection with a placeholder
|
|
398
|
+
var tr = view.state.tr;
|
|
399
|
+
if (!tr.selection.empty) {
|
|
400
|
+
tr.deleteSelection();
|
|
401
|
+
}
|
|
402
|
+
tr.setMeta(this.plugin, { add: { id: id, pos: tr.selection.from } });
|
|
403
|
+
view.dispatch(tr);
|
|
404
|
+
uploader(file).subscribe({
|
|
405
|
+
next: function (url) {
|
|
406
|
+
var pos = _this.findPlaceholder(view.state, id);
|
|
407
|
+
// If the content around the placeholder has been deleted, drop
|
|
408
|
+
// the image
|
|
409
|
+
if (pos === null) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
// Otherwise, insert it at the placeholder's position, and remove
|
|
413
|
+
// the placeholder
|
|
414
|
+
view.dispatch(view.state.tr
|
|
415
|
+
.replaceWith(pos, pos, schema.nodes.image.create({ src: url }))
|
|
416
|
+
.setMeta(_this.plugin, { remove: { id: id } }));
|
|
417
|
+
},
|
|
418
|
+
error: function () {
|
|
419
|
+
// On failure, just clean up the placeholder
|
|
420
|
+
view === null || view === void 0 ? void 0 : view.dispatch(tr.setMeta(_this.plugin, { remove: { id: id } }));
|
|
421
|
+
},
|
|
422
|
+
});
|
|
423
|
+
};
|
|
424
|
+
return ImagePlugin;
|
|
425
|
+
}());
|
|
426
|
+
ImagePlugin.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: ImagePlugin, deps: [{ token: i6.DOCUMENT }], target: i0__namespace.ɵɵFactoryTarget.Injectable });
|
|
427
|
+
ImagePlugin.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: ImagePlugin });
|
|
428
|
+
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: ImagePlugin, decorators: [{
|
|
429
|
+
type: i0.Injectable
|
|
430
|
+
}], ctorParameters: function () {
|
|
431
|
+
return [{ type: Document, decorators: [{
|
|
432
|
+
type: i0.Inject,
|
|
433
|
+
args: [i6.DOCUMENT]
|
|
434
|
+
}] }];
|
|
435
|
+
} });
|
|
436
|
+
|
|
437
|
+
var basicNodes = {
|
|
356
438
|
heading: prosemirrorSchemaBasic.nodes.heading,
|
|
357
439
|
doc: prosemirrorSchemaBasic.nodes.doc,
|
|
358
440
|
paragraph: prosemirrorSchemaBasic.nodes.paragraph,
|
|
359
441
|
text: prosemirrorSchemaBasic.nodes.text,
|
|
360
442
|
hard_break: prosemirrorSchemaBasic.nodes.hard_break,
|
|
361
443
|
};
|
|
362
|
-
var
|
|
444
|
+
var basicMarks = {
|
|
363
445
|
link: prosemirrorSchemaBasic.marks.link,
|
|
364
446
|
em: prosemirrorSchemaBasic.marks.em,
|
|
365
447
|
strong: prosemirrorSchemaBasic.marks.strong,
|
|
366
448
|
};
|
|
367
|
-
var
|
|
368
|
-
var
|
|
369
|
-
nodes: prosemirrorSchemaList.addListNodes(
|
|
370
|
-
marks:
|
|
449
|
+
var tmpSchema = new prosemirrorModel.Schema({ nodes: basicNodes, marks: basicMarks });
|
|
450
|
+
var basicSchema = new prosemirrorModel.Schema({
|
|
451
|
+
nodes: prosemirrorSchemaList.addListNodes(tmpSchema.spec.nodes, 'paragraph block*', 'block'),
|
|
452
|
+
marks: tmpSchema.spec.marks,
|
|
453
|
+
});
|
|
454
|
+
var tmpSchema2 = new prosemirrorModel.Schema({
|
|
455
|
+
nodes: Object.assign(Object.assign({}, prosemirrorSchemaBasic.nodes), prosemirrorTables.tableNodes({
|
|
456
|
+
tableGroup: 'block',
|
|
457
|
+
cellContent: 'block+',
|
|
458
|
+
cellAttributes: {
|
|
459
|
+
background: {
|
|
460
|
+
default: null,
|
|
461
|
+
getFromDOM: function (dom) {
|
|
462
|
+
return dom.style.backgroundColor || null;
|
|
463
|
+
},
|
|
464
|
+
setDOMAttr: function (value, attrs) {
|
|
465
|
+
if (value) {
|
|
466
|
+
attrs.style = (attrs.style || '') + ("background-color: " + value + ";");
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
},
|
|
471
|
+
})),
|
|
472
|
+
marks: basicMarks,
|
|
473
|
+
});
|
|
474
|
+
var advancedSchema = new prosemirrorModel.Schema({
|
|
475
|
+
nodes: prosemirrorSchemaList.addListNodes(tmpSchema2.spec.nodes, 'paragraph block*', 'block'),
|
|
476
|
+
marks: basicMarks,
|
|
371
477
|
});
|
|
372
478
|
|
|
373
479
|
var LinkDialogComponent = /** @class */ (function () {
|
|
@@ -382,9 +488,8 @@
|
|
|
382
488
|
this.form.setValue(data);
|
|
383
489
|
}
|
|
384
490
|
LinkDialogComponent.prototype.maybeConfirm = function () {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}
|
|
491
|
+
var _this = this;
|
|
492
|
+
i11.ifValid(this.form).subscribe(function () { return _this.confirm(); });
|
|
388
493
|
};
|
|
389
494
|
LinkDialogComponent.prototype.confirm = function () {
|
|
390
495
|
this.dialogRef.close(this.form.value);
|
|
@@ -406,6 +511,42 @@
|
|
|
406
511
|
}] }, { type: i1__namespace.MatDialogRef }];
|
|
407
512
|
} });
|
|
408
513
|
|
|
514
|
+
function createCell(cellType, cellContent) {
|
|
515
|
+
return cellContent ? cellType.createChecked(null, cellContent) : cellType.createAndFill();
|
|
516
|
+
}
|
|
517
|
+
function createTable(state, rowsCount, colsCount, withHeaderRow, cellContent) {
|
|
518
|
+
var types = prosemirrorTables.tableNodeTypes(state.schema);
|
|
519
|
+
var headerCells = [];
|
|
520
|
+
var cells = [];
|
|
521
|
+
for (var index = 0; index < colsCount; index += 1) {
|
|
522
|
+
var cell = createCell(types.cell, cellContent);
|
|
523
|
+
if (cell) {
|
|
524
|
+
cells.push(cell);
|
|
525
|
+
}
|
|
526
|
+
if (withHeaderRow) {
|
|
527
|
+
var headerCell = createCell(types.header_cell, cellContent);
|
|
528
|
+
if (headerCell) {
|
|
529
|
+
headerCells.push(headerCell);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
var rows = [];
|
|
534
|
+
for (var index = 0; index < rowsCount; index += 1) {
|
|
535
|
+
rows.push(types.row.createChecked(null, withHeaderRow && index === 0 ? headerCells : cells));
|
|
536
|
+
}
|
|
537
|
+
return types.table.createChecked(null, rows);
|
|
538
|
+
}
|
|
539
|
+
function addTable(state, dispatch, _a) {
|
|
540
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.rowsCount, rowsCount = _c === void 0 ? 3 : _c, _d = _b.colsCount, colsCount = _d === void 0 ? 3 : _d, _e = _b.withHeaderRow, withHeaderRow = _e === void 0 ? true : _e, cellContent = _b.cellContent;
|
|
541
|
+
var offset = state.tr.selection.anchor + 1;
|
|
542
|
+
var nodes = createTable(state, rowsCount, colsCount, withHeaderRow, cellContent);
|
|
543
|
+
var tr = state.tr.replaceSelectionWith(nodes).scrollIntoView();
|
|
544
|
+
var resolvedPos = tr.doc.resolve(offset);
|
|
545
|
+
// move cursor into table
|
|
546
|
+
tr.setSelection(prosemirrorState.TextSelection.near(resolvedPos));
|
|
547
|
+
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr);
|
|
548
|
+
}
|
|
549
|
+
|
|
409
550
|
/**
|
|
410
551
|
* One item of the menu.
|
|
411
552
|
*
|
|
@@ -461,35 +602,6 @@
|
|
|
461
602
|
}
|
|
462
603
|
return false;
|
|
463
604
|
}
|
|
464
|
-
// function insertImageItem(nodeType: NodeType) {
|
|
465
|
-
// return new MenuItem({
|
|
466
|
-
// enable(state): boolean {
|
|
467
|
-
// return canInsert(state, nodeType);
|
|
468
|
-
// },
|
|
469
|
-
// run(state, _, view) {
|
|
470
|
-
// let {from, to} = state.selection,
|
|
471
|
-
// attrs = null;
|
|
472
|
-
// if (state.selection instanceof NodeSelection && state.selection.node.type == nodeType) {
|
|
473
|
-
// attrs = state.selection.node.attrs;
|
|
474
|
-
// }
|
|
475
|
-
// openPrompt({
|
|
476
|
-
// title: 'Insert image',
|
|
477
|
-
// fields: {
|
|
478
|
-
// src: new TextField({label: 'Location', required: true, value: attrs && attrs.src}),
|
|
479
|
-
// title: new TextField({label: 'Title', value: attrs && attrs.title}),
|
|
480
|
-
// alt: new TextField({
|
|
481
|
-
// label: 'Description',
|
|
482
|
-
// value: attrs ? attrs.alt : state.doc.textBetween(from, to, ' '),
|
|
483
|
-
// }),
|
|
484
|
-
// },
|
|
485
|
-
// callback(attrs) {
|
|
486
|
-
// view.dispatch(view.state.tr.replaceSelectionWith(nodeType.createAndFill(attrs)));
|
|
487
|
-
// view.focus();
|
|
488
|
-
// },
|
|
489
|
-
// });
|
|
490
|
-
// },
|
|
491
|
-
// });
|
|
492
|
-
// }
|
|
493
605
|
function cmdItem(cmd, options, useEnable) {
|
|
494
606
|
if (options === void 0) { options = {}; }
|
|
495
607
|
if (useEnable === void 0) { useEnable = false; }
|
|
@@ -580,10 +692,6 @@
|
|
|
580
692
|
if (type) {
|
|
581
693
|
r.toggleLink = linkItem(type, dialog);
|
|
582
694
|
}
|
|
583
|
-
type = schema.nodes.image;
|
|
584
|
-
if (type) {
|
|
585
|
-
// r.insertImage = insertImageItem(type);
|
|
586
|
-
}
|
|
587
695
|
type = schema.nodes.bullet_list;
|
|
588
696
|
if (type) {
|
|
589
697
|
r.wrapBulletList = wrapListItem(type);
|
|
@@ -625,6 +733,22 @@
|
|
|
625
733
|
},
|
|
626
734
|
});
|
|
627
735
|
}
|
|
736
|
+
type = schema.nodes.table;
|
|
737
|
+
if (type) {
|
|
738
|
+
r.insertTable = new Item({ run: function (e, tr) { return addTable(e, tr); } });
|
|
739
|
+
r.addColumnBefore = new Item({ run: prosemirrorTables.addColumnBefore });
|
|
740
|
+
r.addColumnAfter = new Item({ run: prosemirrorTables.addColumnAfter });
|
|
741
|
+
r.deleteColumn = new Item({ run: prosemirrorTables.deleteColumn });
|
|
742
|
+
r.addRowBefore = new Item({ run: prosemirrorTables.addRowBefore });
|
|
743
|
+
r.addRowAfter = new Item({ run: prosemirrorTables.addRowAfter });
|
|
744
|
+
r.deleteRow = new Item({ run: prosemirrorTables.deleteRow });
|
|
745
|
+
r.deleteTable = new Item({ run: prosemirrorTables.deleteTable });
|
|
746
|
+
r.mergeCells = new Item({ run: prosemirrorTables.mergeCells });
|
|
747
|
+
r.splitCell = new Item({ run: prosemirrorTables.splitCell });
|
|
748
|
+
r.toggleHeaderColumn = new Item({ run: prosemirrorTables.toggleHeaderColumn });
|
|
749
|
+
r.toggleHeaderRow = new Item({ run: prosemirrorTables.toggleHeaderRow });
|
|
750
|
+
r.toggleHeaderCell = new Item({ run: prosemirrorTables.toggleHeaderCell });
|
|
751
|
+
}
|
|
628
752
|
return r;
|
|
629
753
|
}
|
|
630
754
|
|
|
@@ -639,25 +763,39 @@
|
|
|
639
763
|
*/
|
|
640
764
|
// @dynamic
|
|
641
765
|
var NaturalEditorComponent = /** @class */ (function () {
|
|
642
|
-
function NaturalEditorComponent(ngControl, document, dialog) {
|
|
766
|
+
function NaturalEditorComponent(ngControl, document, dialog, imagePlugin) {
|
|
643
767
|
this.ngControl = ngControl;
|
|
644
768
|
this.document = document;
|
|
645
769
|
this.dialog = dialog;
|
|
770
|
+
this.imagePlugin = imagePlugin;
|
|
646
771
|
this.view = null;
|
|
647
772
|
this.contentChange = new i0.EventEmitter();
|
|
773
|
+
/**
|
|
774
|
+
* Callback to upload an image.
|
|
775
|
+
*
|
|
776
|
+
* If given it will enable advanced schema, including image and tables.
|
|
777
|
+
* It must be given on initialization and cannot be changed later on.
|
|
778
|
+
*/
|
|
779
|
+
this.imageUploader = null;
|
|
780
|
+
this.schema = basicSchema;
|
|
648
781
|
/**
|
|
649
782
|
* HTML string
|
|
650
783
|
*/
|
|
651
784
|
this.content = '';
|
|
652
785
|
this.menu = null;
|
|
786
|
+
/**
|
|
787
|
+
* If subscribed to, then the save button will be shown and click events forwarded
|
|
788
|
+
*/
|
|
789
|
+
this.save = new i0.EventEmitter();
|
|
653
790
|
if (this.ngControl !== null) {
|
|
654
791
|
this.ngControl.valueAccessor = this;
|
|
655
792
|
}
|
|
656
793
|
}
|
|
657
794
|
NaturalEditorComponent.prototype.ngOnInit = function () {
|
|
658
795
|
var _this = this;
|
|
659
|
-
this.
|
|
660
|
-
|
|
796
|
+
this.schema = this.imageUploader ? advancedSchema : basicSchema;
|
|
797
|
+
this.menu = buildMenuItems(this.schema, this.dialog);
|
|
798
|
+
var serializer = prosemirrorModel.DOMSerializer.fromSchema(this.schema);
|
|
661
799
|
var state = this.createState();
|
|
662
800
|
this.view = new prosemirrorView.EditorView(this.editor.nativeElement, {
|
|
663
801
|
state: state,
|
|
@@ -694,21 +832,28 @@
|
|
|
694
832
|
}
|
|
695
833
|
};
|
|
696
834
|
NaturalEditorComponent.prototype.createState = function () {
|
|
835
|
+
var _this = this;
|
|
697
836
|
var template = this.document.createElement('_');
|
|
698
837
|
template.innerHTML = '<div>' + this.content + '</div>';
|
|
699
838
|
if (!template.firstChild) {
|
|
700
839
|
throw new Error('child of template element could not be created');
|
|
701
840
|
}
|
|
702
|
-
var parser = prosemirrorModel.DOMParser.fromSchema(schema);
|
|
841
|
+
var parser = prosemirrorModel.DOMParser.fromSchema(this.schema);
|
|
703
842
|
var doc = parser.parse(template.firstChild);
|
|
704
|
-
var
|
|
843
|
+
var plugins = __spreadArray(__spreadArray([], __read(prosemirrorExampleSetup.exampleSetup({ schema: this.schema, menuBar: false }))), [
|
|
844
|
+
new prosemirrorState.Plugin({
|
|
845
|
+
view: function () { return _this; },
|
|
846
|
+
}),
|
|
847
|
+
]);
|
|
848
|
+
if (this.schema === advancedSchema) {
|
|
849
|
+
plugins.push(this.imagePlugin.plugin, prosemirrorTables.columnResizing(undefined), prosemirrorTables.tableEditing(), prosemirrorKeymap.keymap({
|
|
850
|
+
Tab: prosemirrorTables.goToNextCell(1),
|
|
851
|
+
'Shift-Tab': prosemirrorTables.goToNextCell(-1),
|
|
852
|
+
}));
|
|
853
|
+
}
|
|
705
854
|
return prosemirrorState.EditorState.create({
|
|
706
855
|
doc: doc,
|
|
707
|
-
plugins:
|
|
708
|
-
new prosemirrorState.Plugin({
|
|
709
|
-
view: function () { return self; },
|
|
710
|
-
}),
|
|
711
|
-
]),
|
|
856
|
+
plugins: plugins,
|
|
712
857
|
});
|
|
713
858
|
};
|
|
714
859
|
/**
|
|
@@ -757,16 +902,26 @@
|
|
|
757
902
|
item.spec.run(this.view.state, this.view.dispatch, this.view, event);
|
|
758
903
|
this.view.focus();
|
|
759
904
|
};
|
|
905
|
+
NaturalEditorComponent.prototype.upload = function (file) {
|
|
906
|
+
if (!this.view || !this.imageUploader) {
|
|
907
|
+
return;
|
|
908
|
+
}
|
|
909
|
+
if (this.view.state.selection.$from.parent.inlineContent) {
|
|
910
|
+
this.imagePlugin.startImageUpload(this.view, file, this.imageUploader, this.schema);
|
|
911
|
+
}
|
|
912
|
+
this.view.focus();
|
|
913
|
+
};
|
|
760
914
|
return NaturalEditorComponent;
|
|
761
915
|
}());
|
|
762
|
-
NaturalEditorComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: NaturalEditorComponent, deps: [{ token: i4__namespace.NgControl, optional: true, self: true }, { token: i6.DOCUMENT }, { token: i1__namespace.MatDialog }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
763
|
-
NaturalEditorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.9", type: NaturalEditorComponent, selector: "natural-editor", outputs: { contentChange: "contentChange" }, viewQueries: [{ propertyName: "editor", first: true, predicate: ["editor"], descendants: true, read: i0.ElementRef, static: true }], ngImport: i0__namespace, template: "<div class=\"menu\" *ngIf=\"menu\">\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\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 #editor></div>\n", styles: [".menu{border-bottom:1px solid;display:flex;flex-wrap:wrap;padding:10px 18px}::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}\n"], components: [{ type: i3__namespace$1.MatButtonToggle, selector: "mat-button-toggle", inputs: ["disableRipple", "aria-labelledby", "tabIndex", "appearance", "checked", "disabled", "id", "name", "aria-label", "value"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { type: i4__namespace$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3__namespace.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: i6__namespace$1.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { type: i6__namespace$1.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3__namespace$1.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { type: i8__namespace.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i6__namespace$1.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }] });
|
|
916
|
+
NaturalEditorComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: NaturalEditorComponent, deps: [{ token: i4__namespace.NgControl, optional: true, self: true }, { token: i6.DOCUMENT }, { token: i1__namespace.MatDialog }, { token: ImagePlugin }], target: i0__namespace.ɵɵFactoryTarget.Component });
|
|
917
|
+
NaturalEditorComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.9", 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: i0.ElementRef, static: true }], ngImport: i0__namespace, 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 <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:bold;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__namespace.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__namespace$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i6__namespace$1.MatButtonToggle, selector: "mat-button-toggle", inputs: ["disableRipple", "aria-labelledby", "tabIndex", "appearance", "checked", "disabled", "id", "name", "aria-label", "value"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { type: i7__namespace.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { type: i7__namespace.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { type: i8__namespace.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10__namespace.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i6__namespace$1.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { type: i7__namespace.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { type: i11__namespace.NaturalFileDropDirective, selector: ":not([naturalFileSelect])[naturalFileDrop]", outputs: ["fileOver"] }] });
|
|
764
918
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: NaturalEditorComponent, decorators: [{
|
|
765
919
|
type: i0.Component,
|
|
766
920
|
args: [{
|
|
767
921
|
selector: 'natural-editor',
|
|
768
922
|
templateUrl: './editor.component.html',
|
|
769
923
|
styleUrls: ['./editor.component.scss'],
|
|
924
|
+
providers: [ImagePlugin],
|
|
770
925
|
}]
|
|
771
926
|
}], ctorParameters: function () {
|
|
772
927
|
return [{ type: i4__namespace.NgControl, decorators: [{
|
|
@@ -776,26 +931,32 @@
|
|
|
776
931
|
}] }, { type: Document, decorators: [{
|
|
777
932
|
type: i0.Inject,
|
|
778
933
|
args: [i6.DOCUMENT]
|
|
779
|
-
}] }, { type: i1__namespace.MatDialog }];
|
|
934
|
+
}] }, { type: i1__namespace.MatDialog }, { type: ImagePlugin }];
|
|
780
935
|
}, propDecorators: { editor: [{
|
|
781
936
|
type: i0.ViewChild,
|
|
782
937
|
args: ['editor', { read: i0.ElementRef, static: true }]
|
|
783
938
|
}], contentChange: [{
|
|
784
939
|
type: i0.Output
|
|
940
|
+
}], imageUploader: [{
|
|
941
|
+
type: i0.Input
|
|
942
|
+
}], save: [{
|
|
943
|
+
type: i0.Output
|
|
785
944
|
}] } });
|
|
786
945
|
|
|
787
946
|
var imports = [
|
|
788
947
|
i6.CommonModule,
|
|
789
948
|
i3.MatButtonModule,
|
|
790
|
-
|
|
949
|
+
i6$1.MatButtonToggleModule,
|
|
791
950
|
i1.MatDialogModule,
|
|
792
951
|
i2.MatFormFieldModule,
|
|
793
|
-
|
|
952
|
+
i5$1.MatIconModule,
|
|
794
953
|
i5.MatInputModule,
|
|
795
|
-
|
|
954
|
+
i7.MatMenuModule,
|
|
796
955
|
toolbar.MatToolbarModule,
|
|
797
|
-
|
|
956
|
+
i10.MatTooltipModule,
|
|
798
957
|
i4.ReactiveFormsModule,
|
|
958
|
+
i11.NaturalFileModule,
|
|
959
|
+
i8.MatDividerModule,
|
|
799
960
|
];
|
|
800
961
|
var NaturalEditorModule = /** @class */ (function () {
|
|
801
962
|
function NaturalEditorModule() {
|
|
@@ -805,36 +966,42 @@
|
|
|
805
966
|
NaturalEditorModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: NaturalEditorModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
|
|
806
967
|
NaturalEditorModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: NaturalEditorModule, declarations: [NaturalEditorComponent, LinkDialogComponent], imports: [i6.CommonModule,
|
|
807
968
|
i3.MatButtonModule,
|
|
808
|
-
|
|
969
|
+
i6$1.MatButtonToggleModule,
|
|
809
970
|
i1.MatDialogModule,
|
|
810
971
|
i2.MatFormFieldModule,
|
|
811
|
-
|
|
972
|
+
i5$1.MatIconModule,
|
|
812
973
|
i5.MatInputModule,
|
|
813
|
-
|
|
974
|
+
i7.MatMenuModule,
|
|
814
975
|
toolbar.MatToolbarModule,
|
|
815
|
-
|
|
816
|
-
i4.ReactiveFormsModule
|
|
976
|
+
i10.MatTooltipModule,
|
|
977
|
+
i4.ReactiveFormsModule,
|
|
978
|
+
i11.NaturalFileModule,
|
|
979
|
+
i8.MatDividerModule], exports: [i6.CommonModule,
|
|
817
980
|
i3.MatButtonModule,
|
|
818
|
-
|
|
981
|
+
i6$1.MatButtonToggleModule,
|
|
819
982
|
i1.MatDialogModule,
|
|
820
983
|
i2.MatFormFieldModule,
|
|
821
|
-
|
|
984
|
+
i5$1.MatIconModule,
|
|
822
985
|
i5.MatInputModule,
|
|
823
|
-
|
|
986
|
+
i7.MatMenuModule,
|
|
824
987
|
toolbar.MatToolbarModule,
|
|
825
|
-
|
|
826
|
-
i4.ReactiveFormsModule,
|
|
988
|
+
i10.MatTooltipModule,
|
|
989
|
+
i4.ReactiveFormsModule,
|
|
990
|
+
i11.NaturalFileModule,
|
|
991
|
+
i8.MatDividerModule, NaturalEditorComponent] });
|
|
827
992
|
NaturalEditorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: NaturalEditorModule, imports: [__spreadArray([], __read(imports)), i6.CommonModule,
|
|
828
993
|
i3.MatButtonModule,
|
|
829
|
-
|
|
994
|
+
i6$1.MatButtonToggleModule,
|
|
830
995
|
i1.MatDialogModule,
|
|
831
996
|
i2.MatFormFieldModule,
|
|
832
|
-
|
|
997
|
+
i5$1.MatIconModule,
|
|
833
998
|
i5.MatInputModule,
|
|
834
|
-
|
|
999
|
+
i7.MatMenuModule,
|
|
835
1000
|
toolbar.MatToolbarModule,
|
|
836
|
-
|
|
837
|
-
i4.ReactiveFormsModule
|
|
1001
|
+
i10.MatTooltipModule,
|
|
1002
|
+
i4.ReactiveFormsModule,
|
|
1003
|
+
i11.NaturalFileModule,
|
|
1004
|
+
i8.MatDividerModule] });
|
|
838
1005
|
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: NaturalEditorModule, decorators: [{
|
|
839
1006
|
type: i0.NgModule,
|
|
840
1007
|
args: [{
|