fix(component): editor component style (#2120)

This commit is contained in:
Himself65
2023-04-25 01:58:30 -05:00
committed by GitHub
parent 3f1293ca3c
commit a807647639
2 changed files with 15 additions and 9 deletions
+1
View File
@@ -20,6 +20,7 @@ export default {
}, },
async viteFinal(config, { configType }) { async viteFinal(config, { configType }) {
return mergeConfig(config, { return mergeConfig(config, {
assetsInclude: ['**/*.md'],
plugins: [ plugins: [
vanillaExtractPlugin(), vanillaExtractPlugin(),
tsconfigPaths({ tsconfigPaths({
@@ -10,6 +10,11 @@ import { useState } from 'react';
import type { EditorProps } from '.'; import type { EditorProps } from '.';
import { BlockSuiteEditor } from '.'; import { BlockSuiteEditor } from '.';
const blockSuiteWorkspace = new Workspace({
id: 'test',
blobStorages: [createMemoryStorage],
});
function initPage(page: Page): void { function initPage(page: Page): void {
// Add page block and surface block at root level // Add page block and surface block at root level
const pageBlockId = page.addBlock('affine:page', { const pageBlockId = page.addBlock('affine:page', {
@@ -27,11 +32,6 @@ function initPage(page: Page): void {
page.resetHistory(); page.resetHistory();
} }
const blockSuiteWorkspace = new Workspace({
id: 'test',
blobStorages: [createMemoryStorage],
});
blockSuiteWorkspace.register(AffineSchemas).register(__unstableSchemas); blockSuiteWorkspace.register(AffineSchemas).register(__unstableSchemas);
const page = blockSuiteWorkspace.createPage('page0'); const page = blockSuiteWorkspace.createPage('page0');
initPage(page); initPage(page);
@@ -42,10 +42,15 @@ export default {
component: BlockSuiteEditor, component: BlockSuiteEditor,
} satisfies BlockSuiteMeta; } satisfies BlockSuiteMeta;
const Template: StoryFn<EditorProps> = (props: EditorProps) => { const Template: StoryFn<EditorProps> = (props: Partial<EditorProps>) => {
return ( return (
<> <div
<BlockSuiteEditor {...props} page={page} mode="page" /> style={{
height: '100vh',
width: '100vw',
}}
>
<BlockSuiteEditor onInit={initPage} page={page} mode="page" {...props} />
<div <div
style={{ style={{
position: 'absolute', position: 'absolute',
@@ -54,7 +59,7 @@ const Template: StoryFn<EditorProps> = (props: EditorProps) => {
}} }}
id="toolWrapper" id="toolWrapper"
/> />
</> </div>
); );
}; };