@manuscripts/transform 2.1.1-LEAN-3092-4 → 2.1.1-LEAN-3092-7
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.
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
*/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
18
|
exports.htmlFromJatsNode = exports.updateDocumentIDs = void 0;
|
|
19
|
+
const crypto_1 = require("crypto");
|
|
20
|
+
const schema_1 = require("../../schema");
|
|
19
21
|
const transformer_1 = require("../../transformer");
|
|
20
22
|
const updateDocumentIDs = (node, replacements) => {
|
|
21
23
|
const warnings = [];
|
|
@@ -30,6 +32,10 @@ function recurseDoc(node, fn) {
|
|
|
30
32
|
node.descendants((n) => fn(n));
|
|
31
33
|
}
|
|
32
34
|
const updateNodeID = (node, replacements, warnings) => {
|
|
35
|
+
if (node.type === schema_1.schema.nodes.inline_equation) {
|
|
36
|
+
node.attrs = Object.assign(Object.assign({}, node.attrs), { id: `InlineMathFragment:${(0, crypto_1.randomUUID)()}` });
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
33
39
|
if (!('id' in node.attrs)) {
|
|
34
40
|
return;
|
|
35
41
|
}
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { randomUUID } from 'crypto';
|
|
17
|
+
import { schema } from '../../schema';
|
|
16
18
|
import { generateID, nodeTypesMap } from '../../transformer';
|
|
17
19
|
export const updateDocumentIDs = (node, replacements) => {
|
|
18
20
|
const warnings = [];
|
|
@@ -26,6 +28,10 @@ function recurseDoc(node, fn) {
|
|
|
26
28
|
node.descendants((n) => fn(n));
|
|
27
29
|
}
|
|
28
30
|
const updateNodeID = (node, replacements, warnings) => {
|
|
31
|
+
if (node.type === schema.nodes.inline_equation) {
|
|
32
|
+
node.attrs = Object.assign(Object.assign({}, node.attrs), { id: `InlineMathFragment:${randomUUID()}` });
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
29
35
|
if (!('id' in node.attrs)) {
|
|
30
36
|
return;
|
|
31
37
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@manuscripts/transform",
|
|
3
3
|
"description": "ProseMirror transformer for Manuscripts applications",
|
|
4
|
-
"version": "2.1.1-LEAN-3092-
|
|
4
|
+
"version": "2.1.1-LEAN-3092-7",
|
|
5
5
|
"repository": "github:Atypon-OpenSource/manuscripts-transform",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"main": "dist/cjs",
|