@ubox-tools/deploy-xperience 1.1.18 → 1.1.19
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 +10 -2
- package/package.json +1 -1
package/deploy.js
CHANGED
|
@@ -429,7 +429,7 @@ async function injectToEditor(page, content) {
|
|
|
429
429
|
}
|
|
430
430
|
return false;
|
|
431
431
|
}, content);
|
|
432
|
-
if (monacoOk) return;
|
|
432
|
+
if (monacoOk) { console.log(' [editor] Monaco'); return; }
|
|
433
433
|
|
|
434
434
|
// Try CodeMirror API
|
|
435
435
|
const cmOk = await page.evaluate(text => {
|
|
@@ -437,9 +437,10 @@ async function injectToEditor(page, content) {
|
|
|
437
437
|
if (cm?.CodeMirror) { cm.CodeMirror.setValue(text); return true; }
|
|
438
438
|
return false;
|
|
439
439
|
}, content);
|
|
440
|
-
if (cmOk) return;
|
|
440
|
+
if (cmOk) { console.log(' [editor] CodeMirror'); return; }
|
|
441
441
|
|
|
442
442
|
// Fallback: clipboard paste into Ace / generic textarea
|
|
443
|
+
console.log(' [editor] clipboard');
|
|
443
444
|
writeClipboard(content);
|
|
444
445
|
const ed = await page.$('.ace_editor, .cm-editor, .monaco-editor, textarea');
|
|
445
446
|
if (!ed) throw new Error('No code editor found on page');
|
|
@@ -667,6 +668,13 @@ async function injectSource(page, proxy) {
|
|
|
667
668
|
|
|
668
669
|
await clickByText(page, 'Edit source');
|
|
669
670
|
await sleep(3000);
|
|
671
|
+
// Wait for the editor (Monaco or CodeMirror) to fully initialize.
|
|
672
|
+
// On first-ever source editor visit in a session, Monaco may still be loading
|
|
673
|
+
// after 3 s — this ensures injection happens only once it's ready.
|
|
674
|
+
await page.waitForFunction(() => {
|
|
675
|
+
return !!(window.monaco?.editor?.getModels) ||
|
|
676
|
+
!!(document.querySelector('.CodeMirror')?.CodeMirror);
|
|
677
|
+
}, { timeout: 15000 }).catch(() => null);
|
|
670
678
|
console.log(` [source] URL after Edit source: ${page.url()}`);
|
|
671
679
|
|
|
672
680
|
// Tab label → filename
|
package/package.json
CHANGED