@ecodev/natural-editor 41.3.0 → 42.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.
Files changed (66) hide show
  1. package/{esm2015/ecodev-natural-editor.js → esm2020/ecodev-natural-editor.mjs} +0 -0
  2. package/esm2020/lib/class-dialog/class-dialog.component.mjs +37 -0
  3. package/esm2020/lib/color-dialog/color-dialog.component.mjs +184 -0
  4. package/esm2020/lib/custom-css/custom-css.directive.mjs +71 -0
  5. package/esm2020/lib/editor/editor.component.mjs +213 -0
  6. package/esm2020/lib/editor.module.mjs +90 -0
  7. package/{esm2015/lib/link-dialog/link-dialog.component.js → esm2020/lib/link-dialog/link-dialog.component.mjs} +5 -8
  8. package/esm2020/lib/utils/image.mjs +81 -0
  9. package/{esm2015/lib/utils/inputrules.js → esm2020/lib/utils/inputrules.mjs} +0 -0
  10. package/esm2020/lib/utils/items/cell-background-color-item.mjs +55 -0
  11. package/esm2020/lib/utils/items/class-item.mjs +86 -0
  12. package/esm2020/lib/utils/items/horizontal-rule-item.mjs +24 -0
  13. package/esm2020/lib/utils/items/item.mjs +39 -0
  14. package/esm2020/lib/utils/items/link-item.mjs +40 -0
  15. package/esm2020/lib/utils/items/table-item.mjs +43 -0
  16. package/esm2020/lib/utils/items/text-align-item.mjs +78 -0
  17. package/esm2020/lib/utils/items/utils.mjs +41 -0
  18. package/esm2020/lib/utils/items/wrap-list-item.mjs +6 -0
  19. package/esm2020/lib/utils/keymap.mjs +115 -0
  20. package/esm2020/lib/utils/menu.mjs +101 -0
  21. package/esm2020/lib/utils/schema/paragraph-with-alignment.mjs +50 -0
  22. package/esm2020/lib/utils/schema/schema.mjs +51 -0
  23. package/esm2020/lib/utils/schema/table.mjs +113 -0
  24. package/esm2020/public-api.mjs +9 -0
  25. package/fesm2015/ecodev-natural-editor.mjs +1548 -0
  26. package/fesm2015/ecodev-natural-editor.mjs.map +1 -0
  27. package/fesm2020/ecodev-natural-editor.mjs +1546 -0
  28. package/fesm2020/ecodev-natural-editor.mjs.map +1 -0
  29. package/lib/class-dialog/class-dialog.component.d.ts +24 -0
  30. package/lib/color-dialog/color-dialog.component.d.ts +26 -0
  31. package/lib/custom-css/custom-css.directive.d.ts +29 -0
  32. package/lib/editor.module.d.ts +19 -16
  33. package/lib/utils/items/cell-background-color-item.d.ts +5 -0
  34. package/lib/utils/items/class-item.d.ts +6 -0
  35. package/lib/utils/items/horizontal-rule-item.d.ts +5 -0
  36. package/lib/utils/{item.d.ts → items/item.d.ts} +0 -0
  37. package/lib/utils/items/link-item.d.ts +6 -0
  38. package/lib/utils/items/table-item.d.ts +4 -0
  39. package/lib/utils/{text-align-item.d.ts → items/text-align-item.d.ts} +0 -0
  40. package/lib/utils/items/utils.d.ts +18 -0
  41. package/lib/utils/items/wrap-list-item.d.ts +3 -0
  42. package/lib/utils/menu.d.ts +2 -2
  43. package/lib/utils/schema/paragraph-with-alignment.d.ts +8 -0
  44. package/lib/utils/{schema.d.ts → schema/schema.d.ts} +0 -0
  45. package/lib/utils/schema/table.d.ts +9 -0
  46. package/package.json +22 -8
  47. package/public-api.d.ts +1 -0
  48. package/src/lib/editor/_editor.theme.scss +1 -1
  49. package/theming/_natural-editor.theme.scss +1 -1
  50. package/bundles/ecodev-natural-editor.umd.js +0 -1351
  51. package/bundles/ecodev-natural-editor.umd.js.map +0 -1
  52. package/esm2015/lib/editor/editor.component.js +0 -219
  53. package/esm2015/lib/editor.module.js +0 -82
  54. package/esm2015/lib/utils/image.js +0 -81
  55. package/esm2015/lib/utils/item.js +0 -39
  56. package/esm2015/lib/utils/keymap.js +0 -115
  57. package/esm2015/lib/utils/menu.js +0 -178
  58. package/esm2015/lib/utils/paragraph-with-alignment.js +0 -43
  59. package/esm2015/lib/utils/schema.js +0 -47
  60. package/esm2015/lib/utils/table.js +0 -37
  61. package/esm2015/lib/utils/text-align-item.js +0 -78
  62. package/esm2015/public-api.js +0 -8
  63. package/fesm2015/ecodev-natural-editor.js +0 -997
  64. package/fesm2015/ecodev-natural-editor.js.map +0 -1
  65. package/lib/utils/paragraph-with-alignment.d.ts +0 -2
  66. package/lib/utils/table.d.ts +0 -8
@@ -1,1351 +0,0 @@
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-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('prosemirror-history'), require('prosemirror-dropcursor'), require('prosemirror-gapcursor'), require('prosemirror-inputrules'), 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-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', 'prosemirror-history', 'prosemirror-dropcursor', 'prosemirror-gapcursor', 'prosemirror-inputrules', '@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-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.prosemirrorHistory, global.prosemirrorDropcursor, global.prosemirrorGapcursor, global.prosemirrorInputrules, 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, prosemirrorModel, i6, prosemirrorTables, prosemirrorKeymap, prosemirrorSchemaBasic, prosemirrorSchemaList, prosemirrorMenu, prosemirrorCommands, i1, i4, i11, i2, i3, i5, prosemirrorHistory, prosemirrorDropcursor, prosemirrorGapcursor, prosemirrorInputrules, i5$1, i6$1, i7, i8, i10, toolbar) { 'use strict';
6
-
7
- function _interopNamespace(e) {
8
- if (e && e.__esModule) return e;
9
- var n = Object.create(null);
10
- if (e) {
11
- Object.keys(e).forEach(function (k) {
12
- if (k !== 'default') {
13
- var d = Object.getOwnPropertyDescriptor(e, k);
14
- Object.defineProperty(n, k, d.get ? d : {
15
- enumerable: true,
16
- get: function () { return e[k]; }
17
- });
18
- }
19
- });
20
- }
21
- n["default"] = e;
22
- return Object.freeze(n);
23
- }
24
-
25
- var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
26
- var i6__namespace = /*#__PURE__*/_interopNamespace(i6);
27
- var i1__namespace = /*#__PURE__*/_interopNamespace(i1);
28
- var i4__namespace = /*#__PURE__*/_interopNamespace(i4);
29
- var i11__namespace = /*#__PURE__*/_interopNamespace(i11);
30
- var i2__namespace = /*#__PURE__*/_interopNamespace(i2);
31
- var i3__namespace = /*#__PURE__*/_interopNamespace(i3);
32
- var i5__namespace = /*#__PURE__*/_interopNamespace(i5);
33
- var i5__namespace$1 = /*#__PURE__*/_interopNamespace(i5$1);
34
- var i6__namespace$1 = /*#__PURE__*/_interopNamespace(i6$1);
35
- var i7__namespace = /*#__PURE__*/_interopNamespace(i7);
36
- var i8__namespace = /*#__PURE__*/_interopNamespace(i8);
37
- var i10__namespace = /*#__PURE__*/_interopNamespace(i10);
38
-
39
- /*! *****************************************************************************
40
- Copyright (c) Microsoft Corporation.
41
-
42
- Permission to use, copy, modify, and/or distribute this software for any
43
- purpose with or without fee is hereby granted.
44
-
45
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
46
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
47
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
48
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
49
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
50
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
51
- PERFORMANCE OF THIS SOFTWARE.
52
- ***************************************************************************** */
53
- /* global Reflect, Promise */
54
- var extendStatics = function (d, b) {
55
- extendStatics = Object.setPrototypeOf ||
56
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
57
- function (d, b) { for (var p in b)
58
- if (Object.prototype.hasOwnProperty.call(b, p))
59
- d[p] = b[p]; };
60
- return extendStatics(d, b);
61
- };
62
- function __extends(d, b) {
63
- if (typeof b !== "function" && b !== null)
64
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
65
- extendStatics(d, b);
66
- function __() { this.constructor = d; }
67
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
68
- }
69
- var __assign = function () {
70
- __assign = Object.assign || function __assign(t) {
71
- for (var s, i = 1, n = arguments.length; i < n; i++) {
72
- s = arguments[i];
73
- for (var p in s)
74
- if (Object.prototype.hasOwnProperty.call(s, p))
75
- t[p] = s[p];
76
- }
77
- return t;
78
- };
79
- return __assign.apply(this, arguments);
80
- };
81
- function __rest(s, e) {
82
- var t = {};
83
- for (var p in s)
84
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
85
- t[p] = s[p];
86
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
87
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
88
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
89
- t[p[i]] = s[p[i]];
90
- }
91
- return t;
92
- }
93
- function __decorate(decorators, target, key, desc) {
94
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
95
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
96
- r = Reflect.decorate(decorators, target, key, desc);
97
- else
98
- for (var i = decorators.length - 1; i >= 0; i--)
99
- if (d = decorators[i])
100
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
101
- return c > 3 && r && Object.defineProperty(target, key, r), r;
102
- }
103
- function __param(paramIndex, decorator) {
104
- return function (target, key) { decorator(target, key, paramIndex); };
105
- }
106
- function __metadata(metadataKey, metadataValue) {
107
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
108
- return Reflect.metadata(metadataKey, metadataValue);
109
- }
110
- function __awaiter(thisArg, _arguments, P, generator) {
111
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
112
- return new (P || (P = Promise))(function (resolve, reject) {
113
- function fulfilled(value) { try {
114
- step(generator.next(value));
115
- }
116
- catch (e) {
117
- reject(e);
118
- } }
119
- function rejected(value) { try {
120
- step(generator["throw"](value));
121
- }
122
- catch (e) {
123
- reject(e);
124
- } }
125
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
126
- step((generator = generator.apply(thisArg, _arguments || [])).next());
127
- });
128
- }
129
- function __generator(thisArg, body) {
130
- var _ = { label: 0, sent: function () { if (t[0] & 1)
131
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
132
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
133
- function verb(n) { return function (v) { return step([n, v]); }; }
134
- function step(op) {
135
- if (f)
136
- throw new TypeError("Generator is already executing.");
137
- while (_)
138
- try {
139
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)
140
- return t;
141
- if (y = 0, t)
142
- op = [op[0] & 2, t.value];
143
- switch (op[0]) {
144
- case 0:
145
- case 1:
146
- t = op;
147
- break;
148
- case 4:
149
- _.label++;
150
- return { value: op[1], done: false };
151
- case 5:
152
- _.label++;
153
- y = op[1];
154
- op = [0];
155
- continue;
156
- case 7:
157
- op = _.ops.pop();
158
- _.trys.pop();
159
- continue;
160
- default:
161
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
162
- _ = 0;
163
- continue;
164
- }
165
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
166
- _.label = op[1];
167
- break;
168
- }
169
- if (op[0] === 6 && _.label < t[1]) {
170
- _.label = t[1];
171
- t = op;
172
- break;
173
- }
174
- if (t && _.label < t[2]) {
175
- _.label = t[2];
176
- _.ops.push(op);
177
- break;
178
- }
179
- if (t[2])
180
- _.ops.pop();
181
- _.trys.pop();
182
- continue;
183
- }
184
- op = body.call(thisArg, _);
185
- }
186
- catch (e) {
187
- op = [6, e];
188
- y = 0;
189
- }
190
- finally {
191
- f = t = 0;
192
- }
193
- if (op[0] & 5)
194
- throw op[1];
195
- return { value: op[0] ? op[1] : void 0, done: true };
196
- }
197
- }
198
- var __createBinding = Object.create ? (function (o, m, k, k2) {
199
- if (k2 === undefined)
200
- k2 = k;
201
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
202
- }) : (function (o, m, k, k2) {
203
- if (k2 === undefined)
204
- k2 = k;
205
- o[k2] = m[k];
206
- });
207
- function __exportStar(m, o) {
208
- for (var p in m)
209
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
210
- __createBinding(o, m, p);
211
- }
212
- function __values(o) {
213
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
214
- if (m)
215
- return m.call(o);
216
- if (o && typeof o.length === "number")
217
- return {
218
- next: function () {
219
- if (o && i >= o.length)
220
- o = void 0;
221
- return { value: o && o[i++], done: !o };
222
- }
223
- };
224
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
225
- }
226
- function __read(o, n) {
227
- var m = typeof Symbol === "function" && o[Symbol.iterator];
228
- if (!m)
229
- return o;
230
- var i = m.call(o), r, ar = [], e;
231
- try {
232
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
233
- ar.push(r.value);
234
- }
235
- catch (error) {
236
- e = { error: error };
237
- }
238
- finally {
239
- try {
240
- if (r && !r.done && (m = i["return"]))
241
- m.call(i);
242
- }
243
- finally {
244
- if (e)
245
- throw e.error;
246
- }
247
- }
248
- return ar;
249
- }
250
- /** @deprecated */
251
- function __spread() {
252
- for (var ar = [], i = 0; i < arguments.length; i++)
253
- ar = ar.concat(__read(arguments[i]));
254
- return ar;
255
- }
256
- /** @deprecated */
257
- function __spreadArrays() {
258
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
259
- s += arguments[i].length;
260
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
261
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
262
- r[k] = a[j];
263
- return r;
264
- }
265
- function __spreadArray(to, from, pack) {
266
- if (pack || arguments.length === 2)
267
- for (var i = 0, l = from.length, ar; i < l; i++) {
268
- if (ar || !(i in from)) {
269
- if (!ar)
270
- ar = Array.prototype.slice.call(from, 0, i);
271
- ar[i] = from[i];
272
- }
273
- }
274
- return to.concat(ar || Array.prototype.slice.call(from));
275
- }
276
- function __await(v) {
277
- return this instanceof __await ? (this.v = v, this) : new __await(v);
278
- }
279
- function __asyncGenerator(thisArg, _arguments, generator) {
280
- if (!Symbol.asyncIterator)
281
- throw new TypeError("Symbol.asyncIterator is not defined.");
282
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
283
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
284
- function verb(n) { if (g[n])
285
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
286
- function resume(n, v) { try {
287
- step(g[n](v));
288
- }
289
- catch (e) {
290
- settle(q[0][3], e);
291
- } }
292
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
293
- function fulfill(value) { resume("next", value); }
294
- function reject(value) { resume("throw", value); }
295
- function settle(f, v) { if (f(v), q.shift(), q.length)
296
- resume(q[0][0], q[0][1]); }
297
- }
298
- function __asyncDelegator(o) {
299
- var i, p;
300
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
301
- function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
302
- }
303
- function __asyncValues(o) {
304
- if (!Symbol.asyncIterator)
305
- throw new TypeError("Symbol.asyncIterator is not defined.");
306
- var m = o[Symbol.asyncIterator], i;
307
- return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
308
- function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
309
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
310
- }
311
- function __makeTemplateObject(cooked, raw) {
312
- if (Object.defineProperty) {
313
- Object.defineProperty(cooked, "raw", { value: raw });
314
- }
315
- else {
316
- cooked.raw = raw;
317
- }
318
- return cooked;
319
- }
320
- ;
321
- var __setModuleDefault = Object.create ? (function (o, v) {
322
- Object.defineProperty(o, "default", { enumerable: true, value: v });
323
- }) : function (o, v) {
324
- o["default"] = v;
325
- };
326
- function __importStar(mod) {
327
- if (mod && mod.__esModule)
328
- return mod;
329
- var result = {};
330
- if (mod != null)
331
- for (var k in mod)
332
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
333
- __createBinding(result, mod, k);
334
- __setModuleDefault(result, mod);
335
- return result;
336
- }
337
- function __importDefault(mod) {
338
- return (mod && mod.__esModule) ? mod : { default: mod };
339
- }
340
- function __classPrivateFieldGet(receiver, state, kind, f) {
341
- if (kind === "a" && !f)
342
- throw new TypeError("Private accessor was defined without a getter");
343
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
344
- throw new TypeError("Cannot read private member from an object whose class did not declare it");
345
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
346
- }
347
- function __classPrivateFieldSet(receiver, state, value, kind, f) {
348
- if (kind === "m")
349
- throw new TypeError("Private method is not writable");
350
- if (kind === "a" && !f)
351
- throw new TypeError("Private accessor was defined without a setter");
352
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
353
- throw new TypeError("Cannot write private member to an object whose class did not declare it");
354
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
355
- }
356
-
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 ALIGN_PATTERN = /(left|right|center|justify)/;
438
- // https://github.com/ProseMirror/prosemirror-schema-basic/blob/master/src/schema-basic.js
439
- // :: NodeSpec A plain paragraph textblock. Represented in the DOM
440
- // as a `<p>` element.
441
- var paragraphWithAlignment = {
442
- attrs: {
443
- align: { default: null },
444
- id: { default: null },
445
- },
446
- content: 'inline*',
447
- group: 'block',
448
- parseDOM: [
449
- {
450
- tag: 'p',
451
- getAttrs: function (dom) {
452
- if (!(dom instanceof HTMLElement)) {
453
- return;
454
- }
455
- var textAlign = dom.style.textAlign;
456
- var align = dom.getAttribute('align') || textAlign || '';
457
- align = ALIGN_PATTERN.test(align) ? align : null;
458
- var id = dom.getAttribute('id') || '';
459
- return { align: align, id: id };
460
- },
461
- },
462
- ],
463
- toDOM: function (node) {
464
- var _a = node.attrs, align = _a.align, id = _a.id;
465
- var attrs = {};
466
- var style = '';
467
- if (align && align !== 'left') {
468
- style += "text-align: " + align + ";";
469
- }
470
- if (style) {
471
- attrs.style = style;
472
- }
473
- if (id) {
474
- attrs.id = id;
475
- }
476
- return ['p', attrs, 0];
477
- },
478
- };
479
-
480
- var basicNodes = {
481
- heading: prosemirrorSchemaBasic.nodes.heading,
482
- doc: prosemirrorSchemaBasic.nodes.doc,
483
- paragraph: prosemirrorSchemaBasic.nodes.paragraph,
484
- text: prosemirrorSchemaBasic.nodes.text,
485
- hard_break: prosemirrorSchemaBasic.nodes.hard_break,
486
- };
487
- var basicMarks = {
488
- link: prosemirrorSchemaBasic.marks.link,
489
- em: prosemirrorSchemaBasic.marks.em,
490
- strong: prosemirrorSchemaBasic.marks.strong,
491
- };
492
- var tmpSchema = new prosemirrorModel.Schema({ nodes: basicNodes, marks: basicMarks });
493
- var basicSchema = new prosemirrorModel.Schema({
494
- nodes: prosemirrorSchemaList.addListNodes(tmpSchema.spec.nodes, 'paragraph block*', 'block'),
495
- marks: tmpSchema.spec.marks,
496
- });
497
- var tmpSchema2 = new prosemirrorModel.Schema({
498
- nodes: Object.assign(Object.assign(Object.assign({}, prosemirrorSchemaBasic.nodes), prosemirrorTables.tableNodes({
499
- tableGroup: 'block',
500
- cellContent: 'block+',
501
- cellAttributes: {
502
- background: {
503
- default: null,
504
- getFromDOM: function (dom) {
505
- return dom.style.backgroundColor || null;
506
- },
507
- setDOMAttr: function (value, attrs) {
508
- if (value) {
509
- attrs.style = (attrs.style || '') + ("background-color: " + value + ";");
510
- }
511
- },
512
- },
513
- },
514
- })), { paragraph: paragraphWithAlignment }),
515
- marks: basicMarks,
516
- });
517
- var advancedSchema = new prosemirrorModel.Schema({
518
- nodes: prosemirrorSchemaList.addListNodes(tmpSchema2.spec.nodes, 'paragraph block*', 'block'),
519
- marks: basicMarks,
520
- });
521
-
522
- var LinkDialogComponent = /** @class */ (function () {
523
- function LinkDialogComponent(data, dialogRef) {
524
- this.dialogRef = dialogRef;
525
- this.hrefControl = new i4.FormControl('', i4.Validators.required);
526
- this.titleControl = new i4.FormControl('');
527
- this.form = new i4.FormGroup({
528
- href: this.hrefControl,
529
- title: this.titleControl,
530
- });
531
- this.form.setValue(data);
532
- }
533
- LinkDialogComponent.prototype.maybeConfirm = function () {
534
- var _this = this;
535
- i11.ifValid(this.form).subscribe(function () { return _this.confirm(); });
536
- };
537
- LinkDialogComponent.prototype.confirm = function () {
538
- this.dialogRef.close(this.form.value);
539
- };
540
- return LinkDialogComponent;
541
- }());
542
- LinkDialogComponent.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: LinkDialogComponent, deps: [{ token: i1.MAT_DIALOG_DATA }, { token: i1__namespace.MatDialogRef }], target: i0__namespace.ɵɵFactoryTarget.Component });
543
- LinkDialogComponent.ɵcmp = i0__namespace.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "12.2.9", type: LinkDialogComponent, selector: "ng-component", ngImport: i0__namespace, template: "<h2 i18n mat-dialog-title>Ins\u00E9rer un lien</h2>\n\n<mat-dialog-content [formGroup]=\"form\">\n <mat-form-field>\n <mat-label i18n>URL</mat-label>\n <input matInput [formControl]=\"hrefControl\" (keydown.enter)=\"maybeConfirm()\" />\n <mat-error *ngIf=\"hrefControl.hasError('required')\" i18n>Ce champ est requis</mat-error>\n </mat-form-field>\n <mat-form-field>\n <mat-label i18n>Titre</mat-label>\n <input matInput [formControl]=\"titleControl\" (keydown.enter)=\"maybeConfirm()\" />\n </mat-form-field>\n</mat-dialog-content>\n\n<mat-dialog-actions>\n <button mat-button [mat-dialog-close] i18n>Annuler</button>\n <button mat-stroked-button (click)=\"maybeConfirm()\" [disabled]=\"!form.valid\"><span i18n>Valider</span></button>\n</mat-dialog-actions>\n", styles: ["mat-dialog-actions{display:flex;flex-direction:row;justify-content:flex-end}mat-dialog-content{width:70vw;max-width:60em;display:grid}\n"], components: [{ type: i2__namespace.MatFormField, selector: "mat-form-field", inputs: ["color", "floatLabel", "appearance", "hideRequiredMarker", "hintLabel"], exportAs: ["matFormField"] }, { 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"] }], directives: [{ type: i1__namespace.MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { type: i1__namespace.MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { type: i4__namespace.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { type: i4__namespace.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { type: i2__namespace.MatLabel, selector: "mat-label" }, { type: i5__namespace.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["id", "disabled", "required", "type", "value", "readonly", "placeholder", "errorStateMatcher", "aria-describedby"], exportAs: ["matInput"] }, { type: i4__namespace.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { type: i4__namespace.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { type: i4__namespace.FormControlDirective, selector: "[formControl]", inputs: ["disabled", "formControl", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { type: i6__namespace.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i2__namespace.MatError, selector: "mat-error", inputs: ["id"] }, { type: i1__namespace.MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]" }, { type: i1__namespace.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["type", "mat-dialog-close", "aria-label", "matDialogClose"], exportAs: ["matDialogClose"] }] });
544
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: LinkDialogComponent, decorators: [{
545
- type: i0.Component,
546
- args: [{
547
- templateUrl: './link-dialog.component.html',
548
- styleUrls: ['./link-dialog.component.scss'],
549
- }]
550
- }], ctorParameters: function () {
551
- return [{ type: undefined, decorators: [{
552
- type: i0.Inject,
553
- args: [i1.MAT_DIALOG_DATA]
554
- }] }, { type: i1__namespace.MatDialogRef }];
555
- } });
556
-
557
- function createCell(cellType, cellContent) {
558
- return cellContent ? cellType.createChecked(null, cellContent) : cellType.createAndFill();
559
- }
560
- function createTable(state, rowsCount, colsCount, withHeaderRow, cellContent) {
561
- var types = prosemirrorTables.tableNodeTypes(state.schema);
562
- var headerCells = [];
563
- var cells = [];
564
- for (var index = 0; index < colsCount; index += 1) {
565
- var cell = createCell(types.cell, cellContent);
566
- if (cell) {
567
- cells.push(cell);
568
- }
569
- if (withHeaderRow) {
570
- var headerCell = createCell(types.header_cell, cellContent);
571
- if (headerCell) {
572
- headerCells.push(headerCell);
573
- }
574
- }
575
- }
576
- var rows = [];
577
- for (var index = 0; index < rowsCount; index += 1) {
578
- rows.push(types.row.createChecked(null, withHeaderRow && index === 0 ? headerCells : cells));
579
- }
580
- return types.table.createChecked(null, rows);
581
- }
582
- function addTable(state, dispatch, _a) {
583
- 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;
584
- var offset = state.tr.selection.anchor + 1;
585
- var nodes = createTable(state, rowsCount, colsCount, withHeaderRow, cellContent);
586
- var tr = state.tr.replaceSelectionWith(nodes).scrollIntoView();
587
- var resolvedPos = tr.doc.resolve(offset);
588
- // move cursor into table
589
- tr.setSelection(prosemirrorState.TextSelection.near(resolvedPos));
590
- dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr);
591
- }
592
-
593
- /**
594
- * One item of the menu.
595
- *
596
- * This is the equivalent of `MenuItem` but without all the rendering logic since we use Angular
597
- * templates for rendering. Also it caches the state of the item everytime the editor state changes,
598
- * so Angular can query the state as often as needed without performance hit.
599
- */
600
- var Item = /** @class */ (function () {
601
- function Item(spec) {
602
- this.spec = spec;
603
- /**
604
- * Whether the item is 'active' (for example, the item for toggling the strong mark might be active when the cursor is in strong text).
605
- */
606
- this.active = false;
607
- /**
608
- * Button is shown but disabled, because the item cannot be (un-)applied
609
- */
610
- this.disabled = false;
611
- /**
612
- * Whether the item is shown at the moment
613
- */
614
- this.show = true;
615
- }
616
- /**
617
- * Update the item state according to the editor state
618
- */
619
- Item.prototype.update = function (view, state) {
620
- if (this.spec.active) {
621
- this.active = this.spec.active(state);
622
- }
623
- if (this.spec.enable) {
624
- this.disabled = !this.spec.enable(state);
625
- }
626
- if (this.spec.select) {
627
- this.show = this.spec.select(state);
628
- }
629
- };
630
- return Item;
631
- }());
632
-
633
- function setTextAlign(tr, schema, alignment) {
634
- console.log('setTextAlign', alignment);
635
- var selection = tr.selection, doc = tr.doc;
636
- if (!selection || !doc) {
637
- return tr;
638
- }
639
- var from = selection.from, to = selection.to;
640
- var nodes = schema.nodes;
641
- var tasks = [];
642
- alignment = alignment || null;
643
- var allowedNodeTypes = new Set([
644
- nodes.paragraph,
645
- // nodes['blockquote'],
646
- // nodes['listItem'],
647
- // nodes['heading'],
648
- ]);
649
- doc.nodesBetween(from, to, function (node, pos) {
650
- var nodeType = node.type;
651
- var align = node.attrs.align || null;
652
- if (align !== alignment && allowedNodeTypes.has(nodeType)) {
653
- tasks.push({
654
- node: node,
655
- pos: pos,
656
- nodeType: nodeType,
657
- });
658
- }
659
- return true;
660
- });
661
- if (!tasks.length) {
662
- return tr;
663
- }
664
- tasks.forEach(function (job) {
665
- var node = job.node, pos = job.pos, nodeType = job.nodeType;
666
- var newAttrs = Object.assign(Object.assign({}, node.attrs), { align: alignment ? alignment : null });
667
- console.log('newAttrs', newAttrs);
668
- tr = tr.setNodeMarkup(pos, nodeType, newAttrs, node.marks);
669
- });
670
- return tr;
671
- }
672
- var TextAlignItem = /** @class */ (function (_super) {
673
- __extends(TextAlignItem, _super);
674
- function TextAlignItem(alignment) {
675
- var _this = _super.call(this, {
676
- active: function (state) {
677
- var selection = state.selection, doc = state.doc;
678
- var from = selection.from, to = selection.to;
679
- var keepLooking = true;
680
- var active = false;
681
- doc.nodesBetween(from, to, function (node) {
682
- if (keepLooking && node.attrs.align === alignment) {
683
- keepLooking = false;
684
- active = true;
685
- }
686
- return keepLooking;
687
- });
688
- return active;
689
- },
690
- enable: function (state) {
691
- var selection = state.selection;
692
- return selection instanceof prosemirrorState.TextSelection || selection instanceof prosemirrorState.AllSelection;
693
- },
694
- run: function (state, dispatch) {
695
- var schema = state.schema, selection = state.selection;
696
- console.log(_this);
697
- var tr = setTextAlign(state.tr.setSelection(selection), schema, _this.active ? null : alignment);
698
- if (tr.docChanged) {
699
- dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr);
700
- return true;
701
- }
702
- else {
703
- return false;
704
- }
705
- },
706
- }) || this;
707
- return _this;
708
- }
709
- return TextAlignItem;
710
- }(Item));
711
-
712
- /**
713
- * Convert built-in `MenuItem` into our Angular specific `Item`
714
- */
715
- function toItem(item) {
716
- return new Item(item.spec);
717
- }
718
- function canInsert(state, nodeType) {
719
- var $from = state.selection.$from;
720
- for (var d = $from.depth; d >= 0; d--) {
721
- var index = $from.index(d);
722
- if ($from.node(d).canReplaceWith(index, index, nodeType)) {
723
- return true;
724
- }
725
- }
726
- return false;
727
- }
728
- function cmdItem(cmd, options, useEnable) {
729
- if (options === void 0) { options = {}; }
730
- if (useEnable === void 0) { useEnable = false; }
731
- var passedOptions = Object.assign({ run: cmd }, options);
732
- if ((!options.enable || useEnable) && !options.select) {
733
- passedOptions[options.enable ? 'enable' : 'select'] = function (state) { return cmd(state); };
734
- }
735
- return new Item(passedOptions);
736
- }
737
- function markActive(state, type) {
738
- var _a = state.selection, from = _a.from, $from = _a.$from, to = _a.to, empty = _a.empty;
739
- if (empty) {
740
- return !!type.isInSet(state.storedMarks || $from.marks());
741
- }
742
- else {
743
- return state.doc.rangeHasMark(from, to, type);
744
- }
745
- }
746
- function markItem(markType, options) {
747
- if (options === void 0) { options = {}; }
748
- var passedOptions = Object.assign({ active: function (state) {
749
- return markActive(state, markType);
750
- } }, options);
751
- return cmdItem(prosemirrorCommands.toggleMark(markType), passedOptions, true);
752
- }
753
- function linkItem(markType, dialog) {
754
- return new Item({
755
- active: function (state) {
756
- return markActive(state, markType);
757
- },
758
- enable: function (state) {
759
- return !state.selection.empty;
760
- },
761
- run: function (state, dispatch, view) {
762
- if (markActive(state, markType)) {
763
- prosemirrorCommands.toggleMark(markType)(state, dispatch);
764
- return true;
765
- }
766
- dialog
767
- .open(LinkDialogComponent, {
768
- data: {
769
- href: '',
770
- title: '',
771
- },
772
- })
773
- .afterClosed()
774
- .subscribe(function (result) {
775
- if (result) {
776
- if (!result.title) {
777
- delete result.title;
778
- }
779
- prosemirrorCommands.toggleMark(markType, result)(view.state, view.dispatch);
780
- }
781
- view.focus();
782
- });
783
- },
784
- });
785
- }
786
- function wrapListItem(nodeType) {
787
- return cmdItem(prosemirrorSchemaList.wrapInList(nodeType));
788
- }
789
- /**
790
- * Given a schema, look for default mark and node types in it and
791
- * return an object with relevant menu items relating to those marks:
792
- */
793
- function buildMenuItems(schema, dialog) {
794
- var r = {
795
- joinUp: toItem(prosemirrorMenu.joinUpItem),
796
- lift: toItem(prosemirrorMenu.liftItem),
797
- selectParentNode: toItem(prosemirrorMenu.selectParentNodeItem),
798
- undo: toItem(prosemirrorMenu.undoItem),
799
- redo: toItem(prosemirrorMenu.redoItem),
800
- };
801
- var type;
802
- type = schema.marks.strong;
803
- if (type) {
804
- r.toggleStrong = markItem(type);
805
- }
806
- type = schema.marks.em;
807
- if (type) {
808
- r.toggleEm = markItem(type);
809
- }
810
- type = schema.marks.code;
811
- if (type) {
812
- r.toggleCode = markItem(type);
813
- }
814
- type = schema.marks.link;
815
- if (type) {
816
- r.toggleLink = linkItem(type, dialog);
817
- }
818
- type = schema.nodes.bullet_list;
819
- if (type) {
820
- r.wrapBulletList = wrapListItem(type);
821
- }
822
- type = schema.nodes.ordered_list;
823
- if (type) {
824
- r.wrapOrderedList = wrapListItem(type);
825
- }
826
- type = schema.nodes.blockquote;
827
- if (type) {
828
- r.wrapBlockQuote = toItem(prosemirrorMenu.wrapItem(type, {}));
829
- }
830
- type = schema.nodes.paragraph;
831
- if (type) {
832
- r.makeParagraph = toItem(prosemirrorMenu.blockTypeItem(type, {}));
833
- if (type.spec === paragraphWithAlignment) {
834
- r.alignLeft = new TextAlignItem('left');
835
- r.alignRight = new TextAlignItem('right');
836
- r.alignCenter = new TextAlignItem('center');
837
- r.alignJustify = new TextAlignItem('justify');
838
- }
839
- }
840
- type = schema.nodes.code_block;
841
- if (type) {
842
- r.makeCodeBlock = toItem(prosemirrorMenu.blockTypeItem(type, {}));
843
- }
844
- type = schema.nodes.heading;
845
- if (type) {
846
- r.makeHead1 = toItem(prosemirrorMenu.blockTypeItem(type, { attrs: { level: 1 } }));
847
- r.makeHead2 = toItem(prosemirrorMenu.blockTypeItem(type, { attrs: { level: 2 } }));
848
- r.makeHead3 = toItem(prosemirrorMenu.blockTypeItem(type, { attrs: { level: 3 } }));
849
- r.makeHead4 = toItem(prosemirrorMenu.blockTypeItem(type, { attrs: { level: 4 } }));
850
- r.makeHead5 = toItem(prosemirrorMenu.blockTypeItem(type, { attrs: { level: 5 } }));
851
- r.makeHead6 = toItem(prosemirrorMenu.blockTypeItem(type, { attrs: { level: 6 } }));
852
- }
853
- type = schema.nodes.horizontal_rule;
854
- if (type) {
855
- var hr_1 = type;
856
- r.insertHorizontalRule = new Item({
857
- enable: function (state) {
858
- return canInsert(state, hr_1);
859
- },
860
- run: function (state, dispatch) {
861
- dispatch(state.tr.replaceSelectionWith(hr_1.create()));
862
- },
863
- });
864
- }
865
- type = schema.nodes.table;
866
- if (type) {
867
- r.insertTable = new Item({ run: function (e, tr) { return addTable(e, tr); } });
868
- r.addColumnBefore = new Item({ run: prosemirrorTables.addColumnBefore });
869
- r.addColumnAfter = new Item({ run: prosemirrorTables.addColumnAfter });
870
- r.deleteColumn = new Item({ run: prosemirrorTables.deleteColumn });
871
- r.addRowBefore = new Item({ run: prosemirrorTables.addRowBefore });
872
- r.addRowAfter = new Item({ run: prosemirrorTables.addRowAfter });
873
- r.deleteRow = new Item({ run: prosemirrorTables.deleteRow });
874
- r.deleteTable = new Item({ run: prosemirrorTables.deleteTable });
875
- r.mergeCells = new Item({ run: prosemirrorTables.mergeCells });
876
- r.splitCell = new Item({ run: prosemirrorTables.splitCell });
877
- r.toggleHeaderColumn = new Item({ run: prosemirrorTables.toggleHeaderColumn });
878
- r.toggleHeaderRow = new Item({ run: prosemirrorTables.toggleHeaderRow });
879
- r.toggleHeaderCell = new Item({ run: prosemirrorTables.toggleHeaderCell });
880
- }
881
- return r;
882
- }
883
-
884
- /**
885
- * Given a blockquote node type, returns an input rule that turns `"> "`
886
- * at the start of a textblock into a blockquote.
887
- */
888
- function blockQuoteRule(nodeType) {
889
- return prosemirrorInputrules.wrappingInputRule(/^\s*>\s$/, nodeType);
890
- }
891
- /**
892
- * Given a list node type, returns an input rule that turns a number
893
- * followed by a dot at the start of a textblock into an ordered list.
894
- */
895
- function orderedListRule(nodeType) {
896
- return prosemirrorInputrules.wrappingInputRule(/^(\d+)\.\s$/, nodeType, function (match) { return ({ order: +match[1] }); }, function (match, node) { return node.childCount + node.attrs.order === +match[1]; });
897
- }
898
- /**
899
- * Given a list node type, returns an input rule that turns a bullet
900
- * (dash, plush, or asterisk) at the start of a textblock into a
901
- * bullet list.
902
- */
903
- function bulletListRule(nodeType) {
904
- return prosemirrorInputrules.wrappingInputRule(/^\s*([-+*])\s$/, nodeType);
905
- }
906
- /**
907
- * Given a code block node type, returns an input rule that turns a
908
- * textblock starting with three backticks into a code block.
909
- */
910
- function codeBlockRule(nodeType) {
911
- return prosemirrorInputrules.textblockTypeInputRule(/^```$/, nodeType);
912
- }
913
- /**
914
- * Given a node type and a maximum level, creates an input rule that
915
- * turns up to that number of `#` characters followed by a space at
916
- * the start of a textblock into a heading whose level corresponds to
917
- * the number of `#` signs.
918
- */
919
- function headingRule(nodeType, maxLevel) {
920
- return prosemirrorInputrules.textblockTypeInputRule(new RegExp('^(#{1,' + maxLevel + '})\\s$'), nodeType, function (match) { return ({
921
- level: match[1].length,
922
- }); });
923
- }
924
- /**
925
- * A set of input rules for creating the basic block quotes, lists,
926
- * code blocks, and heading.
927
- */
928
- function buildInputRules(schema) {
929
- var rules = [prosemirrorInputrules.ellipsis, prosemirrorInputrules.emDash];
930
- var type = schema.nodes.blockquote;
931
- if (type) {
932
- rules.push(blockQuoteRule(type));
933
- }
934
- type = schema.nodes.ordered_list;
935
- if (type) {
936
- rules.push(orderedListRule(type));
937
- }
938
- type = schema.nodes.bullet_list;
939
- if (type) {
940
- rules.push(bulletListRule(type));
941
- }
942
- type = schema.nodes.code_block;
943
- if (type) {
944
- rules.push(codeBlockRule(type));
945
- }
946
- type = schema.nodes.heading;
947
- if (type) {
948
- rules.push(headingRule(type, 6));
949
- }
950
- return prosemirrorInputrules.inputRules({ rules: rules });
951
- }
952
-
953
- /**
954
- * Inspect the given schema looking for marks and nodes from the
955
- * basic schema, and if found, add key bindings related to them.
956
- * This will add:
957
- *
958
- * * **Mod-b** for toggling [strong](#schema-basic.StrongMark)
959
- * * **Mod-i** for toggling [emphasis](#schema-basic.EmMark)
960
- * * **Mod-`** for toggling [code font](#schema-basic.CodeMark)
961
- * * **Ctrl-Shift-0** for making the current textblock a paragraph
962
- * * **Ctrl-Shift-1** to **Ctrl-Shift-Digit6** for making the current
963
- * textblock a heading of the corresponding level
964
- * * **Ctrl-Shift-Backslash** to make the current textblock a code block
965
- * * **Ctrl-Shift-8** to wrap the selection in an ordered list
966
- * * **Ctrl-Shift-9** to wrap the selection in a bullet list
967
- * * **Ctrl->** to wrap the selection in a block quote
968
- * * **Enter** to split a non-empty textblock in a list item while at
969
- * the same time splitting the list item
970
- * * **Mod-Enter** to insert a hard break
971
- * * **Mod-_** to insert a horizontal rule
972
- * * **Backspace** to undo an input rule
973
- * * **Alt-ArrowUp** to `joinUp`
974
- * * **Alt-ArrowDown** to `joinDown`
975
- * * **Mod-BracketLeft** to `lift`
976
- * * **Escape** to `selectParentNode`
977
- *
978
- * You can suppress or map these bindings by passing a `mapKeys`
979
- * argument, which maps key names (say `"Mod-B"` to either `false`, to
980
- * remove the binding, or a new key name string.
981
- */
982
- function buildKeymap(schema, isMac) {
983
- var keys = {};
984
- keys['Mod-z'] = prosemirrorHistory.undo;
985
- keys['Shift-Mod-z'] = prosemirrorHistory.redo;
986
- keys['Backspace'] = prosemirrorInputrules.undoInputRule;
987
- if (!isMac) {
988
- keys['Mod-y'] = prosemirrorHistory.redo;
989
- }
990
- keys['Alt-ArrowUp'] = prosemirrorCommands.joinUp;
991
- keys['Alt-ArrowDown'] = prosemirrorCommands.joinDown;
992
- keys['Mod-BracketLeft'] = prosemirrorCommands.lift;
993
- keys['Escape'] = prosemirrorCommands.selectParentNode;
994
- var type = schema.marks.strong;
995
- if (type) {
996
- keys['Mod-b'] = prosemirrorCommands.toggleMark(type);
997
- keys['Mod-B'] = prosemirrorCommands.toggleMark(type);
998
- }
999
- type = schema.marks.em;
1000
- if (type) {
1001
- keys['Mod-i'] = prosemirrorCommands.toggleMark(type);
1002
- keys['Mod-I'] = prosemirrorCommands.toggleMark(type);
1003
- }
1004
- type = schema.marks.code;
1005
- if (type) {
1006
- keys['Mod-`'] = prosemirrorCommands.toggleMark(type);
1007
- }
1008
- type = schema.nodes.bullet_list;
1009
- if (type) {
1010
- keys['Shift-Ctrl-8'] = prosemirrorSchemaList.wrapInList(type);
1011
- }
1012
- type = schema.nodes.ordered_list;
1013
- if (type) {
1014
- keys['Shift-Ctrl-9'] = prosemirrorSchemaList.wrapInList(type);
1015
- }
1016
- type = schema.nodes.blockquote;
1017
- if (type) {
1018
- keys['Ctrl->'] = prosemirrorCommands.wrapIn(type);
1019
- }
1020
- type = schema.nodes.hard_break;
1021
- if (type) {
1022
- var br_1 = type;
1023
- var cmd = prosemirrorCommands.chainCommands(prosemirrorCommands.exitCode, function (state, dispatch) {
1024
- dispatch === null || dispatch === void 0 ? void 0 : dispatch(state.tr.replaceSelectionWith(br_1.create()).scrollIntoView());
1025
- return true;
1026
- });
1027
- keys['Mod-Enter'] = cmd;
1028
- keys['Shift-Enter'] = cmd;
1029
- if (isMac) {
1030
- keys['Ctrl-Enter'] = cmd;
1031
- }
1032
- }
1033
- type = schema.nodes.list_item;
1034
- if (type) {
1035
- keys['Enter'] = prosemirrorSchemaList.splitListItem(type);
1036
- keys['Mod-['] = prosemirrorSchemaList.liftListItem(type);
1037
- keys['Mod-]'] = prosemirrorSchemaList.sinkListItem(type);
1038
- }
1039
- type = schema.nodes.paragraph;
1040
- if (type) {
1041
- keys['Shift-Ctrl-0'] = prosemirrorCommands.setBlockType(type);
1042
- }
1043
- type = schema.nodes.code_block;
1044
- if (type) {
1045
- keys['Shift-Ctrl-\\'] = prosemirrorCommands.setBlockType(type);
1046
- }
1047
- type = schema.nodes.heading;
1048
- if (type) {
1049
- for (var i = 1; i <= 6; i++) {
1050
- keys['Shift-Ctrl-' + i] = prosemirrorCommands.setBlockType(type, { level: i });
1051
- }
1052
- }
1053
- type = schema.nodes.horizontal_rule;
1054
- if (type) {
1055
- var hr_1 = type;
1056
- keys['Mod-_'] = function (state, dispatch) {
1057
- dispatch === null || dispatch === void 0 ? void 0 : dispatch(state.tr.replaceSelectionWith(hr_1.create()).scrollIntoView());
1058
- return true;
1059
- };
1060
- }
1061
- return keys;
1062
- }
1063
-
1064
- /**
1065
- * Prosemirror component
1066
- *
1067
- * Usage :
1068
- *
1069
- * ```html
1070
- * <natural-editor [(ngModel)]="htmlString"></natural-editor>
1071
- * ```
1072
- */
1073
- // @dynamic
1074
- var NaturalEditorComponent = /** @class */ (function () {
1075
- function NaturalEditorComponent(ngControl, document, dialog, imagePlugin) {
1076
- this.ngControl = ngControl;
1077
- this.document = document;
1078
- this.dialog = dialog;
1079
- this.imagePlugin = imagePlugin;
1080
- this.view = null;
1081
- this.contentChange = new i0.EventEmitter();
1082
- /**
1083
- * Callback to upload an image.
1084
- *
1085
- * If given it will enable advanced schema, including image and tables.
1086
- * It must be given on initialization and cannot be changed later on.
1087
- */
1088
- this.imageUploader = null;
1089
- this.schema = basicSchema;
1090
- /**
1091
- * HTML string
1092
- */
1093
- this.content = '';
1094
- this.menu = null;
1095
- /**
1096
- * If subscribed to, then the save button will be shown and click events forwarded
1097
- */
1098
- this.save = new i0.EventEmitter();
1099
- if (this.ngControl !== null) {
1100
- this.ngControl.valueAccessor = this;
1101
- }
1102
- }
1103
- NaturalEditorComponent.prototype.ngOnInit = function () {
1104
- var _this = this;
1105
- this.schema = this.imageUploader ? advancedSchema : basicSchema;
1106
- this.menu = buildMenuItems(this.schema, this.dialog);
1107
- var serializer = prosemirrorModel.DOMSerializer.fromSchema(this.schema);
1108
- var state = this.createState();
1109
- this.view = new prosemirrorView.EditorView(this.editor.nativeElement, {
1110
- state: state,
1111
- dispatchTransaction: function (transaction) {
1112
- if (!_this.view) {
1113
- return;
1114
- }
1115
- var newState = _this.view.state.apply(transaction);
1116
- _this.view.updateState(newState);
1117
- // Transform doc into HTML string
1118
- var dom = serializer.serializeFragment(_this.view.state.doc);
1119
- var el = _this.document.createElement('_');
1120
- el.appendChild(dom);
1121
- var newContent = el.innerHTML;
1122
- if (_this.content === newContent) {
1123
- return;
1124
- }
1125
- _this.content = el.innerHTML;
1126
- if (_this.onChange) {
1127
- _this.onChange(_this.content);
1128
- }
1129
- _this.contentChange.emit(_this.content);
1130
- },
1131
- });
1132
- this.update();
1133
- };
1134
- NaturalEditorComponent.prototype.writeValue = function (val) {
1135
- if (typeof val === 'string' && val !== this.content) {
1136
- this.content = val;
1137
- }
1138
- if (this.view !== null) {
1139
- var state = this.createState();
1140
- this.view.updateState(state);
1141
- }
1142
- };
1143
- NaturalEditorComponent.prototype.createState = function () {
1144
- var template = this.document.createElement('_');
1145
- template.innerHTML = '<div>' + this.content + '</div>';
1146
- if (!template.firstChild) {
1147
- throw new Error('child of template element could not be created');
1148
- }
1149
- var parser = prosemirrorModel.DOMParser.fromSchema(this.schema);
1150
- var doc = parser.parse(template.firstChild);
1151
- return prosemirrorState.EditorState.create({
1152
- doc: doc,
1153
- plugins: this.createPlugins(),
1154
- });
1155
- };
1156
- NaturalEditorComponent.prototype.createPlugins = function () {
1157
- var _this = this;
1158
- var _a;
1159
- var isMac = !!((_a = this.document.defaultView) === null || _a === void 0 ? void 0 : _a.navigator.platform.match(/Mac/));
1160
- var plugins = [
1161
- buildInputRules(this.schema),
1162
- prosemirrorKeymap.keymap(buildKeymap(this.schema, isMac)),
1163
- prosemirrorKeymap.keymap(prosemirrorCommands.baseKeymap),
1164
- prosemirrorDropcursor.dropCursor(),
1165
- prosemirrorGapcursor.gapCursor(),
1166
- prosemirrorHistory.history(),
1167
- new prosemirrorState.Plugin({
1168
- props: {
1169
- attributes: { class: 'ProseMirror-example-setup-style' },
1170
- },
1171
- }),
1172
- new prosemirrorState.Plugin({
1173
- view: function () { return _this; },
1174
- }),
1175
- ];
1176
- if (this.schema === advancedSchema) {
1177
- plugins.push(this.imagePlugin.plugin, prosemirrorTables.columnResizing(undefined), prosemirrorTables.tableEditing(), prosemirrorKeymap.keymap({
1178
- Tab: prosemirrorTables.goToNextCell(1),
1179
- 'Shift-Tab': prosemirrorTables.goToNextCell(-1),
1180
- }));
1181
- }
1182
- return plugins;
1183
- };
1184
- /**
1185
- * Called by Prosemirror whenever the editor state changes. So we update our menu states.
1186
- */
1187
- NaturalEditorComponent.prototype.update = function () {
1188
- var e_1, _b;
1189
- if (!this.view || !this.menu) {
1190
- return;
1191
- }
1192
- try {
1193
- for (var _c = __values(Object.values(this.menu)), _d = _c.next(); !_d.done; _d = _c.next()) {
1194
- var item = _d.value;
1195
- item.update(this.view, this.view.state);
1196
- }
1197
- }
1198
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1199
- finally {
1200
- try {
1201
- if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
1202
- }
1203
- finally { if (e_1) throw e_1.error; }
1204
- }
1205
- };
1206
- NaturalEditorComponent.prototype.registerOnChange = function (fn) {
1207
- this.onChange = fn;
1208
- };
1209
- NaturalEditorComponent.prototype.registerOnTouched = function (fn) { };
1210
- NaturalEditorComponent.prototype.setDisabledState = function (isDisabled) {
1211
- // TODO disable editor ?
1212
- };
1213
- NaturalEditorComponent.prototype.ngOnDestroy = function () {
1214
- if (this.view) {
1215
- this.view.destroy();
1216
- this.view = null;
1217
- }
1218
- };
1219
- NaturalEditorComponent.prototype.run = function (event, key) {
1220
- if (!this.view || !this.menu) {
1221
- return;
1222
- }
1223
- var item = this.menu[key];
1224
- if (!item || item.disabled || !item.show) {
1225
- return;
1226
- }
1227
- item.spec.run(this.view.state, this.view.dispatch, this.view, event);
1228
- this.view.focus();
1229
- };
1230
- NaturalEditorComponent.prototype.upload = function (file) {
1231
- if (!this.view || !this.imageUploader) {
1232
- return;
1233
- }
1234
- if (this.view.state.selection.$from.parent.inlineContent) {
1235
- this.imagePlugin.startImageUpload(this.view, file, this.imageUploader, this.schema);
1236
- }
1237
- this.view.focus();
1238
- };
1239
- return NaturalEditorComponent;
1240
- }());
1241
- 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 });
1242
- 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 <mat-button-toggle-group *ngIf=\"menu.alignLeft\">\n <mat-button-toggle\n *ngIf=\"menu.alignLeft\"\n [disabled]=\"menu.alignLeft.disabled\"\n [checked]=\"menu.alignLeft.active\"\n (click)=\"run($event, 'alignLeft')\"\n i18n-matTooltip\n matTooltip=\"Aligner gauche\"\n >\n <mat-icon>format_align_left</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.alignCenter\"\n [disabled]=\"menu.alignCenter.disabled\"\n [checked]=\"menu.alignCenter.active\"\n (click)=\"run($event, 'alignCenter')\"\n i18n-matTooltip\n matTooltip=\"Centrer\"\n >\n <mat-icon>format_align_center</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.alignRight\"\n [disabled]=\"menu.alignRight.disabled\"\n [checked]=\"menu.alignRight.active\"\n (click)=\"run($event, 'alignRight')\"\n i18n-matTooltip\n matTooltip=\"Aligner droite\"\n >\n <mat-icon>format_align_right</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.alignJustify\"\n [disabled]=\"menu.alignJustify.disabled\"\n [checked]=\"menu.alignJustify.active\"\n (click)=\"run($event, 'alignJustify')\"\n i18n-matTooltip\n matTooltip=\"Justifier\"\n >\n <mat-icon>format_align_justify</mat-icon>\n </mat-button-toggle>\n </mat-button-toggle-group>\n\n <button\n mat-button\n *ngIf=\"menu.undo\"\n [disabled]=\"menu.undo.disabled\"\n (click)=\"run($event, 'undo')\"\n i18n-matTooltip\n matTooltip=\"Annuler\"\n >\n <mat-icon>undo</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.redo\"\n [disabled]=\"menu.redo.disabled\"\n (click)=\"run($event, 'redo')\"\n i18n-matTooltip\n matTooltip=\"Refaire\"\n >\n <mat-icon>redo</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.wrapBulletList && menu.wrapBulletList.show\"\n [disabled]=\"menu.wrapBulletList.disabled\"\n (click)=\"run($event, 'wrapBulletList')\"\n i18n-matTooltip\n matTooltip=\"Liste \u00E0 puce\"\n >\n <mat-icon>format_list_bulleted</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.wrapOrderedList && menu.wrapOrderedList.show\"\n [disabled]=\"menu.wrapOrderedList.disabled\"\n (click)=\"run($event, 'wrapOrderedList')\"\n i18n-matTooltip\n matTooltip=\"Liste \u00E0 num\u00E9ro\"\n >\n <mat-icon>format_list_numbered</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.wrapBlockQuote && menu.wrapBlockQuote.show\"\n [disabled]=\"menu.wrapBlockQuote.disabled\"\n (click)=\"run($event, 'wrapBlockQuote')\"\n i18n-matTooltip\n matTooltip=\"Citation\"\n >\n <mat-icon>format_quote</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.joinUp && menu.joinUp.show\"\n [disabled]=\"menu.joinUp.disabled\"\n (click)=\"run($event, 'joinUp')\"\n i18n-matTooltip\n matTooltip=\"Fusionner avec l'\u00E9l\u00E9ment du haut\"\n >\n <mat-icon>move_up</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.lift && menu.lift.show\"\n [disabled]=\"menu.lift.disabled\"\n (click)=\"run($event, 'lift')\"\n i18n-matTooltip\n matTooltip=\"D\u00E9sindenter\"\n >\n <mat-icon>format_indent_decrease</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.selectParentNode && menu.selectParentNode.show\"\n [disabled]=\"menu.selectParentNode.disabled\"\n (click)=\"run($event, 'selectParentNode')\"\n i18n-matTooltip\n matTooltip=\"S\u00E9lectionner l'\u00E9l\u00E9ment parent\"\n >\n <mat-icon>select_all</mat-icon>\n </button>\n </div>\n</div>\n<div #editor></div>\n", styles: [".menu{border-bottom:1px solid;display:flex;flex-wrap:wrap;padding:10px 18px}.menu-container{position:sticky;top:-20px;z-index:999}::ng-deep .ProseMirror{position:relative}::ng-deep .ProseMirror{word-wrap:break-word;white-space:pre-wrap;-webkit-font-variant-ligatures:none;font-feature-settings:none;font-variant-ligatures:none}::ng-deep .ProseMirror pre{white-space:pre-wrap}::ng-deep .ProseMirror li{position:relative}::ng-deep .ProseMirror-hideselection *::selection{background:transparent}::ng-deep .ProseMirror-hideselection *::-moz-selection{background:transparent}::ng-deep .ProseMirror-hideselection{caret-color:transparent}::ng-deep .ProseMirror-selectednode{outline:2px solid #8cf}::ng-deep li.ProseMirror-selectednode{outline:none}::ng-deep li.ProseMirror-selectednode:after{content:\"\";position:absolute;left:-32px;right:-2px;top:-2px;bottom:-2px;border:2px solid #8cf;pointer-events:none}::ng-deep .ProseMirror-gapcursor{display:none;pointer-events:none;position:absolute}::ng-deep .ProseMirror-gapcursor:after{content:\"\";display:block;position:absolute;top:-2px;width:20px;border-top:1px solid black;animation:ProseMirror-cursor-blink 1.1s steps(2,start) infinite}@keyframes ProseMirror-cursor-blink{to{visibility:hidden}}::ng-deep .ProseMirror-focused .ProseMirror-gapcursor{display:block}::ng-deep .ProseMirror-example-setup-style hr{padding:2px 10px;border:none;margin:1em 0}::ng-deep .ProseMirror-example-setup-style hr:after{content:\"\";display:block;height:1px;background-color:silver;line-height:2px}::ng-deep .ProseMirror ul,::ng-deep .ProseMirror ol{padding-left:30px}::ng-deep .ProseMirror blockquote{padding-left:1em;border-left:3px solid #eee;margin-left:0;margin-right:0}::ng-deep .ProseMirror-example-setup-style img{cursor:default}::ng-deep .ProseMirror p:first-child,::ng-deep .ProseMirror h1:first-child,::ng-deep .ProseMirror h2:first-child,::ng-deep .ProseMirror h3:first-child,::ng-deep .ProseMirror h4:first-child,::ng-deep .ProseMirror h5:first-child,::ng-deep .ProseMirror h6:first-child{margin-top:10px}::ng-deep .ProseMirror{padding:4px 8px 4px 14px;line-height:1.2;outline:none}::ng-deep .ProseMirror p{margin-bottom:1em}::ng-deep .ProseMirror .tableWrapper{overflow-x:auto}::ng-deep .ProseMirror table{border-collapse:collapse;table-layout:fixed;width:100%;overflow:hidden}::ng-deep .ProseMirror td,::ng-deep .ProseMirror th{vertical-align:top;box-sizing:border-box;position:relative}::ng-deep .ProseMirror .column-resize-handle{position:absolute;right:-2px;top:0;bottom:0;width:4px;z-index:20;background-color:#adf;pointer-events:none}::ng-deep .ProseMirror.resize-cursor{cursor:col-resize}::ng-deep .ProseMirror .selectedCell:after{z-index:2;position:absolute;content:\"\";left:0;right:0;top:0;bottom:0;background:rgba(200,200,255,.4);pointer-events:none}::ng-deep .ProseMirror table{margin:0}::ng-deep .ProseMirror th,::ng-deep .ProseMirror td{min-width:1em;border:1px solid #ddd;padding:3px 5px}::ng-deep .ProseMirror .tableWrapper{margin:1em 0}::ng-deep .ProseMirror th{font-weight: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"] }] });
1243
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: NaturalEditorComponent, decorators: [{
1244
- type: i0.Component,
1245
- args: [{
1246
- selector: 'natural-editor',
1247
- templateUrl: './editor.component.html',
1248
- styleUrls: ['./editor.component.scss'],
1249
- providers: [ImagePlugin],
1250
- }]
1251
- }], ctorParameters: function () {
1252
- return [{ type: i4__namespace.NgControl, decorators: [{
1253
- type: i0.Optional
1254
- }, {
1255
- type: i0.Self
1256
- }] }, { type: Document, decorators: [{
1257
- type: i0.Inject,
1258
- args: [i6.DOCUMENT]
1259
- }] }, { type: i1__namespace.MatDialog }, { type: ImagePlugin }];
1260
- }, propDecorators: { editor: [{
1261
- type: i0.ViewChild,
1262
- args: ['editor', { read: i0.ElementRef, static: true }]
1263
- }], contentChange: [{
1264
- type: i0.Output
1265
- }], imageUploader: [{
1266
- type: i0.Input
1267
- }], save: [{
1268
- type: i0.Output
1269
- }] } });
1270
-
1271
- var imports = [
1272
- i6.CommonModule,
1273
- i3.MatButtonModule,
1274
- i6$1.MatButtonToggleModule,
1275
- i1.MatDialogModule,
1276
- i2.MatFormFieldModule,
1277
- i5$1.MatIconModule,
1278
- i5.MatInputModule,
1279
- i7.MatMenuModule,
1280
- toolbar.MatToolbarModule,
1281
- i10.MatTooltipModule,
1282
- i4.ReactiveFormsModule,
1283
- i11.NaturalFileModule,
1284
- i8.MatDividerModule,
1285
- ];
1286
- var NaturalEditorModule = /** @class */ (function () {
1287
- function NaturalEditorModule() {
1288
- }
1289
- return NaturalEditorModule;
1290
- }());
1291
- NaturalEditorModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: NaturalEditorModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
1292
- NaturalEditorModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: NaturalEditorModule, declarations: [NaturalEditorComponent, LinkDialogComponent], imports: [i6.CommonModule,
1293
- i3.MatButtonModule,
1294
- i6$1.MatButtonToggleModule,
1295
- i1.MatDialogModule,
1296
- i2.MatFormFieldModule,
1297
- i5$1.MatIconModule,
1298
- i5.MatInputModule,
1299
- i7.MatMenuModule,
1300
- toolbar.MatToolbarModule,
1301
- i10.MatTooltipModule,
1302
- i4.ReactiveFormsModule,
1303
- i11.NaturalFileModule,
1304
- i8.MatDividerModule], exports: [i6.CommonModule,
1305
- i3.MatButtonModule,
1306
- i6$1.MatButtonToggleModule,
1307
- i1.MatDialogModule,
1308
- i2.MatFormFieldModule,
1309
- i5$1.MatIconModule,
1310
- i5.MatInputModule,
1311
- i7.MatMenuModule,
1312
- toolbar.MatToolbarModule,
1313
- i10.MatTooltipModule,
1314
- i4.ReactiveFormsModule,
1315
- i11.NaturalFileModule,
1316
- i8.MatDividerModule, NaturalEditorComponent] });
1317
- NaturalEditorModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: NaturalEditorModule, imports: [__spreadArray([], __read(imports)), i6.CommonModule,
1318
- i3.MatButtonModule,
1319
- i6$1.MatButtonToggleModule,
1320
- i1.MatDialogModule,
1321
- i2.MatFormFieldModule,
1322
- i5$1.MatIconModule,
1323
- i5.MatInputModule,
1324
- i7.MatMenuModule,
1325
- toolbar.MatToolbarModule,
1326
- i10.MatTooltipModule,
1327
- i4.ReactiveFormsModule,
1328
- i11.NaturalFileModule,
1329
- i8.MatDividerModule] });
1330
- i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0__namespace, type: NaturalEditorModule, decorators: [{
1331
- type: i0.NgModule,
1332
- args: [{
1333
- declarations: [NaturalEditorComponent, LinkDialogComponent],
1334
- imports: __spreadArray([], __read(imports)),
1335
- exports: __spreadArray(__spreadArray([], __read(imports)), [NaturalEditorComponent]),
1336
- }]
1337
- }] });
1338
-
1339
- // Load `$localize` onto the global scope - to be able to use that function to translate strings in components/services.
1340
-
1341
- /**
1342
- * Generated bundle index. Do not edit.
1343
- */
1344
-
1345
- exports.NaturalEditorComponent = NaturalEditorComponent;
1346
- exports.NaturalEditorModule = NaturalEditorModule;
1347
-
1348
- Object.defineProperty(exports, '__esModule', { value: true });
1349
-
1350
- }));
1351
- //# sourceMappingURL=ecodev-natural-editor.umd.js.map