mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 20:38:52 +00:00
34 lines
758 B
TypeScript
34 lines
758 B
TypeScript
import { createIdentifier, type ServiceProvider } from '@blocksuite/global/di';
|
|
import type {
|
|
BaseAdapter,
|
|
ExtensionType,
|
|
Transformer,
|
|
} from '@blocksuite/store';
|
|
|
|
type AdapterConstructor = new (
|
|
job: Transformer,
|
|
provider: ServiceProvider
|
|
) => BaseAdapter;
|
|
|
|
export interface ClipboardAdapterConfig {
|
|
mimeType: string;
|
|
priority: number;
|
|
adapter: AdapterConstructor;
|
|
}
|
|
|
|
export const ClipboardAdapterConfigIdentifier =
|
|
createIdentifier<ClipboardAdapterConfig>('clipboard-adapter-config');
|
|
|
|
export function ClipboardAdapterConfigExtension(
|
|
config: ClipboardAdapterConfig
|
|
): ExtensionType {
|
|
return {
|
|
setup: di => {
|
|
di.addImpl(
|
|
ClipboardAdapterConfigIdentifier(config.mimeType),
|
|
() => config
|
|
);
|
|
},
|
|
};
|
|
}
|