fix: attachShadow guard, null toggleMemoryBtn, register canvas components
- Add if (!this.shadowRoot) guard in history panel and space settings connectedCallback to prevent error on element reconnection - Null-check toggleMemoryBtn before addEventListener since #toggle-memory element was removed - Import and register RStackSpaceSettings + RStackHistoryPanel in canvas.html so settings gear and history panel work on canvas page Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
e9eb56aa2e
commit
5842bd9f9a
|
|
@ -52,7 +52,7 @@ export class RStackHistoryPanel extends HTMLElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
this.attachShadow({ mode: "open" });
|
if (!this.shadowRoot) this.attachShadow({ mode: "open" });
|
||||||
this._render();
|
this._render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ export class RStackSpaceSettings extends HTMLElement {
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
this._space = this.getAttribute("space") || "";
|
this._space = this.getAttribute("space") || "";
|
||||||
this.attachShadow({ mode: "open" });
|
if (!this.shadowRoot) this.attachShadow({ mode: "open" });
|
||||||
this._render();
|
this._render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2218,6 +2218,8 @@
|
||||||
import { RStackSpaceSwitcher } from "@shared/components/rstack-space-switcher";
|
import { RStackSpaceSwitcher } from "@shared/components/rstack-space-switcher";
|
||||||
import { RStackTabBar } from "@shared/components/rstack-tab-bar";
|
import { RStackTabBar } from "@shared/components/rstack-tab-bar";
|
||||||
import { RStackMi } from "@shared/components/rstack-mi";
|
import { RStackMi } from "@shared/components/rstack-mi";
|
||||||
|
import { RStackSpaceSettings } from "@shared/components/rstack-space-settings";
|
||||||
|
import { RStackHistoryPanel } from "@shared/components/rstack-history-panel";
|
||||||
import { rspaceNavUrl } from "@shared/url-helpers";
|
import { rspaceNavUrl } from "@shared/url-helpers";
|
||||||
|
|
||||||
// Expose URL helper globally (matches shell.js)
|
// Expose URL helper globally (matches shell.js)
|
||||||
|
|
@ -2229,6 +2231,8 @@
|
||||||
RStackSpaceSwitcher.define();
|
RStackSpaceSwitcher.define();
|
||||||
RStackTabBar.define();
|
RStackTabBar.define();
|
||||||
RStackMi.define();
|
RStackMi.define();
|
||||||
|
RStackSpaceSettings.define();
|
||||||
|
RStackHistoryPanel.define();
|
||||||
|
|
||||||
// Reload space list when user signs in/out
|
// Reload space list when user signs in/out
|
||||||
document.addEventListener("auth-change", () => {
|
document.addEventListener("auth-change", () => {
|
||||||
|
|
@ -4907,11 +4911,13 @@
|
||||||
return d.innerHTML;
|
return d.innerHTML;
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleMemoryBtn.addEventListener("click", () => {
|
if (toggleMemoryBtn) {
|
||||||
const isOpen = memoryPanel.classList.toggle("open");
|
toggleMemoryBtn.addEventListener("click", () => {
|
||||||
toggleMemoryBtn.classList.toggle("active", isOpen);
|
const isOpen = memoryPanel.classList.toggle("open");
|
||||||
if (isOpen) renderMemoryPanel();
|
toggleMemoryBtn.classList.toggle("active", isOpen);
|
||||||
});
|
if (isOpen) renderMemoryPanel();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Hide Forgotten toggle — hides all forgotten shapes from the canvas
|
// Hide Forgotten toggle — hides all forgotten shapes from the canvas
|
||||||
// Injected into rstack-identity dropdown under theme toggle
|
// Injected into rstack-identity dropdown under theme toggle
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue