pinokiod 3.203.0 → 3.204.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.203.0",
3
+ "version": "3.204.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -484,12 +484,53 @@ document.addEventListener("DOMContentLoaded", () => {
484
484
 
485
485
  try {
486
486
  const frameElement = window.frameElement || null;
487
- window.top?.postMessage({
488
- e: 'pinokio-start-inspector',
489
- frameUrl: window.location.href,
490
- frameName: window.name || null,
491
- frameNodeId: frameElement?.dataset?.nodeId || null,
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
  }