You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/extensions/Color/index.md
+103-6Lines changed: 103 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ next:
8
8
9
9
# Color
10
10
11
-
The Color extension allows you to add color to your editor.
11
+
The Color extension allows you to add text color to your editor with support for custom colors, keyboard shortcuts, and synchronized color selection across toolbar and bubble menu.
12
12
13
13
- Based on TipTap's Color extension. [@tiptap/extension-text-style](https://tiptap.dev/docs/editor/extensions/functionality/color)
14
14
@@ -20,10 +20,24 @@ import { Color } from 'reactjs-tiptap-editor/color'; // [!code ++]
20
20
const extensions = [
21
21
...,
22
22
// Import Extensions Here
23
-
Color// [!code ++]
23
+
Color, // [!code ++]
24
+
// or with configuration
25
+
Color.configure({ // [!code ++]
26
+
colors: COLORS_LIST, // [!code ++]
27
+
defaultColor: '#000000', // [!code ++]
28
+
}), // [!code ++]
24
29
];
25
30
```
26
31
32
+
## Features
33
+
34
+
- 🎨 **Rich Color Palette**: Choose from a wide range of predefined colors
35
+
- ⌨️ **Keyboard Shortcuts**: Quick color application with `Mod-Shift-C`
36
+
- 🔄 **Smart Toggle**: Intelligent color toggling and replacement
37
+
- 🎯 **Synchronized Selection**: Color picker syncs between toolbar and bubble menu
38
+
- 🎨 **Custom Colors**: Add custom colors via color picker
39
+
- 💾 **Recent Colors**: Automatically tracks recently used colors
40
+
27
41
## Options
28
42
29
43
### colors
@@ -35,20 +49,103 @@ An array of color options to display in the color picker. If not provided, a def
Copy file name to clipboardExpand all lines: docs/extensions/Highlight/index.md
+118-7Lines changed: 118 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ next:
8
8
9
9
# Highlight
10
10
11
-
The Highlight extension allows you to highlight text in your editor.
11
+
The Highlight extension allows you to highlight text in your editor with support for multiple colors, keyboard shortcuts, and synchronized color selection across toolbar and bubble menu.
12
12
13
13
- Based on TipTap's highlight extension. [@tiptap/extension-highlight](https://tiptap.dev/docs/editor/extensions/marks/highlight)
- 🎨 **Multiple Colors**: Support for multiple highlight colors
34
+
- ⌨️ **Keyboard Shortcuts**: Quick highlighting with `Mod-Shift-H`
35
+
- 🔄 **Smart Toggle**: Intelligent highlight toggling and replacement
36
+
- 🎯 **Synchronized Selection**: Color picker syncs between toolbar and bubble menu
37
+
- 🎨 **Custom Colors**: Add custom highlight colors via color picker
38
+
- 💾 **Recent Colors**: Automatically tracks recently used colors
39
+
- ❌ **No Fill Option**: Option to remove highlight
40
+
27
41
## Options
28
42
43
+
### defaultColor
44
+
45
+
Type: `string`\
46
+
Default: `undefined`
47
+
48
+
The default highlight color to use when the extension is initialized. This color will be used when applying highlight via keyboard shortcut for the first time.
49
+
50
+
```js
51
+
Highlight.configure({
52
+
defaultColor:'#ffff00', // Yellow
53
+
// or
54
+
defaultColor:'#ffc078', // Orange
55
+
})
56
+
```
57
+
29
58
### shortcutKeys
30
59
31
60
Type: `string[]`\
32
61
Default: `['⇧', 'mod', 'H']`
33
62
34
-
Keyboard shortcuts for the extension.
63
+
Keyboard shortcuts for applying the highlight. Default is `Mod-Shift-H` (Ctrl-Shift-H on Windows/Linux, Cmd-Shift-H on Mac).
35
64
36
-
### defaultColor
65
+
```js
66
+
Highlight.configure({
67
+
shortcutKeys: ['⇧', 'mod', 'H'],
68
+
})
69
+
```
37
70
38
-
Type: `string`\
39
-
Default: `none`
71
+
## Keyboard Shortcut Behavior
72
+
73
+
The `Mod-Shift-H` keyboard shortcut has intelligent toggle behavior:
74
+
75
+
1.**No highlight applied**: Applies the currently selected highlight color
76
+
2.**Same color already applied**: Removes the highlight (toggle off)
77
+
3.**Different color applied**: Replaces with the currently selected highlight color
78
+
4.**"No Fill" selected**: Does nothing (prevents applying undefined highlight)
79
+
80
+
## Color Selection Synchronization
81
+
82
+
The extension maintains a shared highlight color state across all instances:
83
+
84
+
- Selecting a color in the toolbar updates the bubble menu
85
+
- Selecting a color in the bubble menu updates the toolbar
0 commit comments