fix: copilot not working (#3425)

This commit is contained in:
Alex Yang
2023-07-27 17:28:21 -07:00
committed by GitHub
parent aa69a7cad2
commit f9929ebd61
11 changed files with 165 additions and 181 deletions

View File

@@ -16,6 +16,12 @@ export const headerItemsAtom = atom<Record<string, CallbackMap['headerItem']>>(
export const editorItemsAtom = atom<Record<string, CallbackMap['editor']>>({});
export const registeredPluginAtom = atom<string[]>([]);
export const windowItemsAtom = atom<Record<string, CallbackMap['window']>>({});
export const settingItemsAtom = atom<Record<string, CallbackMap['setting']>>(
{}
);
export const formatBarItemsAtom = atom<
Record<string, CallbackMap['formatBar']>
>({});
export const currentWorkspaceIdAtom = atom<string | null>(null);
export const currentPageIdAtom = atom<string | null>(null);

View File

@@ -1,12 +1,20 @@
import type { getCurrentBlockRange } from '@blocksuite/blocks';
import type { EditorContainer } from '@blocksuite/editor';
import type { Page } from '@blocksuite/store';
import type { FC } from 'react';
export type Part = 'headerItem' | 'editor' | 'window';
export type Part = 'headerItem' | 'editor' | 'window' | 'setting' | 'formatBar';
export type CallbackMap = {
headerItem: (root: HTMLElement) => () => void;
window: (root: HTMLElement) => () => void;
editor: (root: HTMLElement, editor: EditorContainer) => () => void;
setting: (root: HTMLElement) => () => void;
formatBar: (
root: HTMLElement,
page: Page,
getBlockRange: () => ReturnType<typeof getCurrentBlockRange>
) => () => void;
};
export interface PluginContext {