Skip to content

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.

fix: check error

lawvs67238b8da8dd
diff --git a/libs/components/editor-plugins/src/placeholder/PlaceholderPanel.tsx b/libs/components/editor-plugins/src/placeholder/PlaceholderPanel.tsx
index 429336c976..89b66256f7 100644
--- a/libs/components/editor-plugins/src/placeholder/PlaceholderPanel.tsx
+++ b/libs/components/editor-plugins/src/placeholder/PlaceholderPanel.tsx
@@ -141,8 +141,7 @@ export const PlaceholderPanel = (props: PlaceholderPanelProps) => {
setOpen(false);
props.onClickTips();
};
- const templateList: Array<TemplateMeta> =
- TemplateFactory.defaultTemplateList;
+ const templateList = TemplateFactory.defaultTemplateList;
const handleNewFromTemplate = async (template: TemplateMeta) => {
const pageId = await editor.getRootBlockId();
const newPage = await services.api.editorBlock.getBlock(
@@ -162,33 +161,30 @@ export const PlaceholderPanel = (props: PlaceholderPanelProps) => {
setOpen(false);
};
return (
- <>
- <PlaceholderPanelContainer
- style={{
- top: point.y + 'px',
- left: point.x + 'px',
- display: open ? 'block' : 'none',
- }}
- >
- <EmptyPageTipContainer onClick={handleClickEmptyPage}>
- Press Enter to continue with an empty page, or pick a
- template
- </EmptyPageTipContainer>
- <div style={{ marginTop: '4px', marginLeft: '-8px' }}>
- {templateList.map((template, index) => {
- return (
- <TemplateItemContainer
- key={index}
- onClick={() => {
- handleNewFromTemplate(template);
- }}
- >
- <BaseButton>{template.name}</BaseButton>
- </TemplateItemContainer>
- );
- })}
- </div>
- </PlaceholderPanelContainer>
- </>
+ <PlaceholderPanelContainer
+ style={{
+ top: point.y + 'px',
+ left: point.x + 'px',
+ display: open ? 'block' : 'none',
+ }}
+ >
+ <EmptyPageTipContainer onClick={handleClickEmptyPage}>
+ Press Enter to continue with an empty page, or pick a template
+ </EmptyPageTipContainer>
+ <div style={{ marginTop: '4px', marginLeft: '-8px' }}>
+ {templateList.map((template, index) => {
+ return (
+ <TemplateItemContainer
+ key={index}
+ onClick={() => {
+ handleNewFromTemplate(template);
+ }}
+ >
+ <BaseButton>{template.name}</BaseButton>
+ </TemplateItemContainer>
+ );
+ })}
+ </div>
+ </PlaceholderPanelContainer>
);
};
diff --git a/libs/datasource/db-service/src/services/editor-block/templates/template-factory.ts b/libs/datasource/db-service/src/services/editor-block/templates/template-factory.ts
index 953cf0e6de..88a8d08bbe 100644
--- a/libs/datasource/db-service/src/services/editor-block/templates/template-factory.ts
+++ b/libs/datasource/db-service/src/services/editor-block/templates/template-factory.ts
@@ -13,7 +13,7 @@ const groupTemplateMap = {
grid: gridTemplate,
} as GroupTemplateMap;
-const defaultTemplateList = [
+const defaultTemplateList: Array<TemplateMeta> = [
{
name: 'New From Quick Start',
groupKeys: ['todolist'],
@@ -22,10 +22,10 @@ const defaultTemplateList = [
{ name: 'New From Blog', groupKeys: ['blog'] },
{ name: ' New Todolist', groupKeys: ['todolist'] },
{ name: ' New Empty Page', groupKeys: ['empty'] },
-] as const;
+];
const TemplateFactory = {
- defaultTemplateList: defaultTemplateList,
+ defaultTemplateList,
generatePageTemplateByGroupKeys(props: TemplateMeta): Template {
const newTitle = props.name || 'Get Started with AFFiNE';
const keys: GroupTemplateKeys[] = props.groupKeys || [];