mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-30 00:29:46 +08:00
feat(editor): add shortcut to highlighter tool (#11604)
Closes: [BS-3092](https://linear.app/affine-design/issue/BS-3092/highlighter-快捷键) ### What's Changed! * Added shortcut `⇧ P` to highlighter tool [Screen Recording 2025-04-10 at 16.33.30.mov <span class="graphite__hidden">(uploaded via Graphite)</span> <img class="graphite__hidden" src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/8ypiIKZXudF5a0tIgIzf/38aadc08-ed18-4b48-9d91-b4876d14a2d3.mov" />](https://app.graphite.dev/media/video/8ypiIKZXudF5a0tIgIzf/38aadc08-ed18-4b48-9d91-b4876d14a2d3.mov)
This commit is contained in:
@@ -57,3 +57,28 @@ test('should exit drawing tools menu when Escape is pressed', async ({
|
||||
|
||||
await expect(drawingToolsMenu).toBeHidden();
|
||||
});
|
||||
|
||||
test('should enter highlighter tool when `Shift + P` is pressed', async ({
|
||||
page,
|
||||
}) => {
|
||||
const drawingToolButton = page.locator('.edgeless-pen-button');
|
||||
const drawingToolsMenu = page.locator('edgeless-pen-menu');
|
||||
|
||||
await expect(drawingToolButton).toHaveAttribute('data-drawing-tool', 'brush');
|
||||
await expect(drawingToolsMenu).toBeHidden();
|
||||
|
||||
await page.keyboard.press('Shift+P');
|
||||
|
||||
await expect(drawingToolButton).toHaveAttribute(
|
||||
'data-drawing-tool',
|
||||
'highlighter'
|
||||
);
|
||||
await expect(drawingToolsMenu).toBeVisible();
|
||||
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(drawingToolsMenu).toBeHidden();
|
||||
await expect(drawingToolButton).toHaveAttribute(
|
||||
'data-drawing-tool',
|
||||
'highlighter'
|
||||
);
|
||||
});
|
||||
|
||||
@@ -211,7 +211,7 @@ export async function locatorEdgelessToolButton(
|
||||
switch (type) {
|
||||
case 'brush':
|
||||
case 'highlighter':
|
||||
buttonType = 'div';
|
||||
buttonType = 'edgeless-tool-icon-button';
|
||||
break;
|
||||
case 'pen':
|
||||
case 'text':
|
||||
|
||||
@@ -289,7 +289,7 @@ export async function locateEdgelessToolButton(
|
||||
switch (type) {
|
||||
case 'brush':
|
||||
case 'highlighter':
|
||||
buttonType = 'div';
|
||||
buttonType = 'edgeless-tool-icon-button';
|
||||
break;
|
||||
case 'pen':
|
||||
case 'text':
|
||||
|
||||
Reference in New Issue
Block a user