Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛(frontend) add default toolbar buttons #355

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ and this project adheres to

- 📝Contributing.md #352

## Fixed

- 🐛(frontend) add default toolbar buttons #355


## [1.6.0] - 2024-10-17

Expand Down
29 changes: 29 additions & 0 deletions src/frontend/apps/e2e/__tests__/app-impress/doc-editor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,35 @@ test.beforeEach(async ({ page }) => {
});

test.describe('Doc Editor', () => {
test('it checks default toolbar buttons are displayed', async ({
page,
browserName,
}) => {
await createDoc(page, 'doc-toolbar', browserName, 1);

const editor = page.locator('.ProseMirror');
await editor.click();
await editor.fill('test content');

await editor.getByText('test content').dblclick();
await expect(page.locator('button[data-test="bold"]')).toBeVisible();
await expect(page.locator('button[data-test="italic"]')).toBeVisible();
await expect(page.locator('button[data-test="underline"]')).toBeVisible();
await expect(page.locator('button[data-test="strike"]')).toBeVisible();
await expect(
page.locator('button[data-test="alignTextLeft"]'),
).toBeVisible();
await expect(
page.locator('button[data-test="alignTextCenter"]'),
).toBeVisible();
await expect(
page.locator('button[data-test="alignTextRight"]'),
).toBeVisible();
await expect(page.locator('button[data-test="colors"]')).toBeVisible();
await expect(page.locator('button[data-test="unnestBlock"]')).toBeVisible();
await expect(page.locator('button[data-test="createLink"]')).toBeVisible();
Copy link
Collaborator

@PanchoutNathan PanchoutNathan Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the add the BlockTypeSelect inside tests and good to me !

});

test('checks the Doc is connected to the provider server', async ({
page,
browserName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import '@blocknote/mantine/style.css';
import {
BasicTextStyleButton,
BlockTypeSelect,
ColorStyleButton,
CreateLinkButton,
FormattingToolbar,
FormattingToolbarController,
NestBlockButton,
TextAlignButton,
UnnestBlockButton,
getFormattingToolbarItems,
} from '@blocknote/react';
import React from 'react';

Expand All @@ -18,42 +12,15 @@ import { MarkdownButton } from './MarkdownButton';
export const BlockNoteToolbar = () => {
return (
<FormattingToolbarController
formattingToolbar={() => (
formattingToolbar={({ blockTypeSelectItems }) => (
<FormattingToolbar>
<BlockTypeSelect key="blockTypeSelect" />
{getFormattingToolbarItems(blockTypeSelectItems)}

{/* Extra button to do some AI powered actions */}
<AIGroupButton key="AIButton" />

{/* Extra button to convert from markdown to json */}
<MarkdownButton key="customButton" />

<BasicTextStyleButton basicTextStyle="bold" key="boldStyleButton" />
<BasicTextStyleButton
basicTextStyle="italic"
key="italicStyleButton"
/>
<BasicTextStyleButton
basicTextStyle="underline"
key="underlineStyleButton"
/>
<BasicTextStyleButton
basicTextStyle="strike"
key="strikeStyleButton"
/>
{/* Extra button to toggle code styles */}
<BasicTextStyleButton key="codeStyleButton" basicTextStyle="code" />

<TextAlignButton textAlignment="left" key="textAlignLeftButton" />
<TextAlignButton textAlignment="center" key="textAlignCenterButton" />
<TextAlignButton textAlignment="right" key="textAlignRightButton" />

<ColorStyleButton key="colorStyleButton" />

<NestBlockButton key="nestBlockButton" />
<UnnestBlockButton key="unnestBlockButton" />

<CreateLinkButton key="createLinkButton" />
</FormattingToolbar>
)}
/>
Expand Down
Loading