@contentful/field-editor-shared 4.3.1-canary.0 → 4.4.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,6 +20,7 @@ _export(exports, {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
23
|
+
const _reactdom = require("react-dom");
|
|
23
24
|
const _client = require("react-dom/client");
|
|
24
25
|
const _f36components = require("@contentful/f36-components");
|
|
25
26
|
const _isNumber = /*#__PURE__*/ _interop_require_default(require("lodash/isNumber"));
|
|
@@ -69,6 +70,7 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
69
70
|
}
|
|
70
71
|
return newObj;
|
|
71
72
|
}
|
|
73
|
+
const CLOSE_DELAY = 300;
|
|
72
74
|
function open(componentRenderer) {
|
|
73
75
|
let rootDom = null;
|
|
74
76
|
let reactRoot = null;
|
|
@@ -87,18 +89,21 @@ function open(componentRenderer) {
|
|
|
87
89
|
isShown: true
|
|
88
90
|
};
|
|
89
91
|
function render({ onClose, isShown }) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
(0, _reactdom.flushSync)(()=>{
|
|
93
|
+
getRoot().render(componentRenderer({
|
|
94
|
+
onClose,
|
|
95
|
+
isShown
|
|
96
|
+
}));
|
|
97
|
+
});
|
|
94
98
|
}
|
|
95
|
-
function onClose(...args) {
|
|
99
|
+
async function onClose(...args) {
|
|
96
100
|
currentConfig = {
|
|
97
101
|
...currentConfig,
|
|
98
102
|
isShown: false
|
|
99
103
|
};
|
|
100
104
|
render(currentConfig);
|
|
101
105
|
resolve(...args);
|
|
106
|
+
await new Promise((r)=>setTimeout(r, CLOSE_DELAY));
|
|
102
107
|
reactRoot?.unmount();
|
|
103
108
|
rootDom?.remove();
|
|
104
109
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { flushSync } from 'react-dom';
|
|
2
3
|
import { createRoot } from 'react-dom/client';
|
|
3
4
|
import { Modal, ModalHeader } from '@contentful/f36-components';
|
|
4
5
|
import isNumber from 'lodash/isNumber';
|
|
6
|
+
const CLOSE_DELAY = 300;
|
|
5
7
|
export function open(componentRenderer) {
|
|
6
8
|
let rootDom = null;
|
|
7
9
|
let reactRoot = null;
|
|
@@ -20,18 +22,21 @@ export function open(componentRenderer) {
|
|
|
20
22
|
isShown: true
|
|
21
23
|
};
|
|
22
24
|
function render({ onClose, isShown }) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
flushSync(()=>{
|
|
26
|
+
getRoot().render(componentRenderer({
|
|
27
|
+
onClose,
|
|
28
|
+
isShown
|
|
29
|
+
}));
|
|
30
|
+
});
|
|
27
31
|
}
|
|
28
|
-
function onClose(...args) {
|
|
32
|
+
async function onClose(...args) {
|
|
29
33
|
currentConfig = {
|
|
30
34
|
...currentConfig,
|
|
31
35
|
isShown: false
|
|
32
36
|
};
|
|
33
37
|
render(currentConfig);
|
|
34
38
|
resolve(...args);
|
|
39
|
+
await new Promise((r)=>setTimeout(r, CLOSE_DELAY));
|
|
35
40
|
reactRoot?.unmount();
|
|
36
41
|
rootDom?.remove();
|
|
37
42
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-shared",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.0",
|
|
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.
|
|
46
|
+
"@contentful/field-editor-test-utils": "^3.1.0",
|
|
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": "b3a1d791df55536d6de78bb138b97224d6c0c70e"
|
|
77
77
|
}
|