@contentful/field-editor-shared 4.3.0 → 4.3.1-canary.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.
|
@@ -20,7 +20,7 @@ _export(exports, {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
23
|
-
const
|
|
23
|
+
const _client = require("react-dom/client");
|
|
24
24
|
const _f36components = require("@contentful/f36-components");
|
|
25
25
|
const _isNumber = /*#__PURE__*/ _interop_require_default(require("lodash/isNumber"));
|
|
26
26
|
function _interop_require_default(obj) {
|
|
@@ -71,13 +71,15 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
71
71
|
}
|
|
72
72
|
function open(componentRenderer) {
|
|
73
73
|
let rootDom = null;
|
|
74
|
+
let reactRoot = null;
|
|
74
75
|
const getRoot = ()=>{
|
|
75
76
|
if (rootDom === null) {
|
|
76
77
|
rootDom = document.createElement('div');
|
|
77
78
|
rootDom.setAttribute('id', 'field-editor-modal-root');
|
|
78
79
|
document.body.appendChild(rootDom);
|
|
80
|
+
reactRoot = (0, _client.createRoot)(rootDom);
|
|
79
81
|
}
|
|
80
|
-
return
|
|
82
|
+
return reactRoot;
|
|
81
83
|
};
|
|
82
84
|
return new Promise((resolve)=>{
|
|
83
85
|
let currentConfig = {
|
|
@@ -85,10 +87,10 @@ function open(componentRenderer) {
|
|
|
85
87
|
isShown: true
|
|
86
88
|
};
|
|
87
89
|
function render({ onClose, isShown }) {
|
|
88
|
-
|
|
90
|
+
getRoot().render(componentRenderer({
|
|
89
91
|
onClose,
|
|
90
92
|
isShown
|
|
91
|
-
})
|
|
93
|
+
}));
|
|
92
94
|
}
|
|
93
95
|
function onClose(...args) {
|
|
94
96
|
currentConfig = {
|
|
@@ -97,7 +99,8 @@ function open(componentRenderer) {
|
|
|
97
99
|
};
|
|
98
100
|
render(currentConfig);
|
|
99
101
|
resolve(...args);
|
|
100
|
-
|
|
102
|
+
reactRoot?.unmount();
|
|
103
|
+
rootDom?.remove();
|
|
101
104
|
}
|
|
102
105
|
render(currentConfig);
|
|
103
106
|
});
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { createRoot } from 'react-dom/client';
|
|
3
3
|
import { Modal, ModalHeader } from '@contentful/f36-components';
|
|
4
4
|
import isNumber from 'lodash/isNumber';
|
|
5
5
|
export function open(componentRenderer) {
|
|
6
6
|
let rootDom = null;
|
|
7
|
+
let reactRoot = null;
|
|
7
8
|
const getRoot = ()=>{
|
|
8
9
|
if (rootDom === null) {
|
|
9
10
|
rootDom = document.createElement('div');
|
|
10
11
|
rootDom.setAttribute('id', 'field-editor-modal-root');
|
|
11
12
|
document.body.appendChild(rootDom);
|
|
13
|
+
reactRoot = createRoot(rootDom);
|
|
12
14
|
}
|
|
13
|
-
return
|
|
15
|
+
return reactRoot;
|
|
14
16
|
};
|
|
15
17
|
return new Promise((resolve)=>{
|
|
16
18
|
let currentConfig = {
|
|
@@ -18,10 +20,10 @@ export function open(componentRenderer) {
|
|
|
18
20
|
isShown: true
|
|
19
21
|
};
|
|
20
22
|
function render({ onClose, isShown }) {
|
|
21
|
-
|
|
23
|
+
getRoot().render(componentRenderer({
|
|
22
24
|
onClose,
|
|
23
25
|
isShown
|
|
24
|
-
})
|
|
26
|
+
}));
|
|
25
27
|
}
|
|
26
28
|
function onClose(...args) {
|
|
27
29
|
currentConfig = {
|
|
@@ -30,7 +32,8 @@ export function open(componentRenderer) {
|
|
|
30
32
|
};
|
|
31
33
|
render(currentConfig);
|
|
32
34
|
resolve(...args);
|
|
33
|
-
|
|
35
|
+
reactRoot?.unmount();
|
|
36
|
+
rootDom?.remove();
|
|
34
37
|
}
|
|
35
38
|
render(currentConfig);
|
|
36
39
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-shared",
|
|
3
|
-
"version": "4.3.0",
|
|
3
|
+
"version": "4.3.1-canary.0+72ee3709",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@contentful/app-sdk": "^4.42.0",
|
|
46
|
-
"@contentful/field-editor-test-utils": "^3.0.
|
|
46
|
+
"@contentful/field-editor-test-utils": "^3.0.1-canary.32+72ee3709",
|
|
47
47
|
"@lingui/core": "5.3.0",
|
|
48
48
|
"@tanstack/react-query": "^4.3.9",
|
|
49
49
|
"@testing-library/react": "16.3.0"
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"registry": "https://npm.pkg.github.com/"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "72ee370988fabd25720deff8861b5a2620da0b5a"
|
|
77
77
|
}
|