pinokiod 3.203.0 → 3.205.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/package.json +1 -1
- package/server/public/nav.js +57 -6
package/package.json
CHANGED
package/server/public/nav.js
CHANGED
|
@@ -484,16 +484,67 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
|
484
484
|
|
|
485
485
|
try {
|
|
486
486
|
const frameElement = window.frameElement || null;
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
487
|
+
const hostNodeId = frameElement?.dataset?.nodeId || null;
|
|
488
|
+
|
|
489
|
+
let targetFrame = null;
|
|
490
|
+
try {
|
|
491
|
+
targetFrame =
|
|
492
|
+
document.querySelector('.appcanvas iframe.selected') ||
|
|
493
|
+
document.querySelector('.appcanvas iframe:not(.hidden)');
|
|
494
|
+
} catch (_) {
|
|
495
|
+
targetFrame = null;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
const frameUrl = (() => {
|
|
499
|
+
if (!targetFrame) return window.location.href;
|
|
500
|
+
const attr = targetFrame.getAttribute('src');
|
|
501
|
+
if (attr && attr.trim()) return attr.trim();
|
|
502
|
+
try {
|
|
503
|
+
if (targetFrame.src && targetFrame.src.trim()) {
|
|
504
|
+
return targetFrame.src.trim();
|
|
505
|
+
}
|
|
506
|
+
} catch (_) {}
|
|
507
|
+
return window.location.href;
|
|
508
|
+
})();
|
|
509
|
+
|
|
510
|
+
const frameName = (() => {
|
|
511
|
+
if (targetFrame && targetFrame.name && targetFrame.name.trim()) {
|
|
512
|
+
return targetFrame.name.trim();
|
|
513
|
+
}
|
|
514
|
+
if (typeof window.name === 'string' && window.name.trim()) {
|
|
515
|
+
return window.name.trim();
|
|
516
|
+
}
|
|
517
|
+
return null;
|
|
518
|
+
})();
|
|
519
|
+
|
|
520
|
+
const frameNodeId =
|
|
521
|
+
(targetFrame?.dataset?.nodeId && targetFrame.dataset.nodeId.trim()) ||
|
|
522
|
+
(hostNodeId && hostNodeId.trim()) ||
|
|
523
|
+
null;
|
|
524
|
+
|
|
525
|
+
window.top?.postMessage(
|
|
526
|
+
{
|
|
527
|
+
e: 'pinokio-start-inspector',
|
|
528
|
+
frameUrl,
|
|
529
|
+
frameName,
|
|
530
|
+
frameNodeId,
|
|
531
|
+
},
|
|
532
|
+
'*'
|
|
533
|
+
);
|
|
493
534
|
} catch (err) {
|
|
494
535
|
console.warn('[PinokioInspector] postMessage failed', err);
|
|
495
536
|
}
|
|
496
537
|
}, true);
|
|
538
|
+
window.addEventListener('message', (event) => {
|
|
539
|
+
if (!event || event.source === window || !event.data || !event.data.pinokioInspector) {
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
try {
|
|
543
|
+
window.top?.postMessage(event.data, '*');
|
|
544
|
+
} catch (err) {
|
|
545
|
+
console.warn('[PinokioInspector] relay failed', err);
|
|
546
|
+
}
|
|
547
|
+
});
|
|
497
548
|
}
|
|
498
549
|
|
|
499
550
|
|