mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-11 18:45:30 +03:00
chore: add null check for create new page with title (#1490)
This commit is contained in:
parent
356181881b
commit
fd6abfa8ce
@ -1,7 +1,7 @@
|
|||||||
import { useTranslation } from '@affine/i18n';
|
import { useTranslation } from '@affine/i18n';
|
||||||
import type { PageBlockModel } from '@blocksuite/blocks';
|
import type { PageBlockModel } from '@blocksuite/blocks';
|
||||||
import { PlusIcon } from '@blocksuite/icons';
|
import { PlusIcon } from '@blocksuite/icons';
|
||||||
import { assertEquals, nanoid } from '@blocksuite/store';
|
import { assertEquals, assertExists, nanoid } from '@blocksuite/store';
|
||||||
import { Command } from 'cmdk';
|
import { Command } from 'cmdk';
|
||||||
import { NextRouter } from 'next/router';
|
import { NextRouter } from 'next/router';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
@ -44,6 +44,7 @@ export const Footer: React.FC<FooterProps> = ({
|
|||||||
const block = newPage.getBlockByFlavour(
|
const block = newPage.getBlockByFlavour(
|
||||||
'affine:page'
|
'affine:page'
|
||||||
)[0] as PageBlockModel;
|
)[0] as PageBlockModel;
|
||||||
|
assertExists(block);
|
||||||
block.title.insert(query, 0);
|
block.title.insert(query, 0);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
|
Loading…
Reference in New Issue
Block a user