@examind/block-sdk 0.2.2 → 0.2.3

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/dist/index.js CHANGED
@@ -140,6 +140,10 @@ function createHtmlFromNestedEditor(editor, metadata) {
140
140
  }
141
141
 
142
142
  // src/exportToHtml/ExcelQuestionNodeHandler.ts
143
+ var htmlOrNullIfEmpty = (editor) => {
144
+ const html = createHtmlFromNestedEditor(editor);
145
+ return !html || html === "<p></p>" ? null : html;
146
+ };
143
147
  var ExcelQuestionNodeHandler = class extends NodeHandler {
144
148
  processNode(node) {
145
149
  if (!isSerializedExcelQuestionNode(node)) return null;
@@ -147,14 +151,14 @@ var ExcelQuestionNodeHandler = class extends NodeHandler {
147
151
  ...node.data,
148
152
  parts: node.data.parts.map((p) => ({
149
153
  ...p,
150
- objective: createHtmlFromNestedEditor(p.objective),
151
- instructions: createHtmlFromNestedEditor(p.instructions),
154
+ objective: htmlOrNullIfEmpty(p.objective),
155
+ instructions: htmlOrNullIfEmpty(p.instructions),
152
156
  tasks: p.tasks.map((t) => ({
153
157
  ...t,
154
- instructions: createHtmlFromNestedEditor(t.instructions),
158
+ instructions: htmlOrNullIfEmpty(t.instructions),
155
159
  steps: t.steps.map((s) => ({
156
160
  ...s,
157
- description: createHtmlFromNestedEditor(s.description)
161
+ description: htmlOrNullIfEmpty(s.description)
158
162
  }))
159
163
  }))
160
164
  }))
package/dist/index.mjs CHANGED
@@ -113,6 +113,10 @@ function createHtmlFromNestedEditor(editor, metadata) {
113
113
  }
114
114
 
115
115
  // src/exportToHtml/ExcelQuestionNodeHandler.ts
116
+ var htmlOrNullIfEmpty = (editor) => {
117
+ const html = createHtmlFromNestedEditor(editor);
118
+ return !html || html === "<p></p>" ? null : html;
119
+ };
116
120
  var ExcelQuestionNodeHandler = class extends NodeHandler {
117
121
  processNode(node) {
118
122
  if (!isSerializedExcelQuestionNode(node)) return null;
@@ -120,14 +124,14 @@ var ExcelQuestionNodeHandler = class extends NodeHandler {
120
124
  ...node.data,
121
125
  parts: node.data.parts.map((p) => ({
122
126
  ...p,
123
- objective: createHtmlFromNestedEditor(p.objective),
124
- instructions: createHtmlFromNestedEditor(p.instructions),
127
+ objective: htmlOrNullIfEmpty(p.objective),
128
+ instructions: htmlOrNullIfEmpty(p.instructions),
125
129
  tasks: p.tasks.map((t) => ({
126
130
  ...t,
127
- instructions: createHtmlFromNestedEditor(t.instructions),
131
+ instructions: htmlOrNullIfEmpty(t.instructions),
128
132
  steps: t.steps.map((s) => ({
129
133
  ...s,
130
- description: createHtmlFromNestedEditor(s.description)
134
+ description: htmlOrNullIfEmpty(s.description)
131
135
  }))
132
136
  }))
133
137
  }))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@examind/block-sdk",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "@comment version": [
5
5
  "Don't specify package version here. It will be injected by publish workflow."
6
6
  ],
@@ -21,7 +21,7 @@
21
21
  "peerDependencies": {
22
22
  "nanoid": ">=3.0.0",
23
23
  "node-html-parser": ">=6.0.0",
24
- "@examind/block-types": "^0.2.2"
24
+ "@examind/block-types": "^0.2.3"
25
25
  },
26
26
  "devDependencies": {
27
27
  "@eslint/js": "^9.17.0",
@@ -36,7 +36,7 @@
36
36
  "tsup": "^8.3.5",
37
37
  "typescript": "^5.7.2",
38
38
  "typescript-eslint": "^8.18.2",
39
- "@examind/block-types": "0.2.2"
39
+ "@examind/block-types": "0.2.3"
40
40
  },
41
41
  "dependencies": {
42
42
  "lodash-es": "4.17.21"