@ecodev/natural-editor 41.2.0 → 41.2.1

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.
@@ -3,16 +3,15 @@ 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
5
  import { Plugin, TextSelection, EditorState } from 'prosemirror-state';
6
- import { exampleSetup } from 'prosemirror-example-setup';
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';
@@ -422,6 +425,186 @@ function buildMenuItems(schema, dialog) {
422
425
  return r;
423
426
  }
424
427
 
428
+ /**
429
+ * Given a blockquote node type, returns an input rule that turns `"> "`
430
+ * at the start of a textblock into a blockquote.
431
+ */
432
+ function blockQuoteRule(nodeType) {
433
+ return wrappingInputRule(/^\s*>\s$/, nodeType);
434
+ }
435
+ /**
436
+ * Given a list node type, returns an input rule that turns a number
437
+ * followed by a dot at the start of a textblock into an ordered list.
438
+ */
439
+ function orderedListRule(nodeType) {
440
+ return wrappingInputRule(/^(\d+)\.\s$/, nodeType, match => ({ order: +match[1] }), (match, node) => node.childCount + node.attrs.order === +match[1]);
441
+ }
442
+ /**
443
+ * Given a list node type, returns an input rule that turns a bullet
444
+ * (dash, plush, or asterisk) at the start of a textblock into a
445
+ * bullet list.
446
+ */
447
+ function bulletListRule(nodeType) {
448
+ return wrappingInputRule(/^\s*([-+*])\s$/, nodeType);
449
+ }
450
+ /**
451
+ * Given a code block node type, returns an input rule that turns a
452
+ * textblock starting with three backticks into a code block.
453
+ */
454
+ function codeBlockRule(nodeType) {
455
+ return textblockTypeInputRule(/^```$/, nodeType);
456
+ }
457
+ /**
458
+ * Given a node type and a maximum level, creates an input rule that
459
+ * turns up to that number of `#` characters followed by a space at
460
+ * the start of a textblock into a heading whose level corresponds to
461
+ * the number of `#` signs.
462
+ */
463
+ function headingRule(nodeType, maxLevel) {
464
+ return textblockTypeInputRule(new RegExp('^(#{1,' + maxLevel + '})\\s$'), nodeType, match => ({
465
+ level: match[1].length,
466
+ }));
467
+ }
468
+ /**
469
+ * A set of input rules for creating the basic block quotes, lists,
470
+ * code blocks, and heading.
471
+ */
472
+ function buildInputRules(schema) {
473
+ const rules = [ellipsis, emDash];
474
+ let type = schema.nodes.blockquote;
475
+ if (type) {
476
+ rules.push(blockQuoteRule(type));
477
+ }
478
+ type = schema.nodes.ordered_list;
479
+ if (type) {
480
+ rules.push(orderedListRule(type));
481
+ }
482
+ type = schema.nodes.bullet_list;
483
+ if (type) {
484
+ rules.push(bulletListRule(type));
485
+ }
486
+ type = schema.nodes.code_block;
487
+ if (type) {
488
+ rules.push(codeBlockRule(type));
489
+ }
490
+ type = schema.nodes.heading;
491
+ if (type) {
492
+ rules.push(headingRule(type, 6));
493
+ }
494
+ return inputRules({ rules });
495
+ }
496
+
497
+ /**
498
+ * Inspect the given schema looking for marks and nodes from the
499
+ * basic schema, and if found, add key bindings related to them.
500
+ * This will add:
501
+ *
502
+ * * **Mod-b** for toggling [strong](#schema-basic.StrongMark)
503
+ * * **Mod-i** for toggling [emphasis](#schema-basic.EmMark)
504
+ * * **Mod-`** for toggling [code font](#schema-basic.CodeMark)
505
+ * * **Ctrl-Shift-0** for making the current textblock a paragraph
506
+ * * **Ctrl-Shift-1** to **Ctrl-Shift-Digit6** for making the current
507
+ * textblock a heading of the corresponding level
508
+ * * **Ctrl-Shift-Backslash** to make the current textblock a code block
509
+ * * **Ctrl-Shift-8** to wrap the selection in an ordered list
510
+ * * **Ctrl-Shift-9** to wrap the selection in a bullet list
511
+ * * **Ctrl->** to wrap the selection in a block quote
512
+ * * **Enter** to split a non-empty textblock in a list item while at
513
+ * the same time splitting the list item
514
+ * * **Mod-Enter** to insert a hard break
515
+ * * **Mod-_** to insert a horizontal rule
516
+ * * **Backspace** to undo an input rule
517
+ * * **Alt-ArrowUp** to `joinUp`
518
+ * * **Alt-ArrowDown** to `joinDown`
519
+ * * **Mod-BracketLeft** to `lift`
520
+ * * **Escape** to `selectParentNode`
521
+ *
522
+ * You can suppress or map these bindings by passing a `mapKeys`
523
+ * argument, which maps key names (say `"Mod-B"` to either `false`, to
524
+ * remove the binding, or a new key name string.
525
+ */
526
+ function buildKeymap(schema, isMac) {
527
+ const keys = {};
528
+ keys['Mod-z'] = undo;
529
+ keys['Shift-Mod-z'] = redo;
530
+ keys['Backspace'] = undoInputRule;
531
+ if (!isMac) {
532
+ keys['Mod-y'] = redo;
533
+ }
534
+ keys['Alt-ArrowUp'] = joinUp;
535
+ keys['Alt-ArrowDown'] = joinDown;
536
+ keys['Mod-BracketLeft'] = lift;
537
+ keys['Escape'] = selectParentNode;
538
+ let type = schema.marks.strong;
539
+ if (type) {
540
+ keys['Mod-b'] = toggleMark(type);
541
+ keys['Mod-B'] = toggleMark(type);
542
+ }
543
+ type = schema.marks.em;
544
+ if (type) {
545
+ keys['Mod-i'] = toggleMark(type);
546
+ keys['Mod-I'] = toggleMark(type);
547
+ }
548
+ type = schema.marks.code;
549
+ if (type) {
550
+ keys['Mod-`'] = toggleMark(type);
551
+ }
552
+ type = schema.nodes.bullet_list;
553
+ if (type) {
554
+ keys['Shift-Ctrl-8'] = wrapInList(type);
555
+ }
556
+ type = schema.nodes.ordered_list;
557
+ if (type) {
558
+ keys['Shift-Ctrl-9'] = wrapInList(type);
559
+ }
560
+ type = schema.nodes.blockquote;
561
+ if (type) {
562
+ keys['Ctrl->'] = wrapIn(type);
563
+ }
564
+ type = schema.nodes.hard_break;
565
+ if (type) {
566
+ const br = type;
567
+ const cmd = chainCommands(exitCode, (state, dispatch) => {
568
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch(state.tr.replaceSelectionWith(br.create()).scrollIntoView());
569
+ return true;
570
+ });
571
+ keys['Mod-Enter'] = cmd;
572
+ keys['Shift-Enter'] = cmd;
573
+ if (isMac) {
574
+ keys['Ctrl-Enter'] = cmd;
575
+ }
576
+ }
577
+ type = schema.nodes.list_item;
578
+ if (type) {
579
+ keys['Enter'] = splitListItem(type);
580
+ keys['Mod-['] = liftListItem(type);
581
+ keys['Mod-]'] = sinkListItem(type);
582
+ }
583
+ type = schema.nodes.paragraph;
584
+ if (type) {
585
+ keys['Shift-Ctrl-0'] = setBlockType(type);
586
+ }
587
+ type = schema.nodes.code_block;
588
+ if (type) {
589
+ keys['Shift-Ctrl-\\'] = setBlockType(type);
590
+ }
591
+ type = schema.nodes.heading;
592
+ if (type) {
593
+ for (let i = 1; i <= 6; i++) {
594
+ keys['Shift-Ctrl-' + i] = setBlockType(type, { level: i });
595
+ }
596
+ }
597
+ type = schema.nodes.horizontal_rule;
598
+ if (type) {
599
+ const hr = type;
600
+ keys['Mod-_'] = (state, dispatch) => {
601
+ dispatch === null || dispatch === void 0 ? void 0 : dispatch(state.tr.replaceSelectionWith(hr.create()).scrollIntoView());
602
+ return true;
603
+ };
604
+ }
605
+ return keys;
606
+ }
607
+
425
608
  /**
426
609
  * Prosemirror component
427
610
  *
@@ -508,8 +691,26 @@ class NaturalEditorComponent {
508
691
  }
509
692
  const parser = DOMParser.fromSchema(this.schema);
510
693
  const doc = parser.parse(template.firstChild);
694
+ return EditorState.create({
695
+ doc: doc,
696
+ plugins: this.createPlugins(),
697
+ });
698
+ }
699
+ createPlugins() {
700
+ var _a;
701
+ const isMac = !!((_a = this.document.defaultView) === null || _a === void 0 ? void 0 : _a.navigator.platform.match(/Mac/));
511
702
  const plugins = [
512
- ...exampleSetup({ schema: this.schema, menuBar: false }),
703
+ buildInputRules(this.schema),
704
+ keymap(buildKeymap(this.schema, isMac)),
705
+ keymap(baseKeymap),
706
+ dropCursor(),
707
+ gapCursor(),
708
+ history(),
709
+ new Plugin({
710
+ props: {
711
+ attributes: { class: 'ProseMirror-example-setup-style' },
712
+ },
713
+ }),
513
714
  new Plugin({
514
715
  view: () => this,
515
716
  }),
@@ -520,10 +721,7 @@ class NaturalEditorComponent {
520
721
  'Shift-Tab': goToNextCell(-1),
521
722
  }));
522
723
  }
523
- return EditorState.create({
524
- doc: doc,
525
- plugins: plugins,
526
- });
724
+ return plugins;
527
725
  }
528
726
  /**
529
727
  * Called by Prosemirror whenever the editor state changes. So we update our menu states.
@@ -1 +1 @@
1
- {"version":3,"file":"ecodev-natural-editor.js","sources":["../../../projects/natural-editor/src/lib/utils/image.ts","../../../projects/natural-editor/src/lib/utils/schema.ts","../../../projects/natural-editor/src/lib/link-dialog/link-dialog.component.ts","../../../projects/natural-editor/src/lib/link-dialog/link-dialog.component.html","../../../projects/natural-editor/src/lib/utils/table.ts","../../../projects/natural-editor/src/lib/utils/menu.ts","../../../projects/natural-editor/src/lib/editor/editor.component.ts","../../../projects/natural-editor/src/lib/editor/editor.component.html","../../../projects/natural-editor/src/lib/editor.module.ts","../../../projects/natural-editor/src/public-api.ts","../../../projects/natural-editor/src/ecodev-natural-editor.ts"],"sourcesContent":["import {Decoration, DecorationSet, EditorView} from 'prosemirror-view';\nimport {EditorState, Plugin} from 'prosemirror-state';\nimport {Observable} from 'rxjs';\nimport {Schema} from 'prosemirror-model';\nimport {Inject, Injectable} from '@angular/core';\nimport {DOCUMENT} from '@angular/common';\n\nexport type ImageUploader = (file: File) => Observable<string>;\n\n@Injectable()\nexport class ImagePlugin {\n public readonly plugin: Plugin<DecorationSet>;\n\n constructor(@Inject(DOCUMENT) private readonly document: Document) {\n this.plugin = new Plugin<DecorationSet>({\n state: {\n init(): DecorationSet {\n return DecorationSet.empty;\n },\n apply(tr, set): DecorationSet {\n // Adjust decoration positions to changes made by the transaction\n set = set.map(tr.mapping, tr.doc);\n\n // See if the transaction adds or removes any placeholders\n const action = tr.getMeta(this);\n if (action && action.add) {\n const widget = document.createElement('placeholder');\n const deco = Decoration.widget(action.add.pos, widget, {id: action.add.id});\n set = set.add(tr.doc, [deco]);\n } else if (action && action.remove) {\n set = set.remove(set.find(undefined, undefined, spec => spec.id === action.remove.id));\n }\n\n return set;\n },\n },\n props: {\n decorations(state): DecorationSet {\n return this.getState(state);\n },\n },\n });\n }\n\n private findPlaceholder(state: EditorState, id: {}): number | null {\n const decorators = this.plugin.getState(state);\n const found = decorators.find(undefined, undefined, spec => spec.id === id);\n return found.length ? found[0].from : null;\n }\n\n public startImageUpload(view: EditorView, file: File, uploader: ImageUploader, schema: Schema): void {\n // A fresh object to act as the ID for this upload\n const id = {};\n\n // Replace the selection with a placeholder\n const tr = view.state.tr;\n if (!tr.selection.empty) {\n tr.deleteSelection();\n }\n\n tr.setMeta(this.plugin, {add: {id, pos: tr.selection.from}});\n view.dispatch(tr);\n\n uploader(file).subscribe({\n next: url => {\n const pos = this.findPlaceholder(view.state, id);\n // If the content around the placeholder has been deleted, drop\n // the image\n if (pos === null) {\n return;\n }\n\n // Otherwise, insert it at the placeholder's position, and remove\n // the placeholder\n view.dispatch(\n view.state.tr\n .replaceWith(pos, pos, schema.nodes.image.create({src: url}))\n .setMeta(this.plugin, {remove: {id}}),\n );\n },\n error: () => {\n // On failure, just clean up the placeholder\n view?.dispatch(tr.setMeta(this.plugin, {remove: {id}}));\n },\n });\n }\n}\n","import {marks, nodes} from 'prosemirror-schema-basic';\nimport {addListNodes} from 'prosemirror-schema-list';\nimport {Schema} from 'prosemirror-model';\nimport {tableNodes} from 'prosemirror-tables';\n\n// Keep only basic elements\ntype BasicNodes = Omit<typeof nodes, 'image' | 'code_block' | 'blockquote' | 'horizontal_rule'>;\nconst basicNodes: BasicNodes = {\n heading: nodes.heading,\n doc: nodes.doc,\n paragraph: nodes.paragraph,\n text: nodes.text,\n hard_break: nodes.hard_break,\n};\n\ntype BasicMarks = Omit<typeof marks, 'code'>;\nconst basicMarks: BasicMarks = {\n link: marks.link,\n em: marks.em,\n strong: marks.strong,\n};\n\nconst tmpSchema = new Schema({nodes: basicNodes, marks: basicMarks});\n\nexport const basicSchema = new Schema({\n nodes: addListNodes(tmpSchema.spec.nodes, 'paragraph block*', 'block'),\n marks: tmpSchema.spec.marks,\n});\n\nconst tmpSchema2 = new Schema({\n nodes: {\n ...nodes,\n ...tableNodes({\n tableGroup: 'block',\n cellContent: 'block+',\n cellAttributes: {\n background: {\n default: null,\n getFromDOM(dom: Element): string | null {\n return (dom as HTMLElement).style.backgroundColor || null;\n },\n setDOMAttr(value: any, attrs: any): void {\n if (value) {\n attrs.style = (attrs.style || '') + `background-color: ${value};`;\n }\n },\n },\n },\n }),\n },\n marks: basicMarks,\n});\n\nexport const advancedSchema = new Schema({\n nodes: addListNodes(tmpSchema2.spec.nodes, 'paragraph block*', 'block'),\n marks: basicMarks,\n});\n","import {Component, Inject} from '@angular/core';\nimport {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';\nimport {FormControl, FormGroup, Validators} from '@angular/forms';\nimport {ifValid} from '@ecodev/natural';\n\nexport interface LinkDialogData {\n href: string;\n title?: string;\n}\n\n@Component({\n templateUrl: './link-dialog.component.html',\n styleUrls: ['./link-dialog.component.scss'],\n})\nexport class LinkDialogComponent {\n public readonly hrefControl = new FormControl('', Validators.required);\n public readonly titleControl = new FormControl('');\n public readonly form = new FormGroup({\n href: this.hrefControl,\n title: this.titleControl,\n });\n\n constructor(\n @Inject(MAT_DIALOG_DATA) data: LinkDialogData,\n private dialogRef: MatDialogRef<LinkDialogComponent, LinkDialogData>,\n ) {\n this.form.setValue(data);\n }\n\n public maybeConfirm(): void {\n ifValid(this.form).subscribe(() => this.confirm());\n }\n\n private confirm(): void {\n this.dialogRef.close(this.form.value);\n }\n}\n","<h2 i18n mat-dialog-title>Insérer 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","import {EditorState, TextSelection, Transaction} from 'prosemirror-state';\nimport {Fragment, Node as ProsemirrorNode, NodeType} from 'prosemirror-model';\nimport {tableNodeTypes} from 'prosemirror-tables';\n\nfunction createCell(\n cellType: NodeType,\n cellContent?: Fragment | ProsemirrorNode | Array<ProsemirrorNode>,\n): ProsemirrorNode<any> | null | undefined {\n return cellContent ? cellType.createChecked(null, cellContent) : cellType.createAndFill();\n}\n\nfunction createTable(\n state: EditorState,\n rowsCount: number,\n colsCount: number,\n withHeaderRow: boolean,\n cellContent?: Fragment | ProsemirrorNode | Array<ProsemirrorNode>,\n): ProsemirrorNode {\n const types = tableNodeTypes(state.schema);\n const headerCells = [];\n const cells = [];\n\n for (let index = 0; index < colsCount; index += 1) {\n const cell = createCell(types.cell, cellContent);\n\n if (cell) {\n cells.push(cell);\n }\n\n if (withHeaderRow) {\n const headerCell = createCell(types.header_cell, cellContent);\n\n if (headerCell) {\n headerCells.push(headerCell);\n }\n }\n }\n\n const rows = [];\n\n for (let index = 0; index < rowsCount; index += 1) {\n rows.push(types.row.createChecked(null, withHeaderRow && index === 0 ? headerCells : cells));\n }\n\n return types.table.createChecked(null, rows);\n}\n\nexport function addTable(\n state: EditorState,\n dispatch?: (tr: Transaction) => void,\n {\n rowsCount = 3,\n colsCount = 3,\n withHeaderRow = true,\n cellContent,\n }: {\n rowsCount?: number;\n colsCount?: number;\n withHeaderRow?: boolean;\n cellContent?: Fragment | ProsemirrorNode | Array<ProsemirrorNode>;\n } = {},\n): void {\n const offset = state.tr.selection.anchor + 1;\n\n const nodes = createTable(state, rowsCount, colsCount, withHeaderRow, cellContent);\n const tr = state.tr.replaceSelectionWith(nodes).scrollIntoView();\n const resolvedPos = tr.doc.resolve(offset);\n\n // move cursor into table\n tr.setSelection(TextSelection.near(resolvedPos));\n\n dispatch?.(tr);\n}\n","import {\n blockTypeItem,\n joinUpItem,\n liftItem,\n MenuItem,\n MenuItemSpec,\n redoItem,\n selectParentNodeItem,\n undoItem,\n wrapItem,\n} from 'prosemirror-menu';\nimport {EditorState, Transaction} from 'prosemirror-state';\nimport {Command, toggleMark} from 'prosemirror-commands';\nimport {wrapInList} from 'prosemirror-schema-list';\nimport {MarkType, NodeType, Schema} from 'prosemirror-model';\nimport {MatDialog} from '@angular/material/dialog';\nimport {LinkDialogComponent, LinkDialogData} from '../link-dialog/link-dialog.component';\nimport {EditorView} from 'prosemirror-view';\nimport {\n addColumnAfter,\n addColumnBefore,\n addRowAfter,\n addRowBefore,\n deleteColumn,\n deleteRow,\n deleteTable,\n mergeCells,\n splitCell,\n toggleHeaderCell,\n toggleHeaderColumn,\n toggleHeaderRow,\n} from 'prosemirror-tables';\nimport {addTable} from './table';\n\n/**\n * One item of the menu.\n *\n * This is the equivalent of `MenuItem` but without all the rendering logic since we use Angular\n * templates for rendering. Also it caches the state of the item everytime the editor state changes,\n * so Angular can query the state as often as needed without performance hit.\n */\nexport class Item {\n /**\n * Whether the item is 'active' (for example, the item for toggling the strong mark might be active when the cursor is in strong text).\n */\n public active = false;\n\n /**\n * Button is shown but disabled, because the item cannot be (un-)applied\n */\n public disabled = false;\n\n /**\n * Whether the item is shown at the moment\n */\n public show = true;\n\n constructor(public readonly spec: MenuItemSpec) {}\n\n /**\n * Update the item state according to the editor state\n */\n public update(view: EditorView, state: EditorState): void {\n if (this.spec.active) {\n this.active = this.spec.active(state);\n }\n\n if (this.spec.enable) {\n this.disabled = !this.spec.enable(state);\n }\n\n if (this.spec.select) {\n this.show = this.spec.select(state);\n }\n }\n}\n\n/**\n * Convert built-in `MenuItem` into our Angular specific `Item`\n */\nfunction toItem(item: MenuItem): Item {\n return new Item(item.spec);\n}\n\nfunction canInsert(state: EditorState, nodeType: NodeType): boolean {\n const $from = state.selection.$from;\n for (let d = $from.depth; d >= 0; d--) {\n const index = $from.index(d);\n if ($from.node(d).canReplaceWith(index, index, nodeType)) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction cmdItem(cmd: Command, options: Partial<MenuItemSpec> = {}, useEnable = false): Item {\n const passedOptions: MenuItemSpec = {\n run: cmd,\n ...options,\n };\n\n if ((!options.enable || useEnable) && !options.select) {\n passedOptions[options.enable ? 'enable' : 'select'] = (state: EditorState) => cmd(state);\n }\n\n return new Item(passedOptions);\n}\n\nfunction markActive(state: EditorState, type: MarkType): boolean {\n const {from, $from, to, empty} = state.selection;\n if (empty) {\n return !!type.isInSet(state.storedMarks || $from.marks());\n } else {\n return state.doc.rangeHasMark(from, to, type);\n }\n}\n\nfunction markItem(markType: MarkType, options: Partial<MenuItemSpec> = {}): Item {\n const passedOptions: Partial<MenuItemSpec> = {\n active(state: EditorState): boolean {\n return markActive(state, markType);\n },\n ...options,\n };\n\n return cmdItem(toggleMark(markType), passedOptions, true);\n}\n\nfunction linkItem(markType: MarkType, dialog: MatDialog): Item {\n return new Item({\n active(state: EditorState): boolean {\n return markActive(state, markType);\n },\n enable(state: EditorState): boolean {\n return !state.selection.empty;\n },\n run(state: EditorState, dispatch: (p: Transaction) => void, view: EditorView): boolean | void {\n if (markActive(state, markType)) {\n toggleMark(markType)(state, dispatch);\n return true;\n }\n\n dialog\n .open<LinkDialogComponent, LinkDialogData, LinkDialogData>(LinkDialogComponent, {\n data: {\n href: '',\n title: '',\n },\n })\n .afterClosed()\n .subscribe(result => {\n if (result) {\n if (!result.title) {\n delete result.title;\n }\n\n toggleMark(markType, result)(view.state, view.dispatch);\n }\n\n view.focus();\n });\n },\n });\n}\n\nfunction wrapListItem(nodeType: NodeType): Item {\n return cmdItem(wrapInList(nodeType));\n}\n\nexport type Key =\n | 'toggleStrong'\n | 'toggleEm'\n | 'toggleCode'\n | 'toggleLink'\n | 'wrapBulletList'\n | 'wrapOrderedList'\n | 'wrapBlockQuote'\n | 'makeParagraph'\n | 'makeCodeBlock'\n | 'makeHead1'\n | 'makeHead2'\n | 'makeHead3'\n | 'makeHead4'\n | 'makeHead5'\n | 'makeHead6'\n | 'insertHorizontalRule'\n | 'joinUp'\n | 'lift'\n | 'selectParentNode'\n | 'undo'\n | 'redo'\n | 'insertTable'\n | 'addColumnBefore'\n | 'addColumnAfter'\n | 'deleteColumn'\n | 'addRowBefore'\n | 'addRowAfter'\n | 'deleteRow'\n | 'deleteTable'\n | 'mergeCells'\n | 'splitCell'\n | 'toggleHeaderColumn'\n | 'toggleHeaderRow'\n | 'toggleHeaderCell';\n\nexport type MenuItems = Partial<Record<Key, Item>>;\n\n/**\n * Given a schema, look for default mark and node types in it and\n * return an object with relevant menu items relating to those marks:\n */\nexport function buildMenuItems(schema: Schema, dialog: MatDialog): MenuItems {\n const r: MenuItems = {\n joinUp: toItem(joinUpItem),\n lift: toItem(liftItem),\n selectParentNode: toItem(selectParentNodeItem),\n undo: toItem(undoItem as unknown as MenuItem), // Typing is incorrect, so we force it\n redo: toItem(redoItem as unknown as MenuItem),\n };\n\n let type: MarkType | NodeType | undefined;\n type = schema.marks.strong;\n if (type) {\n r.toggleStrong = markItem(type);\n }\n\n type = schema.marks.em;\n if (type) {\n r.toggleEm = markItem(type);\n }\n\n type = schema.marks.code;\n if (type) {\n r.toggleCode = markItem(type);\n }\n\n type = schema.marks.link;\n if (type) {\n r.toggleLink = linkItem(type, dialog);\n }\n\n type = schema.nodes.bullet_list;\n if (type) {\n r.wrapBulletList = wrapListItem(type);\n }\n\n type = schema.nodes.ordered_list;\n if (type) {\n r.wrapOrderedList = wrapListItem(type);\n }\n\n type = schema.nodes.blockquote;\n if (type) {\n r.wrapBlockQuote = toItem(wrapItem(type, {}));\n }\n\n type = schema.nodes.paragraph;\n if (type) {\n r.makeParagraph = toItem(blockTypeItem(type, {}));\n }\n\n type = schema.nodes.code_block;\n if (type) {\n r.makeCodeBlock = toItem(blockTypeItem(type, {}));\n }\n\n type = schema.nodes.heading;\n if (type) {\n r.makeHead1 = toItem(blockTypeItem(type, {attrs: {level: 1}}));\n r.makeHead2 = toItem(blockTypeItem(type, {attrs: {level: 2}}));\n r.makeHead3 = toItem(blockTypeItem(type, {attrs: {level: 3}}));\n r.makeHead4 = toItem(blockTypeItem(type, {attrs: {level: 4}}));\n r.makeHead5 = toItem(blockTypeItem(type, {attrs: {level: 5}}));\n r.makeHead6 = toItem(blockTypeItem(type, {attrs: {level: 6}}));\n }\n\n type = schema.nodes.horizontal_rule;\n if (type) {\n const hr = type;\n r.insertHorizontalRule = new Item({\n enable(state): boolean {\n return canInsert(state, hr);\n },\n run(state, dispatch): void {\n dispatch(state.tr.replaceSelectionWith(hr.create()));\n },\n });\n }\n\n type = schema.nodes.table;\n if (type) {\n r.insertTable = new Item({run: (e, tr) => addTable(e, tr)});\n r.addColumnBefore = new Item({run: addColumnBefore});\n r.addColumnAfter = new Item({run: addColumnAfter});\n r.deleteColumn = new Item({run: deleteColumn});\n r.addRowBefore = new Item({run: addRowBefore});\n r.addRowAfter = new Item({run: addRowAfter});\n r.deleteRow = new Item({run: deleteRow});\n r.deleteTable = new Item({run: deleteTable});\n r.mergeCells = new Item({run: mergeCells});\n r.splitCell = new Item({run: splitCell});\n r.toggleHeaderColumn = new Item({run: toggleHeaderColumn});\n r.toggleHeaderRow = new Item({run: toggleHeaderRow});\n r.toggleHeaderCell = new Item({run: toggleHeaderCell});\n }\n\n return r;\n}\n","import {\n Component,\n ElementRef,\n EventEmitter,\n Inject,\n Input,\n OnDestroy,\n OnInit,\n Optional,\n Output,\n Self,\n ViewChild,\n} from '@angular/core';\nimport {ControlValueAccessor, NgControl} from '@angular/forms';\nimport {EditorView} from 'prosemirror-view';\nimport {EditorState, Plugin, Transaction} from 'prosemirror-state';\n// @ts-ignore\nimport {exampleSetup} from 'prosemirror-example-setup';\nimport {DOMParser, DOMSerializer, Schema} from 'prosemirror-model';\nimport {DOCUMENT} from '@angular/common';\nimport {MatDialog} from '@angular/material/dialog';\nimport {columnResizing, goToNextCell, tableEditing} from 'prosemirror-tables';\nimport {keymap} from 'prosemirror-keymap';\nimport {ImagePlugin, ImageUploader} from '../utils/image';\nimport {advancedSchema, basicSchema} from '../utils/schema';\nimport {buildMenuItems, Key, MenuItems} from '../utils/menu';\n\n/**\n * Prosemirror component\n *\n * Usage :\n *\n * ```html\n * <natural-editor [(ngModel)]=\"htmlString\"></natural-editor>\n * ```\n */\n// @dynamic\n@Component({\n selector: 'natural-editor',\n templateUrl: './editor.component.html',\n styleUrls: ['./editor.component.scss'],\n providers: [ImagePlugin],\n})\nexport class NaturalEditorComponent implements OnInit, OnDestroy, ControlValueAccessor {\n private view: EditorView | null = null;\n\n @ViewChild('editor', {read: ElementRef, static: true}) private editor!: ElementRef;\n\n @Output() public readonly contentChange = new EventEmitter<string>();\n\n /**\n * Callback to upload an image.\n *\n * If given it will enable advanced schema, including image and tables.\n * It must be given on initialization and cannot be changed later on.\n */\n @Input() public imageUploader: ImageUploader | null = null;\n\n private schema: Schema = basicSchema;\n\n /**\n * Interface with ControlValueAccessor\n * Notifies parent model / form controller\n */\n private onChange?: (value: string | null) => void;\n\n /**\n * HTML string\n */\n private content = '';\n\n public menu: MenuItems | null = null;\n\n /**\n * If subscribed to, then the save button will be shown and click events forwarded\n */\n @Output() public readonly save = new EventEmitter<void>();\n\n constructor(\n @Optional() @Self() public readonly ngControl: NgControl,\n @Inject(DOCUMENT) private readonly document: Document,\n private readonly dialog: MatDialog,\n private readonly imagePlugin: ImagePlugin,\n ) {\n if (this.ngControl !== null) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n public ngOnInit(): void {\n this.schema = this.imageUploader ? advancedSchema : basicSchema;\n this.menu = buildMenuItems(this.schema, this.dialog);\n const serializer = DOMSerializer.fromSchema(this.schema);\n const state = this.createState();\n\n this.view = new EditorView(this.editor.nativeElement, {\n state: state,\n dispatchTransaction: (transaction: Transaction) => {\n if (!this.view) {\n return;\n }\n\n const newState = this.view.state.apply(transaction);\n this.view.updateState(newState);\n\n // Transform doc into HTML string\n const dom = serializer.serializeFragment(this.view.state.doc as any);\n const el = this.document.createElement('_');\n el.appendChild(dom);\n\n const newContent = el.innerHTML;\n if (this.content === newContent) {\n return;\n }\n\n this.content = el.innerHTML;\n\n if (this.onChange) {\n this.onChange(this.content);\n }\n this.contentChange.emit(this.content);\n },\n });\n this.update();\n }\n\n public writeValue(val: string | undefined): void {\n if (typeof val === 'string' && val !== this.content) {\n this.content = val;\n }\n\n if (this.view !== null) {\n const state = this.createState();\n this.view.updateState(state);\n }\n }\n\n private createState(): EditorState {\n const template = this.document.createElement('_');\n template.innerHTML = '<div>' + this.content + '</div>';\n if (!template.firstChild) {\n throw new Error('child of template element could not be created');\n }\n\n const parser = DOMParser.fromSchema(this.schema);\n const doc = parser.parse(template.firstChild);\n\n const plugins = [\n ...exampleSetup({schema: this.schema, menuBar: false}),\n new Plugin({\n view: () => this,\n }),\n ];\n\n if (this.schema === advancedSchema) {\n plugins.push(\n this.imagePlugin.plugin,\n columnResizing(undefined as any),\n tableEditing(),\n keymap({\n Tab: goToNextCell(1),\n 'Shift-Tab': goToNextCell(-1),\n }),\n );\n }\n\n return EditorState.create({\n doc: doc,\n plugins: plugins,\n });\n }\n\n /**\n * Called by Prosemirror whenever the editor state changes. So we update our menu states.\n */\n public update(): void {\n if (!this.view || !this.menu) {\n return;\n }\n\n for (const item of Object.values(this.menu)) {\n item.update(this.view, this.view.state);\n }\n }\n\n public registerOnChange(fn: any): void {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: any): void {}\n\n public setDisabledState(isDisabled: boolean): void {\n // TODO disable editor ?\n }\n\n public ngOnDestroy(): void {\n if (this.view) {\n this.view.destroy();\n this.view = null;\n }\n }\n\n public run(event: Event, key: Key): void {\n if (!this.view || !this.menu) {\n return;\n }\n\n const item = this.menu[key];\n if (!item || item.disabled || !item.show) {\n return;\n }\n\n item.spec.run(this.view.state, this.view.dispatch, this.view, event);\n this.view.focus();\n }\n\n public upload(file: File): void {\n if (!this.view || !this.imageUploader) {\n return;\n }\n\n if (this.view.state.selection.$from.parent.inlineContent) {\n this.imagePlugin.startImageUpload(this.view, file, this.imageUploader, this.schema);\n }\n\n this.view.focus();\n }\n}\n","<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érer 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érer 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érer 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érer une colonne après\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érer 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érer une ligne après\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ête 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ête 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ête 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érer 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 à 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 à numéro\"\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'élément 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ésindenter\"\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électionner l'élément parent\"\n >\n <mat-icon>select_all</mat-icon>\n </button>\n </div>\n</div>\n<div #editor></div>\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {NaturalEditorComponent} from './editor/editor.component';\nimport {MatButtonModule} from '@angular/material/button';\nimport {MatButtonToggleModule} from '@angular/material/button-toggle';\nimport {MatToolbarModule} from '@angular/material/toolbar';\nimport {MatIconModule} from '@angular/material/icon';\nimport {MatMenuModule} from '@angular/material/menu';\nimport {LinkDialogComponent} from './link-dialog/link-dialog.component';\nimport {ReactiveFormsModule} from '@angular/forms';\nimport {MatDialogModule} from '@angular/material/dialog';\nimport {MatFormFieldModule} from '@angular/material/form-field';\nimport {MatInputModule} from '@angular/material/input';\nimport {MatTooltipModule} from '@angular/material/tooltip';\nimport {NaturalFileModule} from '@ecodev/natural';\nimport {MatDividerModule} from '@angular/material/divider';\n\nconst imports = [\n CommonModule,\n MatButtonModule,\n MatButtonToggleModule,\n MatDialogModule,\n MatFormFieldModule,\n MatIconModule,\n MatInputModule,\n MatMenuModule,\n MatToolbarModule,\n MatTooltipModule,\n ReactiveFormsModule,\n NaturalFileModule,\n MatDividerModule,\n];\n\n@NgModule({\n declarations: [NaturalEditorComponent, LinkDialogComponent],\n imports: [...imports],\n exports: [...imports, NaturalEditorComponent],\n})\nexport class NaturalEditorModule {}\n","// Load `$localize` onto the global scope - to be able to use that function to translate strings in components/services.\nimport '@angular/localize/init';\n\n/*\n * Public API Surface of natural-editor\n */\n\nexport {NaturalEditorComponent} from './lib/editor/editor.component';\nexport {NaturalEditorModule} from './lib/editor.module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAUa,WAAW;IAGpB,YAA+C,QAAkB;QAAlB,aAAQ,GAAR,QAAQ,CAAU;QAC7D,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAgB;YACpC,KAAK,EAAE;gBACH,IAAI;oBACA,OAAO,aAAa,CAAC,KAAK,CAAC;iBAC9B;gBACD,KAAK,CAAC,EAAE,EAAE,GAAG;;oBAET,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;;oBAGlC,MAAM,MAAM,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;oBAChC,IAAI,MAAM,IAAI,MAAM,CAAC,GAAG,EAAE;wBACtB,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;wBACrD,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,EAAC,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,EAAC,CAAC,CAAC;wBAC5E,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;qBACjC;yBAAM,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE;wBAChC,GAAG,GAAG,GAAG,CAAC,MA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rB,eAAe;QACf,kBAAkB;QAClB,aAAa;QACb,cAAc;QACd,aAAa;QACb,gBAAgB;QAChB,gBAAgB;QAChB,mBAAmB;QACnB,iBAAiB;QACjB,gBAAgB,EAMM,sBAAsB;iHAEnC,mBAAmB,YAHnB,CAAC,GAAG,OAAO,CAAC,EAjBrB,YAAY;QACZ,eAAe;QACf,qBAAqB;QACrB,eAAe;QACf,kBAAkB;QAClB,aAAa;QACb,cAAc;QACd,aAAa;QACb,gBAAgB;QAChB,gBAAgB;QAChB,mBAAmB;QACnB,iBAAiB;QACjB,gBAAgB;2FAQP,mBAAmB;kBAL/B,QAAQ;mBAAC;oBACN,YAAY,EAAE,CAAC,sBAAsB,EAAE,mBAAmB,CAAC;oBAC3D,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;oBACrB,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,sBAAsB,CAAC;iBAChD;;;ACrCD;;ACAA;;;;;;"}
1
+ {"version":3,"file":"ecodev-natural-editor.js","sources":["../../../projects/natural-editor/src/lib/utils/image.ts","../../../projects/natural-editor/src/lib/utils/schema.ts","../../../projects/natural-editor/src/lib/link-dialog/link-dialog.component.ts","../../../projects/natural-editor/src/lib/link-dialog/link-dialog.component.html","../../../projects/natural-editor/src/lib/utils/table.ts","../../../projects/natural-editor/src/lib/utils/menu.ts","../../../projects/natural-editor/src/lib/utils/inputrules.ts","../../../projects/natural-editor/src/lib/utils/keymap.ts","../../../projects/natural-editor/src/lib/editor/editor.component.ts","../../../projects/natural-editor/src/lib/editor/editor.component.html","../../../projects/natural-editor/src/lib/editor.module.ts","../../../projects/natural-editor/src/public-api.ts","../../../projects/natural-editor/src/ecodev-natural-editor.ts"],"sourcesContent":["import {Decoration, DecorationSet, EditorView} from 'prosemirror-view';\nimport {EditorState, Plugin} from 'prosemirror-state';\nimport {Observable} from 'rxjs';\nimport {Schema} from 'prosemirror-model';\nimport {Inject, Injectable} from '@angular/core';\nimport {DOCUMENT} from '@angular/common';\n\nexport type ImageUploader = (file: File) => Observable<string>;\n\n@Injectable()\nexport class ImagePlugin {\n public readonly plugin: Plugin<DecorationSet>;\n\n constructor(@Inject(DOCUMENT) private readonly document: Document) {\n this.plugin = new Plugin<DecorationSet>({\n state: {\n init(): DecorationSet {\n return DecorationSet.empty;\n },\n apply(tr, set): DecorationSet {\n // Adjust decoration positions to changes made by the transaction\n set = set.map(tr.mapping, tr.doc);\n\n // See if the transaction adds or removes any placeholders\n const action = tr.getMeta(this);\n if (action && action.add) {\n const widget = document.createElement('placeholder');\n const deco = Decoration.widget(action.add.pos, widget, {id: action.add.id});\n set = set.add(tr.doc, [deco]);\n } else if (action && action.remove) {\n set = set.remove(set.find(undefined, undefined, spec => spec.id === action.remove.id));\n }\n\n return set;\n },\n },\n props: {\n decorations(state): DecorationSet {\n return this.getState(state);\n },\n },\n });\n }\n\n private findPlaceholder(state: EditorState, id: {}): number | null {\n const decorators = this.plugin.getState(state);\n const found = decorators.find(undefined, undefined, spec => spec.id === id);\n return found.length ? found[0].from : null;\n }\n\n public startImageUpload(view: EditorView, file: File, uploader: ImageUploader, schema: Schema): void {\n // A fresh object to act as the ID for this upload\n const id = {};\n\n // Replace the selection with a placeholder\n const tr = view.state.tr;\n if (!tr.selection.empty) {\n tr.deleteSelection();\n }\n\n tr.setMeta(this.plugin, {add: {id, pos: tr.selection.from}});\n view.dispatch(tr);\n\n uploader(file).subscribe({\n next: url => {\n const pos = this.findPlaceholder(view.state, id);\n // If the content around the placeholder has been deleted, drop\n // the image\n if (pos === null) {\n return;\n }\n\n // Otherwise, insert it at the placeholder's position, and remove\n // the placeholder\n view.dispatch(\n view.state.tr\n .replaceWith(pos, pos, schema.nodes.image.create({src: url}))\n .setMeta(this.plugin, {remove: {id}}),\n );\n },\n error: () => {\n // On failure, just clean up the placeholder\n view?.dispatch(tr.setMeta(this.plugin, {remove: {id}}));\n },\n });\n }\n}\n","import {marks, nodes} from 'prosemirror-schema-basic';\nimport {addListNodes} from 'prosemirror-schema-list';\nimport {Schema} from 'prosemirror-model';\nimport {tableNodes} from 'prosemirror-tables';\n\n// Keep only basic elements\ntype BasicNodes = Omit<typeof nodes, 'image' | 'code_block' | 'blockquote' | 'horizontal_rule'>;\nconst basicNodes: BasicNodes = {\n heading: nodes.heading,\n doc: nodes.doc,\n paragraph: nodes.paragraph,\n text: nodes.text,\n hard_break: nodes.hard_break,\n};\n\ntype BasicMarks = Omit<typeof marks, 'code'>;\nconst basicMarks: BasicMarks = {\n link: marks.link,\n em: marks.em,\n strong: marks.strong,\n};\n\nconst tmpSchema = new Schema({nodes: basicNodes, marks: basicMarks});\n\nexport const basicSchema = new Schema({\n nodes: addListNodes(tmpSchema.spec.nodes, 'paragraph block*', 'block'),\n marks: tmpSchema.spec.marks,\n});\n\nconst tmpSchema2 = new Schema({\n nodes: {\n ...nodes,\n ...tableNodes({\n tableGroup: 'block',\n cellContent: 'block+',\n cellAttributes: {\n background: {\n default: null,\n getFromDOM(dom: Element): string | null {\n return (dom as HTMLElement).style.backgroundColor || null;\n },\n setDOMAttr(value: any, attrs: any): void {\n if (value) {\n attrs.style = (attrs.style || '') + `background-color: ${value};`;\n }\n },\n },\n },\n }),\n },\n marks: basicMarks,\n});\n\nexport const advancedSchema = new Schema({\n nodes: addListNodes(tmpSchema2.spec.nodes, 'paragraph block*', 'block'),\n marks: basicMarks,\n});\n","import {Component, Inject} from '@angular/core';\nimport {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog';\nimport {FormControl, FormGroup, Validators} from '@angular/forms';\nimport {ifValid} from '@ecodev/natural';\n\nexport interface LinkDialogData {\n href: string;\n title?: string;\n}\n\n@Component({\n templateUrl: './link-dialog.component.html',\n styleUrls: ['./link-dialog.component.scss'],\n})\nexport class LinkDialogComponent {\n public readonly hrefControl = new FormControl('', Validators.required);\n public readonly titleControl = new FormControl('');\n public readonly form = new FormGroup({\n href: this.hrefControl,\n title: this.titleControl,\n });\n\n constructor(\n @Inject(MAT_DIALOG_DATA) data: LinkDialogData,\n private dialogRef: MatDialogRef<LinkDialogComponent, LinkDialogData>,\n ) {\n this.form.setValue(data);\n }\n\n public maybeConfirm(): void {\n ifValid(this.form).subscribe(() => this.confirm());\n }\n\n private confirm(): void {\n this.dialogRef.close(this.form.value);\n }\n}\n","<h2 i18n mat-dialog-title>Insérer 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","import {EditorState, TextSelection, Transaction} from 'prosemirror-state';\nimport {Fragment, Node as ProsemirrorNode, NodeType} from 'prosemirror-model';\nimport {tableNodeTypes} from 'prosemirror-tables';\n\nfunction createCell(\n cellType: NodeType,\n cellContent?: Fragment | ProsemirrorNode | Array<ProsemirrorNode>,\n): ProsemirrorNode<any> | null | undefined {\n return cellContent ? cellType.createChecked(null, cellContent) : cellType.createAndFill();\n}\n\nfunction createTable(\n state: EditorState,\n rowsCount: number,\n colsCount: number,\n withHeaderRow: boolean,\n cellContent?: Fragment | ProsemirrorNode | Array<ProsemirrorNode>,\n): ProsemirrorNode {\n const types = tableNodeTypes(state.schema);\n const headerCells = [];\n const cells = [];\n\n for (let index = 0; index < colsCount; index += 1) {\n const cell = createCell(types.cell, cellContent);\n\n if (cell) {\n cells.push(cell);\n }\n\n if (withHeaderRow) {\n const headerCell = createCell(types.header_cell, cellContent);\n\n if (headerCell) {\n headerCells.push(headerCell);\n }\n }\n }\n\n const rows = [];\n\n for (let index = 0; index < rowsCount; index += 1) {\n rows.push(types.row.createChecked(null, withHeaderRow && index === 0 ? headerCells : cells));\n }\n\n return types.table.createChecked(null, rows);\n}\n\nexport function addTable(\n state: EditorState,\n dispatch?: (tr: Transaction) => void,\n {\n rowsCount = 3,\n colsCount = 3,\n withHeaderRow = true,\n cellContent,\n }: {\n rowsCount?: number;\n colsCount?: number;\n withHeaderRow?: boolean;\n cellContent?: Fragment | ProsemirrorNode | Array<ProsemirrorNode>;\n } = {},\n): void {\n const offset = state.tr.selection.anchor + 1;\n\n const nodes = createTable(state, rowsCount, colsCount, withHeaderRow, cellContent);\n const tr = state.tr.replaceSelectionWith(nodes).scrollIntoView();\n const resolvedPos = tr.doc.resolve(offset);\n\n // move cursor into table\n tr.setSelection(TextSelection.near(resolvedPos));\n\n dispatch?.(tr);\n}\n","import {\n blockTypeItem,\n joinUpItem,\n liftItem,\n MenuItem,\n MenuItemSpec,\n redoItem,\n selectParentNodeItem,\n undoItem,\n wrapItem,\n} from 'prosemirror-menu';\nimport {EditorState, Transaction} from 'prosemirror-state';\nimport {Command, toggleMark} from 'prosemirror-commands';\nimport {wrapInList} from 'prosemirror-schema-list';\nimport {MarkType, NodeType, Schema} from 'prosemirror-model';\nimport {MatDialog} from '@angular/material/dialog';\nimport {LinkDialogComponent, LinkDialogData} from '../link-dialog/link-dialog.component';\nimport {EditorView} from 'prosemirror-view';\nimport {\n addColumnAfter,\n addColumnBefore,\n addRowAfter,\n addRowBefore,\n deleteColumn,\n deleteRow,\n deleteTable,\n mergeCells,\n splitCell,\n toggleHeaderCell,\n toggleHeaderColumn,\n toggleHeaderRow,\n} from 'prosemirror-tables';\nimport {addTable} from './table';\n\n/**\n * One item of the menu.\n *\n * This is the equivalent of `MenuItem` but without all the rendering logic since we use Angular\n * templates for rendering. Also it caches the state of the item everytime the editor state changes,\n * so Angular can query the state as often as needed without performance hit.\n */\nexport class Item {\n /**\n * Whether the item is 'active' (for example, the item for toggling the strong mark might be active when the cursor is in strong text).\n */\n public active = false;\n\n /**\n * Button is shown but disabled, because the item cannot be (un-)applied\n */\n public disabled = false;\n\n /**\n * Whether the item is shown at the moment\n */\n public show = true;\n\n constructor(public readonly spec: MenuItemSpec) {}\n\n /**\n * Update the item state according to the editor state\n */\n public update(view: EditorView, state: EditorState): void {\n if (this.spec.active) {\n this.active = this.spec.active(state);\n }\n\n if (this.spec.enable) {\n this.disabled = !this.spec.enable(state);\n }\n\n if (this.spec.select) {\n this.show = this.spec.select(state);\n }\n }\n}\n\n/**\n * Convert built-in `MenuItem` into our Angular specific `Item`\n */\nfunction toItem(item: MenuItem): Item {\n return new Item(item.spec);\n}\n\nfunction canInsert(state: EditorState, nodeType: NodeType): boolean {\n const $from = state.selection.$from;\n for (let d = $from.depth; d >= 0; d--) {\n const index = $from.index(d);\n if ($from.node(d).canReplaceWith(index, index, nodeType)) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction cmdItem(cmd: Command, options: Partial<MenuItemSpec> = {}, useEnable = false): Item {\n const passedOptions: MenuItemSpec = {\n run: cmd,\n ...options,\n };\n\n if ((!options.enable || useEnable) && !options.select) {\n passedOptions[options.enable ? 'enable' : 'select'] = (state: EditorState) => cmd(state);\n }\n\n return new Item(passedOptions);\n}\n\nfunction markActive(state: EditorState, type: MarkType): boolean {\n const {from, $from, to, empty} = state.selection;\n if (empty) {\n return !!type.isInSet(state.storedMarks || $from.marks());\n } else {\n return state.doc.rangeHasMark(from, to, type);\n }\n}\n\nfunction markItem(markType: MarkType, options: Partial<MenuItemSpec> = {}): Item {\n const passedOptions: Partial<MenuItemSpec> = {\n active(state: EditorState): boolean {\n return markActive(state, markType);\n },\n ...options,\n };\n\n return cmdItem(toggleMark(markType), passedOptions, true);\n}\n\nfunction linkItem(markType: MarkType, dialog: MatDialog): Item {\n return new Item({\n active(state: EditorState): boolean {\n return markActive(state, markType);\n },\n enable(state: EditorState): boolean {\n return !state.selection.empty;\n },\n run(state: EditorState, dispatch: (p: Transaction) => void, view: EditorView): boolean | void {\n if (markActive(state, markType)) {\n toggleMark(markType)(state, dispatch);\n return true;\n }\n\n dialog\n .open<LinkDialogComponent, LinkDialogData, LinkDialogData>(LinkDialogComponent, {\n data: {\n href: '',\n title: '',\n },\n })\n .afterClosed()\n .subscribe(result => {\n if (result) {\n if (!result.title) {\n delete result.title;\n }\n\n toggleMark(markType, result)(view.state, view.dispatch);\n }\n\n view.focus();\n });\n },\n });\n}\n\nfunction wrapListItem(nodeType: NodeType): Item {\n return cmdItem(wrapInList(nodeType));\n}\n\nexport type Key =\n | 'toggleStrong'\n | 'toggleEm'\n | 'toggleCode'\n | 'toggleLink'\n | 'wrapBulletList'\n | 'wrapOrderedList'\n | 'wrapBlockQuote'\n | 'makeParagraph'\n | 'makeCodeBlock'\n | 'makeHead1'\n | 'makeHead2'\n | 'makeHead3'\n | 'makeHead4'\n | 'makeHead5'\n | 'makeHead6'\n | 'insertHorizontalRule'\n | 'joinUp'\n | 'lift'\n | 'selectParentNode'\n | 'undo'\n | 'redo'\n | 'insertTable'\n | 'addColumnBefore'\n | 'addColumnAfter'\n | 'deleteColumn'\n | 'addRowBefore'\n | 'addRowAfter'\n | 'deleteRow'\n | 'deleteTable'\n | 'mergeCells'\n | 'splitCell'\n | 'toggleHeaderColumn'\n | 'toggleHeaderRow'\n | 'toggleHeaderCell';\n\nexport type MenuItems = Partial<Record<Key, Item>>;\n\n/**\n * Given a schema, look for default mark and node types in it and\n * return an object with relevant menu items relating to those marks:\n */\nexport function buildMenuItems(schema: Schema, dialog: MatDialog): MenuItems {\n const r: MenuItems = {\n joinUp: toItem(joinUpItem),\n lift: toItem(liftItem),\n selectParentNode: toItem(selectParentNodeItem),\n undo: toItem(undoItem as unknown as MenuItem), // Typing is incorrect, so we force it\n redo: toItem(redoItem as unknown as MenuItem),\n };\n\n let type: MarkType | NodeType | undefined;\n type = schema.marks.strong;\n if (type) {\n r.toggleStrong = markItem(type);\n }\n\n type = schema.marks.em;\n if (type) {\n r.toggleEm = markItem(type);\n }\n\n type = schema.marks.code;\n if (type) {\n r.toggleCode = markItem(type);\n }\n\n type = schema.marks.link;\n if (type) {\n r.toggleLink = linkItem(type, dialog);\n }\n\n type = schema.nodes.bullet_list;\n if (type) {\n r.wrapBulletList = wrapListItem(type);\n }\n\n type = schema.nodes.ordered_list;\n if (type) {\n r.wrapOrderedList = wrapListItem(type);\n }\n\n type = schema.nodes.blockquote;\n if (type) {\n r.wrapBlockQuote = toItem(wrapItem(type, {}));\n }\n\n type = schema.nodes.paragraph;\n if (type) {\n r.makeParagraph = toItem(blockTypeItem(type, {}));\n }\n\n type = schema.nodes.code_block;\n if (type) {\n r.makeCodeBlock = toItem(blockTypeItem(type, {}));\n }\n\n type = schema.nodes.heading;\n if (type) {\n r.makeHead1 = toItem(blockTypeItem(type, {attrs: {level: 1}}));\n r.makeHead2 = toItem(blockTypeItem(type, {attrs: {level: 2}}));\n r.makeHead3 = toItem(blockTypeItem(type, {attrs: {level: 3}}));\n r.makeHead4 = toItem(blockTypeItem(type, {attrs: {level: 4}}));\n r.makeHead5 = toItem(blockTypeItem(type, {attrs: {level: 5}}));\n r.makeHead6 = toItem(blockTypeItem(type, {attrs: {level: 6}}));\n }\n\n type = schema.nodes.horizontal_rule;\n if (type) {\n const hr = type;\n r.insertHorizontalRule = new Item({\n enable(state): boolean {\n return canInsert(state, hr);\n },\n run(state, dispatch): void {\n dispatch(state.tr.replaceSelectionWith(hr.create()));\n },\n });\n }\n\n type = schema.nodes.table;\n if (type) {\n r.insertTable = new Item({run: (e, tr) => addTable(e, tr)});\n r.addColumnBefore = new Item({run: addColumnBefore});\n r.addColumnAfter = new Item({run: addColumnAfter});\n r.deleteColumn = new Item({run: deleteColumn});\n r.addRowBefore = new Item({run: addRowBefore});\n r.addRowAfter = new Item({run: addRowAfter});\n r.deleteRow = new Item({run: deleteRow});\n r.deleteTable = new Item({run: deleteTable});\n r.mergeCells = new Item({run: mergeCells});\n r.splitCell = new Item({run: splitCell});\n r.toggleHeaderColumn = new Item({run: toggleHeaderColumn});\n r.toggleHeaderRow = new Item({run: toggleHeaderRow});\n r.toggleHeaderCell = new Item({run: toggleHeaderCell});\n }\n\n return r;\n}\n","import {\n ellipsis,\n emDash,\n InputRule,\n inputRules,\n textblockTypeInputRule,\n wrappingInputRule,\n} from 'prosemirror-inputrules';\nimport {NodeType, Schema} from 'prosemirror-model';\nimport {Plugin} from 'prosemirror-state';\n\n/**\n * Given a blockquote node type, returns an input rule that turns `\"> \"`\n * at the start of a textblock into a blockquote.\n */\nfunction blockQuoteRule(nodeType: NodeType): InputRule {\n return wrappingInputRule(/^\\s*>\\s$/, nodeType);\n}\n\n/**\n * Given a list node type, returns an input rule that turns a number\n * followed by a dot at the start of a textblock into an ordered list.\n */\nfunction orderedListRule(nodeType: NodeType): InputRule {\n return wrappingInputRule(\n /^(\\d+)\\.\\s$/,\n nodeType,\n match => ({order: +match[1]}),\n (match, node) => node.childCount + node.attrs.order === +match[1],\n );\n}\n\n/**\n * Given a list node type, returns an input rule that turns a bullet\n * (dash, plush, or asterisk) at the start of a textblock into a\n * bullet list.\n */\nfunction bulletListRule(nodeType: NodeType): InputRule {\n return wrappingInputRule(/^\\s*([-+*])\\s$/, nodeType);\n}\n\n/**\n * Given a code block node type, returns an input rule that turns a\n * textblock starting with three backticks into a code block.\n */\nfunction codeBlockRule(nodeType: NodeType): InputRule {\n return textblockTypeInputRule(/^```$/, nodeType);\n}\n\n/**\n * Given a node type and a maximum level, creates an input rule that\n * turns up to that number of `#` characters followed by a space at\n * the start of a textblock into a heading whose level corresponds to\n * the number of `#` signs.\n */\nfunction headingRule(nodeType: NodeType, maxLevel: number): InputRule {\n return textblockTypeInputRule(new RegExp('^(#{1,' + maxLevel + '})\\\\s$'), nodeType, match => ({\n level: match[1].length,\n }));\n}\n\n/**\n * A set of input rules for creating the basic block quotes, lists,\n * code blocks, and heading.\n */\nexport function buildInputRules(schema: Schema): Plugin {\n const rules = [ellipsis, emDash];\n\n let type = schema.nodes.blockquote;\n if (type) {\n rules.push(blockQuoteRule(type));\n }\n\n type = schema.nodes.ordered_list;\n if (type) {\n rules.push(orderedListRule(type));\n }\n\n type = schema.nodes.bullet_list;\n if (type) {\n rules.push(bulletListRule(type));\n }\n\n type = schema.nodes.code_block;\n if (type) {\n rules.push(codeBlockRule(type));\n }\n\n type = schema.nodes.heading;\n if (type) {\n rules.push(headingRule(type, 6));\n }\n\n return inputRules({rules});\n}\n","import {\n chainCommands,\n exitCode,\n joinDown,\n joinUp,\n Keymap,\n lift,\n selectParentNode,\n setBlockType,\n toggleMark,\n wrapIn,\n} from 'prosemirror-commands';\nimport {liftListItem, sinkListItem, splitListItem, wrapInList} from 'prosemirror-schema-list';\nimport {redo, undo} from 'prosemirror-history';\nimport {undoInputRule} from 'prosemirror-inputrules';\nimport {MarkType, NodeType, Schema} from 'prosemirror-model';\n\n/**\n * Inspect the given schema looking for marks and nodes from the\n * basic schema, and if found, add key bindings related to them.\n * This will add:\n *\n * * **Mod-b** for toggling [strong](#schema-basic.StrongMark)\n * * **Mod-i** for toggling [emphasis](#schema-basic.EmMark)\n * * **Mod-`** for toggling [code font](#schema-basic.CodeMark)\n * * **Ctrl-Shift-0** for making the current textblock a paragraph\n * * **Ctrl-Shift-1** to **Ctrl-Shift-Digit6** for making the current\n * textblock a heading of the corresponding level\n * * **Ctrl-Shift-Backslash** to make the current textblock a code block\n * * **Ctrl-Shift-8** to wrap the selection in an ordered list\n * * **Ctrl-Shift-9** to wrap the selection in a bullet list\n * * **Ctrl->** to wrap the selection in a block quote\n * * **Enter** to split a non-empty textblock in a list item while at\n * the same time splitting the list item\n * * **Mod-Enter** to insert a hard break\n * * **Mod-_** to insert a horizontal rule\n * * **Backspace** to undo an input rule\n * * **Alt-ArrowUp** to `joinUp`\n * * **Alt-ArrowDown** to `joinDown`\n * * **Mod-BracketLeft** to `lift`\n * * **Escape** to `selectParentNode`\n *\n * You can suppress or map these bindings by passing a `mapKeys`\n * argument, which maps key names (say `\"Mod-B\"` to either `false`, to\n * remove the binding, or a new key name string.\n */\nexport function buildKeymap(schema: Schema, isMac: boolean): Keymap {\n const keys: Keymap = {};\n\n keys['Mod-z'] = undo;\n keys['Shift-Mod-z'] = redo;\n keys['Backspace'] = undoInputRule;\n if (!isMac) {\n keys['Mod-y'] = redo;\n }\n\n keys['Alt-ArrowUp'] = joinUp;\n keys['Alt-ArrowDown'] = joinDown;\n keys['Mod-BracketLeft'] = lift;\n keys['Escape'] = selectParentNode;\n\n let type: MarkType | NodeType = schema.marks.strong;\n if (type) {\n keys['Mod-b'] = toggleMark(type);\n keys['Mod-B'] = toggleMark(type);\n }\n\n type = schema.marks.em;\n if (type) {\n keys['Mod-i'] = toggleMark(type);\n keys['Mod-I'] = toggleMark(type);\n }\n\n type = schema.marks.code;\n if (type) {\n keys['Mod-`'] = toggleMark(type);\n }\n\n type = schema.nodes.bullet_list;\n if (type) {\n keys['Shift-Ctrl-8'] = wrapInList(type);\n }\n\n type = schema.nodes.ordered_list;\n if (type) {\n keys['Shift-Ctrl-9'] = wrapInList(type);\n }\n\n type = schema.nodes.blockquote;\n if (type) {\n keys['Ctrl->'] = wrapIn(type);\n }\n\n type = schema.nodes.hard_break;\n if (type) {\n const br = type;\n const cmd = chainCommands(exitCode, (state, dispatch) => {\n dispatch?.(state.tr.replaceSelectionWith(br.create()).scrollIntoView());\n return true;\n });\n keys['Mod-Enter'] = cmd;\n keys['Shift-Enter'] = cmd;\n if (isMac) {\n keys['Ctrl-Enter'] = cmd;\n }\n }\n\n type = schema.nodes.list_item;\n if (type) {\n keys['Enter'] = splitListItem(type);\n keys['Mod-['] = liftListItem(type);\n keys['Mod-]'] = sinkListItem(type);\n }\n\n type = schema.nodes.paragraph;\n if (type) {\n keys['Shift-Ctrl-0'] = setBlockType(type);\n }\n\n type = schema.nodes.code_block;\n if (type) {\n keys['Shift-Ctrl-\\\\'] = setBlockType(type);\n }\n\n type = schema.nodes.heading;\n if (type) {\n for (let i = 1; i <= 6; i++) {\n keys['Shift-Ctrl-' + i] = setBlockType(type, {level: i});\n }\n }\n\n type = schema.nodes.horizontal_rule;\n if (type) {\n const hr = type;\n keys['Mod-_'] = (state, dispatch) => {\n dispatch?.(state.tr.replaceSelectionWith(hr.create()).scrollIntoView());\n return true;\n };\n }\n\n return keys;\n}\n","import {\n Component,\n ElementRef,\n EventEmitter,\n Inject,\n Input,\n OnDestroy,\n OnInit,\n Optional,\n Output,\n Self,\n ViewChild,\n} from '@angular/core';\nimport {ControlValueAccessor, NgControl} from '@angular/forms';\nimport {EditorView} from 'prosemirror-view';\nimport {EditorState, Plugin, Transaction} from 'prosemirror-state';\nimport {DOMParser, DOMSerializer, Schema} from 'prosemirror-model';\nimport {DOCUMENT} from '@angular/common';\nimport {MatDialog} from '@angular/material/dialog';\nimport {columnResizing, goToNextCell, tableEditing} from 'prosemirror-tables';\nimport {keymap} from 'prosemirror-keymap';\nimport {ImagePlugin, ImageUploader} from '../utils/image';\nimport {advancedSchema, basicSchema} from '../utils/schema';\nimport {buildMenuItems, Key, MenuItems} from '../utils/menu';\nimport {history} from 'prosemirror-history';\nimport {baseKeymap} from 'prosemirror-commands';\nimport {dropCursor} from 'prosemirror-dropcursor';\nimport {gapCursor} from 'prosemirror-gapcursor';\nimport {buildInputRules} from '../utils/inputrules';\nimport {buildKeymap} from '../utils/keymap';\n\n/**\n * Prosemirror component\n *\n * Usage :\n *\n * ```html\n * <natural-editor [(ngModel)]=\"htmlString\"></natural-editor>\n * ```\n */\n// @dynamic\n@Component({\n selector: 'natural-editor',\n templateUrl: './editor.component.html',\n styleUrls: ['./editor.component.scss'],\n providers: [ImagePlugin],\n})\nexport class NaturalEditorComponent implements OnInit, OnDestroy, ControlValueAccessor {\n private view: EditorView | null = null;\n\n @ViewChild('editor', {read: ElementRef, static: true}) private editor!: ElementRef;\n\n @Output() public readonly contentChange = new EventEmitter<string>();\n\n /**\n * Callback to upload an image.\n *\n * If given it will enable advanced schema, including image and tables.\n * It must be given on initialization and cannot be changed later on.\n */\n @Input() public imageUploader: ImageUploader | null = null;\n\n private schema: Schema = basicSchema;\n\n /**\n * Interface with ControlValueAccessor\n * Notifies parent model / form controller\n */\n private onChange?: (value: string | null) => void;\n\n /**\n * HTML string\n */\n private content = '';\n\n public menu: MenuItems | null = null;\n\n /**\n * If subscribed to, then the save button will be shown and click events forwarded\n */\n @Output() public readonly save = new EventEmitter<void>();\n\n constructor(\n @Optional() @Self() public readonly ngControl: NgControl,\n @Inject(DOCUMENT) private readonly document: Document,\n private readonly dialog: MatDialog,\n private readonly imagePlugin: ImagePlugin,\n ) {\n if (this.ngControl !== null) {\n this.ngControl.valueAccessor = this;\n }\n }\n\n public ngOnInit(): void {\n this.schema = this.imageUploader ? advancedSchema : basicSchema;\n this.menu = buildMenuItems(this.schema, this.dialog);\n const serializer = DOMSerializer.fromSchema(this.schema);\n const state = this.createState();\n\n this.view = new EditorView(this.editor.nativeElement, {\n state: state,\n dispatchTransaction: (transaction: Transaction) => {\n if (!this.view) {\n return;\n }\n\n const newState = this.view.state.apply(transaction);\n this.view.updateState(newState);\n\n // Transform doc into HTML string\n const dom = serializer.serializeFragment(this.view.state.doc as any);\n const el = this.document.createElement('_');\n el.appendChild(dom);\n\n const newContent = el.innerHTML;\n if (this.content === newContent) {\n return;\n }\n\n this.content = el.innerHTML;\n\n if (this.onChange) {\n this.onChange(this.content);\n }\n this.contentChange.emit(this.content);\n },\n });\n this.update();\n }\n\n public writeValue(val: string | undefined): void {\n if (typeof val === 'string' && val !== this.content) {\n this.content = val;\n }\n\n if (this.view !== null) {\n const state = this.createState();\n this.view.updateState(state);\n }\n }\n\n private createState(): EditorState {\n const template = this.document.createElement('_');\n template.innerHTML = '<div>' + this.content + '</div>';\n if (!template.firstChild) {\n throw new Error('child of template element could not be created');\n }\n\n const parser = DOMParser.fromSchema(this.schema);\n const doc = parser.parse(template.firstChild);\n\n return EditorState.create({\n doc: doc,\n plugins: this.createPlugins(),\n });\n }\n\n private createPlugins(): Plugin[] {\n const isMac = !!this.document.defaultView?.navigator.platform.match(/Mac/);\n\n const plugins = [\n buildInputRules(this.schema),\n keymap(buildKeymap(this.schema, isMac)),\n keymap(baseKeymap),\n dropCursor(),\n gapCursor(),\n history(),\n new Plugin({\n props: {\n attributes: {class: 'ProseMirror-example-setup-style'},\n },\n }),\n new Plugin({\n view: () => this,\n }),\n ];\n\n if (this.schema === advancedSchema) {\n plugins.push(\n this.imagePlugin.plugin,\n columnResizing(undefined as any),\n tableEditing(),\n keymap({\n Tab: goToNextCell(1),\n 'Shift-Tab': goToNextCell(-1),\n }),\n );\n }\n\n return plugins;\n }\n\n /**\n * Called by Prosemirror whenever the editor state changes. So we update our menu states.\n */\n public update(): void {\n if (!this.view || !this.menu) {\n return;\n }\n\n for (const item of Object.values(this.menu)) {\n item.update(this.view, this.view.state);\n }\n }\n\n public registerOnChange(fn: any): void {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: any): void {}\n\n public setDisabledState(isDisabled: boolean): void {\n // TODO disable editor ?\n }\n\n public ngOnDestroy(): void {\n if (this.view) {\n this.view.destroy();\n this.view = null;\n }\n }\n\n public run(event: Event, key: Key): void {\n if (!this.view || !this.menu) {\n return;\n }\n\n const item = this.menu[key];\n if (!item || item.disabled || !item.show) {\n return;\n }\n\n item.spec.run(this.view.state, this.view.dispatch, this.view, event);\n this.view.focus();\n }\n\n public upload(file: File): void {\n if (!this.view || !this.imageUploader) {\n return;\n }\n\n if (this.view.state.selection.$from.parent.inlineContent) {\n this.imagePlugin.startImageUpload(this.view, file, this.imageUploader, this.schema);\n }\n\n this.view.focus();\n }\n}\n","<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érer 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érer 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érer 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érer une colonne après\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érer 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érer une ligne après\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ête 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ête 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ête 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érer 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 à 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 à numéro\"\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'élément 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ésindenter\"\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électionner l'élément parent\"\n >\n <mat-icon>select_all</mat-icon>\n </button>\n </div>\n</div>\n<div #editor></div>\n","import {CommonModule} from '@angular/common';\nimport {NgModule} from '@angular/core';\nimport {NaturalEditorComponent} from './editor/editor.component';\nimport {MatButtonModule} from '@angular/material/button';\nimport {MatButtonToggleModule} from '@angular/material/button-toggle';\nimport {MatToolbarModule} from '@angular/material/toolbar';\nimport {MatIconModule} from '@angular/material/icon';\nimport {MatMenuModule} from '@angular/material/menu';\nimport {LinkDialogComponent} from './link-dialog/link-dialog.component';\nimport {ReactiveFormsModule} from '@angular/forms';\nimport {MatDialogModule} from '@angular/material/dialog';\nimport {MatFormFieldModule} from '@angular/material/form-field';\nimport {MatInputModule} from '@angular/material/input';\nimport {MatTooltipModule} from '@angular/material/tooltip';\nimport {NaturalFileModule} from '@ecodev/natural';\nimport {MatDividerModule} from '@angular/material/divider';\n\nconst imports = [\n CommonModule,\n MatButtonModule,\n MatButtonToggleModule,\n MatDialogModule,\n MatFormFieldModule,\n MatIconModule,\n MatInputModule,\n MatMenuModule,\n MatToolbarModule,\n MatTooltipModule,\n ReactiveFormsModule,\n NaturalFileModule,\n MatDividerModule,\n];\n\n@NgModule({\n declarations: [NaturalEditorComponent, LinkDialogComponent],\n imports: [...imports],\n exports: [...imports, NaturalEditorComponent],\n})\nexport class NaturalEditorModule {}\n","// Load `$localize` onto the global scope - to be able to use that function to translate strings in components/services.\nimport '@angular/localize/init';\n\n/*\n * Public API Surface of natural-editor\n */\n\nexport {NaturalEditorComponent} from './lib/editor/editor.component';\nexport {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OAAO,GAAG;IACZ,YAAY;IACZ,eAAe;IACf,qBAAqB;IACrB,eAAe;IACf,kBAAkB;IAClB,aAAa;IACb,cAAc;IACd,aAAa;IACb,gBAAgB;IAChB,gBAAgB;IAChB,mBAAmB;IACnB,iBAAiB;IACjB,gBAAgB;CACnB,CAAC;MAOW,mBAAmB;;gHAAnB,mBAAmB;iHAAnB,mBAAmB,iBAJb,sBAAsB,EAAE,mBAAmB,aAhB1D,YAAY;QACZ,eAAe;QACf,qBAAqB;QACrB,eAAe;QACf,kBAAkB;QAClB,aAAa;QACb,cAAc;QACd,aAAa;QACb,gBAAgB;QAChB,gBAAgB;QAChB,mBAAmB;QACnB,iBAAiB;QACjB,gBAAgB,aAZhB,YAAY;QACZ,eAAe;QACf,qBAAqB;QACrB,eAAe;QACf,kBAAkB;QAClB,aAAa;QACb,cAAc;QACd,aAAa;QACb,gBAAgB;QAChB,gBAAgB;QAChB,mBAAmB;QACnB,iBAAiB;QACjB,gBAAgB,EAMM,sBAAsB;iHAEnC,mBAAmB,YAHnB,CAAC,GAAG,OAAO,CAAC,EAjBrB,YAAY;QACZ,eAAe;QACf,qBAAqB;QACrB,eAAe;QACf,kBAAkB;QAClB,aAAa;QACb,cAAc;QACd,aAAa;QACb,gBAAgB;QAChB,gBAAgB;QAChB,mBAAmB;QACnB,iBAAiB;QACjB,gBAAgB;2FAQP,mBAAmB;kBAL/B,QAAQ;mBAAC;oBACN,YAAY,EAAE,CAAC,sBAAsB,EAAE,mBAAmB,CAAC;oBAC3D,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC;oBACrB,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,sBAAsB,CAAC;iBAChD;;;ACrCD;;ACAA;;;;;;"}
@@ -47,6 +47,7 @@ export declare class NaturalEditorComponent implements OnInit, OnDestroy, Contro
47
47
  ngOnInit(): void;
48
48
  writeValue(val: string | undefined): void;
49
49
  private createState;
50
+ private createPlugins;
50
51
  /**
51
52
  * Called by Prosemirror whenever the editor state changes. So we update our menu states.
52
53
  */
@@ -0,0 +1,7 @@
1
+ import { Schema } from 'prosemirror-model';
2
+ import { Plugin } from 'prosemirror-state';
3
+ /**
4
+ * A set of input rules for creating the basic block quotes, lists,
5
+ * code blocks, and heading.
6
+ */
7
+ export declare function buildInputRules(schema: Schema): Plugin;
@@ -0,0 +1,32 @@
1
+ import { Keymap } from 'prosemirror-commands';
2
+ import { Schema } from 'prosemirror-model';
3
+ /**
4
+ * Inspect the given schema looking for marks and nodes from the
5
+ * basic schema, and if found, add key bindings related to them.
6
+ * This will add:
7
+ *
8
+ * * **Mod-b** for toggling [strong](#schema-basic.StrongMark)
9
+ * * **Mod-i** for toggling [emphasis](#schema-basic.EmMark)
10
+ * * **Mod-`** for toggling [code font](#schema-basic.CodeMark)
11
+ * * **Ctrl-Shift-0** for making the current textblock a paragraph
12
+ * * **Ctrl-Shift-1** to **Ctrl-Shift-Digit6** for making the current
13
+ * textblock a heading of the corresponding level
14
+ * * **Ctrl-Shift-Backslash** to make the current textblock a code block
15
+ * * **Ctrl-Shift-8** to wrap the selection in an ordered list
16
+ * * **Ctrl-Shift-9** to wrap the selection in a bullet list
17
+ * * **Ctrl->** to wrap the selection in a block quote
18
+ * * **Enter** to split a non-empty textblock in a list item while at
19
+ * the same time splitting the list item
20
+ * * **Mod-Enter** to insert a hard break
21
+ * * **Mod-_** to insert a horizontal rule
22
+ * * **Backspace** to undo an input rule
23
+ * * **Alt-ArrowUp** to `joinUp`
24
+ * * **Alt-ArrowDown** to `joinDown`
25
+ * * **Mod-BracketLeft** to `lift`
26
+ * * **Escape** to `selectParentNode`
27
+ *
28
+ * You can suppress or map these bindings by passing a `mapKeys`
29
+ * argument, which maps key names (say `"Mod-B"` to either `false`, to
30
+ * remove the binding, or a new key name string.
31
+ */
32
+ export declare function buildKeymap(schema: Schema, isMac: boolean): Keymap;