fix
This commit is contained in:
parent
af78d0459b
commit
073a8cc557
|
|
@ -20,10 +20,12 @@ import { EdPopScript } from "./panel/popup/script/pop-script";
|
|||
import { EdPopSite } from "./panel/popup/site/site-popup";
|
||||
import { iconVSCode } from "./panel/popup/code/icons";
|
||||
import { isLocalhost } from "../../utils/ui/is-localhost";
|
||||
import { w } from "../../utils/types/general";
|
||||
|
||||
export const EdBase = () => {
|
||||
const p = useGlobal(EDGlobal, "EDITOR");
|
||||
|
||||
w.editorRender = p.render;
|
||||
edUndoManager(p);
|
||||
|
||||
if (p.status === "init") {
|
||||
|
|
@ -135,6 +137,26 @@ export const EdBase = () => {
|
|||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{w.offline && <div
|
||||
className={cx(
|
||||
css`
|
||||
position: fixed;
|
||||
bottom: 20px;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
z-index: 999;
|
||||
`,
|
||||
"flex justify-center cursor-pointer"
|
||||
)}
|
||||
>
|
||||
<div
|
||||
className="bg-red-500 text-white px-4 py-2 rounded-full text-sm"
|
||||
>
|
||||
Reconnecting, changes are not saved...
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -166,11 +166,17 @@ const connect = (
|
|||
);
|
||||
|
||||
ws.onopen = () => {
|
||||
w.offline = false;
|
||||
w.editorRender?.();
|
||||
|
||||
sendWs(ws, { type: SyncType.UserID, user_id, site_id, page_id });
|
||||
conf.ws = ws;
|
||||
event.opened();
|
||||
};
|
||||
ws.onclose = async () => {
|
||||
w.offline = true;
|
||||
w.editorRender?.();
|
||||
|
||||
const res = event.disconnected();
|
||||
if (res.reconnect) {
|
||||
setTimeout(async () => {
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ export const w = window as unknown as {
|
|||
_api: any;
|
||||
_db: any;
|
||||
offline: boolean;
|
||||
editorRender?: () => void;
|
||||
debug: {
|
||||
on: any;
|
||||
off: any;
|
||||
|
|
|
|||
Loading…
Reference in New Issue