mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-23 21:06:22 +08:00
1f45cc5dec
**Directory Structure Changes** - Renamed multiple block-related directories by removing the "block-" prefix: - `block-attachment` → `attachment` - `block-bookmark` → `bookmark` - `block-callout` → `callout` - `block-code` → `code` - `block-data-view` → `data-view` - `block-database` → `database` - `block-divider` → `divider` - `block-edgeless-text` → `edgeless-text` - `block-embed` → `embed`
49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import { QuickToolMixin } from '@blocksuite/affine-widget-edgeless-toolbar';
|
|
import { FrameIcon } from '@blocksuite/icons/lit';
|
|
import type { GfxToolsFullOptionValue } from '@blocksuite/std/gfx';
|
|
import { css, html, LitElement } from 'lit';
|
|
|
|
export class EdgelessFrameToolButton extends QuickToolMixin(LitElement) {
|
|
static override styles = css`
|
|
:host {
|
|
display: flex;
|
|
}
|
|
`;
|
|
|
|
override type: GfxToolsFullOptionValue['type'] = 'frame';
|
|
|
|
private _toggleFrameMenu() {
|
|
if (this.tryDisposePopper()) return;
|
|
|
|
const menu = this.createPopper('edgeless-frame-menu', this);
|
|
menu.element.edgeless = this.edgeless;
|
|
}
|
|
|
|
override render() {
|
|
const type = this.edgelessTool?.type;
|
|
return html`
|
|
<edgeless-tool-icon-button
|
|
class="edgeless-frame-button"
|
|
.tooltip=${this.popper
|
|
? ''
|
|
: html`<affine-tooltip-content-with-shortcut
|
|
data-tip="${'Frame'}"
|
|
data-shortcut="${'F'}"
|
|
></affine-tooltip-content-with-shortcut>`}
|
|
.tooltipOffset=${17}
|
|
.iconSize=${'24px'}
|
|
.active=${type === 'frame'}
|
|
.iconContainerPadding=${6}
|
|
@click=${() => {
|
|
// don't update tool before toggling menu
|
|
this._toggleFrameMenu();
|
|
this.setEdgelessTool({ type: 'frame' });
|
|
}}
|
|
>
|
|
${FrameIcon()}
|
|
<toolbar-arrow-up-icon></toolbar-arrow-up-icon>
|
|
</edgeless-tool-icon-button>
|
|
`;
|
|
}
|
|
}
|