refactor(editor): render presentation toolbar on demand (#9442)

This commit is contained in:
doodlewind
2024-12-31 02:01:35 +00:00
parent 79e006467c
commit 2b47625deb
2 changed files with 13 additions and 15 deletions

View File

@@ -657,17 +657,18 @@ export class EdgelessToolbarWidget extends WidgetComponent<
@mousedown=${stopPropagation}
@pointerdown=${stopPropagation}
>
<presentation-toolbar
.visible=${this.isPresentMode}
.edgeless=${this.block}
.settingMenuShow=${this.presentSettingMenuShow}
.frameMenuShow=${this.presentFrameMenuShow}
.setSettingMenuShow=${(show: boolean) =>
(this.presentSettingMenuShow = show)}
.setFrameMenuShow=${(show: boolean) =>
(this.presentFrameMenuShow = show)}
.containerWidth=${this.containerWidth}
></presentation-toolbar>
${this.isPresentMode
? html`<presentation-toolbar
.edgeless=${this.block}
.settingMenuShow=${this.presentSettingMenuShow}
.frameMenuShow=${this.presentFrameMenuShow}
.setSettingMenuShow=${(show: boolean) =>
(this.presentSettingMenuShow = show)}
.setFrameMenuShow=${(show: boolean) =>
(this.presentFrameMenuShow = show)}
.containerWidth=${this.containerWidth}
></presentation-toolbar>`
: nothing}
${this.isPresentMode ? nothing : this._renderContent()}
</div>
</smooth-corner>

View File

@@ -322,7 +322,7 @@ export class PresentationToolbar extends EdgelessToolbarToolMixin(
return html`
<style>
:host {
display: ${this.visible ? 'flex' : 'none'};
display: flex;
}
</style>
<edgeless-tool-icon-button
@@ -442,9 +442,6 @@ export class PresentationToolbar extends EdgelessToolbarToolMixin(
@property({ type: Boolean })
accessor settingMenuShow = false;
@property({ attribute: true, type: Boolean })
accessor visible = true;
}
declare global {