refactor(editor): unify directories naming (#11516)
**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`
This commit is contained in:
893 files changed
+439
-460
No files matched your search
@@ -0,0 +1,60 @@
|
||||
import type { MenuConfig } from '@blocksuite/affine-components/context-menu';
|
||||
import { createIdentifier } from '@blocksuite/global/di';
|
||||
import type { BlockComponent } from '@blocksuite/std';
|
||||
import type { GfxController, GfxToolsMap } from '@blocksuite/std/gfx';
|
||||
import type { ExtensionType } from '@blocksuite/store';
|
||||
import { type TemplateResult } from 'lit';
|
||||
|
||||
export interface QuickTool {
|
||||
type?: keyof GfxToolsMap;
|
||||
enable?: boolean;
|
||||
content: TemplateResult;
|
||||
/**
|
||||
* if not configured, the tool will not be shown in dense mode
|
||||
*/
|
||||
menu?: MenuConfig;
|
||||
}
|
||||
|
||||
export interface SeniorTool {
|
||||
/**
|
||||
* Used to show in nav-button's tooltip
|
||||
*/
|
||||
name: string;
|
||||
content: TemplateResult;
|
||||
enable?: boolean;
|
||||
}
|
||||
|
||||
export type ToolBuilder<T> = (options: {
|
||||
block: BlockComponent;
|
||||
gfx: GfxController;
|
||||
toolbarContainer: HTMLElement;
|
||||
}) => T;
|
||||
|
||||
export const QuickToolIdentifier = createIdentifier<ToolBuilder<QuickTool>>(
|
||||
'edgeless-quick-tool'
|
||||
);
|
||||
export const SeniorToolIdentifier = createIdentifier<ToolBuilder<SeniorTool>>(
|
||||
'edgeless-senior-tool'
|
||||
);
|
||||
|
||||
export const QuickToolExtension = (
|
||||
id: string,
|
||||
builder: ToolBuilder<QuickTool>
|
||||
): ExtensionType => {
|
||||
return {
|
||||
setup: di => {
|
||||
di.addImpl(QuickToolIdentifier(id), () => builder);
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const SeniorToolExtension = (
|
||||
id: string,
|
||||
builder: ToolBuilder<SeniorTool>
|
||||
): ExtensionType => {
|
||||
return {
|
||||
setup: di => {
|
||||
di.addImpl(SeniorToolIdentifier(id), () => builder);
|
||||
},
|
||||
};
|
||||
};
|
||||
Reference in new issue
Block a user