@ecodev/natural-editor 1.1.0 → 41.1.3

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/README.md CHANGED
@@ -1,42 +1,18 @@
1
- # Natural
1
+ # Natural Editor
2
2
 
3
3
  [![Build Status](https://github.com/Ecodev/natural/workflows/main/badge.svg)](https://github.com/Ecodev/natural/actions)
4
- [![Total Downloads](https://img.shields.io/npm/dt/@ecodev/natural.svg)](https://www.npmjs.com/package/@ecodev/natural)
5
- [![Latest Stable Version](https://img.shields.io/npm/v/@ecodev/natural.svg)](https://www.npmjs.com/package/@ecodev/natural)
6
- [![License](https://img.shields.io/npm/l/@ecodev/natural.svg)](https://www.npmjs.com/package/@ecodev/natural)
7
- [![Join the chat at https://gitter.im/Ecodev/natural](https://badges.gitter.im/Ecodev/natural.svg)](https://gitter.im/Ecodev/natural)
4
+ [![Total Downloads](https://img.shields.io/npm/dt/@ecodev/natural-editor.svg)](https://www.npmjs.com/package/@ecodev/natural-editor)
5
+ [![Latest Stable Version](https://img.shields.io/npm/v/@ecodev/natural-editor.svg)](https://www.npmjs.com/package/@ecodev/natural-editor)
6
+ [![License](https://img.shields.io/npm/l/@ecodev/natural-editor.svg)](https://www.npmjs.com/package/@ecodev/natural-editor)
8
7
 
9
- This project is a collection of Angular Material components and various utilities classes for Angular projects.
8
+ Prosemirror editor for Angular projects.
10
9
 
11
10
  ## Install
12
11
 
13
12
  ```bash
14
- yarn add @ecodev/natural
13
+ yarn add @ecodev/natural-editor
15
14
  ```
16
15
 
17
16
  ## Development
18
17
 
19
- The most useful commands for development are:
20
-
21
- - `yarn dev` to start a development server
22
- - `yarn build-demo` to build the docs locally (it will be published automatically by GitHub Actions)
23
- - `git tag -am 1.2.3 1.2.3 && git push` to publish the lib to npm (via GitHub Actions `release` job)
24
-
25
- ### i18n
26
-
27
- This library is ready to be translated, but it does not ship translations. It is up to the consuming
28
- application to extract and translate strings.
29
-
30
- ## Components
31
-
32
- ### Natural Search
33
-
34
- This is an Angular component to search for things via configurable facets. Facets may be
35
- configured to use one of the built-in component, or a custom component to input values.
36
-
37
- See the component in action on [the demo page](https://ecodev.github.io/natural).
38
-
39
- #### Prior work
40
-
41
- While the implementation is entirely different, [VisualSearch.js
42
- ](https://github.com/documentcloud/visualsearch/) was an important inspiration.
18
+ See [main README](../../README.md).
@@ -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-schema-basic'), require('prosemirror-schema-list'), require('@angular/common'), require('prosemirror-menu'), require('prosemirror-commands'), require('@angular/material/dialog'), require('@angular/forms'), require('@angular/material/form-field'), require('@angular/material/button'), require('@angular/material/input'), require('@angular/material/toolbar'), require('@angular/material/button-toggle'), require('@angular/material/icon'), require('@angular/material/menu'), require('@angular/material/tooltip')) :
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-schema-basic', 'prosemirror-schema-list', '@angular/common', 'prosemirror-menu', 'prosemirror-commands', '@angular/material/dialog', '@angular/forms', '@angular/material/form-field', '@angular/material/button', '@angular/material/input', '@angular/material/toolbar', '@angular/material/button-toggle', '@angular/material/icon', '@angular/material/menu', '@angular/material/tooltip'], 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["prosemirror-schema-basic"], global["prosemirror-schema-list"], global.ng.common, global["prosemirror-menu"], global["prosemirror-commands"], global.ng.material.dialog, global.ng.forms, global.ng.material.formField, global.ng.material.button, global.ng.material.input, global.ng.material.toolbar, global.ng.material.buttonToggle, global.ng.material.icon, global.ng.material.menu, global.ng.material.tooltip));
5
- })(this, (function (exports, init, i0, prosemirrorView, prosemirrorState, prosemirrorExampleSetup, prosemirrorModel, prosemirrorSchemaBasic, prosemirrorSchemaList, i6, prosemirrorMenu, prosemirrorCommands, i1, i4, i2, i3, i5, i3$1, i4$1, i5$1, i7, i9) { 'use strict';
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,14 +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 i3__namespace$1 = /*#__PURE__*/_interopNamespace(i3$1);
33
- var i4__namespace$1 = /*#__PURE__*/_interopNamespace(i4$1);
34
33
  var i5__namespace$1 = /*#__PURE__*/_interopNamespace(i5$1);
34
+ var i6__namespace$1 = /*#__PURE__*/_interopNamespace(i6$1);
35
35
  var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
36
- var i9__namespace = /*#__PURE__*/_interopNamespace(i9);
36
+ var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
37
+ var i10__namespace = /*#__PURE__*/_interopNamespace(i10);
37
38
 
38
39
  /*! *****************************************************************************
39
40
  Copyright (c) Microsoft Corporation.
@@ -353,22 +354,126 @@
353
354
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
354
355
  }
355
356
 
356
- var myNodes = {
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 = {
357
438
  heading: prosemirrorSchemaBasic.nodes.heading,
358
439
  doc: prosemirrorSchemaBasic.nodes.doc,
359
440
  paragraph: prosemirrorSchemaBasic.nodes.paragraph,
360
441
  text: prosemirrorSchemaBasic.nodes.text,
361
442
  hard_break: prosemirrorSchemaBasic.nodes.hard_break,
362
443
  };
363
- var myMarks = {
444
+ var basicMarks = {
364
445
  link: prosemirrorSchemaBasic.marks.link,
365
446
  em: prosemirrorSchemaBasic.marks.em,
366
447
  strong: prosemirrorSchemaBasic.marks.strong,
367
448
  };
368
- var basicSchema = new prosemirrorModel.Schema({ nodes: myNodes, marks: myMarks });
369
- var schema = new prosemirrorModel.Schema({
370
- nodes: prosemirrorSchemaList.addListNodes(basicSchema.spec.nodes, 'paragraph block*', 'block'),
371
- marks: basicSchema.spec.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,
372
477
  });
373
478
 
374
479
  var LinkDialogComponent = /** @class */ (function () {
@@ -383,9 +488,8 @@
383
488
  this.form.setValue(data);
384
489
  }
385
490
  LinkDialogComponent.prototype.maybeConfirm = function () {
386
- if (this.form.valid) {
387
- this.confirm();
388
- }
491
+ var _this = this;
492
+ i11.ifValid(this.form).subscribe(function () { return _this.confirm(); });
389
493
  };
390
494
  LinkDialogComponent.prototype.confirm = function () {
391
495
  this.dialogRef.close(this.form.value);
@@ -407,6 +511,42 @@
407
511
  }] }, { type: i1__namespace.MatDialogRef }];
408
512
  } });
409
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
+
410
550
  /**
411
551
  * One item of the menu.
412
552
  *
@@ -462,35 +602,6 @@
462
602
  }
463
603
  return false;
464
604
  }
465
- // function insertImageItem(nodeType: NodeType) {
466
- // return new MenuItem({
467
- // enable(state): boolean {
468
- // return canInsert(state, nodeType);
469
- // },
470
- // run(state, _, view) {
471
- // let {from, to} = state.selection,
472
- // attrs = null;
473
- // if (state.selection instanceof NodeSelection && state.selection.node.type == nodeType) {
474
- // attrs = state.selection.node.attrs;
475
- // }
476
- // openPrompt({
477
- // title: 'Insert image',
478
- // fields: {
479
- // src: new TextField({label: 'Location', required: true, value: attrs && attrs.src}),
480
- // title: new TextField({label: 'Title', value: attrs && attrs.title}),
481
- // alt: new TextField({
482
- // label: 'Description',
483
- // value: attrs ? attrs.alt : state.doc.textBetween(from, to, ' '),
484
- // }),
485
- // },
486
- // callback(attrs) {
487
- // view.dispatch(view.state.tr.replaceSelectionWith(nodeType.createAndFill(attrs)));
488
- // view.focus();
489
- // },
490
- // });
491
- // },
492
- // });
493
- // }
494
605
  function cmdItem(cmd, options, useEnable) {
495
606
  if (options === void 0) { options = {}; }
496
607
  if (useEnable === void 0) { useEnable = false; }
@@ -538,10 +649,12 @@
538
649
  })
539
650
  .afterClosed()
540
651
  .subscribe(function (result) {
541
- if (result && !result.title) {
542
- delete result.title;
652
+ if (result) {
653
+ if (!result.title) {
654
+ delete result.title;
655
+ }
656
+ prosemirrorCommands.toggleMark(markType, result)(view.state, view.dispatch);
543
657
  }
544
- prosemirrorCommands.toggleMark(markType, result)(view.state, view.dispatch);
545
658
  view.focus();
546
659
  });
547
660
  },
@@ -579,10 +692,6 @@
579
692
  if (type) {
580
693
  r.toggleLink = linkItem(type, dialog);
581
694
  }
582
- type = schema.nodes.image;
583
- if (type) {
584
- // r.insertImage = insertImageItem(type);
585
- }
586
695
  type = schema.nodes.bullet_list;
587
696
  if (type) {
588
697
  r.wrapBulletList = wrapListItem(type);
@@ -624,6 +733,22 @@
624
733
  },
625
734
  });
626
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
+ }
627
752
  return r;
628
753
  }
629
754
 
@@ -638,25 +763,39 @@
638
763
  */
639
764
  // @dynamic
640
765
  var NaturalEditorComponent = /** @class */ (function () {
641
- function NaturalEditorComponent(ngControl, document, dialog) {
766
+ function NaturalEditorComponent(ngControl, document, dialog, imagePlugin) {
642
767
  this.ngControl = ngControl;
643
768
  this.document = document;
644
769
  this.dialog = dialog;
770
+ this.imagePlugin = imagePlugin;
645
771
  this.view = null;
646
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;
647
781
  /**
648
782
  * HTML string
649
783
  */
650
784
  this.content = '';
651
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();
652
790
  if (this.ngControl !== null) {
653
791
  this.ngControl.valueAccessor = this;
654
792
  }
655
793
  }
656
794
  NaturalEditorComponent.prototype.ngOnInit = function () {
657
795
  var _this = this;
658
- this.menu = buildMenuItems(schema, this.dialog);
659
- var serializer = prosemirrorModel.DOMSerializer.fromSchema(schema);
796
+ this.schema = this.imageUploader ? advancedSchema : basicSchema;
797
+ this.menu = buildMenuItems(this.schema, this.dialog);
798
+ var serializer = prosemirrorModel.DOMSerializer.fromSchema(this.schema);
660
799
  var state = this.createState();
661
800
  this.view = new prosemirrorView.EditorView(this.editor.nativeElement, {
662
801
  state: state,
@@ -693,21 +832,28 @@
693
832
  }
694
833
  };
695
834
  NaturalEditorComponent.prototype.createState = function () {
835
+ var _this = this;
696
836
  var template = this.document.createElement('_');
697
837
  template.innerHTML = '<div>' + this.content + '</div>';
698
838
  if (!template.firstChild) {
699
839
  throw new Error('child of template element could not be created');
700
840
  }
701
- var parser = prosemirrorModel.DOMParser.fromSchema(schema);
841
+ var parser = prosemirrorModel.DOMParser.fromSchema(this.schema);
702
842
  var doc = parser.parse(template.firstChild);
703
- var self = this;
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
+ }
704
854
  return prosemirrorState.EditorState.create({
705
855
  doc: doc,
706
- plugins: __spreadArray(__spreadArray([], __read(prosemirrorExampleSetup.exampleSetup({ schema: schema, menuBar: false }))), [
707
- new prosemirrorState.Plugin({
708
- view: function () { return self; },
709
- }),
710
- ]),
856
+ plugins: plugins,
711
857
  });
712
858
  };
713
859
  /**
@@ -756,16 +902,26 @@
756
902
  item.spec.run(this.view.state, this.view.dispatch, this.view, event);
757
903
  this.view.focus();
758
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
+ };
759
914
  return NaturalEditorComponent;
760
915
  }());
761
- 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 });
762
- 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: "<mat-toolbar *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</mat-toolbar>\n<div #editor></div>\n", styles: ["::ng-deep .ProseMirror{position:relative;background:rgba(0,0,0,.1)}::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 #editor,::ng-deep .editor{background:white;color:#000;background-clip:padding-box;border-radius:4px;border:2px solid rgba(0,0,0,.2);padding:5px 0;margin-bottom:23px}::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.MatToolbar, selector: "mat-toolbar", inputs: ["color"], exportAs: ["matToolbar"] }, { type: i4__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: i5__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: i7__namespace.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { type: i7__namespace.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }], directives: [{ type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i4__namespace$1.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { type: i9__namespace.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i7__namespace.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"] }] });
763
918
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: NaturalEditorComponent, decorators: [{
764
919
  type: i0.Component,
765
920
  args: [{
766
921
  selector: 'natural-editor',
767
922
  templateUrl: './editor.component.html',
768
923
  styleUrls: ['./editor.component.scss'],
924
+ providers: [ImagePlugin],
769
925
  }]
770
926
  }], ctorParameters: function () {
771
927
  return [{ type: i4__namespace.NgControl, decorators: [{
@@ -775,26 +931,32 @@
775
931
  }] }, { type: Document, decorators: [{
776
932
  type: i0.Inject,
777
933
  args: [i6.DOCUMENT]
778
- }] }, { type: i1__namespace.MatDialog }];
934
+ }] }, { type: i1__namespace.MatDialog }, { type: ImagePlugin }];
779
935
  }, propDecorators: { editor: [{
780
936
  type: i0.ViewChild,
781
937
  args: ['editor', { read: i0.ElementRef, static: true }]
782
938
  }], contentChange: [{
783
939
  type: i0.Output
940
+ }], imageUploader: [{
941
+ type: i0.Input
942
+ }], save: [{
943
+ type: i0.Output
784
944
  }] } });
785
945
 
786
946
  var imports = [
787
947
  i6.CommonModule,
788
948
  i3.MatButtonModule,
789
- i4$1.MatButtonToggleModule,
949
+ i6$1.MatButtonToggleModule,
790
950
  i1.MatDialogModule,
791
951
  i2.MatFormFieldModule,
792
952
  i5$1.MatIconModule,
793
953
  i5.MatInputModule,
794
954
  i7.MatMenuModule,
795
- i3$1.MatToolbarModule,
796
- i9.MatTooltipModule,
955
+ toolbar.MatToolbarModule,
956
+ i10.MatTooltipModule,
797
957
  i4.ReactiveFormsModule,
958
+ i11.NaturalFileModule,
959
+ i8.MatDividerModule,
798
960
  ];
799
961
  var NaturalEditorModule = /** @class */ (function () {
800
962
  function NaturalEditorModule() {
@@ -804,36 +966,42 @@
804
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 });
805
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,
806
968
  i3.MatButtonModule,
807
- i4$1.MatButtonToggleModule,
969
+ i6$1.MatButtonToggleModule,
808
970
  i1.MatDialogModule,
809
971
  i2.MatFormFieldModule,
810
972
  i5$1.MatIconModule,
811
973
  i5.MatInputModule,
812
974
  i7.MatMenuModule,
813
- i3$1.MatToolbarModule,
814
- i9.MatTooltipModule,
815
- i4.ReactiveFormsModule], exports: [i6.CommonModule,
975
+ toolbar.MatToolbarModule,
976
+ i10.MatTooltipModule,
977
+ i4.ReactiveFormsModule,
978
+ i11.NaturalFileModule,
979
+ i8.MatDividerModule], exports: [i6.CommonModule,
816
980
  i3.MatButtonModule,
817
- i4$1.MatButtonToggleModule,
981
+ i6$1.MatButtonToggleModule,
818
982
  i1.MatDialogModule,
819
983
  i2.MatFormFieldModule,
820
984
  i5$1.MatIconModule,
821
985
  i5.MatInputModule,
822
986
  i7.MatMenuModule,
823
- i3$1.MatToolbarModule,
824
- i9.MatTooltipModule,
825
- i4.ReactiveFormsModule, NaturalEditorComponent] });
987
+ toolbar.MatToolbarModule,
988
+ i10.MatTooltipModule,
989
+ i4.ReactiveFormsModule,
990
+ i11.NaturalFileModule,
991
+ i8.MatDividerModule, NaturalEditorComponent] });
826
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,
827
993
  i3.MatButtonModule,
828
- i4$1.MatButtonToggleModule,
994
+ i6$1.MatButtonToggleModule,
829
995
  i1.MatDialogModule,
830
996
  i2.MatFormFieldModule,
831
997
  i5$1.MatIconModule,
832
998
  i5.MatInputModule,
833
999
  i7.MatMenuModule,
834
- i3$1.MatToolbarModule,
835
- i9.MatTooltipModule,
836
- i4.ReactiveFormsModule] });
1000
+ toolbar.MatToolbarModule,
1001
+ i10.MatTooltipModule,
1002
+ i4.ReactiveFormsModule,
1003
+ i11.NaturalFileModule,
1004
+ i8.MatDividerModule] });
837
1005
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: NaturalEditorModule, decorators: [{
838
1006
  type: i0.NgModule,
839
1007
  args: [{