@kerebron/extension-tables 0.3.2 → 0.4.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/README.md +26 -11
- package/esm/_dnt.shims.d.ts +6 -0
- package/esm/_dnt.shims.d.ts.map +1 -0
- package/esm/_dnt.shims.js +61 -0
- package/esm/editor/src/CoreEditor.d.ts +13 -4
- package/esm/editor/src/CoreEditor.d.ts.map +1 -1
- package/esm/editor/src/CoreEditor.js +64 -12
- package/esm/editor/src/Extension.d.ts +6 -1
- package/esm/editor/src/Extension.d.ts.map +1 -1
- package/esm/editor/src/Extension.js +21 -1
- package/esm/editor/src/ExtensionManager.d.ts +5 -6
- package/esm/editor/src/ExtensionManager.d.ts.map +1 -1
- package/esm/editor/src/ExtensionManager.js +43 -55
- package/esm/editor/src/Mark.d.ts +3 -0
- package/esm/editor/src/Mark.d.ts.map +1 -1
- package/esm/editor/src/Mark.js +11 -0
- package/esm/editor/src/Node.d.ts +5 -2
- package/esm/editor/src/Node.d.ts.map +1 -1
- package/esm/editor/src/Node.js +13 -2
- package/esm/editor/src/commands/CommandManager.d.ts +13 -6
- package/esm/editor/src/commands/CommandManager.d.ts.map +1 -1
- package/esm/editor/src/commands/CommandManager.js +59 -2
- package/esm/editor/src/commands/baseCommandFactories.d.ts +3 -0
- package/esm/editor/src/commands/baseCommandFactories.d.ts.map +1 -0
- package/esm/editor/src/commands/baseCommandFactories.js +836 -0
- package/esm/editor/src/commands/keyCommandFactories.d.ts +3 -0
- package/esm/editor/src/commands/keyCommandFactories.d.ts.map +1 -0
- package/esm/editor/src/commands/keyCommandFactories.js +10 -0
- package/esm/editor/src/commands/mod.d.ts +5 -53
- package/esm/editor/src/commands/mod.d.ts.map +1 -1
- package/esm/editor/src/commands/mod.js +14 -821
- package/esm/editor/src/commands/replaceCommandFactories.d.ts +3 -0
- package/esm/editor/src/commands/replaceCommandFactories.d.ts.map +1 -0
- package/esm/editor/src/commands/replaceCommandFactories.js +94 -0
- package/esm/editor/src/commands/types.d.ts +18 -0
- package/esm/editor/src/commands/types.d.ts.map +1 -0
- package/esm/editor/src/commands/types.js +1 -0
- package/esm/editor/src/mod.d.ts +2 -0
- package/esm/editor/src/mod.d.ts.map +1 -1
- package/esm/editor/src/mod.js +2 -0
- package/esm/editor/src/plugins/TrackSelecionPlugin.d.ts +6 -0
- package/esm/editor/src/plugins/TrackSelecionPlugin.d.ts.map +1 -0
- package/esm/editor/src/plugins/TrackSelecionPlugin.js +24 -0
- package/esm/editor/src/types.d.ts +19 -1
- package/esm/editor/src/types.d.ts.map +1 -1
- package/esm/editor/src/ui.d.ts +15 -0
- package/esm/editor/src/ui.d.ts.map +1 -0
- package/esm/editor/src/ui.js +16 -0
- package/esm/editor/src/utilities/SmartOutput.d.ts +9 -7
- package/esm/editor/src/utilities/SmartOutput.d.ts.map +1 -1
- package/esm/editor/src/utilities/SmartOutput.js +35 -20
- package/esm/editor/src/utilities/getShadowRoot.d.ts +2 -0
- package/esm/editor/src/utilities/getShadowRoot.d.ts.map +1 -0
- package/esm/editor/src/utilities/getShadowRoot.js +16 -0
- package/esm/editor/src/utilities/mod.d.ts +2 -0
- package/esm/editor/src/utilities/mod.d.ts.map +1 -1
- package/esm/editor/src/utilities/mod.js +2 -0
- package/esm/editor/src/utilities/toRawTextResult.d.ts +3 -0
- package/esm/editor/src/utilities/toRawTextResult.d.ts.map +1 -0
- package/esm/editor/src/utilities/toRawTextResult.js +21 -0
- package/esm/extension-tables/src/NodeTable.d.ts +1 -1
- package/esm/extension-tables/src/NodeTable.d.ts.map +1 -1
- package/esm/extension-tables/src/NodeTable.js +1 -1
- package/esm/extension-tables/src/NodeTableRow.d.ts.map +1 -1
- package/esm/extension-tables/src/utilities/CellSelection.d.ts.map +1 -1
- package/esm/extension-tables/src/utilities/columnResizing.d.ts.map +1 -1
- package/esm/extension-tables/src/utilities/columnResizing.js +2 -1
- package/esm/extension-tables/src/utilities/createTable.d.ts.map +1 -1
- package/esm/extension-tables/src/utilities/createTable.js +2 -1
- package/package.json +3 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replaceCommandFactories.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/commands/replaceCommandFactories.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,cAAc,EAAE,MAAM,UAAU,CAAC;AAwHxD,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAMlE,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Fragment, Slice } from 'prosemirror-model';
|
|
2
|
+
const replaceRangeText = (range, text) => {
|
|
3
|
+
return (state, dispatch) => {
|
|
4
|
+
const tr = state.tr;
|
|
5
|
+
const from = tr.mapping.map(range.from);
|
|
6
|
+
const to = tr.mapping.map(range.to);
|
|
7
|
+
const frag = Fragment.from(state.schema.text(text));
|
|
8
|
+
const insert = new Slice(frag, 0, 0);
|
|
9
|
+
tr.replace(from, to, insert);
|
|
10
|
+
if (dispatch) {
|
|
11
|
+
dispatch(tr);
|
|
12
|
+
}
|
|
13
|
+
return true;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
const replaceRangeSlice = (range, insert) => {
|
|
17
|
+
return (state, dispatch) => {
|
|
18
|
+
const tr = state.tr;
|
|
19
|
+
const from = tr.mapping.map(range.from);
|
|
20
|
+
const to = tr.mapping.map(range.to);
|
|
21
|
+
tr.replace(from, to, insert);
|
|
22
|
+
if (dispatch) {
|
|
23
|
+
dispatch(tr);
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
function getTopMostBlockStartForOffset(state, offset) {
|
|
29
|
+
const { doc } = state;
|
|
30
|
+
const $pos = doc.resolve(offset);
|
|
31
|
+
const blockPos = $pos.before($pos.depth);
|
|
32
|
+
if ($pos.depth === 1)
|
|
33
|
+
return blockPos;
|
|
34
|
+
return $pos.start(1);
|
|
35
|
+
}
|
|
36
|
+
function getTopMostBlockEndForOffset(state, offset) {
|
|
37
|
+
const { doc } = state;
|
|
38
|
+
const $pos = doc.resolve(offset);
|
|
39
|
+
return $pos.end(1);
|
|
40
|
+
}
|
|
41
|
+
function getAdjacentTopBlock(state, offset) {
|
|
42
|
+
const { doc } = state;
|
|
43
|
+
if (offset < 0 || offset > doc.content.size) {
|
|
44
|
+
throw new RangeError('Offset is outside the document');
|
|
45
|
+
}
|
|
46
|
+
const $pos = doc.resolve(offset);
|
|
47
|
+
const atBlockStart = $pos.pos === $pos.start($pos.depth);
|
|
48
|
+
if (atBlockStart) {
|
|
49
|
+
return getTopMostBlockStartForOffset(state, offset);
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
return getTopMostBlockEndForOffset(state, offset);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const insertBlockBefore = (pos, insert) => {
|
|
56
|
+
return (state, dispatch) => {
|
|
57
|
+
const tr = state.tr;
|
|
58
|
+
const blockPos = getTopMostBlockStartForOffset(state, tr.mapping.map(pos));
|
|
59
|
+
tr.insert(blockPos, insert);
|
|
60
|
+
if (dispatch) {
|
|
61
|
+
dispatch(tr);
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
const insertBlockAfter = (pos, insert) => {
|
|
67
|
+
return (state, dispatch) => {
|
|
68
|
+
const tr = state.tr;
|
|
69
|
+
const blockPos = getTopMostBlockEndForOffset(state, tr.mapping.map(pos));
|
|
70
|
+
tr.insert(blockPos, insert);
|
|
71
|
+
if (dispatch) {
|
|
72
|
+
dispatch(tr);
|
|
73
|
+
}
|
|
74
|
+
return true;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
const insertBlockSmart = (pos, insert) => {
|
|
78
|
+
return (state, dispatch) => {
|
|
79
|
+
const tr = state.tr;
|
|
80
|
+
const blockPos = getAdjacentTopBlock(state, tr.mapping.map(pos));
|
|
81
|
+
tr.insert(blockPos, insert);
|
|
82
|
+
if (dispatch) {
|
|
83
|
+
dispatch(tr);
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
export const replaceCommandFactories = {
|
|
89
|
+
replaceRangeText,
|
|
90
|
+
replaceRangeSlice,
|
|
91
|
+
insertBlockBefore,
|
|
92
|
+
insertBlockAfter,
|
|
93
|
+
insertBlockSmart,
|
|
94
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Command } from 'prosemirror-state';
|
|
2
|
+
export { Command };
|
|
3
|
+
export type CommandFactory = (...args: any[]) => Command;
|
|
4
|
+
export interface Commands {
|
|
5
|
+
[name: string]: Command;
|
|
6
|
+
}
|
|
7
|
+
export interface CommandFactories {
|
|
8
|
+
[name: string]: CommandFactory;
|
|
9
|
+
}
|
|
10
|
+
export type CommandShortcuts = {
|
|
11
|
+
[name: string]: string;
|
|
12
|
+
};
|
|
13
|
+
export type ChainedCommands = {
|
|
14
|
+
[Item in keyof Commands]: (...args: unknown[]) => ChainedCommands;
|
|
15
|
+
} & {
|
|
16
|
+
run: () => boolean;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/commands/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,OAAO,EAAE,CAAC;AAEnB,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;AAEzD,MAAM,WAAW,QAAQ;IACvB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC;CAChC;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,eAAe,GACvB;KACC,IAAI,IAAI,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,eAAe;CAClE,GACC;IACA,GAAG,EAAE,MAAM,OAAO,CAAC;CACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/editor/src/mod.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/editor/src/mod.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/editor/src/mod.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC"}
|
package/esm/editor/src/mod.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TrackSelecionPlugin.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/plugins/TrackSelecionPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,qBAAa,mBAAoB,SAAQ,MAAM;gBACjC,MAAM,EAAE,UAAU;CAsB/B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Plugin } from 'prosemirror-state';
|
|
2
|
+
export class TrackSelecionPlugin extends Plugin {
|
|
3
|
+
constructor(editor) {
|
|
4
|
+
super({
|
|
5
|
+
view(editorView) {
|
|
6
|
+
return {
|
|
7
|
+
update(view, prevState) {
|
|
8
|
+
const state = view.state;
|
|
9
|
+
const prevSelection = prevState.selection;
|
|
10
|
+
const selection = state.selection;
|
|
11
|
+
if (!prevSelection.eq(selection)) {
|
|
12
|
+
const event = new CustomEvent('selection', {
|
|
13
|
+
detail: {
|
|
14
|
+
selection,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
editor.dispatchEvent(event);
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -7,11 +7,14 @@ export type AnyExtensionOrReq = AnyExtension | {
|
|
|
7
7
|
requires: Array<AnyExtensionOrReq | string>;
|
|
8
8
|
};
|
|
9
9
|
export type Content = JSONContent | JSONContent[] | null;
|
|
10
|
-
export interface
|
|
10
|
+
export interface EditorConfig {
|
|
11
11
|
element: HTMLElement;
|
|
12
12
|
content: Content;
|
|
13
13
|
parseOptions: ParseOptions;
|
|
14
14
|
extensions: AnyExtensionOrReq[];
|
|
15
|
+
cdnUrl?: string;
|
|
16
|
+
uri?: string;
|
|
17
|
+
languageID?: string;
|
|
15
18
|
topNode?: string;
|
|
16
19
|
}
|
|
17
20
|
export type JSONContent = {
|
|
@@ -31,4 +34,19 @@ export type Attribute<T> = {
|
|
|
31
34
|
default: T;
|
|
32
35
|
toDom?: (node: ProseMirrorNode) => T;
|
|
33
36
|
};
|
|
37
|
+
export interface TextRange {
|
|
38
|
+
from: number;
|
|
39
|
+
to: number;
|
|
40
|
+
}
|
|
41
|
+
export interface RawTextMapEntry {
|
|
42
|
+
nodeIdx: number;
|
|
43
|
+
targetRow: number;
|
|
44
|
+
targetCol: number;
|
|
45
|
+
sourceCol?: number;
|
|
46
|
+
targetPos: number;
|
|
47
|
+
}
|
|
48
|
+
export interface RawTextResult {
|
|
49
|
+
content: string;
|
|
50
|
+
rawTextMap: Array<RawTextMapEntry>;
|
|
51
|
+
}
|
|
34
52
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/editor/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,eAAe,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;AACnD,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAC7C,QAAQ,EAAE,KAAK,CAAC,iBAAiB,GAAG,MAAM,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG,WAAW,EAAE,GAAG,IAAI,CAAC;AAEzD,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/editor/src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,IAAI,eAAe,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;AACnD,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAA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,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;CACpC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CoreEditor } from './CoreEditor.js';
|
|
2
|
+
interface SelectParams {
|
|
3
|
+
anchor: number;
|
|
4
|
+
scrollIntoView: boolean;
|
|
5
|
+
userEvent: string;
|
|
6
|
+
}
|
|
7
|
+
export interface EditorUi {
|
|
8
|
+
showMessage(msg: string): void;
|
|
9
|
+
showError(err: Error): void;
|
|
10
|
+
focus(): void;
|
|
11
|
+
select(params: SelectParams): void;
|
|
12
|
+
}
|
|
13
|
+
export declare function defaultUi(editor: CoreEditor): EditorUi;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=ui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../../src/editor/src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,UAAU,YAAY;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,CAAC;IAC5B,KAAK,IAAI,IAAI,CAAC;IACd,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAC;CACpC;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,CAmBtD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function defaultUi(editor) {
|
|
2
|
+
return {
|
|
3
|
+
showMessage(msg) {
|
|
4
|
+
globalThis.alert(msg);
|
|
5
|
+
},
|
|
6
|
+
showError(err) {
|
|
7
|
+
globalThis.alert(err.message);
|
|
8
|
+
console.error(err);
|
|
9
|
+
},
|
|
10
|
+
focus() {
|
|
11
|
+
// editor.run.focus();
|
|
12
|
+
},
|
|
13
|
+
select({ anchor: number, scrollIntoView: boolean, userEvent: string, }) {
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export interface OutputMeta<K> {
|
|
2
|
+
pos: number;
|
|
2
3
|
rowPos: number;
|
|
3
4
|
colPos: number;
|
|
4
|
-
item
|
|
5
|
+
item?: K;
|
|
5
6
|
}
|
|
6
7
|
interface Mapping {
|
|
7
8
|
sourceNo: number;
|
|
@@ -20,20 +21,21 @@ export interface SourceMap {
|
|
|
20
21
|
export declare class SmartOutput<K> {
|
|
21
22
|
private _rowPos;
|
|
22
23
|
private _colPos;
|
|
24
|
+
private _pos;
|
|
23
25
|
private chunks;
|
|
24
26
|
private metas;
|
|
25
|
-
log(text: string, item
|
|
27
|
+
log(text: string, item?: K): void;
|
|
28
|
+
getMetas(): OutputMeta<K>[];
|
|
26
29
|
get chunkPos(): number;
|
|
27
30
|
rollback(pos: number): void;
|
|
28
31
|
get rowPos(): number;
|
|
29
32
|
get colPos(): number;
|
|
33
|
+
get pos(): number;
|
|
30
34
|
endsWith(text: string): boolean;
|
|
31
35
|
toString(): string;
|
|
32
|
-
getSourceMap(mapper: (
|
|
36
|
+
getSourceMap(mapper: (rowPos: number, colPos: number, pos: number, item?: K) => Mapping | void): SourceMap;
|
|
33
37
|
}
|
|
34
|
-
|
|
35
|
-
export declare function
|
|
36
|
-
/** @param {number | number[]} value */
|
|
37
|
-
export declare function encode(value: any): string;
|
|
38
|
+
export declare function decode(string: string): number[];
|
|
39
|
+
export declare function encode(value: number | number[]): string;
|
|
38
40
|
export {};
|
|
39
41
|
//# sourceMappingURL=SmartOutput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SmartOutput.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/SmartOutput.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"SmartOutput.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/SmartOutput.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,CAAC,CAAC;CACV;AAED,UAAU,OAAO;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,CAAC,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,WAAW,CAAC,CAAC;IACxB,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,IAAI,CAAK;IAEjB,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,KAAK,CAA4B;IAEzC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC;IAyB1B,QAAQ;IAIR,IAAI,QAAQ,WAEX;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM;IAKpB,IAAI,MAAM,WAET;IAED,IAAI,MAAM,WAET;IAED,IAAI,GAAG,WAEN;IAED,QAAQ,CAAC,IAAI,EAAE,MAAM;IAIrB,QAAQ;IAIR,YAAY,CACV,MAAM,EAAE,CACN,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,CAAC,KACL,OAAO,GAAG,IAAI,GAClB,SAAS;CA4Db;AAuDD,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,YAoCpC;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,UAW9C"}
|
|
@@ -12,6 +12,12 @@ export class SmartOutput {
|
|
|
12
12
|
writable: true,
|
|
13
13
|
value: 0
|
|
14
14
|
});
|
|
15
|
+
Object.defineProperty(this, "_pos", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true,
|
|
19
|
+
value: 0
|
|
20
|
+
});
|
|
15
21
|
Object.defineProperty(this, "chunks", {
|
|
16
22
|
enumerable: true,
|
|
17
23
|
configurable: true,
|
|
@@ -26,8 +32,12 @@ export class SmartOutput {
|
|
|
26
32
|
});
|
|
27
33
|
}
|
|
28
34
|
log(text, item) {
|
|
35
|
+
if (text.length === 0) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
29
38
|
this.chunks.push(text);
|
|
30
39
|
this.metas.push({
|
|
40
|
+
pos: this._pos,
|
|
31
41
|
colPos: this._colPos,
|
|
32
42
|
rowPos: this._rowPos,
|
|
33
43
|
item,
|
|
@@ -40,6 +50,10 @@ export class SmartOutput {
|
|
|
40
50
|
this._rowPos += lines.length - 1;
|
|
41
51
|
this._colPos = lines[lines.length - 1].length;
|
|
42
52
|
}
|
|
53
|
+
this._pos += text.length;
|
|
54
|
+
}
|
|
55
|
+
getMetas() {
|
|
56
|
+
return this.metas;
|
|
43
57
|
}
|
|
44
58
|
get chunkPos() {
|
|
45
59
|
return this.chunks.length;
|
|
@@ -54,6 +68,9 @@ export class SmartOutput {
|
|
|
54
68
|
get colPos() {
|
|
55
69
|
return this._colPos;
|
|
56
70
|
}
|
|
71
|
+
get pos() {
|
|
72
|
+
return this._pos;
|
|
73
|
+
}
|
|
57
74
|
endsWith(text) {
|
|
58
75
|
return this.chunks.join('').endsWith(text);
|
|
59
76
|
}
|
|
@@ -64,20 +81,31 @@ export class SmartOutput {
|
|
|
64
81
|
const mappingRows = [];
|
|
65
82
|
let lastRow = -1;
|
|
66
83
|
let lastCol = -1;
|
|
84
|
+
let prevSourceNo = 0;
|
|
85
|
+
let prevSourceRowPos = 0;
|
|
86
|
+
let prevSourceColPos = 0;
|
|
87
|
+
let prevColPos = 0;
|
|
67
88
|
for (const meta of this.metas) {
|
|
68
89
|
while (meta.rowPos >= mappingRows.length) {
|
|
69
90
|
mappingRows.push([]);
|
|
70
91
|
}
|
|
71
92
|
if (lastRow != meta.rowPos || lastCol != meta.colPos) {
|
|
72
93
|
const currentRow = mappingRows[meta.rowPos];
|
|
73
|
-
|
|
94
|
+
if (lastRow != meta.rowPos) {
|
|
95
|
+
prevColPos = 0;
|
|
96
|
+
}
|
|
97
|
+
const mapping = mapper(meta.rowPos, meta.colPos, meta.pos, meta.item);
|
|
74
98
|
if (mapping) {
|
|
75
99
|
currentRow.push([
|
|
76
|
-
meta.colPos,
|
|
77
|
-
mapping.sourceNo,
|
|
78
|
-
mapping.sourceRowPos,
|
|
79
|
-
mapping.sourceColPos,
|
|
100
|
+
meta.colPos - prevColPos,
|
|
101
|
+
mapping.sourceNo - prevSourceNo,
|
|
102
|
+
mapping.sourceRowPos - prevSourceRowPos,
|
|
103
|
+
mapping.sourceColPos - prevSourceColPos,
|
|
80
104
|
]);
|
|
105
|
+
prevColPos = meta.colPos;
|
|
106
|
+
prevSourceNo = mapping.sourceNo;
|
|
107
|
+
prevSourceRowPos = mapping.sourceRowPos;
|
|
108
|
+
prevSourceColPos = mapping.sourceColPos;
|
|
81
109
|
}
|
|
82
110
|
}
|
|
83
111
|
lastRow = meta.rowPos;
|
|
@@ -87,13 +115,6 @@ export class SmartOutput {
|
|
|
87
115
|
.map((row) => row.map((group) => encode(group))
|
|
88
116
|
.join(','))
|
|
89
117
|
.join(';');
|
|
90
|
-
mappingRows.forEach((row, rowNo) => {
|
|
91
|
-
// console.log('g', rowNo, row);
|
|
92
|
-
row.forEach((group) => {
|
|
93
|
-
const enc = encode(group);
|
|
94
|
-
// console.log('g', rowNo, group, enc, decode(enc));
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
118
|
return {
|
|
98
119
|
version: 3,
|
|
99
120
|
file: '',
|
|
@@ -139,19 +160,15 @@ function encodeVLQ(input) {
|
|
|
139
160
|
}
|
|
140
161
|
return result;
|
|
141
162
|
}
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
/** @type {Record<number, string>} */
|
|
145
|
-
let integer_to_char = {};
|
|
163
|
+
const char_to_integer = {};
|
|
164
|
+
const integer_to_char = {};
|
|
146
165
|
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
|
|
147
166
|
.split('')
|
|
148
167
|
.forEach(function (char, i) {
|
|
149
168
|
char_to_integer[char] = i;
|
|
150
169
|
integer_to_char[i] = char;
|
|
151
170
|
});
|
|
152
|
-
/** @param {string} string */
|
|
153
171
|
export function decode(string) {
|
|
154
|
-
/** @type {number[]} */
|
|
155
172
|
let result = [];
|
|
156
173
|
let shift = 0;
|
|
157
174
|
let value = 0;
|
|
@@ -181,7 +198,6 @@ export function decode(string) {
|
|
|
181
198
|
}
|
|
182
199
|
return result;
|
|
183
200
|
}
|
|
184
|
-
/** @param {number | number[]} value */
|
|
185
201
|
export function encode(value) {
|
|
186
202
|
if (typeof value === 'number') {
|
|
187
203
|
return encode_integer(value);
|
|
@@ -192,7 +208,6 @@ export function encode(value) {
|
|
|
192
208
|
}
|
|
193
209
|
return result;
|
|
194
210
|
}
|
|
195
|
-
/** @param {number} num */
|
|
196
211
|
function encode_integer(num) {
|
|
197
212
|
let result = '';
|
|
198
213
|
if (num < 0) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getShadowRoot.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/getShadowRoot.ts"],"names":[],"mappings":"AAAA,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAiBvE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function getShadowRoot(element) {
|
|
2
|
+
let current = element;
|
|
3
|
+
while (current) {
|
|
4
|
+
if (current.toString() === '[object ShadowRoot]') {
|
|
5
|
+
return current;
|
|
6
|
+
}
|
|
7
|
+
if (current instanceof ShadowRoot) {
|
|
8
|
+
if (current.host) {
|
|
9
|
+
return current.host.shadowRoot || undefined;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
current = current.parentElement ||
|
|
13
|
+
((current instanceof ShadowRoot) ? current.host : undefined);
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/mod.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/mod.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toRawTextResult.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/toRawTextResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,aAAa,EAAE,MAAM,aAAa,CAAC;AAE7D,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,SAAI,GAAG,aAAa,CAwB3E"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function toRawTextResult(content, nodeIdx = 0) {
|
|
2
|
+
const lines = content.split('\n');
|
|
3
|
+
const rawTextMap = [];
|
|
4
|
+
let targetPos = 0;
|
|
5
|
+
let targetRow = 0;
|
|
6
|
+
for (const line of lines) {
|
|
7
|
+
rawTextMap.push({
|
|
8
|
+
nodeIdx,
|
|
9
|
+
targetRow,
|
|
10
|
+
targetCol: 0,
|
|
11
|
+
targetPos,
|
|
12
|
+
});
|
|
13
|
+
targetRow++;
|
|
14
|
+
targetPos += line.length + 1;
|
|
15
|
+
nodeIdx += line.length + 1;
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
content,
|
|
19
|
+
rawTextMap,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -16,6 +16,6 @@ export declare class NodeTable extends Node {
|
|
|
16
16
|
getInputRules(type: NodeType): InputRule[];
|
|
17
17
|
getCommandFactories(editor: CoreEditor, type: NodeType): Partial<CommandFactories>;
|
|
18
18
|
getKeyboardShortcuts(): Partial<CommandShortcuts>;
|
|
19
|
-
getProseMirrorPlugins(
|
|
19
|
+
getProseMirrorPlugins(): Plugin[];
|
|
20
20
|
}
|
|
21
21
|
//# sourceMappingURL=NodeTable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeTable.d.ts","sourceRoot":"","sources":["../../../src/extension-tables/src/NodeTable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EAAE,KAAK,UAAU,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,6CAA6C,CAAC;
|
|
1
|
+
{"version":3,"file":"NodeTable.d.ts","sourceRoot":"","sources":["../../../src/extension-tables/src/NodeTable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EAAE,KAAK,UAAU,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,6CAA6C,CAAC;AA2B7E,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAG3C,qBAAa,SAAU,SAAQ,IAAI;IACxB,IAAI,SAAW;IACxB,QAAQ,WAAW;IAEV,UAAU;;;6BAGE,WAAW;;MAM9B;IAEO,WAAW,IAAI,QAAQ;IAgBvB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,EAAE;IAI1C,mBAAmB,CAC1B,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,QAAQ,GACb,OAAO,CAAC,gBAAgB,CAAC;IAsDnB,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAKjD,qBAAqB,IAAI,MAAM,EAAE;CAM3C"}
|
|
@@ -1 +1 @@
|
|
|
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,gBAAgB,EACrB,KAAK,gBAAgB,
|
|
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,gBAAgB,EACrB,KAAK,gBAAgB,EACtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,KAAK,SAAS,EAEf,MAAM,6CAA6C,CAAC;AAErD,qBAAa,YAAa,SAAQ,IAAI;IAC3B,IAAI,SAAe;IAC5B,QAAQ,WAAa;IAEZ,WAAW,IAAI,QAAQ;IAWvB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,EAAE;IAI1C,mBAAmB,CAC1B,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,QAAQ,GACb,OAAO,CAAC,gBAAgB,CAAC;IAMnB,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAI3D"}
|
|
@@ -1 +1 @@
|
|
|
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,C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AC,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;WAQlB,QAAQ,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,iBAAiB,GAAG,aAAa;IAI3E,MAAM,CAAC,MAAM,CACX,GAAG,EAAE,IAAI,EACT,UAAU,EAAE,MAAM,EAClB,QAAQ,GAAE,MAAmB,GAC5B,aAAa;IAIP,WAAW,IAAI,YAAY;CAGrC;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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnResizing.d.ts","sourceRoot":"","sources":["../../../../src/extension-tables/src/utilities/columnResizing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"columnResizing.d.ts","sourceRoot":"","sources":["../../../../src/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AAI,EAAE,MAAM,GACX,aAAa,CAwCf"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as dntShim from "../../../_dnt.shims.js";
|
|
1
2
|
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
2
3
|
import { Decoration, DecorationSet, } from 'prosemirror-view';
|
|
3
4
|
import { tableNodeTypes } from './tableNodeTypes.js';
|
|
@@ -141,7 +142,7 @@ function handleMouseLeave(view) {
|
|
|
141
142
|
function handleMouseDown(view, event, cellMinWidth, defaultCellMinWidth) {
|
|
142
143
|
if (!view.editable)
|
|
143
144
|
return false;
|
|
144
|
-
const win = view.dom.ownerDocument.defaultView;
|
|
145
|
+
const win = view.dom.ownerDocument.defaultView || dntShim.dntGlobalThis;
|
|
145
146
|
const pluginState = columnResizingPluginKey.getState(view.state);
|
|
146
147
|
if (!pluginState || pluginState.activeHandle == -1 || pluginState.dragging) {
|
|
147
148
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTable.d.ts","sourceRoot":"","sources":["../../../../src/extension-tables/src/utilities/createTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAK9E,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,OAAO,EACtB,WAAW,CAAC,EAAE,QAAQ,GAAG,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC,GAChE,eAAe,
|
|
1
|
+
{"version":3,"file":"createTable.d.ts","sourceRoot":"","sources":["../../../../src/extension-tables/src/utilities/createTable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAK9E,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,OAAO,EACtB,WAAW,CAAC,EAAE,QAAQ,GAAG,eAAe,GAAG,KAAK,CAAC,eAAe,CAAC,GAChE,eAAe,CAyCjB"}
|
|
@@ -21,7 +21,8 @@ export function createTable(schema, rowsCount, colsCount, withHeaderRow, cellCon
|
|
|
21
21
|
rows.push(types.row.createChecked(null, withHeaderRow && index === 0 ? headerCells : cells));
|
|
22
22
|
}
|
|
23
23
|
const attrs = {};
|
|
24
|
-
|
|
24
|
+
const tableSpec = schema.spec.nodes.get('table');
|
|
25
|
+
for (const [key, attrSpec] of Object.entries(tableSpec.attrs || {})) {
|
|
25
26
|
if ('undefined' !== typeof attrSpec.default) {
|
|
26
27
|
attrs[key] = attrSpec.default;
|
|
27
28
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kerebron/extension-tables",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"module": "./esm/extension-tables/src/ExtensionTables.js",
|
|
6
6
|
"exports": {
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"prosemirror-model": "1.25.3",
|
|
26
26
|
"prosemirror-state": "1.4.3",
|
|
27
27
|
"prosemirror-transform": "1.10.4",
|
|
28
|
-
"prosemirror-view": "1.40.0"
|
|
28
|
+
"prosemirror-view": "1.40.0",
|
|
29
|
+
"@deno/shim-deno": "~0.18.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@types/node": "^20.9.0"
|