@ecodev/natural-editor 41.1.3 → 41.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/ecodev-natural-editor.umd.js +343 -18
- package/bundles/ecodev-natural-editor.umd.js.map +1 -1
- package/esm2015/lib/editor/editor.component.js +28 -9
- package/esm2015/lib/utils/inputrules.js +70 -0
- package/esm2015/lib/utils/item.js +39 -0
- package/esm2015/lib/utils/keymap.js +115 -0
- package/esm2015/lib/utils/menu.js +10 -39
- package/esm2015/lib/utils/paragraph-with-alignment.js +43 -0
- package/esm2015/lib/utils/schema.js +4 -3
- package/esm2015/lib/utils/text-align-item.js +78 -0
- package/fesm2015/ecodev-natural-editor.js +336 -12
- package/fesm2015/ecodev-natural-editor.js.map +1 -1
- package/lib/editor/editor.component.d.ts +1 -0
- package/lib/utils/inputrules.d.ts +7 -0
- package/lib/utils/item.d.ts +30 -0
- package/lib/utils/keymap.d.ts +32 -0
- package/lib/utils/menu.d.ts +2 -31
- package/lib/utils/paragraph-with-alignment.d.ts +2 -0
- package/lib/utils/text-align-item.d.ts +6 -0
- package/package.json +10 -3
|
@@ -2,17 +2,16 @@ import '@angular/localize/init';
|
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { Injectable, Inject, Component, EventEmitter, ElementRef, Optional, Self, ViewChild, Output, Input, NgModule } from '@angular/core';
|
|
4
4
|
import { DecorationSet, Decoration, EditorView } from 'prosemirror-view';
|
|
5
|
-
import { Plugin, TextSelection, EditorState } from 'prosemirror-state';
|
|
6
|
-
import { exampleSetup } from 'prosemirror-example-setup';
|
|
5
|
+
import { Plugin, TextSelection, AllSelection, EditorState } from 'prosemirror-state';
|
|
7
6
|
import { Schema, DOMSerializer, DOMParser } from 'prosemirror-model';
|
|
8
7
|
import * as i6 from '@angular/common';
|
|
9
8
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
10
9
|
import { tableNodes, tableNodeTypes, addColumnBefore, addColumnAfter, deleteColumn, addRowBefore, addRowAfter, deleteRow, deleteTable, mergeCells, splitCell, toggleHeaderColumn, toggleHeaderRow, toggleHeaderCell, columnResizing, tableEditing, goToNextCell } from 'prosemirror-tables';
|
|
11
10
|
import { keymap } from 'prosemirror-keymap';
|
|
12
11
|
import { nodes, marks } from 'prosemirror-schema-basic';
|
|
13
|
-
import { addListNodes, wrapInList } from 'prosemirror-schema-list';
|
|
12
|
+
import { addListNodes, wrapInList, splitListItem, liftListItem, sinkListItem } from 'prosemirror-schema-list';
|
|
14
13
|
import { joinUpItem, liftItem, selectParentNodeItem, undoItem, redoItem, wrapItem, blockTypeItem } from 'prosemirror-menu';
|
|
15
|
-
import { toggleMark } from 'prosemirror-commands';
|
|
14
|
+
import { toggleMark, joinUp, joinDown, lift, selectParentNode, wrapIn, chainCommands, exitCode, setBlockType, baseKeymap } from 'prosemirror-commands';
|
|
16
15
|
import * as i1 from '@angular/material/dialog';
|
|
17
16
|
import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
|
|
18
17
|
import * as i4 from '@angular/forms';
|
|
@@ -25,6 +24,10 @@ import * as i3 from '@angular/material/button';
|
|
|
25
24
|
import { MatButtonModule } from '@angular/material/button';
|
|
26
25
|
import * as i5 from '@angular/material/input';
|
|
27
26
|
import { MatInputModule } from '@angular/material/input';
|
|
27
|
+
import { undo, redo, history } from 'prosemirror-history';
|
|
28
|
+
import { dropCursor } from 'prosemirror-dropcursor';
|
|
29
|
+
import { gapCursor } from 'prosemirror-gapcursor';
|
|
30
|
+
import { wrappingInputRule, textblockTypeInputRule, ellipsis, emDash, inputRules, undoInputRule } from 'prosemirror-inputrules';
|
|
28
31
|
import * as i5$1 from '@angular/material/icon';
|
|
29
32
|
import { MatIconModule } from '@angular/material/icon';
|
|
30
33
|
import * as i6$1 from '@angular/material/button-toggle';
|
|
@@ -113,6 +116,49 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImpor
|
|
|
113
116
|
args: [DOCUMENT]
|
|
114
117
|
}] }]; } });
|
|
115
118
|
|
|
119
|
+
const ALIGN_PATTERN = /(left|right|center|justify)/;
|
|
120
|
+
// https://github.com/ProseMirror/prosemirror-schema-basic/blob/master/src/schema-basic.js
|
|
121
|
+
// :: NodeSpec A plain paragraph textblock. Represented in the DOM
|
|
122
|
+
// as a `<p>` element.
|
|
123
|
+
const paragraphWithAlignment = {
|
|
124
|
+
attrs: {
|
|
125
|
+
align: { default: null },
|
|
126
|
+
id: { default: null },
|
|
127
|
+
},
|
|
128
|
+
content: 'inline*',
|
|
129
|
+
group: 'block',
|
|
130
|
+
parseDOM: [
|
|
131
|
+
{
|
|
132
|
+
tag: 'p',
|
|
133
|
+
getAttrs: dom => {
|
|
134
|
+
if (!(dom instanceof HTMLElement)) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const { textAlign } = dom.style;
|
|
138
|
+
let align = dom.getAttribute('align') || textAlign || '';
|
|
139
|
+
align = ALIGN_PATTERN.test(align) ? align : null;
|
|
140
|
+
const id = dom.getAttribute('id') || '';
|
|
141
|
+
return { align, id };
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
toDOM: node => {
|
|
146
|
+
const { align, id } = node.attrs;
|
|
147
|
+
const attrs = {};
|
|
148
|
+
let style = '';
|
|
149
|
+
if (align && align !== 'left') {
|
|
150
|
+
style += `text-align: ${align};`;
|
|
151
|
+
}
|
|
152
|
+
if (style) {
|
|
153
|
+
attrs.style = style;
|
|
154
|
+
}
|
|
155
|
+
if (id) {
|
|
156
|
+
attrs.id = id;
|
|
157
|
+
}
|
|
158
|
+
return ['p', attrs, 0];
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
|
|
116
162
|
const basicNodes = {
|
|
117
163
|
heading: nodes.heading,
|
|
118
164
|
doc: nodes.doc,
|
|
@@ -131,7 +177,7 @@ const basicSchema = new Schema({
|
|
|
131
177
|
marks: tmpSchema.spec.marks,
|
|
132
178
|
});
|
|
133
179
|
const tmpSchema2 = new Schema({
|
|
134
|
-
nodes: Object.assign(Object.assign({}, nodes), tableNodes({
|
|
180
|
+
nodes: Object.assign(Object.assign(Object.assign({}, nodes), tableNodes({
|
|
135
181
|
tableGroup: 'block',
|
|
136
182
|
cellContent: 'block+',
|
|
137
183
|
cellAttributes: {
|
|
@@ -147,7 +193,7 @@ const tmpSchema2 = new Schema({
|
|
|
147
193
|
},
|
|
148
194
|
},
|
|
149
195
|
},
|
|
150
|
-
})),
|
|
196
|
+
})), { paragraph: paragraphWithAlignment }),
|
|
151
197
|
marks: basicMarks,
|
|
152
198
|
});
|
|
153
199
|
const advancedSchema = new Schema({
|
|
@@ -259,6 +305,83 @@ class Item {
|
|
|
259
305
|
}
|
|
260
306
|
}
|
|
261
307
|
}
|
|
308
|
+
|
|
309
|
+
function setTextAlign(tr, schema, alignment) {
|
|
310
|
+
console.log('setTextAlign', alignment);
|
|
311
|
+
const { selection, doc } = tr;
|
|
312
|
+
if (!selection || !doc) {
|
|
313
|
+
return tr;
|
|
314
|
+
}
|
|
315
|
+
const { from, to } = selection;
|
|
316
|
+
const { nodes } = schema;
|
|
317
|
+
const tasks = [];
|
|
318
|
+
alignment = alignment || null;
|
|
319
|
+
const allowedNodeTypes = new Set([
|
|
320
|
+
nodes.paragraph,
|
|
321
|
+
// nodes['blockquote'],
|
|
322
|
+
// nodes['listItem'],
|
|
323
|
+
// nodes['heading'],
|
|
324
|
+
]);
|
|
325
|
+
doc.nodesBetween(from, to, (node, pos) => {
|
|
326
|
+
const nodeType = node.type;
|
|
327
|
+
const align = node.attrs.align || null;
|
|
328
|
+
if (align !== alignment && allowedNodeTypes.has(nodeType)) {
|
|
329
|
+
tasks.push({
|
|
330
|
+
node,
|
|
331
|
+
pos,
|
|
332
|
+
nodeType,
|
|
333
|
+
});
|
|
334
|
+
}
|
|
335
|
+
return true;
|
|
336
|
+
});
|
|
337
|
+
if (!tasks.length) {
|
|
338
|
+
return tr;
|
|
339
|
+
}
|
|
340
|
+
tasks.forEach(job => {
|
|
341
|
+
const { node, pos, nodeType } = job;
|
|
342
|
+
const newAttrs = Object.assign(Object.assign({}, node.attrs), { align: alignment ? alignment : null });
|
|
343
|
+
console.log('newAttrs', newAttrs);
|
|
344
|
+
tr = tr.setNodeMarkup(pos, nodeType, newAttrs, node.marks);
|
|
345
|
+
});
|
|
346
|
+
return tr;
|
|
347
|
+
}
|
|
348
|
+
class TextAlignItem extends Item {
|
|
349
|
+
constructor(alignment) {
|
|
350
|
+
super({
|
|
351
|
+
active: state => {
|
|
352
|
+
const { selection, doc } = state;
|
|
353
|
+
const { from, to } = selection;
|
|
354
|
+
let keepLooking = true;
|
|
355
|
+
let active = false;
|
|
356
|
+
doc.nodesBetween(from, to, node => {
|
|
357
|
+
if (keepLooking && node.attrs.align === alignment) {
|
|
358
|
+
keepLooking = false;
|
|
359
|
+
active = true;
|
|
360
|
+
}
|
|
361
|
+
return keepLooking;
|
|
362
|
+
});
|
|
363
|
+
return active;
|
|
364
|
+
},
|
|
365
|
+
enable: state => {
|
|
366
|
+
const { selection } = state;
|
|
367
|
+
return selection instanceof TextSelection || selection instanceof AllSelection;
|
|
368
|
+
},
|
|
369
|
+
run: (state, dispatch) => {
|
|
370
|
+
const { schema, selection } = state;
|
|
371
|
+
console.log(this);
|
|
372
|
+
const tr = setTextAlign(state.tr.setSelection(selection), schema, this.active ? null : alignment);
|
|
373
|
+
if (tr.docChanged) {
|
|
374
|
+
dispatch === null || dispatch === void 0 ? void 0 : dispatch(tr);
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
else {
|
|
378
|
+
return false;
|
|
379
|
+
}
|
|
380
|
+
},
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
262
385
|
/**
|
|
263
386
|
* Convert built-in `MenuItem` into our Angular specific `Item`
|
|
264
387
|
*/
|
|
@@ -377,6 +500,12 @@ function buildMenuItems(schema, dialog) {
|
|
|
377
500
|
type = schema.nodes.paragraph;
|
|
378
501
|
if (type) {
|
|
379
502
|
r.makeParagraph = toItem(blockTypeItem(type, {}));
|
|
503
|
+
if (type.spec === paragraphWithAlignment) {
|
|
504
|
+
r.alignLeft = new TextAlignItem('left');
|
|
505
|
+
r.alignRight = new TextAlignItem('right');
|
|
506
|
+
r.alignCenter = new TextAlignItem('center');
|
|
507
|
+
r.alignJustify = new TextAlignItem('justify');
|
|
508
|
+
}
|
|
380
509
|
}
|
|
381
510
|
type = schema.nodes.code_block;
|
|
382
511
|
if (type) {
|
|
@@ -422,6 +551,186 @@ function buildMenuItems(schema, dialog) {
|
|
|
422
551
|
return r;
|
|
423
552
|
}
|
|
424
553
|
|
|
554
|
+
/**
|
|
555
|
+
* Given a blockquote node type, returns an input rule that turns `"> "`
|
|
556
|
+
* at the start of a textblock into a blockquote.
|
|
557
|
+
*/
|
|
558
|
+
function blockQuoteRule(nodeType) {
|
|
559
|
+
return wrappingInputRule(/^\s*>\s$/, nodeType);
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* Given a list node type, returns an input rule that turns a number
|
|
563
|
+
* followed by a dot at the start of a textblock into an ordered list.
|
|
564
|
+
*/
|
|
565
|
+
function orderedListRule(nodeType) {
|
|
566
|
+
return wrappingInputRule(/^(\d+)\.\s$/, nodeType, match => ({ order: +match[1] }), (match, node) => node.childCount + node.attrs.order === +match[1]);
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Given a list node type, returns an input rule that turns a bullet
|
|
570
|
+
* (dash, plush, or asterisk) at the start of a textblock into a
|
|
571
|
+
* bullet list.
|
|
572
|
+
*/
|
|
573
|
+
function bulletListRule(nodeType) {
|
|
574
|
+
return wrappingInputRule(/^\s*([-+*])\s$/, nodeType);
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Given a code block node type, returns an input rule that turns a
|
|
578
|
+
* textblock starting with three backticks into a code block.
|
|
579
|
+
*/
|
|
580
|
+
function codeBlockRule(nodeType) {
|
|
581
|
+
return textblockTypeInputRule(/^```$/, nodeType);
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Given a node type and a maximum level, creates an input rule that
|
|
585
|
+
* turns up to that number of `#` characters followed by a space at
|
|
586
|
+
* the start of a textblock into a heading whose level corresponds to
|
|
587
|
+
* the number of `#` signs.
|
|
588
|
+
*/
|
|
589
|
+
function headingRule(nodeType, maxLevel) {
|
|
590
|
+
return textblockTypeInputRule(new RegExp('^(#{1,' + maxLevel + '})\\s$'), nodeType, match => ({
|
|
591
|
+
level: match[1].length,
|
|
592
|
+
}));
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* A set of input rules for creating the basic block quotes, lists,
|
|
596
|
+
* code blocks, and heading.
|
|
597
|
+
*/
|
|
598
|
+
function buildInputRules(schema) {
|
|
599
|
+
const rules = [ellipsis, emDash];
|
|
600
|
+
let type = schema.nodes.blockquote;
|
|
601
|
+
if (type) {
|
|
602
|
+
rules.push(blockQuoteRule(type));
|
|
603
|
+
}
|
|
604
|
+
type = schema.nodes.ordered_list;
|
|
605
|
+
if (type) {
|
|
606
|
+
rules.push(orderedListRule(type));
|
|
607
|
+
}
|
|
608
|
+
type = schema.nodes.bullet_list;
|
|
609
|
+
if (type) {
|
|
610
|
+
rules.push(bulletListRule(type));
|
|
611
|
+
}
|
|
612
|
+
type = schema.nodes.code_block;
|
|
613
|
+
if (type) {
|
|
614
|
+
rules.push(codeBlockRule(type));
|
|
615
|
+
}
|
|
616
|
+
type = schema.nodes.heading;
|
|
617
|
+
if (type) {
|
|
618
|
+
rules.push(headingRule(type, 6));
|
|
619
|
+
}
|
|
620
|
+
return inputRules({ rules });
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Inspect the given schema looking for marks and nodes from the
|
|
625
|
+
* basic schema, and if found, add key bindings related to them.
|
|
626
|
+
* This will add:
|
|
627
|
+
*
|
|
628
|
+
* * **Mod-b** for toggling [strong](#schema-basic.StrongMark)
|
|
629
|
+
* * **Mod-i** for toggling [emphasis](#schema-basic.EmMark)
|
|
630
|
+
* * **Mod-`** for toggling [code font](#schema-basic.CodeMark)
|
|
631
|
+
* * **Ctrl-Shift-0** for making the current textblock a paragraph
|
|
632
|
+
* * **Ctrl-Shift-1** to **Ctrl-Shift-Digit6** for making the current
|
|
633
|
+
* textblock a heading of the corresponding level
|
|
634
|
+
* * **Ctrl-Shift-Backslash** to make the current textblock a code block
|
|
635
|
+
* * **Ctrl-Shift-8** to wrap the selection in an ordered list
|
|
636
|
+
* * **Ctrl-Shift-9** to wrap the selection in a bullet list
|
|
637
|
+
* * **Ctrl->** to wrap the selection in a block quote
|
|
638
|
+
* * **Enter** to split a non-empty textblock in a list item while at
|
|
639
|
+
* the same time splitting the list item
|
|
640
|
+
* * **Mod-Enter** to insert a hard break
|
|
641
|
+
* * **Mod-_** to insert a horizontal rule
|
|
642
|
+
* * **Backspace** to undo an input rule
|
|
643
|
+
* * **Alt-ArrowUp** to `joinUp`
|
|
644
|
+
* * **Alt-ArrowDown** to `joinDown`
|
|
645
|
+
* * **Mod-BracketLeft** to `lift`
|
|
646
|
+
* * **Escape** to `selectParentNode`
|
|
647
|
+
*
|
|
648
|
+
* You can suppress or map these bindings by passing a `mapKeys`
|
|
649
|
+
* argument, which maps key names (say `"Mod-B"` to either `false`, to
|
|
650
|
+
* remove the binding, or a new key name string.
|
|
651
|
+
*/
|
|
652
|
+
function buildKeymap(schema, isMac) {
|
|
653
|
+
const keys = {};
|
|
654
|
+
keys['Mod-z'] = undo;
|
|
655
|
+
keys['Shift-Mod-z'] = redo;
|
|
656
|
+
keys['Backspace'] = undoInputRule;
|
|
657
|
+
if (!isMac) {
|
|
658
|
+
keys['Mod-y'] = redo;
|
|
659
|
+
}
|
|
660
|
+
keys['Alt-ArrowUp'] = joinUp;
|
|
661
|
+
keys['Alt-ArrowDown'] = joinDown;
|
|
662
|
+
keys['Mod-BracketLeft'] = lift;
|
|
663
|
+
keys['Escape'] = selectParentNode;
|
|
664
|
+
let type = schema.marks.strong;
|
|
665
|
+
if (type) {
|
|
666
|
+
keys['Mod-b'] = toggleMark(type);
|
|
667
|
+
keys['Mod-B'] = toggleMark(type);
|
|
668
|
+
}
|
|
669
|
+
type = schema.marks.em;
|
|
670
|
+
if (type) {
|
|
671
|
+
keys['Mod-i'] = toggleMark(type);
|
|
672
|
+
keys['Mod-I'] = toggleMark(type);
|
|
673
|
+
}
|
|
674
|
+
type = schema.marks.code;
|
|
675
|
+
if (type) {
|
|
676
|
+
keys['Mod-`'] = toggleMark(type);
|
|
677
|
+
}
|
|
678
|
+
type = schema.nodes.bullet_list;
|
|
679
|
+
if (type) {
|
|
680
|
+
keys['Shift-Ctrl-8'] = wrapInList(type);
|
|
681
|
+
}
|
|
682
|
+
type = schema.nodes.ordered_list;
|
|
683
|
+
if (type) {
|
|
684
|
+
keys['Shift-Ctrl-9'] = wrapInList(type);
|
|
685
|
+
}
|
|
686
|
+
type = schema.nodes.blockquote;
|
|
687
|
+
if (type) {
|
|
688
|
+
keys['Ctrl->'] = wrapIn(type);
|
|
689
|
+
}
|
|
690
|
+
type = schema.nodes.hard_break;
|
|
691
|
+
if (type) {
|
|
692
|
+
const br = type;
|
|
693
|
+
const cmd = chainCommands(exitCode, (state, dispatch) => {
|
|
694
|
+
dispatch === null || dispatch === void 0 ? void 0 : dispatch(state.tr.replaceSelectionWith(br.create()).scrollIntoView());
|
|
695
|
+
return true;
|
|
696
|
+
});
|
|
697
|
+
keys['Mod-Enter'] = cmd;
|
|
698
|
+
keys['Shift-Enter'] = cmd;
|
|
699
|
+
if (isMac) {
|
|
700
|
+
keys['Ctrl-Enter'] = cmd;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
type = schema.nodes.list_item;
|
|
704
|
+
if (type) {
|
|
705
|
+
keys['Enter'] = splitListItem(type);
|
|
706
|
+
keys['Mod-['] = liftListItem(type);
|
|
707
|
+
keys['Mod-]'] = sinkListItem(type);
|
|
708
|
+
}
|
|
709
|
+
type = schema.nodes.paragraph;
|
|
710
|
+
if (type) {
|
|
711
|
+
keys['Shift-Ctrl-0'] = setBlockType(type);
|
|
712
|
+
}
|
|
713
|
+
type = schema.nodes.code_block;
|
|
714
|
+
if (type) {
|
|
715
|
+
keys['Shift-Ctrl-\\'] = setBlockType(type);
|
|
716
|
+
}
|
|
717
|
+
type = schema.nodes.heading;
|
|
718
|
+
if (type) {
|
|
719
|
+
for (let i = 1; i <= 6; i++) {
|
|
720
|
+
keys['Shift-Ctrl-' + i] = setBlockType(type, { level: i });
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
type = schema.nodes.horizontal_rule;
|
|
724
|
+
if (type) {
|
|
725
|
+
const hr = type;
|
|
726
|
+
keys['Mod-_'] = (state, dispatch) => {
|
|
727
|
+
dispatch === null || dispatch === void 0 ? void 0 : dispatch(state.tr.replaceSelectionWith(hr.create()).scrollIntoView());
|
|
728
|
+
return true;
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
return keys;
|
|
732
|
+
}
|
|
733
|
+
|
|
425
734
|
/**
|
|
426
735
|
* Prosemirror component
|
|
427
736
|
*
|
|
@@ -508,8 +817,26 @@ class NaturalEditorComponent {
|
|
|
508
817
|
}
|
|
509
818
|
const parser = DOMParser.fromSchema(this.schema);
|
|
510
819
|
const doc = parser.parse(template.firstChild);
|
|
820
|
+
return EditorState.create({
|
|
821
|
+
doc: doc,
|
|
822
|
+
plugins: this.createPlugins(),
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
createPlugins() {
|
|
826
|
+
var _a;
|
|
827
|
+
const isMac = !!((_a = this.document.defaultView) === null || _a === void 0 ? void 0 : _a.navigator.platform.match(/Mac/));
|
|
511
828
|
const plugins = [
|
|
512
|
-
|
|
829
|
+
buildInputRules(this.schema),
|
|
830
|
+
keymap(buildKeymap(this.schema, isMac)),
|
|
831
|
+
keymap(baseKeymap),
|
|
832
|
+
dropCursor(),
|
|
833
|
+
gapCursor(),
|
|
834
|
+
history(),
|
|
835
|
+
new Plugin({
|
|
836
|
+
props: {
|
|
837
|
+
attributes: { class: 'ProseMirror-example-setup-style' },
|
|
838
|
+
},
|
|
839
|
+
}),
|
|
513
840
|
new Plugin({
|
|
514
841
|
view: () => this,
|
|
515
842
|
}),
|
|
@@ -520,10 +847,7 @@ class NaturalEditorComponent {
|
|
|
520
847
|
'Shift-Tab': goToNextCell(-1),
|
|
521
848
|
}));
|
|
522
849
|
}
|
|
523
|
-
return
|
|
524
|
-
doc: doc,
|
|
525
|
-
plugins: plugins,
|
|
526
|
-
});
|
|
850
|
+
return plugins;
|
|
527
851
|
}
|
|
528
852
|
/**
|
|
529
853
|
* Called by Prosemirror whenever the editor state changes. So we update our menu states.
|
|
@@ -571,7 +895,7 @@ class NaturalEditorComponent {
|
|
|
571
895
|
}
|
|
572
896
|
}
|
|
573
897
|
NaturalEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: NaturalEditorComponent, deps: [{ token: i4.NgControl, optional: true, self: true }, { token: DOCUMENT }, { token: i1.MatDialog }, { token: ImagePlugin }], target: i0.ɵɵFactoryTarget.Component });
|
|
574
|
-
NaturalEditorComponent.ɵcmp = i0.ɵɵ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: ElementRef, static: true }], ngImport: i0, template: "<div class=\"menu-container\" *ngIf=\"menu\">\n <div class=\"menu\">\n <button mat-button *ngIf=\"save.observed\" (click)=\"save.emit()\" i18n-matTooltip matTooltip=\"Enregistrer\">\n <mat-icon>save</mat-icon>\n </button>\n\n <mat-button-toggle-group multiple>\n <mat-button-toggle\n *ngIf=\"menu.toggleStrong\"\n [disabled]=\"menu.toggleStrong.disabled\"\n [checked]=\"menu.toggleStrong.active\"\n (click)=\"run($event, 'toggleStrong')\"\n i18n-matTooltip\n matTooltip=\"Gras\"\n >\n <mat-icon>format_bold</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.toggleEm\"\n [disabled]=\"menu.toggleEm.disabled\"\n [checked]=\"menu.toggleEm.active\"\n (click)=\"run($event, 'toggleEm')\"\n i18n-matTooltip\n matTooltip=\"Italique\"\n >\n <mat-icon>format_italic</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.toggleCode\"\n [disabled]=\"menu.toggleCode.disabled\"\n [checked]=\"menu.toggleCode.active\"\n (click)=\"run($event, 'toggleCode')\"\n i18n-matTooltip\n matTooltip=\"Code\"\n >\n <mat-icon>code</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.toggleLink\"\n [disabled]=\"menu.toggleLink.disabled\"\n [checked]=\"menu.toggleLink.active\"\n (click)=\"run($event, 'toggleLink')\"\n i18n-matTooltip\n matTooltip=\"Ins\u00E9rer un lien...\"\n >\n <mat-icon>insert_link</mat-icon>\n </mat-button-toggle>\n </mat-button-toggle-group>\n\n <button mat-button [matMenuTriggerFor]=\"blockMenu\">\n <span i18n>Type</span>\n <mat-icon>arrow_drop_down</mat-icon>\n </button>\n\n <mat-menu #blockMenu=\"matMenu\">\n <button\n mat-menu-item\n *ngIf=\"menu.makeParagraph\"\n [disabled]=\"menu.makeParagraph.disabled\"\n (click)=\"run($event, 'makeParagraph')\"\n i18n\n >Paragraphe\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeCodeBlock\"\n [disabled]=\"menu.makeCodeBlock.disabled\"\n (click)=\"run($event, 'makeCodeBlock')\"\n i18n\n >Code\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead1\"\n [disabled]=\"menu.makeHead1.disabled\"\n (click)=\"run($event, 'makeHead1')\"\n i18n\n >Titre 1\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead2\"\n [disabled]=\"menu.makeHead2.disabled\"\n (click)=\"run($event, 'makeHead2')\"\n i18n\n >Titre 2\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead3\"\n [disabled]=\"menu.makeHead3.disabled\"\n (click)=\"run($event, 'makeHead3')\"\n i18n\n >Titre 3\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead4\"\n [disabled]=\"menu.makeHead4.disabled\"\n (click)=\"run($event, 'makeHead4')\"\n i18n\n >Titre 4\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead5\"\n [disabled]=\"menu.makeHead5.disabled\"\n (click)=\"run($event, 'makeHead5')\"\n i18n\n >Titre 5\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead6\"\n [disabled]=\"menu.makeHead6.disabled\"\n (click)=\"run($event, 'makeHead6')\"\n i18n\n >Titre 6\n </button>\n </mat-menu>\n\n <button mat-button [matMenuTriggerFor]=\"tableMenu\" *ngIf=\"menu.addColumnBefore\">\n <span i18n>Tableau</span>\n <mat-icon>arrow_drop_down</mat-icon>\n </button>\n\n <mat-menu #tableMenu=\"matMenu\">\n <button\n mat-menu-item\n *ngIf=\"menu.insertTable\"\n [disabled]=\"menu.insertTable.disabled\"\n (click)=\"run($event, 'insertTable')\"\n i18n\n >Ins\u00E9rer un tableau\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.deleteTable\"\n [disabled]=\"menu.deleteTable.disabled\"\n (click)=\"run($event, 'deleteTable')\"\n i18n\n >Supprimer le tableau\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.mergeCells\"\n [disabled]=\"menu.mergeCells.disabled\"\n (click)=\"run($event, 'mergeCells')\"\n i18n\n >Fusionner les cellules\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.splitCell\"\n [disabled]=\"menu.splitCell.disabled\"\n (click)=\"run($event, 'splitCell')\"\n i18n\n >Scinder les cellules\n </button>\n\n <mat-divider></mat-divider>\n\n <button\n mat-menu-item\n *ngIf=\"menu.addColumnBefore\"\n [disabled]=\"menu.addColumnBefore.disabled\"\n (click)=\"run($event, 'addColumnBefore')\"\n i18n\n >Ins\u00E9rer une colonne avant\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.addColumnAfter\"\n [disabled]=\"menu.addColumnAfter.disabled\"\n (click)=\"run($event, 'addColumnAfter')\"\n i18n\n >Ins\u00E9rer une colonne apr\u00E8s\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.deleteColumn\"\n [disabled]=\"menu.deleteColumn.disabled\"\n (click)=\"run($event, 'deleteColumn')\"\n i18n\n >Supprimer la colonne\n </button>\n\n <mat-divider></mat-divider>\n\n <button\n mat-menu-item\n *ngIf=\"menu.addRowBefore\"\n [disabled]=\"menu.addRowBefore.disabled\"\n (click)=\"run($event, 'addRowBefore')\"\n i18n\n >Ins\u00E9rer une ligne avant\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.addRowAfter\"\n [disabled]=\"menu.addRowAfter.disabled\"\n (click)=\"run($event, 'addRowAfter')\"\n i18n\n >Ins\u00E9rer une ligne apr\u00E8s\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.deleteRow\"\n [disabled]=\"menu.deleteRow.disabled\"\n (click)=\"run($event, 'deleteRow')\"\n i18n\n >Supprimer la ligne\n </button>\n\n <mat-divider></mat-divider>\n\n <button\n mat-menu-item\n *ngIf=\"menu.toggleHeaderColumn\"\n [disabled]=\"menu.toggleHeaderColumn.disabled\"\n (click)=\"run($event, 'toggleHeaderColumn')\"\n i18n\n >Ent\u00EAte de colonne\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.toggleHeaderRow\"\n [disabled]=\"menu.toggleHeaderRow.disabled\"\n (click)=\"run($event, 'toggleHeaderRow')\"\n i18n\n >Ent\u00EAte de ligne\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.toggleHeaderCell\"\n [disabled]=\"menu.toggleHeaderCell.disabled\"\n (click)=\"run($event, 'toggleHeaderCell')\"\n i18n\n >Ent\u00EAte de cellule\n </button>\n </mat-menu>\n\n <button\n mat-button\n *ngIf=\"imageUploader\"\n naturalFileDrop\n [selectable]=\"true\"\n [broadcast]=\"false\"\n i18n-matTooltip\n matTooltip=\"Ins\u00E9rer une image\"\n (fileChange)=\"upload($event)\"\n >\n <mat-icon>insert_photo</mat-icon>\n </button>\n\n <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.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i5$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i6$1.MatButtonToggle, selector: "mat-button-toggle", inputs: ["disableRipple", "aria-labelledby", "tabIndex", "appearance", "checked", "disabled", "id", "name", "aria-label", "value"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { type: i7.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { type: i7.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { type: i8.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i6$1.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { type: i7.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { type: i11.NaturalFileDropDirective, selector: ":not([naturalFileSelect])[naturalFileDrop]", outputs: ["fileOver"] }] });
|
|
898
|
+
NaturalEditorComponent.ɵcmp = i0.ɵɵ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: ElementRef, static: true }], ngImport: i0, template: "<div class=\"menu-container\" *ngIf=\"menu\">\n <div class=\"menu\">\n <button mat-button *ngIf=\"save.observed\" (click)=\"save.emit()\" i18n-matTooltip matTooltip=\"Enregistrer\">\n <mat-icon>save</mat-icon>\n </button>\n\n <mat-button-toggle-group multiple>\n <mat-button-toggle\n *ngIf=\"menu.toggleStrong\"\n [disabled]=\"menu.toggleStrong.disabled\"\n [checked]=\"menu.toggleStrong.active\"\n (click)=\"run($event, 'toggleStrong')\"\n i18n-matTooltip\n matTooltip=\"Gras\"\n >\n <mat-icon>format_bold</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.toggleEm\"\n [disabled]=\"menu.toggleEm.disabled\"\n [checked]=\"menu.toggleEm.active\"\n (click)=\"run($event, 'toggleEm')\"\n i18n-matTooltip\n matTooltip=\"Italique\"\n >\n <mat-icon>format_italic</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.toggleCode\"\n [disabled]=\"menu.toggleCode.disabled\"\n [checked]=\"menu.toggleCode.active\"\n (click)=\"run($event, 'toggleCode')\"\n i18n-matTooltip\n matTooltip=\"Code\"\n >\n <mat-icon>code</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.toggleLink\"\n [disabled]=\"menu.toggleLink.disabled\"\n [checked]=\"menu.toggleLink.active\"\n (click)=\"run($event, 'toggleLink')\"\n i18n-matTooltip\n matTooltip=\"Ins\u00E9rer un lien...\"\n >\n <mat-icon>insert_link</mat-icon>\n </mat-button-toggle>\n </mat-button-toggle-group>\n\n <button mat-button [matMenuTriggerFor]=\"blockMenu\">\n <span i18n>Type</span>\n <mat-icon>arrow_drop_down</mat-icon>\n </button>\n\n <mat-menu #blockMenu=\"matMenu\">\n <button\n mat-menu-item\n *ngIf=\"menu.makeParagraph\"\n [disabled]=\"menu.makeParagraph.disabled\"\n (click)=\"run($event, 'makeParagraph')\"\n i18n\n >Paragraphe\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeCodeBlock\"\n [disabled]=\"menu.makeCodeBlock.disabled\"\n (click)=\"run($event, 'makeCodeBlock')\"\n i18n\n >Code\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead1\"\n [disabled]=\"menu.makeHead1.disabled\"\n (click)=\"run($event, 'makeHead1')\"\n i18n\n >Titre 1\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead2\"\n [disabled]=\"menu.makeHead2.disabled\"\n (click)=\"run($event, 'makeHead2')\"\n i18n\n >Titre 2\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead3\"\n [disabled]=\"menu.makeHead3.disabled\"\n (click)=\"run($event, 'makeHead3')\"\n i18n\n >Titre 3\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead4\"\n [disabled]=\"menu.makeHead4.disabled\"\n (click)=\"run($event, 'makeHead4')\"\n i18n\n >Titre 4\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead5\"\n [disabled]=\"menu.makeHead5.disabled\"\n (click)=\"run($event, 'makeHead5')\"\n i18n\n >Titre 5\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.makeHead6\"\n [disabled]=\"menu.makeHead6.disabled\"\n (click)=\"run($event, 'makeHead6')\"\n i18n\n >Titre 6\n </button>\n </mat-menu>\n\n <button mat-button [matMenuTriggerFor]=\"tableMenu\" *ngIf=\"menu.addColumnBefore\">\n <span i18n>Tableau</span>\n <mat-icon>arrow_drop_down</mat-icon>\n </button>\n\n <mat-menu #tableMenu=\"matMenu\">\n <button\n mat-menu-item\n *ngIf=\"menu.insertTable\"\n [disabled]=\"menu.insertTable.disabled\"\n (click)=\"run($event, 'insertTable')\"\n i18n\n >Ins\u00E9rer un tableau\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.deleteTable\"\n [disabled]=\"menu.deleteTable.disabled\"\n (click)=\"run($event, 'deleteTable')\"\n i18n\n >Supprimer le tableau\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.mergeCells\"\n [disabled]=\"menu.mergeCells.disabled\"\n (click)=\"run($event, 'mergeCells')\"\n i18n\n >Fusionner les cellules\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.splitCell\"\n [disabled]=\"menu.splitCell.disabled\"\n (click)=\"run($event, 'splitCell')\"\n i18n\n >Scinder les cellules\n </button>\n\n <mat-divider></mat-divider>\n\n <button\n mat-menu-item\n *ngIf=\"menu.addColumnBefore\"\n [disabled]=\"menu.addColumnBefore.disabled\"\n (click)=\"run($event, 'addColumnBefore')\"\n i18n\n >Ins\u00E9rer une colonne avant\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.addColumnAfter\"\n [disabled]=\"menu.addColumnAfter.disabled\"\n (click)=\"run($event, 'addColumnAfter')\"\n i18n\n >Ins\u00E9rer une colonne apr\u00E8s\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.deleteColumn\"\n [disabled]=\"menu.deleteColumn.disabled\"\n (click)=\"run($event, 'deleteColumn')\"\n i18n\n >Supprimer la colonne\n </button>\n\n <mat-divider></mat-divider>\n\n <button\n mat-menu-item\n *ngIf=\"menu.addRowBefore\"\n [disabled]=\"menu.addRowBefore.disabled\"\n (click)=\"run($event, 'addRowBefore')\"\n i18n\n >Ins\u00E9rer une ligne avant\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.addRowAfter\"\n [disabled]=\"menu.addRowAfter.disabled\"\n (click)=\"run($event, 'addRowAfter')\"\n i18n\n >Ins\u00E9rer une ligne apr\u00E8s\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.deleteRow\"\n [disabled]=\"menu.deleteRow.disabled\"\n (click)=\"run($event, 'deleteRow')\"\n i18n\n >Supprimer la ligne\n </button>\n\n <mat-divider></mat-divider>\n\n <button\n mat-menu-item\n *ngIf=\"menu.toggleHeaderColumn\"\n [disabled]=\"menu.toggleHeaderColumn.disabled\"\n (click)=\"run($event, 'toggleHeaderColumn')\"\n i18n\n >Ent\u00EAte de colonne\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.toggleHeaderRow\"\n [disabled]=\"menu.toggleHeaderRow.disabled\"\n (click)=\"run($event, 'toggleHeaderRow')\"\n i18n\n >Ent\u00EAte de ligne\n </button>\n <button\n mat-menu-item\n *ngIf=\"menu.toggleHeaderCell\"\n [disabled]=\"menu.toggleHeaderCell.disabled\"\n (click)=\"run($event, 'toggleHeaderCell')\"\n i18n\n >Ent\u00EAte de cellule\n </button>\n </mat-menu>\n\n <button\n mat-button\n *ngIf=\"imageUploader\"\n naturalFileDrop\n [selectable]=\"true\"\n [broadcast]=\"false\"\n i18n-matTooltip\n matTooltip=\"Ins\u00E9rer une image\"\n (fileChange)=\"upload($event)\"\n >\n <mat-icon>insert_photo</mat-icon>\n </button>\n\n <mat-button-toggle-group *ngIf=\"menu.alignLeft\">\n <mat-button-toggle\n *ngIf=\"menu.alignLeft\"\n [disabled]=\"menu.alignLeft.disabled\"\n [checked]=\"menu.alignLeft.active\"\n (click)=\"run($event, 'alignLeft')\"\n i18n-matTooltip\n matTooltip=\"Aligner gauche\"\n >\n <mat-icon>format_align_left</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.alignCenter\"\n [disabled]=\"menu.alignCenter.disabled\"\n [checked]=\"menu.alignCenter.active\"\n (click)=\"run($event, 'alignCenter')\"\n i18n-matTooltip\n matTooltip=\"Centrer\"\n >\n <mat-icon>format_align_center</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.alignRight\"\n [disabled]=\"menu.alignRight.disabled\"\n [checked]=\"menu.alignRight.active\"\n (click)=\"run($event, 'alignRight')\"\n i18n-matTooltip\n matTooltip=\"Aligner droite\"\n >\n <mat-icon>format_align_right</mat-icon>\n </mat-button-toggle>\n\n <mat-button-toggle\n *ngIf=\"menu.alignJustify\"\n [disabled]=\"menu.alignJustify.disabled\"\n [checked]=\"menu.alignJustify.active\"\n (click)=\"run($event, 'alignJustify')\"\n i18n-matTooltip\n matTooltip=\"Justifier\"\n >\n <mat-icon>format_align_justify</mat-icon>\n </mat-button-toggle>\n </mat-button-toggle-group>\n\n <button\n mat-button\n *ngIf=\"menu.undo\"\n [disabled]=\"menu.undo.disabled\"\n (click)=\"run($event, 'undo')\"\n i18n-matTooltip\n matTooltip=\"Annuler\"\n >\n <mat-icon>undo</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.redo\"\n [disabled]=\"menu.redo.disabled\"\n (click)=\"run($event, 'redo')\"\n i18n-matTooltip\n matTooltip=\"Refaire\"\n >\n <mat-icon>redo</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.wrapBulletList && menu.wrapBulletList.show\"\n [disabled]=\"menu.wrapBulletList.disabled\"\n (click)=\"run($event, 'wrapBulletList')\"\n i18n-matTooltip\n matTooltip=\"Liste \u00E0 puce\"\n >\n <mat-icon>format_list_bulleted</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.wrapOrderedList && menu.wrapOrderedList.show\"\n [disabled]=\"menu.wrapOrderedList.disabled\"\n (click)=\"run($event, 'wrapOrderedList')\"\n i18n-matTooltip\n matTooltip=\"Liste \u00E0 num\u00E9ro\"\n >\n <mat-icon>format_list_numbered</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.wrapBlockQuote && menu.wrapBlockQuote.show\"\n [disabled]=\"menu.wrapBlockQuote.disabled\"\n (click)=\"run($event, 'wrapBlockQuote')\"\n i18n-matTooltip\n matTooltip=\"Citation\"\n >\n <mat-icon>format_quote</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.joinUp && menu.joinUp.show\"\n [disabled]=\"menu.joinUp.disabled\"\n (click)=\"run($event, 'joinUp')\"\n i18n-matTooltip\n matTooltip=\"Fusionner avec l'\u00E9l\u00E9ment du haut\"\n >\n <mat-icon>move_up</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.lift && menu.lift.show\"\n [disabled]=\"menu.lift.disabled\"\n (click)=\"run($event, 'lift')\"\n i18n-matTooltip\n matTooltip=\"D\u00E9sindenter\"\n >\n <mat-icon>format_indent_decrease</mat-icon>\n </button>\n\n <button\n mat-button\n *ngIf=\"menu.selectParentNode && menu.selectParentNode.show\"\n [disabled]=\"menu.selectParentNode.disabled\"\n (click)=\"run($event, 'selectParentNode')\"\n i18n-matTooltip\n matTooltip=\"S\u00E9lectionner l'\u00E9l\u00E9ment parent\"\n >\n <mat-icon>select_all</mat-icon>\n </button>\n </div>\n</div>\n<div #editor></div>\n", styles: [".menu{border-bottom:1px solid;display:flex;flex-wrap:wrap;padding:10px 18px}.menu-container{position:sticky;top:-20px;z-index:999}::ng-deep .ProseMirror{position:relative}::ng-deep .ProseMirror{word-wrap:break-word;white-space:pre-wrap;-webkit-font-variant-ligatures:none;font-feature-settings:none;font-variant-ligatures:none}::ng-deep .ProseMirror pre{white-space:pre-wrap}::ng-deep .ProseMirror li{position:relative}::ng-deep .ProseMirror-hideselection *::selection{background:transparent}::ng-deep .ProseMirror-hideselection *::-moz-selection{background:transparent}::ng-deep .ProseMirror-hideselection{caret-color:transparent}::ng-deep .ProseMirror-selectednode{outline:2px solid #8cf}::ng-deep li.ProseMirror-selectednode{outline:none}::ng-deep li.ProseMirror-selectednode:after{content:\"\";position:absolute;left:-32px;right:-2px;top:-2px;bottom:-2px;border:2px solid #8cf;pointer-events:none}::ng-deep .ProseMirror-gapcursor{display:none;pointer-events:none;position:absolute}::ng-deep .ProseMirror-gapcursor:after{content:\"\";display:block;position:absolute;top:-2px;width:20px;border-top:1px solid black;animation:ProseMirror-cursor-blink 1.1s steps(2,start) infinite}@keyframes ProseMirror-cursor-blink{to{visibility:hidden}}::ng-deep .ProseMirror-focused .ProseMirror-gapcursor{display:block}::ng-deep .ProseMirror-example-setup-style hr{padding:2px 10px;border:none;margin:1em 0}::ng-deep .ProseMirror-example-setup-style hr:after{content:\"\";display:block;height:1px;background-color:silver;line-height:2px}::ng-deep .ProseMirror ul,::ng-deep .ProseMirror ol{padding-left:30px}::ng-deep .ProseMirror blockquote{padding-left:1em;border-left:3px solid #eee;margin-left:0;margin-right:0}::ng-deep .ProseMirror-example-setup-style img{cursor:default}::ng-deep .ProseMirror p:first-child,::ng-deep .ProseMirror h1:first-child,::ng-deep .ProseMirror h2:first-child,::ng-deep .ProseMirror h3:first-child,::ng-deep .ProseMirror h4:first-child,::ng-deep .ProseMirror h5:first-child,::ng-deep .ProseMirror h6:first-child{margin-top:10px}::ng-deep .ProseMirror{padding:4px 8px 4px 14px;line-height:1.2;outline:none}::ng-deep .ProseMirror p{margin-bottom:1em}::ng-deep .ProseMirror .tableWrapper{overflow-x:auto}::ng-deep .ProseMirror table{border-collapse:collapse;table-layout:fixed;width:100%;overflow:hidden}::ng-deep .ProseMirror td,::ng-deep .ProseMirror th{vertical-align:top;box-sizing:border-box;position:relative}::ng-deep .ProseMirror .column-resize-handle{position:absolute;right:-2px;top:0;bottom:0;width:4px;z-index:20;background-color:#adf;pointer-events:none}::ng-deep .ProseMirror.resize-cursor{cursor:col-resize}::ng-deep .ProseMirror .selectedCell:after{z-index:2;position:absolute;content:\"\";left:0;right:0;top:0;bottom:0;background:rgba(200,200,255,.4);pointer-events:none}::ng-deep .ProseMirror table{margin:0}::ng-deep .ProseMirror th,::ng-deep .ProseMirror td{min-width:1em;border:1px solid #ddd;padding:3px 5px}::ng-deep .ProseMirror .tableWrapper{margin:1em 0}::ng-deep .ProseMirror th{font-weight: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.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { type: i5$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i6$1.MatButtonToggle, selector: "mat-button-toggle", inputs: ["disableRipple", "aria-labelledby", "tabIndex", "appearance", "checked", "disabled", "id", "name", "aria-label", "value"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { type: i7.MatMenu, selector: "mat-menu", exportAs: ["matMenu"] }, { type: i7.MatMenuItem, selector: "[mat-menu-item]", inputs: ["disabled", "disableRipple", "role"], exportAs: ["matMenuItem"] }, { type: i8.MatDivider, selector: "mat-divider", inputs: ["vertical", "inset"] }], directives: [{ type: i6.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i10.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { type: i6$1.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { type: i7.MatMenuTrigger, selector: "[mat-menu-trigger-for], [matMenuTriggerFor]", exportAs: ["matMenuTrigger"] }, { type: i11.NaturalFileDropDirective, selector: ":not([naturalFileSelect])[naturalFileDrop]", outputs: ["fileOver"] }] });
|
|
575
899
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.9", ngImport: i0, type: NaturalEditorComponent, decorators: [{
|
|
576
900
|
type: Component,
|
|
577
901
|
args: [{
|