@ubox-tools/deploy-xperience 1.1.20 → 1.1.22
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/deploy.js +11 -6
- package/package.json +1 -1
package/deploy.js
CHANGED
|
@@ -418,13 +418,18 @@ async function uploadFile(page, absPath) {
|
|
|
418
418
|
|
|
419
419
|
/** Inject text content into the active Monaco/CodeMirror/Ace editor. */
|
|
420
420
|
async function injectToEditor(page, content) {
|
|
421
|
-
// Try Monaco API
|
|
421
|
+
// Try Monaco API
|
|
422
422
|
const monacoOk = await page.evaluate(text => {
|
|
423
|
-
if (window.monaco?.editor)
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
423
|
+
if (!window.monaco?.editor) return false;
|
|
424
|
+
const models = window.monaco.editor.getModels();
|
|
425
|
+
if (!models?.length) return false;
|
|
426
|
+
// Use the LAST model, not the first. When the Parameters tab is visited before
|
|
427
|
+
// the source editor, Monaco pre-loads a read-only preview model (model/1) first.
|
|
428
|
+
// The actual edit model (model/4) is created later and sits at the end of the
|
|
429
|
+
// list. For apps with no parameters (lazy-load), there is only one model, so
|
|
430
|
+
// last === first and behaviour is unchanged.
|
|
431
|
+
models[models.length - 1].setValue(text);
|
|
432
|
+
return true;
|
|
428
433
|
}, content);
|
|
429
434
|
if (monacoOk) return;
|
|
430
435
|
|
package/package.json
CHANGED