@lvce-editor/renderer-process 21.10.0 → 21.12.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/rendererProcessMain.js +34 -9
- package/package.json +1 -1
|
@@ -116,8 +116,8 @@ const execCopy = async () => {
|
|
|
116
116
|
await writeText(text);
|
|
117
117
|
};
|
|
118
118
|
|
|
119
|
-
const
|
|
120
|
-
return confirm(message);
|
|
119
|
+
const confirm = message => {
|
|
120
|
+
return window.confirm(message);
|
|
121
121
|
};
|
|
122
122
|
|
|
123
123
|
const state$9 = {
|
|
@@ -660,6 +660,9 @@ const renderDomElement = (element, eventMap, newEventMap) => {
|
|
|
660
660
|
};
|
|
661
661
|
const renderReferenceNode = element => {
|
|
662
662
|
const instance = get$1$1(element.uid);
|
|
663
|
+
if (!instance || !instance.state) {
|
|
664
|
+
return document.createTextNode('Reference node not found');
|
|
665
|
+
}
|
|
663
666
|
const $Node = instance.state.$Viewlet;
|
|
664
667
|
return $Node;
|
|
665
668
|
};
|
|
@@ -9208,13 +9211,35 @@ const setPatches = (uid, patches) => {
|
|
|
9208
9211
|
}
|
|
9209
9212
|
applyPatch($Viewlet, patches, {}, uid);
|
|
9210
9213
|
};
|
|
9211
|
-
const
|
|
9214
|
+
const waitForElement = selector => {
|
|
9215
|
+
const element = document.querySelector(selector);
|
|
9216
|
+
if (element) {
|
|
9217
|
+
return Promise.resolve(element);
|
|
9218
|
+
}
|
|
9219
|
+
const {
|
|
9220
|
+
promise,
|
|
9221
|
+
resolve
|
|
9222
|
+
} = withResolvers();
|
|
9223
|
+
const observer = new MutationObserver(() => {
|
|
9224
|
+
const element = document.querySelector(selector);
|
|
9225
|
+
if (element) {
|
|
9226
|
+
observer.disconnect();
|
|
9227
|
+
resolve(element);
|
|
9228
|
+
}
|
|
9229
|
+
});
|
|
9230
|
+
observer.observe(document.body, {
|
|
9231
|
+
childList: true,
|
|
9232
|
+
subtree: true
|
|
9233
|
+
});
|
|
9234
|
+
return promise;
|
|
9235
|
+
};
|
|
9236
|
+
const move = async (uid, selector, target) => {
|
|
9212
9237
|
const $Source = document.querySelector(selector);
|
|
9213
|
-
|
|
9214
|
-
|
|
9215
|
-
|
|
9216
|
-
|
|
9217
|
-
|
|
9238
|
+
if (!$Source) {
|
|
9239
|
+
throw new Error(`Source element not found: ${selector}`);
|
|
9240
|
+
}
|
|
9241
|
+
const $Target = await waitForElement(target);
|
|
9242
|
+
$Target.append($Source);
|
|
9218
9243
|
};
|
|
9219
9244
|
|
|
9220
9245
|
// TODO this code is bad
|
|
@@ -9788,7 +9813,7 @@ const commandMap = {
|
|
|
9788
9813
|
'ClipBoard.write': write$1,
|
|
9789
9814
|
'ClipBoard.writeImage': writeImage,
|
|
9790
9815
|
'ClipBoard.writeText': writeText,
|
|
9791
|
-
'ConfirmPrompt.prompt':
|
|
9816
|
+
'ConfirmPrompt.prompt': confirm,
|
|
9792
9817
|
'Css.addCssStyleSheet': addCssStyleSheet,
|
|
9793
9818
|
'Css.getSelectionText': getSelectionText,
|
|
9794
9819
|
'Developer.showState': showState,
|