@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.
Files changed (2) hide show
  1. package/deploy.js +11 -6
  2. 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 first (no clipboard needed)
421
+ // Try Monaco API
422
422
  const monacoOk = await page.evaluate(text => {
423
- if (window.monaco?.editor) {
424
- const models = window.monaco.editor.getModels();
425
- if (models?.length > 0) { models[0].setValue(text); return true; }
426
- }
427
- return false;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ubox-tools/deploy-xperience",
3
- "version": "1.1.20",
3
+ "version": "1.1.22",
4
4
  "description": "Deploy a Ubox experience to studio.ubox.world",
5
5
  "bin": { "deploy-xperience": "./deploy.js" },
6
6
  "dependencies": { "puppeteer": "*" },