@kerebron/extension-codemirror 0.1.0 → 0.1.2
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/esm/editor/src/CoreEditor.d.ts.map +1 -1
- package/esm/editor/src/CoreEditor.js +5 -5
- package/esm/editor/src/nodeToTreeString.d.ts.map +1 -1
- package/esm/editor/src/nodeToTreeString.js +5 -2
- package/esm/editor/src/utilities/createNodeFromContent.d.ts.map +1 -1
- package/esm/editor/src/utilities/createNodeFromContent.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoreEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/src/CoreEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"CoreEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/src/CoreEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGzE,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAkB,MAAM,8BAA8B,CAAC;AAgC/E,qBAAa,UAAW,SAAQ,WAAW;IACzC,SAAgB,OAAO,EAAE,OAAO,CAAC,aAAa,CAAC,CAG7C;IACF,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,cAAc,CAAiB;IAChC,IAAI,EAAG,UAAU,CAAC;IAClB,KAAK,EAAG,WAAW,CAAC;gBAEf,OAAO,GAAE,OAAO,CAAC,aAAa,CAAM;IAyBhD,IAAW,MAAM,qBAEhB;IAEM,KAAK,IAAI,eAAe;IAIxB,GAAG,IAAI,eAAe;IAI7B,OAAO,CAAC,UAAU;IAaX,mBAAmB,CAAC,WAAW,EAAE,WAAW;IAcnD,OAAO,CAAC,YAAY;IAcb,WAAW,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,MAAM;IAwC7C,WAAW,CAAC,SAAS,CAAC,EAAE,MAAM;IAkB9B,OAAO,IAAI,WAAW;IAItB,KAAK,CAAC,OAAO,GAAE,OAAO,CAAC,aAAa,CAAM,GAAG,UAAU;IAOvD,KAAK,CAAC,GAAG,CAAC,EAAE,eAAe;CAMnC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EditorView } from 'prosemirror-view';
|
|
2
|
-
import { Node as ProseMirrorNode
|
|
2
|
+
import { Node as ProseMirrorNode } from 'prosemirror-model';
|
|
3
3
|
import { ExtensionManager } from './ExtensionManager.js';
|
|
4
4
|
import { EditorState } from 'prosemirror-state';
|
|
5
5
|
import { createNodeFromContent } from './utilities/createNodeFromContent.js';
|
|
@@ -21,12 +21,12 @@ function ensureDocSchema(doc, schema) {
|
|
|
21
21
|
};
|
|
22
22
|
// TODO fix readonly warnings
|
|
23
23
|
doc.type = findNode(doc.type.name);
|
|
24
|
-
doc.marks.forEach(mark => {
|
|
24
|
+
doc.marks.forEach((mark) => {
|
|
25
25
|
mark.type = findMark(mark.type.name);
|
|
26
26
|
});
|
|
27
|
-
doc.descendants(node => {
|
|
27
|
+
doc.descendants((node) => {
|
|
28
28
|
node.type = findNode(node.type.name);
|
|
29
|
-
node.marks.forEach(mark => {
|
|
29
|
+
node.marks.forEach((mark) => {
|
|
30
30
|
mark.type = findMark(mark.type.name);
|
|
31
31
|
});
|
|
32
32
|
});
|
|
@@ -182,7 +182,7 @@ export class CoreEditor extends EventTarget {
|
|
|
182
182
|
clone(options = {}) {
|
|
183
183
|
return new CoreEditor({
|
|
184
184
|
...options,
|
|
185
|
-
extensions: [...this.options.extensions]
|
|
185
|
+
extensions: [...this.options.extensions],
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
188
|
debug(doc) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeToTreeString.d.ts","sourceRoot":"","sources":["../../../src/editor/src/nodeToTreeString.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"nodeToTreeString.d.ts","sourceRoot":"","sources":["../../../src/editor/src/nodeToTreeString.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAYzC,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,SAAS,IAAI,EAAE,EACrC,KAAK,SAAI,EACT,UAAU,SAAI,UA0Df;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,QAE5C"}
|
|
@@ -13,7 +13,9 @@ export function nodeToTreeString(node, level = 0, currentPos = 0) {
|
|
|
13
13
|
let output = '';
|
|
14
14
|
if (Array.isArray(node)) {
|
|
15
15
|
for (const child of node) {
|
|
16
|
-
output += delim +
|
|
16
|
+
output += delim +
|
|
17
|
+
nodeToTreeString(child, level + 1, currentPos).replace(/\s+$/gm, '') +
|
|
18
|
+
'\n';
|
|
17
19
|
}
|
|
18
20
|
return output;
|
|
19
21
|
}
|
|
@@ -44,7 +46,8 @@ export function nodeToTreeString(node, level = 0, currentPos = 0) {
|
|
|
44
46
|
output += (delim + ' "' + trimText(node.text) + '"') + '\n';
|
|
45
47
|
}
|
|
46
48
|
node.forEach((child, offset) => {
|
|
47
|
-
output +=
|
|
49
|
+
output +=
|
|
50
|
+
nodeToTreeString(child, level + 1, currentPos + offset + 1).replace(/\s+$/gm, '') + '\n'; // + (node.isLeaf ? 1 : 2)
|
|
48
51
|
});
|
|
49
52
|
return output;
|
|
50
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createNodeFromContent.d.ts","sourceRoot":"","sources":["../../../../src/editor/src/utilities/createNodeFromContent.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C,MAAM,MAAM,4BAA4B,GAAG;IACzC,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,GAAG,eAAe,GAAG,QAAQ,EAC7C,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,4BAA4B,GACrC,eAAe,GAAG,QAAQ,CAiC5B;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,GAAG,eAAe,GAAG,QAAQ,EAC7C,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,4BAA4B,GACrC,eAAe,GAAG,QAAQ,CAY5B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment, Node as ProseMirrorNode
|
|
1
|
+
import { Fragment, Node as ProseMirrorNode } from 'prosemirror-model';
|
|
2
2
|
export function createNodeFromObject(content, schema, options) {
|
|
3
3
|
try {
|
|
4
4
|
// if the JSON Content is an array of nodes, create a fragment for each node
|