@fibery/prosemirror-schema 4.12.0 → 4.14.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 CHANGED
@@ -1,4 +1,5 @@
1
1
  export { defaultHeight, defaultWidth } from "./src/resizable-node-attrs";
2
- export { createSchema } from "./src/create-schema";
2
+ export { Node, Schema } from "prosemirror-model";
3
+ export { createSchema, Basic } from "./src/create-schema";
3
4
  export { DEFAULT_VIDEO_WIDTH, DEFAULT_VIDEO_HEIGHT } from "./src/nodes/video";
4
5
  export type { EmojiOptions } from "./src/nodes/emoji";
package/lib/index.js CHANGED
@@ -1,11 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_VIDEO_HEIGHT = exports.DEFAULT_VIDEO_WIDTH = exports.createSchema = exports.defaultWidth = exports.defaultHeight = void 0;
3
+ exports.DEFAULT_VIDEO_HEIGHT = exports.DEFAULT_VIDEO_WIDTH = exports.Basic = exports.createSchema = exports.Schema = exports.Node = exports.defaultWidth = exports.defaultHeight = void 0;
4
4
  var resizable_node_attrs_1 = require("./src/resizable-node-attrs");
5
5
  Object.defineProperty(exports, "defaultHeight", { enumerable: true, get: function () { return resizable_node_attrs_1.defaultHeight; } });
6
6
  Object.defineProperty(exports, "defaultWidth", { enumerable: true, get: function () { return resizable_node_attrs_1.defaultWidth; } });
7
+ var prosemirror_model_1 = require("prosemirror-model");
8
+ Object.defineProperty(exports, "Node", { enumerable: true, get: function () { return prosemirror_model_1.Node; } });
9
+ Object.defineProperty(exports, "Schema", { enumerable: true, get: function () { return prosemirror_model_1.Schema; } });
7
10
  var create_schema_1 = require("./src/create-schema");
8
11
  Object.defineProperty(exports, "createSchema", { enumerable: true, get: function () { return create_schema_1.createSchema; } });
12
+ Object.defineProperty(exports, "Basic", { enumerable: true, get: function () { return create_schema_1.Basic; } });
9
13
  var video_1 = require("./src/nodes/video");
10
14
  Object.defineProperty(exports, "DEFAULT_VIDEO_WIDTH", { enumerable: true, get: function () { return video_1.DEFAULT_VIDEO_WIDTH; } });
11
15
  Object.defineProperty(exports, "DEFAULT_VIDEO_HEIGHT", { enumerable: true, get: function () { return video_1.DEFAULT_VIDEO_HEIGHT; } });
@@ -9,4 +9,29 @@ type Params = {
9
9
  emojiOptions?: EmojiOptions;
10
10
  };
11
11
  export declare const createSchema: ({ sharedColorGenerator, headingToDOM, mediaToDom, isImageBlockEnabled, fiberyViewEnabled, emojiOptions, }?: Params) => Schema;
12
+ export declare const Basic: {
13
+ nodes: {
14
+ doc: import("prosemirror-model").NodeSpec;
15
+ paragraph: import("prosemirror-model").NodeSpec;
16
+ blockquote: import("prosemirror-model").NodeSpec;
17
+ horizontal_rule: import("prosemirror-model").NodeSpec;
18
+ heading: import("prosemirror-model").NodeSpec;
19
+ code_block: import("prosemirror-model").NodeSpec;
20
+ text: import("prosemirror-model").NodeSpec;
21
+ image: import("prosemirror-model").NodeSpec;
22
+ hard_break: import("prosemirror-model").NodeSpec;
23
+ };
24
+ marks: {
25
+ link: import("prosemirror-model").MarkSpec;
26
+ em: import("prosemirror-model").MarkSpec;
27
+ strong: import("prosemirror-model").MarkSpec;
28
+ code: import("prosemirror-model").MarkSpec;
29
+ };
30
+ fibery: {
31
+ link: import("prosemirror-model").MarkSpec;
32
+ strike: import("prosemirror-model").MarkSpec;
33
+ underline: import("prosemirror-model").MarkSpec;
34
+ textBackgroundColor: import("prosemirror-model").MarkSpec;
35
+ };
36
+ };
12
37
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createSchema = void 0;
3
+ exports.Basic = exports.createSchema = void 0;
4
4
  const prosemirror_model_1 = require("prosemirror-model");
5
5
  const prosemirror_schema_basic_1 = require("prosemirror-schema-basic");
6
6
  const prosemirror_schema_list_1 = require("prosemirror-schema-list");
@@ -16,6 +16,8 @@ const mention_1 = require("./nodes/mention");
16
16
  const fibery_view_1 = require("./nodes/fibery-view");
17
17
  const check_list_1 = require("./nodes/check-list");
18
18
  const check_item_1 = require("./nodes/check-item");
19
+ const math_display_1 = require("./nodes/math-display");
20
+ const math_inline_1 = require("./nodes/math-inline");
19
21
  const code_block_1 = require("./nodes/code-block");
20
22
  const video_1 = require("./nodes/video");
21
23
  const file_1 = require("./nodes/file");
@@ -56,6 +58,8 @@ const createSchema = ({ sharedColorGenerator = null, headingToDOM = null, mediaT
56
58
  callout: callout_1.callout,
57
59
  columns: columns_1.columns,
58
60
  column: column_1.column,
61
+ math_display: math_display_1.math_display,
62
+ math_inline: math_inline_1.math_inline,
59
63
  };
60
64
  let actualNodes = (0, prosemirror_schema_list_1.addListNodes)(base.spec.nodes, "paragraph block*", "block")
61
65
  .append({ ...table_nodes_1.tableNodes })
@@ -84,3 +88,13 @@ const createSchema = ({ sharedColorGenerator = null, headingToDOM = null, mediaT
84
88
  });
85
89
  };
86
90
  exports.createSchema = createSchema;
91
+ exports.Basic = {
92
+ nodes: prosemirror_schema_basic_1.nodes,
93
+ marks: prosemirror_schema_basic_1.marks,
94
+ fibery: {
95
+ link: (0, link_1.makeLink)(prosemirror_schema_basic_1.marks.link),
96
+ strike: strike_1.strike,
97
+ underline: underline_1.underline,
98
+ textBackgroundColor: text_background_color_1.textBackgroundColor,
99
+ },
100
+ };
@@ -8,7 +8,7 @@ const makeLink = (baseLink) => {
8
8
  toDOM(node) {
9
9
  const { href } = node.attrs;
10
10
  let fixedHref = href;
11
- if (!fixedHref.startsWith("http") && !fixedHref.startsWith("/")) {
11
+ if (href && !href.startsWith("mailto:") && !fixedHref.startsWith("http") && !fixedHref.startsWith("/")) {
12
12
  if (httpRegex.test(href)) {
13
13
  fixedHref = `https://${href}`;
14
14
  }
@@ -47,6 +47,7 @@ exports.code_block = {
47
47
  attrs: {
48
48
  guid: { default: "" },
49
49
  language: { default: null },
50
+ wrapCode: { default: false },
50
51
  },
51
52
  parseDOM: [
52
53
  {
@@ -59,8 +60,10 @@ exports.code_block = {
59
60
  getLanguageFromEditorStyle(dom.parentElement) ||
60
61
  getLanguageFromCode(dom) ||
61
62
  dom.getAttribute("data-language");
63
+ const wrapCodeAttr = dom.getAttribute("data-wrap-code");
64
+ const wrapCode = wrapCodeAttr === "true";
62
65
  removeLastNewLine(dom);
63
- return { guid, language };
66
+ return { guid, language, wrapCode };
64
67
  },
65
68
  },
66
69
  // Handle GitHub/Gist paste
@@ -77,6 +80,13 @@ exports.code_block = {
77
80
  ],
78
81
  toDOM(node) {
79
82
  const { guid = "" } = node.attrs;
80
- return ["pre", ["code", { "data-language": node.attrs.language, "data-guid": guid }, 0]];
83
+ return [
84
+ "pre",
85
+ [
86
+ "code",
87
+ { "data-language": node.attrs.language, "data-guid": guid, "data-wrap-code": node.attrs.wrapCode || false },
88
+ 0,
89
+ ],
90
+ ];
81
91
  },
82
92
  };
@@ -0,0 +1,2 @@
1
+ import { NodeSpec } from "prosemirror-model";
2
+ export declare const math_display: NodeSpec;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.math_display = void 0;
4
+ exports.math_display = {
5
+ // important!
6
+ group: "block math",
7
+ content: "text*", // important!
8
+ atom: true, // important!
9
+ code: true, // important!
10
+ toDOM: () => ["math-display", { class: "math-node" }, 0],
11
+ parseDOM: [
12
+ {
13
+ tag: "math-display", // important!
14
+ },
15
+ ],
16
+ };
@@ -0,0 +1,2 @@
1
+ import { NodeSpec } from "prosemirror-model";
2
+ export declare const math_inline: NodeSpec;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.math_inline = void 0;
4
+ exports.math_inline = {
5
+ // important!
6
+ group: "inline math",
7
+ content: "text*", // important!
8
+ inline: true, // important!
9
+ atom: true, // important!
10
+ toDOM: () => ["math-inline", { class: "math-node" }, 0],
11
+ parseDOM: [
12
+ {
13
+ tag: "math-inline", // important!
14
+ },
15
+ ],
16
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/prosemirror-schema",
3
- "version": "4.12.0",
3
+ "version": "4.14.0",
4
4
  "description": "Fibery prosemirror schema",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",