mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 10:22:55 +08:00
47 lines
836 B
TypeScript
47 lines
836 B
TypeScript
import { MenuContext } from '@blocksuite/affine-components/toolbar';
|
|
|
|
import type { CodeBlockComponent } from '../code-block';
|
|
|
|
export class CodeBlockToolbarContext extends MenuContext {
|
|
override close = () => {
|
|
this.abortController.abort();
|
|
};
|
|
|
|
get doc() {
|
|
return this.blockComponent.doc;
|
|
}
|
|
|
|
get host() {
|
|
return this.blockComponent.host;
|
|
}
|
|
|
|
get selectedBlockModels() {
|
|
if (this.blockComponent.model) return [this.blockComponent.model];
|
|
return [];
|
|
}
|
|
|
|
get std() {
|
|
return this.blockComponent.std;
|
|
}
|
|
|
|
constructor(
|
|
public blockComponent: CodeBlockComponent,
|
|
public abortController: AbortController,
|
|
public setActive: (active: boolean) => void
|
|
) {
|
|
super();
|
|
}
|
|
|
|
isEmpty() {
|
|
return false;
|
|
}
|
|
|
|
isMultiple() {
|
|
return false;
|
|
}
|
|
|
|
isSingle() {
|
|
return true;
|
|
}
|
|
}
|