prosemirror-schema-basic 1.2.2 → 1.2.4

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/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## 1.2.4 (2025-03-18)
2
+
3
+ ### Bug fixes
4
+
5
+ Add a `code` flag to the code mark.
6
+
7
+ ## 1.2.3 (2024-07-14)
8
+
9
+ ### Bug fixes
10
+
11
+ Add attribute type validation for headings, images, and link marks.
12
+
1
13
  ## 1.2.2 (2023-05-17)
2
14
 
3
15
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -1,16 +1,11 @@
1
1
  'use strict';
2
2
 
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- });
6
-
7
3
  var prosemirrorModel = require('prosemirror-model');
8
-
9
4
  var pDOM = ["p", 0],
10
- blockquoteDOM = ["blockquote", 0],
11
- hrDOM = ["hr"],
12
- preDOM = ["pre", ["code", 0]],
13
- brDOM = ["br"];
5
+ blockquoteDOM = ["blockquote", 0],
6
+ hrDOM = ["hr"],
7
+ preDOM = ["pre", ["code", 0]],
8
+ brDOM = ["br"];
14
9
  var nodes = {
15
10
  doc: {
16
11
  content: "block+"
@@ -48,7 +43,8 @@ var nodes = {
48
43
  heading: {
49
44
  attrs: {
50
45
  level: {
51
- "default": 1
46
+ "default": 1,
47
+ validate: "number"
52
48
  }
53
49
  },
54
50
  content: "inline*",
@@ -109,12 +105,16 @@ var nodes = {
109
105
  image: {
110
106
  inline: true,
111
107
  attrs: {
112
- src: {},
108
+ src: {
109
+ validate: "string"
110
+ },
113
111
  alt: {
114
- "default": null
112
+ "default": null,
113
+ validate: "string|null"
115
114
  },
116
115
  title: {
117
- "default": null
116
+ "default": null,
117
+ validate: "string|null"
118
118
  }
119
119
  },
120
120
  group: "inline",
@@ -131,9 +131,9 @@ var nodes = {
131
131
  }],
132
132
  toDOM: function toDOM(node) {
133
133
  var _node$attrs = node.attrs,
134
- src = _node$attrs.src,
135
- alt = _node$attrs.alt,
136
- title = _node$attrs.title;
134
+ src = _node$attrs.src,
135
+ alt = _node$attrs.alt,
136
+ title = _node$attrs.title;
137
137
  return ["img", {
138
138
  src: src,
139
139
  alt: alt,
@@ -154,14 +154,17 @@ var nodes = {
154
154
  }
155
155
  };
156
156
  var emDOM = ["em", 0],
157
- strongDOM = ["strong", 0],
158
- codeDOM = ["code", 0];
157
+ strongDOM = ["strong", 0],
158
+ codeDOM = ["code", 0];
159
159
  var marks = {
160
160
  link: {
161
161
  attrs: {
162
- href: {},
162
+ href: {
163
+ validate: "string"
164
+ },
163
165
  title: {
164
- "default": null
166
+ "default": null,
167
+ validate: "string|null"
165
168
  }
166
169
  },
167
170
  inclusive: false,
@@ -176,8 +179,8 @@ var marks = {
176
179
  }],
177
180
  toDOM: function toDOM(node) {
178
181
  var _node$attrs2 = node.attrs,
179
- href = _node$attrs2.href,
180
- title = _node$attrs2.title;
182
+ href = _node$attrs2.href,
183
+ title = _node$attrs2.title;
181
184
  return ["a", {
182
185
  href: href,
183
186
  title: title
@@ -225,6 +228,7 @@ var marks = {
225
228
  }
226
229
  },
227
230
  code: {
231
+ code: true,
228
232
  parseDOM: [{
229
233
  tag: "code"
230
234
  }],
package/dist/index.js CHANGED
@@ -45,7 +45,7 @@ const nodes = {
45
45
  `<h6>` elements.
46
46
  */
47
47
  heading: {
48
- attrs: { level: { default: 1 } },
48
+ attrs: { level: { default: 1, validate: "number" } },
49
49
  content: "inline*",
50
50
  group: "block",
51
51
  defining: true,
@@ -85,9 +85,9 @@ const nodes = {
85
85
  image: {
86
86
  inline: true,
87
87
  attrs: {
88
- src: {},
89
- alt: { default: null },
90
- title: { default: null }
88
+ src: { validate: "string" },
89
+ alt: { default: null, validate: "string|null" },
90
+ title: { default: null, validate: "string|null" }
91
91
  },
92
92
  group: "inline",
93
93
  draggable: true,
@@ -123,8 +123,8 @@ const marks = {
123
123
  */
124
124
  link: {
125
125
  attrs: {
126
- href: {},
127
- title: { default: null }
126
+ href: { validate: "string" },
127
+ title: { default: null, validate: "string|null" }
128
128
  },
129
129
  inclusive: false,
130
130
  parseDOM: [{ tag: "a[href]", getAttrs(dom) {
@@ -164,6 +164,7 @@ const marks = {
164
164
  Code font mark. Represented as a `<code>` element.
165
165
  */
166
166
  code: {
167
+ code: true,
167
168
  parseDOM: [{ tag: "code" }],
168
169
  toDOM() { return codeDOM; }
169
170
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prosemirror-schema-basic",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Basic schema elements for ProseMirror",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -24,7 +24,7 @@
24
24
  "url": "git://github.com/prosemirror/prosemirror-schema-basic.git"
25
25
  },
26
26
  "dependencies": {
27
- "prosemirror-model": "^1.19.0"
27
+ "prosemirror-model": "^1.25.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@prosemirror/buildhelper": "^0.1.5",
@@ -40,7 +40,7 @@ export const nodes = {
40
40
  /// should hold the number 1 to 6. Parsed and serialized as `<h1>` to
41
41
  /// `<h6>` elements.
42
42
  heading: {
43
- attrs: {level: {default: 1}},
43
+ attrs: {level: {default: 1, validate: "number"}},
44
44
  content: "inline*",
45
45
  group: "block",
46
46
  defining: true,
@@ -77,9 +77,9 @@ export const nodes = {
77
77
  image: {
78
78
  inline: true,
79
79
  attrs: {
80
- src: {},
81
- alt: {default: null},
82
- title: {default: null}
80
+ src: {validate: "string"},
81
+ alt: {default: null, validate: "string|null"},
82
+ title: {default: null, validate: "string|null"}
83
83
  },
84
84
  group: "inline",
85
85
  draggable: true,
@@ -112,8 +112,8 @@ export const marks = {
112
112
  /// element.
113
113
  link: {
114
114
  attrs: {
115
- href: {},
116
- title: {default: null}
115
+ href: {validate: "string"},
116
+ title: {default: null, validate: "string|null"}
117
117
  },
118
118
  inclusive: false,
119
119
  parseDOM: [{tag: "a[href]", getAttrs(dom: HTMLElement) {
@@ -150,6 +150,7 @@ export const marks = {
150
150
 
151
151
  /// Code font mark. Represented as a `<code>` element.
152
152
  code: {
153
+ code: true,
153
154
  parseDOM: [{tag: "code"}],
154
155
  toDOM() { return codeDOM }
155
156
  } as MarkSpec