Skip to content

Commit cabfd29

Browse files
committed
Better notification to extensions for isVisible
Add notification to extension: isConnected to track WS status and inform extensions Bump version
1 parent 0b0116f commit cabfd29

File tree

11 files changed

+25
-7
lines changed

11 files changed

+25
-7
lines changed

dist/CNC/GRBL/index.html.gz

450 Bytes
Binary file not shown.

dist/CNC/GRBLHal/index.html.gz

484 Bytes
Binary file not shown.

dist/Plotter/HP-GL/index.html.gz

461 Bytes
Binary file not shown.
309 Bytes
Binary file not shown.
305 Bytes
Binary file not shown.
348 Bytes
Binary file not shown.
350 Bytes
Binary file not shown.

dist/SandTable/GRBL/index.html.gz

449 Bytes
Binary file not shown.

src/components/App/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818
import { h } from "preact"
1919
import { webUIbuild } from "../../targets"
20-
export const webUIversion = "3.0.0-a78"
20+
export const webUIversion = "3.0.0-a79"
2121
export const Esp3dVersion = () => (
2222
<span>
2323
{webUIversion}.{webUIbuild}

src/components/ExtraContent/extraContentItem.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
import { Fragment, h } from "preact"
2121
import { useState, useEffect, useCallback, useRef, useMemo } from "preact/hooks"
22-
import { espHttpURL } from "../Helpers"
22+
import { espHttpURL, dispatchToExtensions } from "../Helpers"
2323
import { useHttpFn } from "../../hooks"
2424
import { ButtonImg, ContainerHelper } from "../Controls"
2525
import { T } from "../Translations"
@@ -47,15 +47,23 @@ const ExtraContentItem = ({
4747
const { createNewRequest } = useHttpFn
4848
const element_id = id.replace("extra_content_", type)
4949
const refreshIntervalRef = useRef(null)
50-
console.log(`Rendering ExtraContentItem ${id} at ${Date.now()}`);
50+
//console.log(`Rendering ExtraContentItem ${id} at ${Date.now()}`);
5151
if (visibilityState[id] === undefined) {
52-
visibilityState[id] = target=="panel" ? isVisibleOnStart : true;
52+
visibilityState[id] = false;
53+
if (type=="extension" && isLoadedState[id]){
54+
const iframeElement = element.querySelector('iframe.extensionContainer');
55+
if (iframeElement){
56+
iframeElement.contentWindow.postMessage(
57+
{ type: "notification", content: {isVisible: msg.isVisible}, id },
58+
"*"
59+
)
60+
}
61+
}
5362
}
5463
if (isLoadedState[id] === undefined) {
5564
isLoadedState[id] = false;
5665
}
5766

58-
5967
const handleContentSuccess = useCallback((result) => {
6068
let blob
6169
switch (type) {
@@ -133,7 +141,6 @@ const ExtraContentItem = ({
133141
loadContent()
134142
}
135143
if ('isVisible' in msg) {
136-
137144
if (element) {
138145
//console.log("Updating visibility for element " + id + " to " + msg.isVisible)
139146
element.style.display = msg.isVisible ? 'block' : 'none';
@@ -220,6 +227,12 @@ const ExtraContentItem = ({
220227
css.forEach((csstag) => {
221228
doc.head.appendChild(csstag.cloneNode(true))
222229
})
230+
if (iframeElement){
231+
iframeElement.contentWindow.postMessage(
232+
{ type: "notification", content: {isConnected: true, isVisible: visibilityState[id]}, id },
233+
"*"
234+
)
235+
}
223236
}
224237
}
225238

0 commit comments

Comments
 (0)