@mirus/tiptap-editor 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +93 -0
- package/babel.config.js +10 -0
- package/dist/assets/index-40717dd0.js +115 -0
- package/dist/assets/index-7678a4fb.css +1 -0
- package/dist/index.html +14 -0
- package/package.json +80 -0
- package/src/App.vue +60 -0
- package/src/App.vue~ +46 -0
- package/src/index.js +3 -0
- package/src/main.js +8 -0
- package/src/main.js~ +9 -0
- package/src/max-character-count.js +48 -0
- package/src/max-character-count.js~ +33 -0
- package/src/tiptap-editor.vue +499 -0
- package/src/tiptap-editor.vue~ +501 -0
- package/src/warnings.js +244 -0
- package/vite.config.js +8 -0
- package/vitest.config.js +10 -0
- package/vue.config.js +18 -0
package/README.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# tiptap-editor
|
|
2
|
+
|
|
3
|
+
Vue component that contains our custom setup for the tiptap editor. Able to highlight phrases and give reasons/fixes to the warnings
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm i tiptap-editor
|
|
7
|
+
yarn add tiptap-editor
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+

|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
<template>
|
|
14
|
+
<TextEditor
|
|
15
|
+
:value.sync="localtext"
|
|
16
|
+
:warnings="warnings"
|
|
17
|
+
:showMenu="true"
|
|
18
|
+
:maxCharacterCount="200"
|
|
19
|
+
height="500px"
|
|
20
|
+
placeholder="write something will-ya!"
|
|
21
|
+
id="some_unique_id"
|
|
22
|
+
/>
|
|
23
|
+
</template
|
|
24
|
+
|
|
25
|
+
<script>
|
|
26
|
+
import tiptapEditor from './tiptap-editor.vue';
|
|
27
|
+
|
|
28
|
+
export default {
|
|
29
|
+
components: { tiptapEditor },
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
warnings: [],
|
|
33
|
+
value: 'this is the initial value'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
</script>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Props
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
- **value:** `String` - the text to edit
|
|
45
|
+
|
|
46
|
+
- **placeholder:** `String` - the text to display when there is nothing in the editor
|
|
47
|
+
|
|
48
|
+
- **warnings:** `[ Objects ]` - an array of text that should be warned about
|
|
49
|
+
|
|
50
|
+
- example:
|
|
51
|
+
```js
|
|
52
|
+
[
|
|
53
|
+
{
|
|
54
|
+
value: 'the',
|
|
55
|
+
message: 'did you mean...',
|
|
56
|
+
options: ['too', 'pizza'], // optional
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: 'test text',
|
|
60
|
+
message: 'cannot say that, sorry',
|
|
61
|
+
overrideClass: 'underlined-green', // optional
|
|
62
|
+
},
|
|
63
|
+
]
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- **maxCharacterCount:** `Number` - Show a count of the current number of characters. If over the max the count will show red
|
|
67
|
+
|
|
68
|
+
- **height:** `String` - height of the text editor, default is `300px`
|
|
69
|
+
|
|
70
|
+
- **showMenu:** `Boolean` - if false, hide the format menu
|
|
71
|
+
|
|
72
|
+
- **id:** `String` - give the editor a unique id. Also adds aria tags to link the editor menu to the text area
|
|
73
|
+
|
|
74
|
+
## Events
|
|
75
|
+
|
|
76
|
+
- **update:value** - emitted whenever the core text value changes
|
|
77
|
+
|
|
78
|
+
- **new-character-count** - the new internal character count of the value. This is useful since the synced value may have formatting, which internal is ignored when counting characters.
|
|
79
|
+
|
|
80
|
+
## Setup
|
|
81
|
+
|
|
82
|
+
- clone this repo
|
|
83
|
+
- `cd` into the repo directory and run `yarn install`
|
|
84
|
+
- run `yarn serve`
|
|
85
|
+
|
|
86
|
+
## Available Scripts
|
|
87
|
+
|
|
88
|
+
- `yarn serve` - start the dev server
|
|
89
|
+
- `yarn build` - build for production
|
|
90
|
+
- `yarn preview` - locally preview production build
|
|
91
|
+
- `yarn format` - run Prettier to format code
|
|
92
|
+
- `yarn validate:format` - run Prettier with `--check` flag
|
|
93
|
+
- `yarn test` - run tests using vitest
|