There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
import { Text, type Workspace } from '@blocksuite/affine/store';
import type { InitFn } from './utils.js';
export const empty: InitFn = (collection: Workspace, id: string) => {
const doc = collection.getDoc(id) ?? collection.createDoc(id);
const store = doc.getStore();
doc.clear();
doc.load(() => {
// Add root block and surface block at root level
const rootId = store.addBlock('affine:page', {
title: new Text(),
});
store.addBlock('affine:surface', {}, rootId);
// Add note block inside root block
const noteId = store.addBlock('affine:note', {}, rootId);
// Add paragraph block inside note block
store.addBlock('affine:paragraph', {}, noteId);
});
doc.resetHistory();
};
empty.id = 'empty';
empty.displayName = 'Empty Editor';
empty.description = 'Start from empty editor';