@carlonicora/nestjs-neo4jsonapi 4.7.0 → 4.8.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/dist/core/blocknote/index.d.ts +1 -0
- package/dist/core/blocknote/index.d.ts.map +1 -1
- package/dist/core/blocknote/index.js +1 -0
- package/dist/core/blocknote/index.js.map +1 -1
- package/dist/core/blocknote/rich-text-empty.d.ts +7 -0
- package/dist/core/blocknote/rich-text-empty.d.ts.map +1 -0
- package/dist/core/blocknote/rich-text-empty.js +59 -0
- package/dist/core/blocknote/rich-text-empty.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/blocknote/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/blocknote/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC"}
|
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./blocknote.module"), exports);
|
|
18
|
+
__exportStar(require("./rich-text-empty"), exports);
|
|
18
19
|
__exportStar(require("./services/blocknote.service"), exports);
|
|
19
20
|
__exportStar(require("./services/blocknote-to-docx.service"), exports);
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/blocknote/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,+DAA6C;AAC7C,uEAAqD"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/blocknote/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,oDAAkC;AAClC,+DAA6C;AAC7C,uEAAqD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function isDocumentEmpty(blocks: unknown): boolean;
|
|
2
|
+
/**
|
|
3
|
+
* Returns null when the wire value (a JSON string of blocks) is an empty
|
|
4
|
+
* document, otherwise the value untouched. Unparseable input counts as empty.
|
|
5
|
+
*/
|
|
6
|
+
export declare function emptyRichTextToNull(value: string | null | undefined): string | null;
|
|
7
|
+
//# sourceMappingURL=rich-text-empty.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rich-text-empty.d.ts","sourceRoot":"","sources":["../../../src/core/blocknote/rich-text-empty.ts"],"names":[],"mappings":"AA6BA,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAGxD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAOnF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDocumentEmpty = isDocumentEmpty;
|
|
4
|
+
exports.emptyRichTextToNull = emptyRichTextToNull;
|
|
5
|
+
/**
|
|
6
|
+
* Server-side twin of the web editor's emptiness rule
|
|
7
|
+
* (packages/nextjs-jsonapi/src/components/editors/BlockNoteEditor.tsx).
|
|
8
|
+
* A BlockNote document that the user has cleared still serialises as one
|
|
9
|
+
* blank paragraph, so a Cypher aggregate cannot tell "never written" from
|
|
10
|
+
* "written". Services normalise an empty rich-text attribute to null with
|
|
11
|
+
* emptyRichTextToNull before the framework writes it.
|
|
12
|
+
*/
|
|
13
|
+
function isBlockEmpty(block) {
|
|
14
|
+
if (!block || typeof block !== "object")
|
|
15
|
+
return true;
|
|
16
|
+
if (block.type !== "paragraph")
|
|
17
|
+
return false;
|
|
18
|
+
if (Array.isArray(block.children) && block.children.length > 0 && !isDocumentEmpty(block.children)) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if (Array.isArray(block.content)) {
|
|
22
|
+
for (const inline of block.content) {
|
|
23
|
+
if (typeof inline === "string") {
|
|
24
|
+
if (inline.trim())
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
else if (inline && typeof inline === "object") {
|
|
28
|
+
if (inline.type !== "text")
|
|
29
|
+
return false;
|
|
30
|
+
if (typeof inline.text === "string" && inline.text.trim())
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else if (typeof block.content === "string" && block.content.trim()) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
function isDocumentEmpty(blocks) {
|
|
41
|
+
if (!Array.isArray(blocks) || blocks.length === 0)
|
|
42
|
+
return true;
|
|
43
|
+
return blocks.every(isBlockEmpty);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Returns null when the wire value (a JSON string of blocks) is an empty
|
|
47
|
+
* document, otherwise the value untouched. Unparseable input counts as empty.
|
|
48
|
+
*/
|
|
49
|
+
function emptyRichTextToNull(value) {
|
|
50
|
+
if (value === null || value === undefined || value === "")
|
|
51
|
+
return null;
|
|
52
|
+
try {
|
|
53
|
+
return isDocumentEmpty(JSON.parse(value)) ? null : value;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=rich-text-empty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rich-text-empty.js","sourceRoot":"","sources":["../../../src/core/blocknote/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