This commit is contained in:
2025-07-14 18:14:40 +00:00
parent 01dad7cc5e
commit 5e25f86a0b
2 changed files with 25 additions and 9 deletions

View File

@@ -260,14 +260,26 @@ export class SioFab extends DeesElement {
public async firstUpdated(args: any) { public async firstUpdated(args: any) {
super.firstUpdated(args); super.firstUpdated(args);
const domtools = await this.domtoolsPromise; const domtools = await this.domtoolsPromise;
const sioCombox: SioCombox = this.shadowRoot.querySelector('sio-combox');
const mainBox: HTMLElement = this.shadowRoot.querySelector('#mainbox');
sioCombox.referenceObject = mainBox;
// Set up keyboard shortcut
domtools.keyboard domtools.keyboard
.on([domtools.keyboard.keyEnum.Ctrl, domtools.keyboard.keyEnum.S]) .on([domtools.keyboard.keyEnum.Ctrl, domtools.keyboard.keyEnum.S])
.subscribe(() => { .subscribe(() => {
this.toggleCombox(); this.toggleCombox();
}); });
} }
public async updated(changedProperties: Map<string | number | symbol, unknown>) {
await super.updated(changedProperties);
// Set reference object when combox is rendered
if ((changedProperties.has('showCombox') || changedProperties.has('hasShownOnce')) &&
(this.showCombox || this.hasShownOnce)) {
const sioCombox: SioCombox = this.shadowRoot.querySelector('sio-combox');
const mainBox: HTMLElement = this.shadowRoot.querySelector('#mainbox');
if (sioCombox && mainBox && !sioCombox.referenceObject) {
sioCombox.referenceObject = mainBox;
}
}
}
} }

View File

@@ -393,7 +393,15 @@ export class SioPdfViewer extends DeesElement {
public async connectedCallback() { public async connectedCallback() {
await super.connectedCallback(); await super.connectedCallback();
// Set up resize observer for responsive rendering if (this.url) {
await this.loadPdf();
}
}
protected async firstUpdated() {
await super.firstUpdated();
// Set up resize observer for responsive rendering after first render
const container = this.shadowRoot?.querySelector('.pdf-container'); const container = this.shadowRoot?.querySelector('.pdf-container');
if (container) { if (container) {
this.resizeObserver = new ResizeObserver(() => { this.resizeObserver = new ResizeObserver(() => {
@@ -403,10 +411,6 @@ export class SioPdfViewer extends DeesElement {
}); });
this.resizeObserver.observe(container); this.resizeObserver.observe(container);
} }
if (this.url) {
await this.loadPdf();
}
} }
public async updated(changedProperties: Map<string | number | symbol, unknown>) { public async updated(changedProperties: Map<string | number | symbol, unknown>) {