@uniweb/content-reader 1.1.3 → 1.1.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/package.json +1 -1
- package/src/parser/block.js +1 -1
- package/src/parser/inline.js +1 -1
- package/src/schema/index.js +16 -0
package/package.json
CHANGED
package/src/parser/block.js
CHANGED
|
@@ -113,7 +113,7 @@ function parseBlock(token, schema) {
|
|
|
113
113
|
content.forEach((element) => {
|
|
114
114
|
if (
|
|
115
115
|
(element.type === "image" && element.attrs?.role !== "icon") ||
|
|
116
|
-
element.type === "
|
|
116
|
+
element.type === "inset_ref"
|
|
117
117
|
) {
|
|
118
118
|
// Extract non-icon images to root level so they become
|
|
119
119
|
// block-level elements. Icons stay inline so the semantic
|
package/src/parser/inline.js
CHANGED
|
@@ -153,7 +153,7 @@ function parseInline(token, schema, removeNewLine = false) {
|
|
|
153
153
|
const component = token.href.slice(1)
|
|
154
154
|
const { role: _role, ...otherAttrs } = token.attrs || {}
|
|
155
155
|
return [{
|
|
156
|
-
type: "
|
|
156
|
+
type: "inset_ref",
|
|
157
157
|
attrs: {
|
|
158
158
|
component,
|
|
159
159
|
alt: text || null,
|
package/src/schema/index.js
CHANGED
|
@@ -60,6 +60,22 @@ const baseNodes = {
|
|
|
60
60
|
// group: "block inline",
|
|
61
61
|
},
|
|
62
62
|
|
|
63
|
+
inset_ref: {
|
|
64
|
+
attrs: {
|
|
65
|
+
component: {},
|
|
66
|
+
alt: { default: null },
|
|
67
|
+
// Dynamic attributes from {key=value} syntax are also stored here
|
|
68
|
+
},
|
|
69
|
+
group: "block",
|
|
70
|
+
},
|
|
71
|
+
|
|
72
|
+
inset_placeholder: {
|
|
73
|
+
attrs: {
|
|
74
|
+
refId: {},
|
|
75
|
+
},
|
|
76
|
+
group: "block",
|
|
77
|
+
},
|
|
78
|
+
|
|
63
79
|
divider: {
|
|
64
80
|
attrs: {
|
|
65
81
|
style: { default: "line" },
|