Skip to content

Commit 630fb59

Browse files
committed
feat: support bracket annotation type
1 parent ffefdaf commit 630fb59

File tree

6 files changed

+37
-13
lines changed

6 files changed

+37
-13
lines changed

README.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ The default global options are:
7272
multiline: false,
7373
// By default annotations are drawn in two iterations.
7474
iterations: 2,
75+
// When drawing a bracket, this configures which side(s) of the element to bracket.
76+
brackets: `right`,
7577
}
7678
```
7779

@@ -106,12 +108,13 @@ Vue.use(VueRoughNotation, options);
106108

107109
This is a mandatory field. It sets the annotation style. Following are the list of supported annotation types:
108110

109-
- **underline**: Create a sketchy underline below an element.
111+
- **underline**: This style creates a sketchy underline below an element.
110112
- **box**: This style draws a box around the element.
111-
- **circle**: Draw a circle around the element.
112-
- **highlight**: Creates a highlight effect as if maked by a highlighter.
113-
- **strike-through**: This style draws a box around the element.
114-
- **crossed-off**: This style draws a box around the element.
113+
- **circle**: This style draws a circle around the element.
114+
- **highlight**: This style creates a highlight effect as if marked by a highlighter.
115+
- **strike-through**: This style draws horizontal lines through the element.
116+
- **crossed-off**: This style draws an 'X' across the element.
117+
- **bracket**: This style draws a bracket around an element, usually a paragraph of text. By default on the right side, but can be configured to any or all of left, right, top, bottom.
115118

116119
#### isShow
117120

@@ -175,7 +178,7 @@ Width of the annotation strokes.
175178

176179
#### padding
177180

178-
**Type**: `number`
181+
**Type**: `number | number[]`
179182

180183
**Required**: `false`
181184

@@ -203,6 +206,16 @@ This property only applies to inline text. To annotate multiline text (each line
203206

204207
By default annotations are drawn in two iterations, e.g. when underlining, drawing from left to right and then back from right to left. Setting this property can let you configure the number of iterations.
205208

209+
#### brackets
210+
211+
**Type**: `string | string[]`
212+
213+
**Required**: `false`
214+
215+
**Default**: `'right'`
216+
217+
Value could be a string or an array of strings, each string being one of these values: **left**, **right**, **top**, **bottom**. When drawing a bracket, this configures which side(s) of the element to bracket. Default value is `right`.
218+
206219
#### tag
207220

208221
**Type**: `string`

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
"license": "MIT",
4141
"dependencies": {
42-
"rough-notation": "^0.3.3"
42+
"rough-notation": "^0.4.0"
4343
},
4444
"devDependencies": {
4545
"@babel/core": "^7.10.1",

src/components/RoughNotation.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const AVAILABLE_TYPES = [
77
'highlight',
88
'strike-through',
99
'crossed-off',
10+
'bracket',
1011
];
1112

1213
export default (options) => ({
@@ -71,6 +72,11 @@ export default (options) => ({
7172
default: () => options.iterations,
7273
},
7374

75+
brackets: {
76+
type: [String, Array],
77+
default: () => options.brackets,
78+
},
79+
7480
order: {
7581
type: [Number, String],
7682
default: 0,

src/options.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,8 @@ export const defaultOptions = {
2020
// e.g.when underlining, drawing from left to right and then back from right to left.
2121
// Setting this property can let you configure the number of iterations.
2222
iterations: 2,
23+
// Value could be a string or an array of strings,
24+
// each string being one of these values: left, right, top, bottom.
25+
// When drawing a bracket, this configures which side(s) of the element to bracket.
26+
brackets: 'right',
2327
};

types/VueRoughNotation.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { PluginObject } from "vue";
22

3-
export type RoughNotationTypes = 'underline' | 'box' | 'circle' | 'highlight' | 'strike-through' | 'crossed-off';
3+
export type RoughNotationTypes = 'underline' | 'box' | 'circle' | 'highlight' | 'strike-through' | 'crossed-off' | 'bracket';
44

55
export interface VueRoughNotationOptions {
66
animate?: boolean;
7-
animationDelay?: number;
87
color?: string;
98
strokeWidth?: number;
109
padding?: number;
10+
multiline?: boolean;
1111
iterations?: number;
12+
brackets?: string;
1213
}
1314

1415
export interface VueRoughNotationPluginObject extends PluginObject<VueRoughNotationOptions> {}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7656,10 +7656,10 @@ rollup@^2.11.2:
76567656
optionalDependencies:
76577657
fsevents "~2.1.2"
76587658

7659-
rough-notation@^0.3.3:
7660-
version "0.3.3"
7661-
resolved "https://registry.yarnpkg.com/rough-notation/-/rough-notation-0.3.3.tgz#abe82f464b3d5d990e6b2ccd11ca5e596b1b0d8e"
7662-
integrity sha512-u2wn53Re907g208tPOxNdlv3WYRaXmXxd7JNTbAzzrkG4/6Iw5ZdhdXol8/AiVreUgt3MiBWpPVt+SYJwkNkXQ==
7659+
rough-notation@^0.4.0:
7660+
version "0.4.0"
7661+
resolved "https://registry.yarnpkg.com/rough-notation/-/rough-notation-0.4.0.tgz#6f97324cb50fc91ec8064219253aa2528a69210f"
7662+
integrity sha512-hDgn9qMIxWnfY+WWjt30aLMtDHR13H8r/NI3EQNdJiEFAzpklH5nKg4eH/thpxCWTYzyg8ueMsKIfz9MzOBQ4Q==
76637663

76647664
rsvp@^4.8.4:
76657665
version "4.8.5"

0 commit comments

Comments
 (0)