@fibery/prosemirror-schema 1.6.0 → 3.0.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/lib/index.d.ts +1 -0
- package/lib/index.js +17 -849
- package/lib/src/create-schema.d.ts +10 -0
- package/lib/src/create-schema.js +69 -0
- package/lib/src/marks/highlight.d.ts +2 -0
- package/lib/src/marks/highlight.js +68 -0
- package/lib/src/marks/highlight.test.d.ts +1 -0
- package/lib/src/marks/highlight.test.js +23 -0
- package/lib/src/marks/hint-query.d.ts +2 -0
- package/lib/src/marks/hint-query.js +23 -0
- package/lib/src/marks/link.d.ts +2 -0
- package/lib/src/marks/link.js +13 -0
- package/lib/src/marks/linked-highlight.d.ts +30 -0
- package/lib/src/marks/linked-highlight.js +57 -0
- package/lib/src/marks/linked-highlight.test.d.ts +1 -0
- package/lib/src/marks/linked-highlight.test.js +37 -0
- package/lib/src/marks/strike.d.ts +2 -0
- package/lib/src/marks/strike.js +7 -0
- package/lib/src/marks/types/mark.d.ts +3 -0
- package/lib/src/marks/types/mark.js +2 -0
- package/lib/src/marks/underline.d.ts +2 -0
- package/lib/src/marks/underline.js +7 -0
- package/lib/src/nodes/check-item.d.ts +11 -0
- package/lib/src/nodes/check-item.js +34 -0
- package/lib/src/nodes/check-list.d.ts +13 -0
- package/lib/src/nodes/check-list.js +31 -0
- package/lib/src/nodes/code-block.d.ts +2 -0
- package/lib/src/nodes/code-block.js +99 -0
- package/lib/src/nodes/code-block.test.d.ts +1 -0
- package/lib/src/nodes/code-block.test.js +147 -0
- package/lib/src/nodes/entity.d.ts +11 -0
- package/lib/src/nodes/entity.js +35 -0
- package/lib/src/nodes/fibery-view.d.ts +2 -0
- package/lib/src/nodes/fibery-view.js +32 -0
- package/lib/src/nodes/heading.d.ts +4 -0
- package/lib/src/nodes/heading.js +65 -0
- package/lib/src/nodes/image-block.d.ts +2 -0
- package/lib/src/nodes/image-block.js +35 -0
- package/lib/src/nodes/important.d.ts +2 -0
- package/lib/src/nodes/important.js +11 -0
- package/lib/src/nodes/media.d.ts +4 -0
- package/lib/src/nodes/media.js +33 -0
- package/lib/src/nodes/mention.d.ts +11 -0
- package/lib/src/nodes/mention.js +35 -0
- package/lib/src/nodes/note.d.ts +2 -0
- package/lib/src/nodes/note.js +11 -0
- package/lib/src/nodes/paragraph.d.ts +2 -0
- package/lib/src/nodes/paragraph.js +20 -0
- package/lib/src/nodes/table-nodes.d.ts +1 -0
- package/lib/src/nodes/table-nodes.js +22 -0
- package/lib/src/nodes/types/inline-content.d.ts +7 -0
- package/lib/src/nodes/types/inline-content.js +2 -0
- package/lib/src/nodes/types/text.d.ts +5 -0
- package/lib/src/nodes/types/text.js +2 -0
- package/lib/src/nodes/video.d.ts +2 -0
- package/lib/src/nodes/video.js +49 -0
- package/lib/src/nodes/video.test.d.ts +1 -0
- package/lib/src/nodes/video.test.js +42 -0
- package/lib/test-helpers/index.d.ts +4 -0
- package/lib/test-helpers/index.js +21 -0
- package/package.json +5 -6
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toHTML = exports.toDOM = exports.fromHTML = void 0;
|
|
4
|
+
const prosemirror_model_1 = require("prosemirror-model");
|
|
5
|
+
const fromHTML = (html, schema, options) => {
|
|
6
|
+
const el = document.createElement("div");
|
|
7
|
+
el.innerHTML = html;
|
|
8
|
+
return prosemirror_model_1.DOMParser.fromSchema(schema).parse(el, options);
|
|
9
|
+
};
|
|
10
|
+
exports.fromHTML = fromHTML;
|
|
11
|
+
const toDOM = (node, schema) => {
|
|
12
|
+
const serializer = prosemirror_model_1.DOMSerializer.fromSchema(schema);
|
|
13
|
+
return serializer.serializeFragment(prosemirror_model_1.Fragment.from(node));
|
|
14
|
+
};
|
|
15
|
+
exports.toDOM = toDOM;
|
|
16
|
+
const toHTML = (node, schema) => {
|
|
17
|
+
const el = document.createElement("div");
|
|
18
|
+
el.appendChild((0, exports.toDOM)(node, schema));
|
|
19
|
+
return el.innerHTML;
|
|
20
|
+
};
|
|
21
|
+
exports.toHTML = toHTML;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/prosemirror-schema",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Fibery prosemirror schema",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"files": [
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
],
|
|
9
9
|
"private": false,
|
|
10
10
|
"scripts": {
|
|
11
|
-
"build": "
|
|
11
|
+
"build": "rm -rf lib && tsc --declaration --noEmit false",
|
|
12
12
|
"test": "jest",
|
|
13
13
|
"test:ci": "yarn test --coverage --reporters=default --reporters=jest-junit",
|
|
14
14
|
"lint": "eslint ",
|
|
@@ -26,12 +26,11 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/prosemirror-model": "1.16.1",
|
|
28
28
|
"babel-loader": "8.2.5",
|
|
29
|
-
"babel-preset
|
|
30
|
-
"eslint-config
|
|
29
|
+
"@fibery/babel-preset": "7.2.0",
|
|
30
|
+
"@fibery/eslint-config": "8.2.0",
|
|
31
31
|
"jest": "27.5.1",
|
|
32
32
|
"jest-junit": "13.0.0",
|
|
33
|
-
"
|
|
34
|
-
"webpack-cli": "4.9.2"
|
|
33
|
+
"typescript": "4.7.4"
|
|
35
34
|
},
|
|
36
35
|
"jest": {
|
|
37
36
|
"testEnvironment": "jsdom",
|