mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 13:25:12 +00:00
Close [BS-2458](https://linear.app/affine-design/issue/BS-2458/toc-dnd重构) ### What Changes - Refactor toc note card dnd with `std.dnd` - Extract note display mode change to command `changeNoteDisplayMode` - It will reorder notes when the display mode changed from `EdgelessOnly` to page mode visible (a.k.a `DocOnly` or `Both`)
56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import { ShadowlessElement } from '@blocksuite/block-std';
|
|
import { WithDisposable } from '@blocksuite/global/utils';
|
|
import type { AffineEditorContainer } from '@blocksuite/presets';
|
|
import { css, html, nothing } from 'lit';
|
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
|
|
@customElement('custom-outline-panel')
|
|
export class CustomOutlinePanel extends WithDisposable(ShadowlessElement) {
|
|
static override styles = css`
|
|
.custom-outline-container {
|
|
position: absolute;
|
|
top: 0;
|
|
right: 16px;
|
|
border: 1px solid var(--affine-border-color, #e3e2e4);
|
|
background: var(--affine-background-overlay-panel-color);
|
|
height: 100vh;
|
|
width: 320px;
|
|
box-sizing: border-box;
|
|
z-index: 1;
|
|
}
|
|
`;
|
|
|
|
private _renderPanel() {
|
|
return html`<affine-outline-panel
|
|
.editor=${this.editor}
|
|
.fitPadding=${[50, 360, 50, 50]}
|
|
></affine-outline-panel>`;
|
|
}
|
|
|
|
override render() {
|
|
return html`
|
|
${this._show
|
|
? html`
|
|
<div class="custom-outline-container">${this._renderPanel()}</div>
|
|
`
|
|
: nothing}
|
|
`;
|
|
}
|
|
|
|
toggleDisplay() {
|
|
this._show = !this._show;
|
|
}
|
|
|
|
@state()
|
|
private accessor _show = false;
|
|
|
|
@property({ attribute: false })
|
|
accessor editor!: AffineEditorContainer;
|
|
}
|
|
|
|
declare global {
|
|
interface HTMLElementTagNameMap {
|
|
'custom-outline-panel': CustomOutlinePanel;
|
|
}
|
|
}
|