@kerebron/extension-tables 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/tables.css +46 -9
- package/package.json +4 -1
- package/esm/editor/src/CoreEditor.d.ts +0 -25
- package/esm/editor/src/CoreEditor.d.ts.map +0 -1
- package/esm/editor/src/CoreEditor.js +0 -194
- package/esm/editor/src/Extension.d.ts +0 -26
- package/esm/editor/src/Extension.d.ts.map +0 -1
- package/esm/editor/src/Extension.js +0 -33
- package/esm/editor/src/ExtensionManager.d.ts +0 -32
- package/esm/editor/src/ExtensionManager.d.ts.map +0 -1
- package/esm/editor/src/ExtensionManager.js +0 -253
- package/esm/editor/src/Mark.d.ts +0 -18
- package/esm/editor/src/Mark.d.ts.map +0 -1
- package/esm/editor/src/Mark.js +0 -34
- package/esm/editor/src/Node.d.ts +0 -27
- package/esm/editor/src/Node.d.ts.map +0 -1
- package/esm/editor/src/Node.js +0 -43
- package/esm/editor/src/commands/CommandManager.d.ts +0 -20
- package/esm/editor/src/commands/CommandManager.d.ts.map +0 -1
- package/esm/editor/src/commands/CommandManager.js +0 -60
- package/esm/editor/src/commands/createChainableState.d.ts +0 -3
- package/esm/editor/src/commands/createChainableState.d.ts.map +0 -1
- package/esm/editor/src/commands/createChainableState.js +0 -29
- package/esm/editor/src/commands/mod.d.ts +0 -49
- package/esm/editor/src/commands/mod.d.ts.map +0 -1
- package/esm/editor/src/commands/mod.js +0 -928
- package/esm/editor/src/mod.d.ts +0 -6
- package/esm/editor/src/mod.d.ts.map +0 -1
- package/esm/editor/src/mod.js +0 -5
- package/esm/editor/src/nodeToTreeString.d.ts +0 -4
- package/esm/editor/src/nodeToTreeString.d.ts.map +0 -1
- package/esm/editor/src/nodeToTreeString.js +0 -56
- package/esm/editor/src/plugins/input-rules/InputRulesPlugin.d.ts +0 -23
- package/esm/editor/src/plugins/input-rules/InputRulesPlugin.d.ts.map +0 -1
- package/esm/editor/src/plugins/input-rules/InputRulesPlugin.js +0 -163
- package/esm/editor/src/plugins/input-rules/mod.d.ts +0 -3
- package/esm/editor/src/plugins/input-rules/mod.d.ts.map +0 -1
- package/esm/editor/src/plugins/input-rules/mod.js +0 -2
- package/esm/editor/src/plugins/input-rules/rulebuilders.d.ts +0 -5
- package/esm/editor/src/plugins/input-rules/rulebuilders.d.ts.map +0 -1
- package/esm/editor/src/plugins/input-rules/rulebuilders.js +0 -50
- package/esm/editor/src/types.d.ts +0 -29
- package/esm/editor/src/types.d.ts.map +0 -1
- package/esm/editor/src/types.js +0 -1
- package/esm/editor/src/utilities/createNodeFromContent.d.ts +0 -8
- package/esm/editor/src/utilities/createNodeFromContent.d.ts.map +0 -1
- package/esm/editor/src/utilities/createNodeFromContent.js +0 -33
- package/esm/editor/src/utilities/getHtmlAttributes.d.ts +0 -4
- package/esm/editor/src/utilities/getHtmlAttributes.d.ts.map +0 -1
- package/esm/editor/src/utilities/getHtmlAttributes.js +0 -47
- package/esm/editor/src/utilities/mod.d.ts +0 -3
- package/esm/editor/src/utilities/mod.d.ts.map +0 -1
- package/esm/editor/src/utilities/mod.js +0 -2
- package/esm/extension-tables/src/ExtensionTables.d.ts +0 -10
- package/esm/extension-tables/src/ExtensionTables.d.ts.map +0 -1
- package/esm/extension-tables/src/ExtensionTables.js +0 -27
- package/esm/extension-tables/src/NodeTable.d.ts +0 -24
- package/esm/extension-tables/src/NodeTable.d.ts.map +0 -1
- package/esm/extension-tables/src/NodeTable.js +0 -115
- package/esm/extension-tables/src/NodeTableCell.d.ts +0 -16
- package/esm/extension-tables/src/NodeTableCell.d.ts.map +0 -1
- package/esm/extension-tables/src/NodeTableCell.js +0 -77
- package/esm/extension-tables/src/NodeTableHeader.d.ts +0 -16
- package/esm/extension-tables/src/NodeTableHeader.d.ts.map +0 -1
- package/esm/extension-tables/src/NodeTableHeader.js +0 -75
- package/esm/extension-tables/src/NodeTableRow.d.ts +0 -16
- package/esm/extension-tables/src/NodeTableRow.d.ts.map +0 -1
- package/esm/extension-tables/src/NodeTableRow.js +0 -47
- package/esm/extension-tables/src/utilities/CellSelection.d.ts +0 -53
- package/esm/extension-tables/src/utilities/CellSelection.d.ts.map +0 -1
- package/esm/extension-tables/src/utilities/CellSelection.js +0 -382
- package/esm/extension-tables/src/utilities/TableMap.d.ts +0 -92
- package/esm/extension-tables/src/utilities/TableMap.d.ts.map +0 -1
- package/esm/extension-tables/src/utilities/TableMap.js +0 -335
- package/esm/extension-tables/src/utilities/TableView.d.ts +0 -21
- package/esm/extension-tables/src/utilities/TableView.d.ts.map +0 -1
- package/esm/extension-tables/src/utilities/TableView.js +0 -108
- package/esm/extension-tables/src/utilities/columnResizing.d.ts +0 -50
- package/esm/extension-tables/src/utilities/columnResizing.d.ts.map +0 -1
- package/esm/extension-tables/src/utilities/columnResizing.js +0 -306
- package/esm/extension-tables/src/utilities/commands.d.ts +0 -166
- package/esm/extension-tables/src/utilities/commands.d.ts.map +0 -1
- package/esm/extension-tables/src/utilities/commands.js +0 -702
- package/esm/extension-tables/src/utilities/copypaste.d.ts +0 -35
- package/esm/extension-tables/src/utilities/copypaste.d.ts.map +0 -1
- package/esm/extension-tables/src/utilities/copypaste.js +0 -283
- package/esm/extension-tables/src/utilities/createCell.d.ts +0 -3
- package/esm/extension-tables/src/utilities/createCell.d.ts.map +0 -1
- package/esm/extension-tables/src/utilities/createCell.js +0 -6
- package/esm/extension-tables/src/utilities/createTable.d.ts +0 -3
- package/esm/extension-tables/src/utilities/createTable.d.ts.map +0 -1
- package/esm/extension-tables/src/utilities/createTable.js +0 -30
- package/esm/extension-tables/src/utilities/fixTables.d.ts +0 -20
- package/esm/extension-tables/src/utilities/fixTables.d.ts.map +0 -1
- package/esm/extension-tables/src/utilities/fixTables.js +0 -146
- package/esm/extension-tables/src/utilities/getTableNodeTypes.d.ts +0 -5
- package/esm/extension-tables/src/utilities/getTableNodeTypes.d.ts.map +0 -1
- package/esm/extension-tables/src/utilities/getTableNodeTypes.js +0 -14
- package/esm/extension-tables/src/utilities/input.d.ts +0 -21
- package/esm/extension-tables/src/utilities/input.d.ts.map +0 -1
- package/esm/extension-tables/src/utilities/input.js +0 -241
- package/esm/extension-tables/src/utilities/tableEditing.d.ts +0 -23
- package/esm/extension-tables/src/utilities/tableEditing.d.ts.map +0 -1
- package/esm/extension-tables/src/utilities/tableEditing.js +0 -63
- package/esm/extension-tables/src/utilities/tableNodeTypes.d.ts +0 -14
- package/esm/extension-tables/src/utilities/tableNodeTypes.d.ts.map +0 -1
- package/esm/extension-tables/src/utilities/tableNodeTypes.js +0 -16
- package/esm/extension-tables/src/utilities/util.d.ts +0 -73
- package/esm/extension-tables/src/utilities/util.d.ts.map +0 -1
- package/esm/extension-tables/src/utilities/util.js +0 -155
- package/esm/package.json +0 -3
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { TextSelection } from 'prosemirror-state';
|
|
2
|
-
import { Node } from '../../editor/src/mod.js';
|
|
3
|
-
import { getHtmlAttributes, setHtmlAttributes, } from '../../editor/src/utilities/mod.js';
|
|
4
|
-
import { createTable } from './utilities/createTable.js';
|
|
5
|
-
import { fixTables } from './utilities/fixTables.js';
|
|
6
|
-
import { CellSelection } from './utilities/CellSelection.js';
|
|
7
|
-
import { columnResizing } from './utilities/columnResizing.js';
|
|
8
|
-
import { tableEditing } from './utilities/tableEditing.js';
|
|
9
|
-
import { addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, deleteColumn, deleteRow, deleteTable, goToNextCell, mergeCells, setCellAttr, splitCell, toggleHeader, toggleHeaderCell, toggleHeaderColumn, toggleHeaderRow, } from './utilities/commands.js';
|
|
10
|
-
export class NodeTable extends Node {
|
|
11
|
-
constructor() {
|
|
12
|
-
super(...arguments);
|
|
13
|
-
Object.defineProperty(this, "name", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
configurable: true,
|
|
16
|
-
writable: true,
|
|
17
|
-
value: 'table'
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(this, "requires", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
configurable: true,
|
|
22
|
-
writable: true,
|
|
23
|
-
value: ['doc']
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(this, "automerge", {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
configurable: true,
|
|
28
|
-
writable: true,
|
|
29
|
-
value: {
|
|
30
|
-
block: 'table',
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
Object.defineProperty(this, "attributes", {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
configurable: true,
|
|
36
|
-
writable: true,
|
|
37
|
-
value: {
|
|
38
|
-
class: {
|
|
39
|
-
default: 'table',
|
|
40
|
-
fromDom(element) {
|
|
41
|
-
return element.hasAttribute('class')
|
|
42
|
-
? element.getAttribute('class')
|
|
43
|
-
: undefined;
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
getNodeSpec() {
|
|
50
|
-
return {
|
|
51
|
-
content: 'table_row+',
|
|
52
|
-
tableRole: 'table',
|
|
53
|
-
isolating: true,
|
|
54
|
-
group: 'block',
|
|
55
|
-
parseDOM: [{
|
|
56
|
-
tag: 'table',
|
|
57
|
-
getAttrs: (element) => setHtmlAttributes(this, element),
|
|
58
|
-
}],
|
|
59
|
-
toDOM: (node) => ['table', getHtmlAttributes(this, node), ['tbody', 0]],
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
getInputRules(type) {
|
|
63
|
-
return [];
|
|
64
|
-
}
|
|
65
|
-
getCommands(editor, type) {
|
|
66
|
-
const commands = {
|
|
67
|
-
addColumnAfter: () => (state, dispatch) => addColumnAfter(state, dispatch),
|
|
68
|
-
addColumnBefore: () => (state, dispatch) => addColumnBefore(state, dispatch),
|
|
69
|
-
addRowAfter: () => (state, dispatch) => addRowAfter(state, dispatch),
|
|
70
|
-
addRowBefore: () => (state, dispatch) => addRowBefore(state, dispatch),
|
|
71
|
-
deleteColumn: () => (state, dispatch) => deleteColumn(state, dispatch),
|
|
72
|
-
deleteRow: () => (state, dispatch) => deleteRow(state, dispatch),
|
|
73
|
-
deleteTable: () => (state, dispatch) => deleteTable(state, dispatch),
|
|
74
|
-
fixTables: () => (state, dispatch) => fixTables(state, dispatch),
|
|
75
|
-
goToNextCell: () => (state, dispatch) => goToNextCell(state, dispatch),
|
|
76
|
-
mergeCells: () => (state, dispatch) => mergeCells(state, dispatch),
|
|
77
|
-
setCellAttr: () => (state, dispatch) => setCellAttr(state, dispatch),
|
|
78
|
-
splitCell: () => (state, dispatch) => splitCell(state, dispatch),
|
|
79
|
-
toggleHeader: () => (state, dispatch) => toggleHeader(state, dispatch),
|
|
80
|
-
toggleHeaderCell: () => (state, dispatch) => toggleHeaderCell(state, dispatch),
|
|
81
|
-
toggleHeaderRow: () => (state, dispatch) => toggleHeaderRow(state, dispatch),
|
|
82
|
-
toggleHeaderColumn: () => (state, dispatch) => toggleHeaderColumn(state, dispatch),
|
|
83
|
-
insertTable: ({ rows = 3, cols = 3, withHeaderRow = true } = {}) => (state, dispatch) => {
|
|
84
|
-
const tr = state.tr;
|
|
85
|
-
const node = createTable(editor.schema, rows, cols, withHeaderRow);
|
|
86
|
-
if (dispatch) {
|
|
87
|
-
const offset = tr.selection.from + 1;
|
|
88
|
-
tr.replaceSelectionWith(node)
|
|
89
|
-
.scrollIntoView()
|
|
90
|
-
.setSelection(TextSelection.near(tr.doc.resolve(offset)));
|
|
91
|
-
}
|
|
92
|
-
return true;
|
|
93
|
-
},
|
|
94
|
-
setCellSelection: (position) => (state, dispatch) => {
|
|
95
|
-
if (dispatch) {
|
|
96
|
-
const selection = CellSelection.create(state.doc, position.anchorCell, position.headCell);
|
|
97
|
-
state.setSelection(selection);
|
|
98
|
-
// state.tr.setSelection(selection)
|
|
99
|
-
}
|
|
100
|
-
return true;
|
|
101
|
-
},
|
|
102
|
-
};
|
|
103
|
-
return commands;
|
|
104
|
-
}
|
|
105
|
-
getKeyboardShortcuts() {
|
|
106
|
-
const keys = {};
|
|
107
|
-
return keys;
|
|
108
|
-
}
|
|
109
|
-
getProseMirrorPlugins(editor) {
|
|
110
|
-
return [
|
|
111
|
-
columnResizing(),
|
|
112
|
-
tableEditing(),
|
|
113
|
-
];
|
|
114
|
-
}
|
|
115
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { NodeSpec, NodeType } from 'prosemirror-model';
|
|
2
|
-
import { type CoreEditor, Node } from '../../editor/src/mod.js';
|
|
3
|
-
import { type Commands, type CommandShortcuts } from '../../editor/src/commands/mod.js';
|
|
4
|
-
import { type InputRule } from '../../editor/src/plugins/input-rules/mod.js';
|
|
5
|
-
export declare class NodeTableCell extends Node {
|
|
6
|
-
name: string;
|
|
7
|
-
requires: string[];
|
|
8
|
-
automerge: {
|
|
9
|
-
block: string;
|
|
10
|
-
};
|
|
11
|
-
getNodeSpec(): NodeSpec;
|
|
12
|
-
getInputRules(type: NodeType): InputRule[];
|
|
13
|
-
getCommands(editor: CoreEditor, type: NodeType): Partial<Commands>;
|
|
14
|
-
getKeyboardShortcuts(): Partial<CommandShortcuts>;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=NodeTableCell.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NodeTableCell.d.ts","sourceRoot":"","sources":["../../../src/extension-tables/src/NodeTableCell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE9E,OAAO,EAAE,KAAK,UAAU,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,6CAA6C,CAAC;AA2B7E,qBAAa,aAAc,SAAQ,IAAI;IAC5B,IAAI,SAAgB;IAC7B,QAAQ,WAAiB;IAEzB,SAAS;;MAEP;IAEO,WAAW,IAAI,QAAQ;IAmBvB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,EAAE;IAI1C,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAKlE,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAI3D"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { Node } from '../../editor/src/mod.js';
|
|
2
|
-
function getCellAttrs(dom) {
|
|
3
|
-
if (typeof dom === 'string') {
|
|
4
|
-
return {};
|
|
5
|
-
}
|
|
6
|
-
const widthAttr = dom.getAttribute('data-colwidth');
|
|
7
|
-
const widths = widthAttr && /^\d+(,\d+)*$/.test(widthAttr)
|
|
8
|
-
? widthAttr.split(',').map((s) => Number(s))
|
|
9
|
-
: null;
|
|
10
|
-
const colspan = Number(dom.getAttribute('colspan') || 1);
|
|
11
|
-
return {
|
|
12
|
-
colspan,
|
|
13
|
-
rowspan: Number(dom.getAttribute('rowspan') || 1),
|
|
14
|
-
colwidth: widths && widths.length == colspan ? widths : null,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function setCellAttrs(node) {
|
|
18
|
-
return {
|
|
19
|
-
colspan: (node.attrs.colspan != 1) ? node.attrs.colspan : undefined,
|
|
20
|
-
rowspan: (node.attrs.rowspan != 1) ? node.attrs.rowspan : undefined,
|
|
21
|
-
'data-colwidth': node.attrs.colwidth?.join(','),
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export class NodeTableCell extends Node {
|
|
25
|
-
constructor() {
|
|
26
|
-
super(...arguments);
|
|
27
|
-
Object.defineProperty(this, "name", {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
configurable: true,
|
|
30
|
-
writable: true,
|
|
31
|
-
value: 'table_cell'
|
|
32
|
-
});
|
|
33
|
-
Object.defineProperty(this, "requires", {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
configurable: true,
|
|
36
|
-
writable: true,
|
|
37
|
-
value: ['table_row']
|
|
38
|
-
});
|
|
39
|
-
Object.defineProperty(this, "automerge", {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
configurable: true,
|
|
42
|
-
writable: true,
|
|
43
|
-
value: {
|
|
44
|
-
block: 'table_cell',
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
getNodeSpec() {
|
|
49
|
-
return {
|
|
50
|
-
content: 'block+',
|
|
51
|
-
attrs: {
|
|
52
|
-
colspan: { default: 1 },
|
|
53
|
-
rowspan: { default: 1 },
|
|
54
|
-
colwidth: { default: null },
|
|
55
|
-
},
|
|
56
|
-
tableRole: 'cell',
|
|
57
|
-
isolating: true,
|
|
58
|
-
parseDOM: [
|
|
59
|
-
{ tag: 'td', getAttrs: (dom) => getCellAttrs(dom) },
|
|
60
|
-
],
|
|
61
|
-
toDOM(node) {
|
|
62
|
-
return ['td', setCellAttrs(node), 0];
|
|
63
|
-
},
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
getInputRules(type) {
|
|
67
|
-
return [];
|
|
68
|
-
}
|
|
69
|
-
getCommands(editor, type) {
|
|
70
|
-
const commands = {};
|
|
71
|
-
return commands;
|
|
72
|
-
}
|
|
73
|
-
getKeyboardShortcuts() {
|
|
74
|
-
const keys = {};
|
|
75
|
-
return keys;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { NodeSpec, NodeType } from 'prosemirror-model';
|
|
2
|
-
import { type CoreEditor, Node } from '../../editor/src/mod.js';
|
|
3
|
-
import { type Commands, type CommandShortcuts } from '../../editor/src/commands/mod.js';
|
|
4
|
-
import { type InputRule } from '../../editor/src/plugins/input-rules/mod.js';
|
|
5
|
-
export declare class NodeTableHeader extends Node {
|
|
6
|
-
name: string;
|
|
7
|
-
requires: string[];
|
|
8
|
-
automerge: {
|
|
9
|
-
block: string;
|
|
10
|
-
};
|
|
11
|
-
getNodeSpec(): NodeSpec;
|
|
12
|
-
getInputRules(type: NodeType): InputRule[];
|
|
13
|
-
getCommands(editor: CoreEditor, type: NodeType): Partial<Commands>;
|
|
14
|
-
getKeyboardShortcuts(): Partial<CommandShortcuts>;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=NodeTableHeader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NodeTableHeader.d.ts","sourceRoot":"","sources":["../../../src/extension-tables/src/NodeTableHeader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE9E,OAAO,EAAE,KAAK,UAAU,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,6CAA6C,CAAC;AA2B7E,qBAAa,eAAgB,SAAQ,IAAI;IAC9B,IAAI,SAAkB;IAC/B,QAAQ,WAAa;IAErB,SAAS;;MAEP;IAEO,WAAW,IAAI,QAAQ;IAiBvB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,EAAE;IAI1C,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAKlE,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAI3D"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { Node } from '../../editor/src/mod.js';
|
|
2
|
-
function getCellAttrs(dom) {
|
|
3
|
-
if (typeof dom === 'string') {
|
|
4
|
-
return {};
|
|
5
|
-
}
|
|
6
|
-
const widthAttr = dom.getAttribute('data-colwidth');
|
|
7
|
-
const widths = widthAttr && /^\d+(,\d+)*$/.test(widthAttr)
|
|
8
|
-
? widthAttr.split(',').map((s) => Number(s))
|
|
9
|
-
: null;
|
|
10
|
-
const colspan = Number(dom.getAttribute('colspan') || 1);
|
|
11
|
-
return {
|
|
12
|
-
colspan,
|
|
13
|
-
rowspan: Number(dom.getAttribute('rowspan') || 1),
|
|
14
|
-
colwidth: widths && widths.length == colspan ? widths : null,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function setCellAttrs(node) {
|
|
18
|
-
return {
|
|
19
|
-
colspan: (node.attrs.colspan != 1) ? node.attrs.colspan : undefined,
|
|
20
|
-
rowspan: (node.attrs.rowspan != 1) ? node.attrs.rowspan : undefined,
|
|
21
|
-
'data-colwidth': node.attrs.colwidth?.join(','),
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export class NodeTableHeader extends Node {
|
|
25
|
-
constructor() {
|
|
26
|
-
super(...arguments);
|
|
27
|
-
Object.defineProperty(this, "name", {
|
|
28
|
-
enumerable: true,
|
|
29
|
-
configurable: true,
|
|
30
|
-
writable: true,
|
|
31
|
-
value: 'table_header'
|
|
32
|
-
});
|
|
33
|
-
Object.defineProperty(this, "requires", {
|
|
34
|
-
enumerable: true,
|
|
35
|
-
configurable: true,
|
|
36
|
-
writable: true,
|
|
37
|
-
value: ['table']
|
|
38
|
-
});
|
|
39
|
-
Object.defineProperty(this, "automerge", {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
configurable: true,
|
|
42
|
-
writable: true,
|
|
43
|
-
value: {
|
|
44
|
-
block: 'table_header',
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
getNodeSpec() {
|
|
49
|
-
return {
|
|
50
|
-
content: 'block+',
|
|
51
|
-
attrs: {
|
|
52
|
-
colspan: { default: 1 },
|
|
53
|
-
rowspan: { default: 1 },
|
|
54
|
-
colwidth: { default: null },
|
|
55
|
-
},
|
|
56
|
-
tableRole: 'header_cell',
|
|
57
|
-
isolating: true,
|
|
58
|
-
parseDOM: [
|
|
59
|
-
{ tag: 'th', getAttrs: (dom) => getCellAttrs(dom) },
|
|
60
|
-
],
|
|
61
|
-
toDOM: (node) => ['th', setCellAttrs(node), 0],
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
getInputRules(type) {
|
|
65
|
-
return [];
|
|
66
|
-
}
|
|
67
|
-
getCommands(editor, type) {
|
|
68
|
-
const commands = {};
|
|
69
|
-
return commands;
|
|
70
|
-
}
|
|
71
|
-
getKeyboardShortcuts() {
|
|
72
|
-
const keys = {};
|
|
73
|
-
return keys;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { NodeSpec, NodeType } from 'prosemirror-model';
|
|
2
|
-
import { type CoreEditor, Node } from '../../editor/src/mod.js';
|
|
3
|
-
import { type Commands, type CommandShortcuts } from '../../editor/src/commands/mod.js';
|
|
4
|
-
import { type InputRule } from '../../editor/src/plugins/input-rules/mod.js';
|
|
5
|
-
export declare class NodeTableRow extends Node {
|
|
6
|
-
name: string;
|
|
7
|
-
requires: string[];
|
|
8
|
-
automerge: {
|
|
9
|
-
block: string;
|
|
10
|
-
};
|
|
11
|
-
getNodeSpec(): NodeSpec;
|
|
12
|
-
getInputRules(type: NodeType): InputRule[];
|
|
13
|
-
getCommands(editor: CoreEditor, type: NodeType): Partial<Commands>;
|
|
14
|
-
getKeyboardShortcuts(): Partial<CommandShortcuts>;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=NodeTableRow.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"NodeTableRow.d.ts","sourceRoot":"","sources":["../../../src/extension-tables/src/NodeTableRow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,KAAK,UAAU,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EAEtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,KAAK,SAAS,EAEf,MAAM,6CAA6C,CAAC;AAErD,qBAAa,YAAa,SAAQ,IAAI;IAC3B,IAAI,SAAe;IAC5B,QAAQ,WAAa;IAErB,SAAS;;MAEP;IAEO,WAAW,IAAI,QAAQ;IAWvB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,EAAE;IAI1C,WAAW,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAMlE,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAI3D"}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { Node } from '../../editor/src/mod.js';
|
|
2
|
-
export class NodeTableRow extends Node {
|
|
3
|
-
constructor() {
|
|
4
|
-
super(...arguments);
|
|
5
|
-
Object.defineProperty(this, "name", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
configurable: true,
|
|
8
|
-
writable: true,
|
|
9
|
-
value: 'table_row'
|
|
10
|
-
});
|
|
11
|
-
Object.defineProperty(this, "requires", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true,
|
|
15
|
-
value: ['table']
|
|
16
|
-
});
|
|
17
|
-
Object.defineProperty(this, "automerge", {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
configurable: true,
|
|
20
|
-
writable: true,
|
|
21
|
-
value: {
|
|
22
|
-
block: 'table_row',
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
getNodeSpec() {
|
|
27
|
-
return {
|
|
28
|
-
content: '(table_cell | table_header)*',
|
|
29
|
-
tableRole: 'row',
|
|
30
|
-
parseDOM: [{ tag: 'tr' }],
|
|
31
|
-
toDOM() {
|
|
32
|
-
return ['tr', 0];
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
getInputRules(type) {
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
getCommands(editor, type) {
|
|
40
|
-
const commands = {};
|
|
41
|
-
return commands;
|
|
42
|
-
}
|
|
43
|
-
getKeyboardShortcuts() {
|
|
44
|
-
const keys = {};
|
|
45
|
-
return keys;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Node, ResolvedPos, Slice } from 'prosemirror-model';
|
|
2
|
-
import { EditorState, Selection, Transaction } from 'prosemirror-state';
|
|
3
|
-
import { DecorationSource } from 'prosemirror-view';
|
|
4
|
-
import { Mappable } from 'prosemirror-transform';
|
|
5
|
-
/**
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
export interface CellSelectionJSON {
|
|
9
|
-
type: string;
|
|
10
|
-
anchor: number;
|
|
11
|
-
head: number;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* A [`Selection`](http://prosemirror.net/docs/ref/#state.Selection)
|
|
15
|
-
* subclass that represents a cell selection spanning part of a table.
|
|
16
|
-
* With the plugin enabled, these will be created when the user
|
|
17
|
-
* selects across cells, and will be drawn by giving selected cells a
|
|
18
|
-
* `selectedCell` CSS class.
|
|
19
|
-
*
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
22
|
-
export declare class CellSelection extends Selection {
|
|
23
|
-
$anchorCell: ResolvedPos;
|
|
24
|
-
$headCell: ResolvedPos;
|
|
25
|
-
constructor($anchorCell: ResolvedPos, $headCell?: ResolvedPos);
|
|
26
|
-
map(doc: Node, mapping: Mappable): CellSelection | Selection;
|
|
27
|
-
content(): Slice;
|
|
28
|
-
replace(tr: Transaction, content?: Slice): void;
|
|
29
|
-
replaceWith(tr: Transaction, node: Node): void;
|
|
30
|
-
forEachCell(f: (node: Node, pos: number) => void): void;
|
|
31
|
-
isColSelection(): boolean;
|
|
32
|
-
static colSelection($anchorCell: ResolvedPos, $headCell?: ResolvedPos): CellSelection;
|
|
33
|
-
isRowSelection(): boolean;
|
|
34
|
-
eq(other: unknown): boolean;
|
|
35
|
-
static rowSelection($anchorCell: ResolvedPos, $headCell?: ResolvedPos): CellSelection;
|
|
36
|
-
toJSON(): CellSelectionJSON;
|
|
37
|
-
static fromJSON(doc: Node, json: CellSelectionJSON): CellSelection;
|
|
38
|
-
static create(doc: Node, anchorCell: number, headCell?: number): CellSelection;
|
|
39
|
-
getBookmark(): CellBookmark;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* @public
|
|
43
|
-
*/
|
|
44
|
-
export declare class CellBookmark {
|
|
45
|
-
anchor: number;
|
|
46
|
-
head: number;
|
|
47
|
-
constructor(anchor: number, head: number);
|
|
48
|
-
map(mapping: Mappable): CellBookmark;
|
|
49
|
-
resolve(doc: Node): CellSelection | Selection;
|
|
50
|
-
}
|
|
51
|
-
export declare function drawCellSelection(state: EditorState): DecorationSource | null;
|
|
52
|
-
export declare function normalizeSelection(state: EditorState, tr: Transaction | undefined, allowTableNodeSelection: boolean): Transaction | undefined;
|
|
53
|
-
//# sourceMappingURL=CellSelection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CellSelection.d.ts","sourceRoot":"","sources":["../../../../src/extension-tables/src/utilities/CellSelection.ts"],"names":[],"mappings":"AAKA,OAAO,EAAY,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EACL,WAAW,EAEX,SAAS,EAGT,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAA6B,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAE/E,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjD;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;GAQG;AACH,qBAAa,aAAc,SAAQ,SAAS;IAGnC,WAAW,EAAE,WAAW,CAAC;IAIzB,SAAS,EAAE,WAAW,CAAC;gBAMlB,WAAW,EAAE,WAAW,EAAE,SAAS,GAAE,WAAyB;IAgCnE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,GAAG,aAAa,GAAG,SAAS;IAoB5D,OAAO,IAAI,KAAK;IA6EhB,OAAO,CAAC,EAAE,EAAE,WAAW,EAAE,OAAO,GAAE,KAAmB,GAAG,IAAI;IAmB5D,WAAW,CAAC,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI;IAI9C,WAAW,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;IAkBvD,cAAc,IAAI,OAAO;WAelB,YAAY,CACxB,WAAW,EAAE,WAAW,EACxB,SAAS,GAAE,WAAyB,GACnC,aAAa;IAmCT,cAAc,IAAI,OAAO;IAczB,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO;WAUpB,YAAY,CACxB,WAAW,EAAE,WAAW,EACxB,SAAS,GAAE,WAAyB,GACnC,aAAa;IAiCT,MAAM,IAAI,iBAAiB;IAQlC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,iBAAiB,GAAG,aAAa;IAIlE,MAAM,CAAC,MAAM,CACX,GAAG,EAAE,IAAI,EACT,UAAU,EAAE,MAAM,EAClB,QAAQ,GAAE,MAAmB,GAC5B,aAAa;IAIhB,WAAW,IAAI,YAAY;CAG5B;AAMD;;GAEG;AACH,qBAAa,YAAY;IAEd,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,MAAM;gBADZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM;IAGrB,GAAG,CAAC,OAAO,EAAE,QAAQ,GAAG,YAAY;IAIpC,OAAO,CAAC,GAAG,EAAE,IAAI,GAAG,aAAa,GAAG,SAAS;CAa9C;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,gBAAgB,GAAG,IAAI,CAS7E;AAgDD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,WAAW,EAClB,EAAE,EAAE,WAAW,GAAG,SAAS,EAC3B,uBAAuB,EAAE,OAAO,GAC/B,WAAW,GAAG,SAAS,CAwBzB"}
|