@fibery/prosemirror-schema 1.6.1 → 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.
Files changed (61) hide show
  1. package/lib/index.d.ts +1 -0
  2. package/lib/index.js +17 -848
  3. package/lib/src/create-schema.d.ts +10 -0
  4. package/lib/src/create-schema.js +69 -0
  5. package/lib/src/marks/highlight.d.ts +2 -0
  6. package/lib/src/marks/highlight.js +68 -0
  7. package/lib/src/marks/highlight.test.d.ts +1 -0
  8. package/lib/src/marks/highlight.test.js +23 -0
  9. package/lib/src/marks/hint-query.d.ts +2 -0
  10. package/lib/src/marks/hint-query.js +23 -0
  11. package/lib/src/marks/link.d.ts +2 -0
  12. package/lib/src/marks/link.js +13 -0
  13. package/lib/src/marks/linked-highlight.d.ts +30 -0
  14. package/lib/src/marks/linked-highlight.js +57 -0
  15. package/lib/src/marks/linked-highlight.test.d.ts +1 -0
  16. package/lib/src/marks/linked-highlight.test.js +37 -0
  17. package/lib/src/marks/strike.d.ts +2 -0
  18. package/lib/src/marks/strike.js +7 -0
  19. package/lib/src/marks/types/mark.d.ts +3 -0
  20. package/lib/src/marks/types/mark.js +2 -0
  21. package/lib/src/marks/underline.d.ts +2 -0
  22. package/lib/src/marks/underline.js +7 -0
  23. package/lib/src/nodes/check-item.d.ts +11 -0
  24. package/lib/src/nodes/check-item.js +34 -0
  25. package/lib/src/nodes/check-list.d.ts +13 -0
  26. package/lib/src/nodes/check-list.js +31 -0
  27. package/lib/src/nodes/code-block.d.ts +2 -0
  28. package/lib/src/nodes/code-block.js +99 -0
  29. package/lib/src/nodes/code-block.test.d.ts +1 -0
  30. package/lib/src/nodes/code-block.test.js +147 -0
  31. package/lib/src/nodes/entity.d.ts +11 -0
  32. package/lib/src/nodes/entity.js +35 -0
  33. package/lib/src/nodes/fibery-view.d.ts +2 -0
  34. package/lib/src/nodes/fibery-view.js +32 -0
  35. package/lib/src/nodes/heading.d.ts +4 -0
  36. package/lib/src/nodes/heading.js +65 -0
  37. package/lib/src/nodes/image-block.d.ts +2 -0
  38. package/lib/src/nodes/image-block.js +35 -0
  39. package/lib/src/nodes/important.d.ts +2 -0
  40. package/lib/src/nodes/important.js +11 -0
  41. package/lib/src/nodes/media.d.ts +4 -0
  42. package/lib/src/nodes/media.js +33 -0
  43. package/lib/src/nodes/mention.d.ts +11 -0
  44. package/lib/src/nodes/mention.js +35 -0
  45. package/lib/src/nodes/note.d.ts +2 -0
  46. package/lib/src/nodes/note.js +11 -0
  47. package/lib/src/nodes/paragraph.d.ts +2 -0
  48. package/lib/src/nodes/paragraph.js +20 -0
  49. package/lib/src/nodes/table-nodes.d.ts +1 -0
  50. package/lib/src/nodes/table-nodes.js +22 -0
  51. package/lib/src/nodes/types/inline-content.d.ts +7 -0
  52. package/lib/src/nodes/types/inline-content.js +2 -0
  53. package/lib/src/nodes/types/text.d.ts +5 -0
  54. package/lib/src/nodes/types/text.js +2 -0
  55. package/lib/src/nodes/video.d.ts +2 -0
  56. package/lib/src/nodes/video.js +49 -0
  57. package/lib/src/nodes/video.test.d.ts +1 -0
  58. package/lib/src/nodes/video.test.js +42 -0
  59. package/lib/test-helpers/index.d.ts +4 -0
  60. package/lib/test-helpers/index.js +21 -0
  61. 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": "1.6.1",
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": "BABEL_ENV=production webpack",
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-fibery": "7.2.0",
30
- "eslint-config-fibery": "7.1.0",
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
- "webpack": "5.72.0",
34
- "webpack-cli": "4.9.2"
33
+ "typescript": "4.7.4"
35
34
  },
36
35
  "jest": {
37
36
  "testEnvironment": "jsdom",