@kerebron/extension-codemirror 0.2.1 → 0.3.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.
- package/README.md +4 -3
- package/esm/editor/src/CoreEditor.d.ts +11 -5
- package/esm/editor/src/CoreEditor.d.ts.map +1 -1
- package/esm/editor/src/CoreEditor.js +64 -61
- package/esm/editor/src/DummyEditorView.d.ts +60 -0
- package/esm/editor/src/DummyEditorView.d.ts.map +1 -0
- package/esm/editor/src/DummyEditorView.js +277 -0
- package/esm/editor/src/Extension.d.ts +9 -9
- package/esm/editor/src/Extension.d.ts.map +1 -1
- package/esm/editor/src/Extension.js +2 -2
- package/esm/editor/src/ExtensionManager.d.ts +8 -7
- package/esm/editor/src/ExtensionManager.d.ts.map +1 -1
- package/esm/editor/src/ExtensionManager.js +58 -39
- package/esm/editor/src/Mark.d.ts +8 -6
- package/esm/editor/src/Mark.d.ts.map +1 -1
- package/esm/editor/src/Mark.js +8 -2
- package/esm/editor/src/Node.d.ts +14 -12
- package/esm/editor/src/Node.d.ts.map +1 -1
- package/esm/editor/src/Node.js +10 -4
- package/esm/editor/src/commands/CommandManager.d.ts +5 -9
- package/esm/editor/src/commands/CommandManager.d.ts.map +1 -1
- package/esm/editor/src/commands/CommandManager.js +7 -6
- package/esm/editor/src/commands/mod.d.ts +12 -6
- package/esm/editor/src/commands/mod.d.ts.map +1 -1
- package/esm/editor/src/commands/mod.js +0 -45
- package/esm/editor/src/mod.d.ts +1 -0
- package/esm/editor/src/mod.d.ts.map +1 -1
- package/esm/editor/src/mod.js +1 -0
- package/esm/editor/src/nodeToTreeString.d.ts +8 -2
- package/esm/editor/src/nodeToTreeString.d.ts.map +1 -1
- package/esm/editor/src/nodeToTreeString.js +47 -29
- package/esm/editor/src/plugins/input-rules/InputRulesPlugin.js +2 -2
- package/esm/editor/src/plugins/keymap/keymap.d.ts +11 -0
- package/esm/editor/src/plugins/keymap/keymap.d.ts.map +1 -0
- package/esm/editor/src/plugins/keymap/keymap.js +125 -0
- package/esm/editor/src/plugins/keymap/w3c-keyname.d.ts +4 -0
- package/esm/editor/src/plugins/keymap/w3c-keyname.d.ts.map +1 -0
- package/esm/editor/src/plugins/keymap/w3c-keyname.js +124 -0
- package/esm/editor/src/types.d.ts +10 -5
- package/esm/editor/src/types.d.ts.map +1 -1
- package/esm/editor/src/utilities/SmartOutput.d.ts +39 -0
- package/esm/editor/src/utilities/SmartOutput.d.ts.map +1 -0
- package/esm/editor/src/utilities/SmartOutput.js +213 -0
- package/esm/editor/src/utilities/createNodeFromContent.d.ts +4 -3
- package/esm/editor/src/utilities/createNodeFromContent.d.ts.map +1 -1
- package/esm/editor/src/utilities/createNodeFromContent.js +4 -5
- package/esm/editor/src/utilities/getHtmlAttributes.d.ts +8 -3
- package/esm/editor/src/utilities/getHtmlAttributes.d.ts.map +1 -1
- package/esm/editor/src/utilities/mod.d.ts +1 -0
- package/esm/editor/src/utilities/mod.d.ts.map +1 -1
- package/esm/editor/src/utilities/mod.js +1 -0
- package/esm/extension-codemirror/src/NodeCodeMirror.d.ts +2 -13
- package/esm/extension-codemirror/src/NodeCodeMirror.d.ts.map +1 -1
- package/esm/extension-codemirror/src/NodeCodeMirror.js +4 -16
- package/esm/extension-codemirror/src/defaults.d.ts.map +1 -1
- package/esm/extension-codemirror/src/utils.d.ts.map +1 -1
- package/package.json +2 -3
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
export class SmartOutput {
|
|
2
|
+
constructor() {
|
|
3
|
+
Object.defineProperty(this, "_rowPos", {
|
|
4
|
+
enumerable: true,
|
|
5
|
+
configurable: true,
|
|
6
|
+
writable: true,
|
|
7
|
+
value: 0
|
|
8
|
+
});
|
|
9
|
+
Object.defineProperty(this, "_colPos", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: true,
|
|
13
|
+
value: 0
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(this, "chunks", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true,
|
|
19
|
+
value: []
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(this, "metas", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
writable: true,
|
|
25
|
+
value: []
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
log(text, item) {
|
|
29
|
+
this.chunks.push(text);
|
|
30
|
+
this.metas.push({
|
|
31
|
+
colPos: this._colPos,
|
|
32
|
+
rowPos: this._rowPos,
|
|
33
|
+
item,
|
|
34
|
+
});
|
|
35
|
+
const lines = text.split('\n');
|
|
36
|
+
if (lines.length === 1) {
|
|
37
|
+
this._colPos += lines[lines.length - 1].length;
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
this._rowPos += lines.length - 1;
|
|
41
|
+
this._colPos = lines[lines.length - 1].length;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
get chunkPos() {
|
|
45
|
+
return this.chunks.length;
|
|
46
|
+
}
|
|
47
|
+
rollback(pos) {
|
|
48
|
+
this.chunks.splice(pos);
|
|
49
|
+
this.metas.splice(pos);
|
|
50
|
+
}
|
|
51
|
+
get rowPos() {
|
|
52
|
+
return this._rowPos;
|
|
53
|
+
}
|
|
54
|
+
get colPos() {
|
|
55
|
+
return this._colPos;
|
|
56
|
+
}
|
|
57
|
+
endsWith(text) {
|
|
58
|
+
return this.chunks.join('').endsWith(text);
|
|
59
|
+
}
|
|
60
|
+
toString() {
|
|
61
|
+
return this.chunks.join('');
|
|
62
|
+
}
|
|
63
|
+
getSourceMap(mapper) {
|
|
64
|
+
const mappingRows = [];
|
|
65
|
+
let lastRow = -1;
|
|
66
|
+
let lastCol = -1;
|
|
67
|
+
for (const meta of this.metas) {
|
|
68
|
+
while (meta.rowPos >= mappingRows.length) {
|
|
69
|
+
mappingRows.push([]);
|
|
70
|
+
}
|
|
71
|
+
if (lastRow != meta.rowPos || lastCol != meta.colPos) {
|
|
72
|
+
const currentRow = mappingRows[meta.rowPos];
|
|
73
|
+
const mapping = mapper(meta.item, meta.rowPos, meta.colPos);
|
|
74
|
+
if (mapping) {
|
|
75
|
+
currentRow.push([
|
|
76
|
+
meta.colPos,
|
|
77
|
+
mapping.sourceNo,
|
|
78
|
+
mapping.sourceRowPos,
|
|
79
|
+
mapping.sourceColPos,
|
|
80
|
+
]);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
lastRow = meta.rowPos;
|
|
84
|
+
lastCol = meta.colPos;
|
|
85
|
+
}
|
|
86
|
+
const mappings = mappingRows
|
|
87
|
+
.map((row) => row.map((group) => encode(group))
|
|
88
|
+
.join(','))
|
|
89
|
+
.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
|
+
return {
|
|
98
|
+
version: 3,
|
|
99
|
+
file: '',
|
|
100
|
+
sourceRoot: '',
|
|
101
|
+
sources: [],
|
|
102
|
+
sourcesContent: [],
|
|
103
|
+
names: [],
|
|
104
|
+
mappings,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
109
|
+
function toVLQ(value) {
|
|
110
|
+
const vlq = [];
|
|
111
|
+
const isNegative = value < 0;
|
|
112
|
+
value = Math.abs(value);
|
|
113
|
+
if (value === 0) {
|
|
114
|
+
vlq.push(0);
|
|
115
|
+
return vlq;
|
|
116
|
+
}
|
|
117
|
+
while (value > 0) {
|
|
118
|
+
let digit = value & 0x1F;
|
|
119
|
+
value >>= 5;
|
|
120
|
+
if (value > 0) {
|
|
121
|
+
digit |= 0x20;
|
|
122
|
+
}
|
|
123
|
+
vlq.push(digit);
|
|
124
|
+
if (vlq.length === 1) {
|
|
125
|
+
digit = isNegative ? (digit | 0x1) : (digit & ~0x1);
|
|
126
|
+
vlq[0] = digit;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return vlq;
|
|
130
|
+
}
|
|
131
|
+
function encodeVLQ(input) {
|
|
132
|
+
const numbers = Array.isArray(input) ? input : [input];
|
|
133
|
+
let result = '';
|
|
134
|
+
for (const num of numbers) {
|
|
135
|
+
const vlq = toVLQ(num);
|
|
136
|
+
for (const digit of vlq) {
|
|
137
|
+
result += BASE64_CHARS[digit];
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
/** @type {Record<string, number>} */
|
|
143
|
+
let char_to_integer = {};
|
|
144
|
+
/** @type {Record<number, string>} */
|
|
145
|
+
let integer_to_char = {};
|
|
146
|
+
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
|
|
147
|
+
.split('')
|
|
148
|
+
.forEach(function (char, i) {
|
|
149
|
+
char_to_integer[char] = i;
|
|
150
|
+
integer_to_char[i] = char;
|
|
151
|
+
});
|
|
152
|
+
/** @param {string} string */
|
|
153
|
+
export function decode(string) {
|
|
154
|
+
/** @type {number[]} */
|
|
155
|
+
let result = [];
|
|
156
|
+
let shift = 0;
|
|
157
|
+
let value = 0;
|
|
158
|
+
for (let i = 0; i < string.length; i += 1) {
|
|
159
|
+
let integer = char_to_integer[string[i]];
|
|
160
|
+
if (integer === undefined) {
|
|
161
|
+
throw new Error('Invalid character (' + string[i] + ')');
|
|
162
|
+
}
|
|
163
|
+
const has_continuation_bit = integer & 32;
|
|
164
|
+
integer &= 31;
|
|
165
|
+
value += integer << shift;
|
|
166
|
+
if (has_continuation_bit) {
|
|
167
|
+
shift += 5;
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
const should_negate = value & 1;
|
|
171
|
+
value >>>= 1;
|
|
172
|
+
if (should_negate) {
|
|
173
|
+
result.push(value === 0 ? -0x80000000 : -value);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
result.push(value);
|
|
177
|
+
}
|
|
178
|
+
// reset
|
|
179
|
+
value = shift = 0;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return result;
|
|
183
|
+
}
|
|
184
|
+
/** @param {number | number[]} value */
|
|
185
|
+
export function encode(value) {
|
|
186
|
+
if (typeof value === 'number') {
|
|
187
|
+
return encode_integer(value);
|
|
188
|
+
}
|
|
189
|
+
let result = '';
|
|
190
|
+
for (let i = 0; i < value.length; i += 1) {
|
|
191
|
+
result += encode_integer(value[i]);
|
|
192
|
+
}
|
|
193
|
+
return result;
|
|
194
|
+
}
|
|
195
|
+
/** @param {number} num */
|
|
196
|
+
function encode_integer(num) {
|
|
197
|
+
let result = '';
|
|
198
|
+
if (num < 0) {
|
|
199
|
+
num = (-num << 1) | 1;
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
num <<= 1;
|
|
203
|
+
}
|
|
204
|
+
do {
|
|
205
|
+
let clamped = num & 31;
|
|
206
|
+
num >>>= 5;
|
|
207
|
+
if (num > 0) {
|
|
208
|
+
clamped |= 32;
|
|
209
|
+
}
|
|
210
|
+
result += integer_to_char[clamped];
|
|
211
|
+
} while (num > 0);
|
|
212
|
+
return result;
|
|
213
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Fragment, Node as ProseMirrorNode, Schema } from 'prosemirror-model';
|
|
2
|
-
import type {
|
|
2
|
+
import type { JSONContent } from '../types.js';
|
|
3
3
|
export type CreateNodeFromContentOptions = {
|
|
4
4
|
errorOnInvalidContent?: boolean;
|
|
5
5
|
};
|
|
6
|
-
export declare function createNodeFromObject(content:
|
|
7
|
-
export declare function
|
|
6
|
+
export declare function createNodeFromObject(content: JSONContent | ProseMirrorNode | Fragment, schema: Schema, options?: CreateNodeFromContentOptions): ProseMirrorNode;
|
|
7
|
+
export declare function createNodeFromArray(content: JSONContent[], schema: Schema): Fragment;
|
|
8
|
+
export declare function createNodeFromContent(content: JSONContent | ProseMirrorNode | Fragment, schema: Schema, options?: CreateNodeFromContentOptions): ProseMirrorNode | Fragment;
|
|
8
9
|
//# sourceMappingURL=createNodeFromContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNodeFromContent.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/createNodeFromContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE9E,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"createNodeFromContent.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/createNodeFromContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE9E,OAAO,KAAK,EAAW,WAAW,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,4BAA4B,GAAG;IACzC,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,WAAW,GAAG,eAAe,GAAG,QAAQ,EACjD,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,4BAA4B,GACrC,eAAe,CA0BjB;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,WAAW,EAAE,EACtB,MAAM,EAAE,MAAM,GACb,QAAQ,CAIV;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,WAAW,GAAG,eAAe,GAAG,QAAQ,EACjD,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,4BAA4B,GACrC,eAAe,GAAG,QAAQ,CAY5B"}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { Fragment, Node as ProseMirrorNode } from 'prosemirror-model';
|
|
2
2
|
export function createNodeFromObject(content, schema, options) {
|
|
3
3
|
try {
|
|
4
|
-
// if the JSON Content is an array of nodes, create a fragment for each node
|
|
5
|
-
if (Array.isArray(content) && content.length > 0) {
|
|
6
|
-
return Fragment.fromArray(content.map((item) => schema.nodeFromJSON(item)));
|
|
7
|
-
}
|
|
8
4
|
const node = schema.nodeFromJSON(content);
|
|
9
5
|
if (options?.errorOnInvalidContent) {
|
|
10
6
|
node.check();
|
|
@@ -21,13 +17,16 @@ export function createNodeFromObject(content, schema, options) {
|
|
|
21
17
|
return schema.topNodeType.createAndFill(null, []);
|
|
22
18
|
}
|
|
23
19
|
}
|
|
20
|
+
export function createNodeFromArray(content, schema) {
|
|
21
|
+
return Fragment.fromArray(content.map((item) => schema.nodeFromJSON(item)));
|
|
22
|
+
}
|
|
24
23
|
export function createNodeFromContent(content, schema, options) {
|
|
25
24
|
if (content instanceof ProseMirrorNode || content instanceof Fragment) {
|
|
26
25
|
return content;
|
|
27
26
|
}
|
|
28
27
|
const isJSONContent = typeof content === 'object' && content !== null;
|
|
29
28
|
if (isJSONContent) {
|
|
30
|
-
createNodeFromObject(content, schema, options);
|
|
29
|
+
return createNodeFromObject(content, schema, options);
|
|
31
30
|
}
|
|
32
31
|
return schema.topNodeType.createAndFill(null, []);
|
|
33
32
|
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { MarkSpec, Node as ProseMirrorNode, NodeSpec } from 'prosemirror-model';
|
|
2
|
+
import type { Mark } from '../Mark.js';
|
|
3
|
+
import type { Node } from '../Node.js';
|
|
4
|
+
type MarkOfNode = Mark | Node;
|
|
5
|
+
export declare function getHtmlAttributes(extension: MarkOfNode, node: ProseMirrorNode): Record<string, any>;
|
|
6
|
+
export declare function setHtmlAttributes(extension: MarkOfNode, element: HTMLElement): Record<string, any>;
|
|
7
|
+
export declare function addAttributesToSchema(spec: MarkSpec | NodeSpec, extension: MarkOfNode): void;
|
|
8
|
+
export {};
|
|
4
9
|
//# sourceMappingURL=getHtmlAttributes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getHtmlAttributes.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/getHtmlAttributes.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"getHtmlAttributes.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/getHtmlAttributes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,IAAI,IAAI,eAAe,EACvB,QAAQ,EACT,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAEvC,KAAK,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9B,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,UAAU,EACrB,IAAI,EAAE,eAAe,uBAmBtB;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,uBAc5E;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,QAAQ,GAAG,QAAQ,EACzB,SAAS,EAAE,UAAU,QAetB"}
|
|
@@ -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"}
|
|
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,26 +1,15 @@
|
|
|
1
1
|
import { Plugin, PluginKey } from 'prosemirror-state';
|
|
2
2
|
import type { NodeSpec, NodeType, Schema } from 'prosemirror-model';
|
|
3
3
|
import { Converter, type CoreEditor, Node } from '../../editor/src/mod.js';
|
|
4
|
-
import { type
|
|
4
|
+
import { type CommandFactories, type CommandShortcuts } from '../../editor/src/commands/mod.js';
|
|
5
5
|
import { type InputRule } from '../../editor/src/plugins/input-rules/mod.js';
|
|
6
6
|
export declare const codeMirrorBlockKey: PluginKey<any>;
|
|
7
7
|
export declare class NodeCodeMirror extends Node {
|
|
8
8
|
name: string;
|
|
9
|
-
automerge: {
|
|
10
|
-
block: string;
|
|
11
|
-
attrParsers: {
|
|
12
|
-
fromAutomerge: (block: any) => {
|
|
13
|
-
lang: any;
|
|
14
|
-
};
|
|
15
|
-
fromProsemirror: (node: any) => {
|
|
16
|
-
lang: any;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
9
|
getConverters(editor: CoreEditor, schema: Schema): Record<string, Converter>;
|
|
21
10
|
getNodeSpec(): NodeSpec;
|
|
22
11
|
getInputRules(type: NodeType): InputRule[];
|
|
23
|
-
|
|
12
|
+
getCommandFactories(editor: CoreEditor, type: NodeType): Partial<CommandFactories>;
|
|
24
13
|
getKeyboardShortcuts(): Partial<CommandShortcuts>;
|
|
25
14
|
getProseMirrorPlugins(editor: CoreEditor): Plugin[];
|
|
26
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeCodeMirror.d.ts","sourceRoot":"","sources":["../../../src/extension-codemirror/src/NodeCodeMirror.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAC;AAC9E,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EACL,KAAK,
|
|
1
|
+
{"version":3,"file":"NodeCodeMirror.d.ts","sourceRoot":"","sources":["../../../src/extension-codemirror/src/NodeCodeMirror.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAC;AAC9E,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEpE,OAAO,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAEtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,KAAK,SAAS,EAEf,MAAM,6CAA6C,CAAC;AAOrD,eAAO,MAAM,kBAAkB,gBAAoC,CAAC;AAyCpE,qBAAa,cAAe,SAAQ,IAAI;IAC7B,IAAI,SAAgB;IAGpB,aAAa,CACpB,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,GACb,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC;IAgDnB,WAAW,IAAI,QAAQ;IA0CvB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,EAAE;IAQ1C,mBAAmB,CAC1B,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,QAAQ,GACb,OAAO,CAAC,gBAAgB,CAAC;IAUnB,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAUjD,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,EAAE;CA8B7D"}
|
|
@@ -50,24 +50,12 @@ export class NodeCodeMirror extends Node {
|
|
|
50
50
|
writable: true,
|
|
51
51
|
value: 'code_block'
|
|
52
52
|
});
|
|
53
|
-
// requires = ['doc'];
|
|
54
|
-
Object.defineProperty(this, "automerge", {
|
|
55
|
-
enumerable: true,
|
|
56
|
-
configurable: true,
|
|
57
|
-
writable: true,
|
|
58
|
-
value: {
|
|
59
|
-
block: this.name,
|
|
60
|
-
attrParsers: {
|
|
61
|
-
fromAutomerge: (block) => ({ lang: block.attrs.lang }),
|
|
62
|
-
fromProsemirror: (node) => ({ lang: node.attrs.lang }),
|
|
63
|
-
},
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
53
|
}
|
|
54
|
+
// requires = ['doc'];
|
|
67
55
|
getConverters(editor, schema) {
|
|
68
56
|
return {
|
|
69
57
|
'text/code-only': {
|
|
70
|
-
fromDoc(document) {
|
|
58
|
+
fromDoc: async (document) => {
|
|
71
59
|
const retVal = [];
|
|
72
60
|
if (document.content) {
|
|
73
61
|
for (const node of document.content.toJSON()) {
|
|
@@ -80,7 +68,7 @@ export class NodeCodeMirror extends Node {
|
|
|
80
68
|
}
|
|
81
69
|
return retVal.join('');
|
|
82
70
|
},
|
|
83
|
-
toDoc(
|
|
71
|
+
toDoc: async (buffer) => {
|
|
84
72
|
const content = {
|
|
85
73
|
'type': 'doc_code',
|
|
86
74
|
'content': [
|
|
@@ -149,7 +137,7 @@ export class NodeCodeMirror extends Node {
|
|
|
149
137
|
textblockTypeInputRule(/^```$/, type),
|
|
150
138
|
];
|
|
151
139
|
}
|
|
152
|
-
|
|
140
|
+
getCommandFactories(editor, type) {
|
|
153
141
|
return {
|
|
154
142
|
'setCodeBlock': (lang) => setBlockType(type, { lang }),
|
|
155
143
|
ArrowLeft: () => arrowHandler('left'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/extension-codemirror/src/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../../../src/extension-codemirror/src/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,eAAO,MAAM,mBAAmB,GAC9B,UAAU,iBAAiB,EAC3B,KAAK,WAAW,EAChB,MAAM,IAAI,EACV,MAAM,UAAU,EAChB,QAAQ,CAAC,MAAM,MAAM,CAAC,GAAG,OAAO,eAwCjC,CAAC;AAmBF,eAAO,MAAM,eAAe,EAAE,iBAS7B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/extension-codemirror/src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,WAAW,EAEX,aAAa,EACb,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAa,MAAM,mBAAmB,CAAC;AAI3D,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,iBAAiB,eAAe,CAAC;AAM9C,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;SAoB3D;AAED,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/extension-codemirror/src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,WAAW,EAEX,aAAa,EACb,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAa,MAAM,mBAAmB,CAAC;AAI3D,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE1D,eAAO,MAAM,iBAAiB,eAAe,CAAC;AAM9C,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;SAoB3D;AAED,eAAO,MAAM,sBAAsB,GACjC,OAAO,IAAI,EACX,QAAQ,UAAU,EAClB,QAAQ,CAAC,MAAM,MAAM,CAAC,GAAG,OAAO,kBAMjC,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,UAAU,EAClB,QAAQ,YAAY,EACpB,QAAQ,CAAC,MAAM,MAAM,CAAC,GAAG,OAAO,SAOjC,CAAC;AAEF,eAAO,MAAM,YAAY,GACvB,YAAY,MAAM,EAClB,MAAM,IAAI,EACV,QAAQ,CAAC,MAAM,MAAM,CAAC,GAAG,OAAO,EAChC,MAAM,YAAY,SAenB,CAAC;AAEF,eAAO,MAAM,WAAW,GACtB,MAAM,MAAM,GAAG,MAAM,EACrB,KAAK,CAAC,CAAC,GAAG,CAAC,EACX,IAAI,UAAU,EACd,MAAM,YAAY,EAClB,QAAQ,OAAO,GAAG,CAAC,MAAM,MAAM,CAAC,YAqBjC,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,QAAQ,YAAY,EAAE,MAAM,UAAU,YAWtE,CAAC;AAEF,eAAO,MAAM,OAAO,GAClB,MAAM,MAAM,EACZ,QAAQ,UAAU,EAClB,UAAU,iBAAiB,EAC3B,cAAc,WAAW,kBAQ1B,CAAC;AAcF,eAAO,MAAM,QAAQ,GACnB,QAAQ,UAAU,EAClB,aAAa,WAAW,EACxB,OAAO,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC,kBAOpC,CAAC;AA2BF,eAAO,MAAM,eAAe,GAC1B,OAAO,WAAW,EAClB,UAAU,CAAC,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,CAAC,GAAG,SAAS,EACjD,YAAY,MAAM,YA4DnB,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,OAAO,WAAW,EAClB,UAAU,CAAC,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,CAAC,GAAG,SAAS,YAwBlD,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,OAAO,WAAW,EAClB,UAAU,CAAC,CAAC,EAAE,EAAE,WAAW,KAAK,IAAI,CAAC,GAAG,SAAS,EACjD,YAAY,MAAM,YAanB,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;CAKlC,CAAC;AAEF,eAAO,MAAM,uBAAuB;iBACF,OAAO;CACxC,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;iBAHM,OAAO;CAMxC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kerebron/extension-codemirror",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"module": "./esm/extension-codemirror/src/ExtensionCodeMirror.js",
|
|
6
6
|
"exports": {
|
|
@@ -33,8 +33,7 @@
|
|
|
33
33
|
"@codemirror/search": "6.5.10",
|
|
34
34
|
"@codemirror/state": "6.5.2",
|
|
35
35
|
"@codemirror/view": "6.38.1",
|
|
36
|
-
"prosemirror-
|
|
37
|
-
"prosemirror-model": "1.25.1",
|
|
36
|
+
"prosemirror-model": "1.25.2",
|
|
38
37
|
"prosemirror-state": "1.4.3",
|
|
39
38
|
"prosemirror-transform": "1.10.4",
|
|
40
39
|
"prosemirror-view": "1.40.0"
|