feat(editor): add highlighter (#10573)

Closes: [BS-2909](https://linear.app/affine-design/issue/BS-2909/新增highlighter)

### What's Changed!

Currently the highlighter tool is very similar to brush, but for the future, it's a standalone module.

* Added `Highlighter` element model
* Added `Highlighter` tool
* Added `Highlighter` entry to the global toolbar
This commit is contained in:
fundon
2025-03-27 08:53:26 +00:00
parent 676a8d653f
commit 2c4278058b
36 changed files with 1667 additions and 483 deletions
@@ -2,6 +2,7 @@ import {
BrushElementModel,
ConnectorElementModel,
GroupElementModel,
HighlighterElementModel,
MindmapElementModel,
ShapeElementModel,
TextElementModel,
@@ -16,12 +17,14 @@ export const elementsCtorMap = {
brush: BrushElementModel,
text: TextElementModel,
mindmap: MindmapElementModel,
highlighter: HighlighterElementModel,
};
export {
BrushElementModel,
ConnectorElementModel,
GroupElementModel,
HighlighterElementModel,
MindmapElementModel,
ShapeElementModel,
SurfaceElementModel,
@@ -35,6 +38,7 @@ export enum CanvasElementType {
MINDMAP = 'mindmap',
SHAPE = 'shape',
TEXT = 'text',
HIGHLIGHTER = 'highlighter',
}
export type ElementModelMap = {
@@ -44,6 +48,7 @@ export type ElementModelMap = {
['text']: TextElementModel;
['group']: GroupElementModel;
['mindmap']: MindmapElementModel;
['highlighter']: HighlighterElementModel;
};
export function isCanvasElementType(type: string): type is CanvasElementType {