@modusoperandi/licit-vignette 0.0.18 → 1.0.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.
Files changed (66) hide show
  1. package/{dist/Constants.d.ts → Constants.d.ts} +6 -6
  2. package/{dist/CreateCommand.d.ts → CreateCommand.d.ts} +7 -7
  3. package/CreateCommand.js +36 -0
  4. package/TableBackgroundColorCommand.d.ts +4 -0
  5. package/TableBackgroundColorCommand.js +6 -0
  6. package/TableBorderColorCommand.d.ts +4 -0
  7. package/TableBorderColorCommand.js +6 -0
  8. package/{dist/VignetteCommand.d.ts → VignetteCommand.d.ts} +19 -12
  9. package/VignetteCommand.js +93 -0
  10. package/VignetteMenuPlugin.d.ts +24 -0
  11. package/VignetteMenuPlugin.js +112 -0
  12. package/{dist/VignetteNodeSpec.d.ts → VignetteNodeSpec.d.ts} +3 -3
  13. package/VignetteNodeSpec.js +67 -0
  14. package/{dist/VignettePlugin.d.ts → VignettePlugin.d.ts} +12 -12
  15. package/VignettePlugin.js +39 -0
  16. package/VignettePlugins.d.ts +3 -0
  17. package/VignettePlugins.js +6 -0
  18. package/index.d.ts +10 -0
  19. package/index.js +10 -0
  20. package/package.json +42 -81
  21. package/{dist/ui → ui}/TableColorCommand.d.ts +17 -14
  22. package/ui/TableColorCommand.js +59 -0
  23. package/.eslintignore +0 -4
  24. package/.eslintrc.js +0 -107
  25. package/.prettierignore +0 -6
  26. package/.prettierrc +0 -5
  27. package/.stylelintignore +0 -3
  28. package/.stylelintrc.json +0 -10
  29. package/LICENSE +0 -21
  30. package/README.md +0 -33
  31. package/babel.config.json +0 -53
  32. package/dist/Constants.js +0 -18
  33. package/dist/CreateCommand.js +0 -30
  34. package/dist/TableBackgroundColorCommand.d.ts +0 -5
  35. package/dist/TableBackgroundColorCommand.js +0 -21
  36. package/dist/TableBorderColorCommand.d.ts +0 -5
  37. package/dist/TableBorderColorCommand.js +0 -21
  38. package/dist/VignetteCommand.js +0 -104
  39. package/dist/VignetteMenuPlugin.d.ts +0 -5
  40. package/dist/VignetteMenuPlugin.js +0 -116
  41. package/dist/VignetteNodeSpec.js +0 -83
  42. package/dist/VignettePlugin.js +0 -49
  43. package/dist/VignettePlugins.d.ts +0 -4
  44. package/dist/VignettePlugins.js +0 -11
  45. package/dist/index.d.ts +0 -2
  46. package/dist/index.js +0 -13
  47. package/dist/index.test.js +0 -48
  48. package/dist/ui/TableColorCommand.js +0 -64
  49. package/jest.config.ts +0 -208
  50. package/jest.setup.js +0 -2
  51. package/lint.sh +0 -4
  52. package/sonar-project.properties +0 -11
  53. package/src/CreateCommand.ts +0 -38
  54. package/src/TableBackgroundColorCommand.ts +0 -9
  55. package/src/TableBorderColorCommand.ts +0 -9
  56. package/src/VignetteCommand.ts +0 -103
  57. package/src/VignetteMenuPlugin.ts +0 -151
  58. package/src/VignetteNodeSpec.ts +0 -74
  59. package/src/VignettePlugin.ts +0 -53
  60. package/src/VignettePlugins.ts +0 -7
  61. package/src/index.test.ts +0 -59
  62. package/src/index.ts +0 -3
  63. package/src/ui/TableColorCommand.tsx +0 -79
  64. package/tsconfig.json +0 -38
  65. package/webpack.config.js +0 -89
  66. /package/{src/Constants.ts → Constants.js} +0 -0
@@ -1,6 +1,6 @@
1
- export declare const VIGNETTE = "vignette";
2
- export declare const PARAGRAPH = "paragraph";
3
- export declare const TABLE = "table";
4
- export declare const TABLE_CELL = "table_cell";
5
- export declare const DEF_BORDER_COLOR = "#36598d";
6
- export declare const DEF_BORDER_RADIUS = "10px";
1
+ export declare const VIGNETTE = "vignette";
2
+ export declare const PARAGRAPH = "paragraph";
3
+ export declare const TABLE = "table";
4
+ export declare const TABLE_CELL = "table_cell";
5
+ export declare const DEF_BORDER_COLOR = "#36598d";
6
+ export declare const DEF_BORDER_RADIUS = "10px";
@@ -1,7 +1,7 @@
1
- import { EditorState } from 'prosemirror-state';
2
- import { Transform } from 'prosemirror-transform';
3
- import { EditorView } from 'prosemirror-view';
4
- import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
5
- type ExecuteCall = (state: EditorState, dispatch?: (tr: Transform) => void, view?: EditorView) => boolean;
6
- export default function createCommand(execute: ExecuteCall): UICommand;
7
- export {};
1
+ import { EditorState } from 'prosemirror-state';
2
+ import { Transform } from 'prosemirror-transform';
3
+ import { EditorView } from 'prosemirror-view';
4
+ import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
5
+ type ExecuteCall = (state: EditorState, dispatch?: (tr: Transform) => void, view?: EditorView) => boolean;
6
+ export declare function createCommand(execute: ExecuteCall): UICommand;
7
+ export {};
@@ -0,0 +1,36 @@
1
+ import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
2
+ export function createCommand(execute) {
3
+ class CustomCommand extends UICommand {
4
+ isEnabled = (state) => {
5
+ return this.execute(state);
6
+ };
7
+ execute = (state, dispatch, view) => {
8
+ const tr = state.tr;
9
+ let endTr = tr;
10
+ execute(state, (nextTr) => {
11
+ endTr = nextTr;
12
+ dispatch?.(endTr);
13
+ }, view);
14
+ return endTr.docChanged || tr !== endTr;
15
+ };
16
+ waitForUserInput = (_state, _dispatch, _view, _event) => {
17
+ return Promise.resolve(undefined);
18
+ };
19
+ executeWithUserInput = (_state, _dispatch, _view, _inputs) => {
20
+ return false;
21
+ };
22
+ cancel() {
23
+ return null;
24
+ }
25
+ renderLabel() {
26
+ return null;
27
+ }
28
+ isActive() {
29
+ return true;
30
+ }
31
+ executeCustom(_state, tr) {
32
+ return tr;
33
+ }
34
+ }
35
+ return new CustomCommand();
36
+ }
@@ -0,0 +1,4 @@
1
+ import { TableColorCommand } from './ui/TableColorCommand';
2
+ export declare class TableBackgroundColorCommand extends TableColorCommand {
3
+ getAttrName: () => string;
4
+ }
@@ -0,0 +1,6 @@
1
+ import { TableColorCommand } from './ui/TableColorCommand';
2
+ export class TableBackgroundColorCommand extends TableColorCommand {
3
+ getAttrName = () => {
4
+ return 'background';
5
+ };
6
+ }
@@ -0,0 +1,4 @@
1
+ import { TableColorCommand } from './ui/TableColorCommand';
2
+ export declare class TableBorderColorCommand extends TableColorCommand {
3
+ getAttrName: () => string;
4
+ }
@@ -0,0 +1,6 @@
1
+ import { TableColorCommand } from './ui/TableColorCommand';
2
+ export class TableBorderColorCommand extends TableColorCommand {
3
+ getAttrName = () => {
4
+ return 'borderColor';
5
+ };
6
+ }
@@ -1,12 +1,19 @@
1
- import { Schema } from 'prosemirror-model';
2
- import { EditorState, Transaction } from 'prosemirror-state';
3
- import { EditorView } from 'prosemirror-view';
4
- import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
5
- declare class VignetteCommand extends UICommand {
6
- isEnabled: (state: EditorState, view?: EditorView) => boolean;
7
- execute: (state: EditorState, dispatch?: (tr: Transaction) => void, view?: EditorView) => boolean;
8
- __isEnabled: (_state: EditorState, _view?: EditorView) => boolean;
9
- insertTable(tr: Transaction, schema: Schema, rows: number, cols: number): Transaction;
10
- insertParagraph(state: EditorState, tr: Transaction): Transaction;
11
- }
12
- export default VignetteCommand;
1
+ import { Schema } from 'prosemirror-model';
2
+ import { EditorState, Transaction } from 'prosemirror-state';
3
+ import { EditorView } from 'prosemirror-view';
4
+ import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
5
+ import * as React from 'react';
6
+ import { Transform } from 'prosemirror-transform';
7
+ export declare class VignetteCommand extends UICommand {
8
+ isEnabled: (state: EditorState, view?: EditorView) => boolean;
9
+ execute: (state: EditorState, dispatch?: (tr: Transaction) => void, view?: EditorView) => boolean;
10
+ waitForUserInput: (_state: EditorState, _dispatch: (tr: Transform) => void, _view: EditorView, _event: React.SyntheticEvent<Element, Event>) => Promise<undefined>;
11
+ executeWithUserInput: (_state: EditorState, _dispatch: (tr: Transform) => void, _view: EditorView, _inputs: string) => boolean;
12
+ cancel(): void;
13
+ __isEnabled: (_state: EditorState, _view?: EditorView) => boolean;
14
+ insertTable(tr: Transaction, schema: Schema, rows: number, cols: number): Transaction;
15
+ insertParagraph(state: EditorState, tr: Transaction): Transaction;
16
+ renderLabel(): any;
17
+ isActive(): boolean;
18
+ executeCustom(_state: EditorState, tr: Transform): Transform;
19
+ }
@@ -0,0 +1,93 @@
1
+ import { Fragment } from 'prosemirror-model';
2
+ import { TextSelection } from 'prosemirror-state';
3
+ import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
4
+ import { DEF_BORDER_COLOR, PARAGRAPH, TABLE, TABLE_CELL } from './Constants';
5
+ export class VignetteCommand extends UICommand {
6
+ isEnabled = (state, view) => {
7
+ return this.__isEnabled(state, view);
8
+ };
9
+ execute = (state, dispatch, view) => {
10
+ if (dispatch) {
11
+ const { schema } = state;
12
+ let { tr } = state;
13
+ tr = this.insertTable(tr, schema, 1, 1);
14
+ tr = this.insertParagraph(state, tr);
15
+ dispatch(tr);
16
+ view?.focus();
17
+ }
18
+ return true;
19
+ };
20
+ waitForUserInput = (_state, _dispatch, _view, _event) => {
21
+ return Promise.resolve(undefined);
22
+ };
23
+ executeWithUserInput = (_state, _dispatch, _view, _inputs) => {
24
+ return false;
25
+ };
26
+ cancel() {
27
+ return null;
28
+ }
29
+ __isEnabled = (_state, _view) => {
30
+ return true;
31
+ };
32
+ insertTable(tr, schema, rows, cols) {
33
+ if (!tr.selection || !tr.doc) {
34
+ return tr;
35
+ }
36
+ const { from, to } = tr.selection;
37
+ if (from !== to) {
38
+ return tr;
39
+ }
40
+ const { nodes } = schema;
41
+ const cell = nodes[TABLE_CELL];
42
+ const paragraph = nodes[PARAGRAPH];
43
+ const row = nodes['table_row'];
44
+ const table = nodes[TABLE];
45
+ if (!(cell && paragraph && row && table)) {
46
+ return tr;
47
+ }
48
+ const rowNodes = [];
49
+ for (let rr = 0; rr < rows; rr++) {
50
+ const cellNodes = [];
51
+ for (let cc = 0; cc < cols; cc++) {
52
+ // [FS] IRAD-950 2020-05-25
53
+ // Fix:Extra arrow key required for cell navigation using arrow right/Left
54
+ const cellNode = cell.create({
55
+ borderColor: DEF_BORDER_COLOR,
56
+ background: '#dce6f2',
57
+ vignette: true,
58
+ }, Fragment.fromArray([paragraph.create()]));
59
+ cellNodes.push(cellNode);
60
+ }
61
+ const rowNode = row.create({}, Fragment.from(cellNodes));
62
+ rowNodes.push(rowNode);
63
+ }
64
+ const tableNode = table.create({ vignette: true }, Fragment.from(rowNodes));
65
+ tr = tr.insert(from, Fragment.from(tableNode));
66
+ const selection = TextSelection.create(tr.doc, from + 5, from + 5);
67
+ tr = tr.setSelection(selection);
68
+ return tr;
69
+ }
70
+ // [FS] 2021-04-01
71
+ // Add empty line after table drop
72
+ // To make easier to enter a line after table
73
+ insertParagraph(state, tr) {
74
+ const paragraph = state.schema.nodes[PARAGRAPH];
75
+ const textNode = state.schema.text(' ');
76
+ const { from, to } = tr.selection;
77
+ if (from !== to) {
78
+ return tr;
79
+ }
80
+ const paragraphNode = paragraph.create({}, textNode, null);
81
+ tr = tr.insert(from + tr.selection.$head.node(1).nodeSize - 4, Fragment.from(paragraphNode));
82
+ return tr;
83
+ }
84
+ renderLabel() {
85
+ return null;
86
+ }
87
+ isActive() {
88
+ return true;
89
+ }
90
+ executeCustom(_state, tr) {
91
+ return tr;
92
+ }
93
+ }
@@ -0,0 +1,24 @@
1
+ import { EditorState, Plugin } from 'prosemirror-state';
2
+ import { EditorView } from 'prosemirror-view';
3
+ import { Node } from 'prosemirror-model';
4
+ import { UICommand } from '@modusoperandi/licit-doc-attrs-step';
5
+ import { TableView } from 'prosemirror-tables';
6
+ export declare class VignetteView {
7
+ constructor(editorView: EditorView);
8
+ setCustomMenu(editorView: EditorView): void;
9
+ setCustomTableNodeViewUpdate(editorView: EditorView): void;
10
+ tableNodeViewEx(tableNodeView: (node: Node, view: EditorView) => TableView, node: Node, view: EditorView): TableView;
11
+ updateEx(update: (node: Node) => boolean, self: VignetteView, node: Node): boolean;
12
+ updateBorder(tableView: TableView): void;
13
+ static isVignette(state: EditorState, actionNode: Node): boolean;
14
+ getMenu(state: EditorState, actionNode: Node, cmdGrps: Array<{
15
+ [key: string]: UICommand;
16
+ }>): Array<{
17
+ [key: string]: UICommand;
18
+ }>;
19
+ isEnabledEx(isEnabled: (state: EditorState, view?: EditorView) => boolean, state: EditorState, view?: EditorView): boolean;
20
+ destroy: () => void;
21
+ }
22
+ export declare class VignetteMenuPlugin extends Plugin {
23
+ constructor();
24
+ }
@@ -0,0 +1,112 @@
1
+ import { Plugin, PluginKey } from 'prosemirror-state';
2
+ import { TableBackgroundColorCommand } from './TableBackgroundColorCommand';
3
+ import { TableBorderColorCommand } from './TableBorderColorCommand';
4
+ import { createCommand } from './CreateCommand';
5
+ import { CellSelection, deleteTable } from 'prosemirror-tables';
6
+ import { TABLE } from './Constants';
7
+ const TABLE_BACKGROUND_COLOR = new TableBackgroundColorCommand();
8
+ const TABLE_BORDER_COLOR = new TableBorderColorCommand();
9
+ const TABLE_DELETE_TABLE = createCommand(deleteTable);
10
+ const VIGNETTE_COMMANDS_GROUP = [
11
+ {
12
+ 'Fill Color...': TABLE_BACKGROUND_COLOR,
13
+ 'Border Color....': TABLE_BORDER_COLOR,
14
+ },
15
+ {
16
+ 'Delete Vignette': TABLE_DELETE_TABLE,
17
+ },
18
+ ];
19
+ export class VignetteView {
20
+ constructor(editorView) {
21
+ this.setCustomMenu(editorView);
22
+ this.setCustomTableNodeViewUpdate(editorView);
23
+ }
24
+ setCustomMenu(editorView) {
25
+ editorView['pluginViews'].forEach((pluginView) => {
26
+ if (
27
+ // 'TableCellTooltipView' has property _cellElement
28
+ Object.hasOwn(pluginView, '_cellElement')) {
29
+ pluginView['getMenu'] = this.getMenu.bind(this);
30
+ }
31
+ });
32
+ }
33
+ setCustomTableNodeViewUpdate(editorView) {
34
+ const tableNodeView = editorView['nodeViews']['table'];
35
+ const tableNodeViewEx = this.tableNodeViewEx.bind(this, tableNodeView);
36
+ editorView['nodeViews'][TABLE] = tableNodeViewEx;
37
+ const index = editorView.state.plugins.findIndex((plugin) => {
38
+ let found = false;
39
+ if (plugin.spec.key) {
40
+ found = plugin.spec.key['key'].includes('tableColumnResizing$');
41
+ }
42
+ return found;
43
+ });
44
+ if (-1 != index) {
45
+ editorView.state.plugins[index].spec.props.nodeViews[TABLE] =
46
+ tableNodeViewEx;
47
+ }
48
+ }
49
+ tableNodeViewEx(tableNodeView, node, view) {
50
+ const base = tableNodeView?.(node, view);
51
+ if (base?.update && node.attrs.vignette) {
52
+ base.update = this.updateEx.bind(base, base.update, this);
53
+ this.updateBorder(base);
54
+ }
55
+ return base;
56
+ }
57
+ updateEx(update, self, node) {
58
+ const result = update.call(this, node);
59
+ if (result) {
60
+ self.updateBorder(this);
61
+ }
62
+ return result;
63
+ }
64
+ updateBorder(tableView) {
65
+ if (tableView.table) {
66
+ tableView.table.style.border = 'none';
67
+ }
68
+ }
69
+ static isVignette(state, actionNode) {
70
+ let vignette = false;
71
+ if (state.selection instanceof CellSelection) {
72
+ if (state.selection.$anchorCell.node(-1).attrs.vignette) {
73
+ vignette = true;
74
+ }
75
+ }
76
+ if (actionNode?.attrs.vignette) {
77
+ vignette = true;
78
+ }
79
+ if (state.selection.$anchor.node(1).attrs.vignette) {
80
+ vignette = true;
81
+ }
82
+ return vignette;
83
+ }
84
+ getMenu(state, actionNode, cmdGrps) {
85
+ const vignette = VignetteView.isVignette(state, actionNode);
86
+ cmdGrps.forEach((cmdGrp) => {
87
+ Object.entries(cmdGrp).forEach((entry) => {
88
+ entry[1].isEnabled = this.isEnabledEx.bind(entry[1], entry[1].isEnabled);
89
+ });
90
+ });
91
+ return vignette ? VIGNETTE_COMMANDS_GROUP : cmdGrps;
92
+ }
93
+ isEnabledEx(isEnabled, state, view) {
94
+ return VignetteView.isVignette(state, null)
95
+ ? false
96
+ : isEnabled.call(this, state, view);
97
+ }
98
+ destroy = () => {
99
+ // do nothing.
100
+ };
101
+ }
102
+ const SPEC = {
103
+ key: new PluginKey('VignetteMenuPlugin'),
104
+ view(editorView) {
105
+ return new VignetteView(editorView);
106
+ },
107
+ };
108
+ export class VignetteMenuPlugin extends Plugin {
109
+ constructor() {
110
+ super(SPEC);
111
+ }
112
+ }
@@ -1,3 +1,3 @@
1
- export declare const VignetteTableNodeSpec: (nodespec: NodeSpec) => any;
2
- export declare const VignetteTableCellNodeSpec: (nodespec: NodeSpec) => any;
3
- export default VignetteTableNodeSpec;
1
+ import { NodeSpec } from 'prosemirror-model';
2
+ export declare const VignetteTableNodeSpec: (nodespec: NodeSpec) => NodeSpec;
3
+ export declare const VignetteTableCellNodeSpec: (nodespec: NodeSpec) => NodeSpec;
@@ -0,0 +1,67 @@
1
+ import { TABLE, VIGNETTE } from './Constants';
2
+ // Override the default table node spec to support custom attributes.
3
+ export const VignetteTableNodeSpec = (nodespec) => ({
4
+ ...nodespec,
5
+ attrs: {
6
+ marginLeft: { default: null },
7
+ vignette: { default: false },
8
+ },
9
+ parseDOM: [
10
+ {
11
+ tag: TABLE,
12
+ getAttrs(dom) {
13
+ const { marginLeft } = dom.style;
14
+ const vignette = dom.getAttribute(VIGNETTE) === 'true' || false;
15
+ const marginAmount = parseFloat(marginLeft);
16
+ if (marginLeft &&
17
+ !Number.isNaN(marginAmount) &&
18
+ marginLeft.includes('px')) {
19
+ return { marginLeft: marginAmount, vignette };
20
+ }
21
+ return { vignette };
22
+ },
23
+ style: 'border',
24
+ }
25
+ ],
26
+ toDOM(node) {
27
+ // Normally, the DOM structure of the table node is rendered by
28
+ // `TableNodeView`. This method is only called when user selects a
29
+ // table node and copies it, which triggers the "serialize to HTML" flow
30
+ // that calles this method.
31
+ const { marginLeft, vignette } = node.attrs;
32
+ const domAttrs = { vignette };
33
+ let style = 'border: none';
34
+ if (marginLeft) {
35
+ style += `margin-left: ${marginLeft}px`;
36
+ }
37
+ domAttrs['style'] = style;
38
+ return [TABLE, domAttrs, 0];
39
+ },
40
+ });
41
+ export const VignetteTableCellNodeSpec = (nodespec) => ({
42
+ ...nodespec,
43
+ attrs: { ...nodespec.attrs, vignette: { default: false } },
44
+ parseDOM: [
45
+ {
46
+ tag: 'td',
47
+ getAttrs: (dom) => {
48
+ return {
49
+ ...nodespec.parseDOM[0].getAttrs(dom),
50
+ vignette: dom.getAttribute(VIGNETTE) === 'true' || false,
51
+ };
52
+ },
53
+ },
54
+ ],
55
+ toDOM(node) {
56
+ const base = nodespec.toDOM(node);
57
+ if (node.attrs.vignette &&
58
+ Array.isArray(base) &&
59
+ 1 < base.length &&
60
+ base[1].style) {
61
+ base[1].style +=
62
+ 'border-radius: 10px; border:none!important; box-shadow: inset 0 0 0 1px #36598d;';
63
+ }
64
+ base[1].vignette = node.attrs.vignette;
65
+ return base;
66
+ },
67
+ });
@@ -1,12 +1,12 @@
1
- import { Plugin } from 'prosemirror-state';
2
- import { EditorView } from 'prosemirror-view';
3
- import { Schema } from 'prosemirror-model';
4
- import VignetteCommand from './VignetteCommand';
5
- export declare class VignettePlugin extends Plugin {
6
- _view: EditorView;
7
- constructor();
8
- getEffectiveSchema(schema: Schema): Schema;
9
- initButtonCommands(): {
10
- '[crop] Insert Vignette': VignetteCommand;
11
- };
12
- }
1
+ import { Plugin } from 'prosemirror-state';
2
+ import { EditorView } from 'prosemirror-view';
3
+ import { Schema } from 'prosemirror-model';
4
+ import { VignetteCommand } from './VignetteCommand';
5
+ export declare class VignettePlugin extends Plugin {
6
+ _view: EditorView;
7
+ constructor();
8
+ getEffectiveSchema(schema: Schema): Schema;
9
+ initButtonCommands(): {
10
+ '[crop] Insert Vignette': VignetteCommand;
11
+ };
12
+ }
@@ -0,0 +1,39 @@
1
+ // Plugin to handle Citation.
2
+ import { Plugin, PluginKey } from 'prosemirror-state';
3
+ import { Schema } from 'prosemirror-model';
4
+ import { VignetteCommand } from './VignetteCommand';
5
+ import { VignetteTableCellNodeSpec, VignetteTableNodeSpec, } from './VignetteNodeSpec';
6
+ import { TABLE, TABLE_CELL } from './Constants';
7
+ export class VignettePlugin extends Plugin {
8
+ _view = null;
9
+ constructor() {
10
+ super({
11
+ key: new PluginKey('VignettePlugin'),
12
+ state: {
13
+ init(_config, _state) {
14
+ // do nothing
15
+ },
16
+ apply(_tr, _set) {
17
+ //do nothing
18
+ },
19
+ },
20
+ props: {
21
+ nodeViews: {},
22
+ },
23
+ });
24
+ }
25
+ getEffectiveSchema(schema) {
26
+ let nodes = schema.spec.nodes.update(TABLE, VignetteTableNodeSpec(schema.spec.nodes.get(TABLE)));
27
+ nodes = nodes.update(TABLE_CELL, VignetteTableCellNodeSpec(schema.spec.nodes.get(TABLE_CELL)));
28
+ const marks = schema.spec.marks;
29
+ return new Schema({
30
+ nodes: nodes,
31
+ marks: marks,
32
+ });
33
+ }
34
+ initButtonCommands() {
35
+ return {
36
+ '[crop] Insert Vignette': new VignetteCommand(),
37
+ };
38
+ }
39
+ }
@@ -0,0 +1,3 @@
1
+ import { VignettePlugin } from './VignettePlugin';
2
+ import { VignetteMenuPlugin } from './VignetteMenuPlugin';
3
+ export declare const VignettePlugins: (VignetteMenuPlugin | VignettePlugin)[];
@@ -0,0 +1,6 @@
1
+ import { VignettePlugin } from './VignettePlugin';
2
+ import { VignetteMenuPlugin } from './VignetteMenuPlugin';
3
+ export const VignettePlugins = [
4
+ new VignetteMenuPlugin(),
5
+ new VignettePlugin(),
6
+ ];
package/index.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ export * from './VignettePlugins';
2
+ export * from './ui/TableColorCommand';
3
+ export * from './CreateCommand';
4
+ export * from './TableBackgroundColorCommand';
5
+ export * from './TableBorderColorCommand';
6
+ export * from './VignetteCommand';
7
+ export * from './VignettePlugin';
8
+ export * from './Constants';
9
+ export * from './VignetteMenuPlugin';
10
+ export * from './VignetteNodeSpec';
package/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export * from './VignettePlugins';
2
+ export * from './ui/TableColorCommand';
3
+ export * from './CreateCommand';
4
+ export * from './TableBackgroundColorCommand';
5
+ export * from './TableBorderColorCommand';
6
+ export * from './VignetteCommand';
7
+ export * from './VignettePlugin';
8
+ export * from './Constants';
9
+ export * from './VignetteMenuPlugin';
10
+ export * from './VignetteNodeSpec';