mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-11 23:26:30 +08:00
c010e05023
* Fix/venus spanish (#423) fix: update venus spanish language Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com> * fix: can not convert url text to link after paste * fix: double link icon size error * feat(code): enhance markdown parse code * fix(code): add robust * fix: remove special menu * chore: clean code * fix: ime with command menu * fix(code): langs[lang] is not a function * fix: can't add image and delete more action button (#430) * feat: add zh_Hant for venus (#431) * fix: lang select in code block is insanity * GitHub Doc Updates (#421) * Update types-of-contributions.md * Update README.md Tidy up links section * fix: inline menu position (#433) Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com> Co-authored-by: QiShaoXuan <qishaoxuan777@gmail.com> Co-authored-by: tzhangchi <terry.zhangchi@outlook.com> Co-authored-by: lawvs <18554747+lawvs@users.noreply.github.com> Co-authored-by: DiamondThree <diamond.shx@gmail.com> Co-authored-by: CJSS <CJSS@users.noreply.github.com> Co-authored-by: Qi <474021214@qq.com>
69 lines
2.3 KiB
TypeScript
69 lines
2.3 KiB
TypeScript
import {
|
|
BulletBlock,
|
|
CalloutBlock,
|
|
CodeBlock,
|
|
DividerBlock,
|
|
EmbedLinkBlock,
|
|
FigmaBlock,
|
|
// TocBlock,
|
|
FileBlock,
|
|
GridBlock,
|
|
GridItemBlock,
|
|
GroupBlock,
|
|
GroupDividerBlock,
|
|
Heading1Block,
|
|
Heading2Block,
|
|
Heading3Block,
|
|
ImageBlock,
|
|
NumberedBlock,
|
|
PageBlock,
|
|
QuoteBlock,
|
|
RefLinkBlock,
|
|
TextBlock,
|
|
TodoBlock,
|
|
YoutubeBlock,
|
|
} from '@toeverything/components/editor-blocks';
|
|
import { plugins } from '@toeverything/components/editor-plugins';
|
|
import { Protocol } from '@toeverything/datasource/db-service';
|
|
import { BlockEditor } from '@toeverything/framework/virgo';
|
|
|
|
export const createEditor = (
|
|
workspace: string,
|
|
rootBlockId: string,
|
|
isEdgeless?: boolean
|
|
) => {
|
|
const blockEditor = new BlockEditor({
|
|
workspace,
|
|
rootBlockId,
|
|
views: {
|
|
[Protocol.Block.Type.page]: new PageBlock(),
|
|
[Protocol.Block.Type.reference]: new RefLinkBlock(),
|
|
[Protocol.Block.Type.code]: new CodeBlock(),
|
|
[Protocol.Block.Type.text]: new TextBlock(),
|
|
[Protocol.Block.Type.heading1]: new Heading1Block(),
|
|
[Protocol.Block.Type.heading2]: new Heading2Block(),
|
|
[Protocol.Block.Type.heading3]: new Heading3Block(),
|
|
[Protocol.Block.Type.quote]: new QuoteBlock(),
|
|
[Protocol.Block.Type.todo]: new TodoBlock(),
|
|
// [Protocol.Block.Type.toc]: new TocBlock(),
|
|
[Protocol.Block.Type.file]: new FileBlock(),
|
|
[Protocol.Block.Type.image]: new ImageBlock(),
|
|
[Protocol.Block.Type.divider]: new DividerBlock(),
|
|
[Protocol.Block.Type.callout]: new CalloutBlock(),
|
|
[Protocol.Block.Type.youtube]: new YoutubeBlock(),
|
|
[Protocol.Block.Type.figma]: new FigmaBlock(),
|
|
[Protocol.Block.Type.group]: new GroupBlock(),
|
|
[Protocol.Block.Type.embedLink]: new EmbedLinkBlock(),
|
|
[Protocol.Block.Type.numbered]: new NumberedBlock(),
|
|
[Protocol.Block.Type.bullet]: new BulletBlock(),
|
|
[Protocol.Block.Type.grid]: new GridBlock(),
|
|
[Protocol.Block.Type.gridItem]: new GridItemBlock(),
|
|
[Protocol.Block.Type.groupDivider]: new GroupDividerBlock(),
|
|
},
|
|
plugins,
|
|
isEdgeless,
|
|
});
|
|
|
|
return blockEditor;
|
|
};
|