mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 05:14:54 +00:00
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:
@@ -3,6 +3,7 @@ import {
|
||||
ConnectorMode,
|
||||
DEFAULT_CONNECTOR_MODE,
|
||||
DEFAULT_FRONT_ENDPOINT_STYLE,
|
||||
DEFAULT_HIGHLIGHTER_LINE_WIDTH,
|
||||
DEFAULT_REAR_ENDPOINT_STYLE,
|
||||
DEFAULT_ROUGHNESS,
|
||||
DefaultTheme,
|
||||
@@ -14,6 +15,7 @@ import {
|
||||
FontWeight,
|
||||
FontWeightSchema,
|
||||
FrameZodSchema,
|
||||
HIGHLIGHTER_LINE_WIDTHS,
|
||||
LayoutType,
|
||||
LineWidth,
|
||||
MindmapStyle,
|
||||
@@ -89,6 +91,19 @@ export const BrushSchema = z
|
||||
lineWidth: LineWidth.Four,
|
||||
});
|
||||
|
||||
export const HighlighterSchema = z
|
||||
.object({
|
||||
color: ColorSchema,
|
||||
lineWidth: z
|
||||
.number()
|
||||
.int()
|
||||
.refine(value => HIGHLIGHTER_LINE_WIDTHS.includes(value)),
|
||||
})
|
||||
.default({
|
||||
color: DefaultTheme.hightlighterColor,
|
||||
lineWidth: DEFAULT_HIGHLIGHTER_LINE_WIDTH,
|
||||
});
|
||||
|
||||
const DEFAULT_SHAPE = {
|
||||
color: DefaultTheme.shapeTextColor,
|
||||
fillColor: DefaultTheme.shapeFillColor,
|
||||
@@ -162,6 +177,7 @@ export const MindmapSchema = z
|
||||
export const NodePropsSchema = z.object({
|
||||
connector: ConnectorSchema,
|
||||
brush: BrushSchema,
|
||||
highlighter: HighlighterSchema,
|
||||
text: TextSchema,
|
||||
mindmap: MindmapSchema,
|
||||
'affine:edgeless-text': EdgelessTextZodSchema,
|
||||
|
||||
Reference in New Issue
Block a user