@kvass/rich-text 1.4.8 → 1.4.10
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.
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- master
|
|
6
|
+
jobs:
|
|
7
|
+
deploy:
|
|
8
|
+
runs-on: ubuntu-20.04
|
|
9
|
+
steps:
|
|
10
|
+
- uses: actions/checkout@v3
|
|
11
|
+
- uses: actions/setup-node@v3
|
|
12
|
+
with:
|
|
13
|
+
node-version: '18'
|
|
14
|
+
- run: npm install
|
|
15
|
+
- name: Release
|
|
16
|
+
env:
|
|
17
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
18
|
+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
|
19
|
+
run: npx semantic-release
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kvass/rich-text",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.10",
|
|
4
4
|
"description": "rich text component for kvass",
|
|
5
5
|
"main": "src/Component.vue",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"No tests yet\"",
|
|
8
|
-
"semantic-release": "
|
|
8
|
+
"semantic-release": "semantic-release"
|
|
9
9
|
},
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -24,9 +24,8 @@
|
|
|
24
24
|
"homepage": "https://github.com/Kvass-App/rich-text#readme",
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"cz-conventional-changelog": "^3.3.0",
|
|
27
|
-
"
|
|
28
|
-
"semantic-release-cli": "^5.4.0"
|
|
29
|
-
"semantic-release": "^17.3.0"
|
|
27
|
+
"semantic-release": "^17.3.0",
|
|
28
|
+
"semantic-release-cli": "^5.4.0"
|
|
30
29
|
},
|
|
31
30
|
"config": {
|
|
32
31
|
"commitizen": {
|
|
@@ -34,11 +33,12 @@
|
|
|
34
33
|
}
|
|
35
34
|
},
|
|
36
35
|
"dependencies": {
|
|
37
|
-
"@kvass/storage": "^1.0
|
|
36
|
+
"@kvass/storage": "^1.1.0",
|
|
38
37
|
"@tiptap/extension-image": "^2.0.0-beta.220",
|
|
39
38
|
"@tiptap/extension-link": "^2.0.0-beta.220",
|
|
40
|
-
"@tiptap/
|
|
39
|
+
"@tiptap/extension-superscript": "^2.2.1",
|
|
41
40
|
"@tiptap/pm": "^2.0.0-beta.220",
|
|
41
|
+
"@tiptap/starter-kit": "^2.0.0-beta.220",
|
|
42
42
|
"@tiptap/vue-2": "^2.0.0-beta.220"
|
|
43
43
|
}
|
|
44
44
|
}
|
package/src/Component.vue
CHANGED
|
@@ -74,10 +74,20 @@
|
|
|
74
74
|
import { Editor, EditorContent, BubbleMenu } from '@tiptap/vue-2'
|
|
75
75
|
import Link from '@tiptap/extension-link'
|
|
76
76
|
import Image from '@tiptap/extension-image'
|
|
77
|
+
import Superscript from '@tiptap/extension-superscript'
|
|
77
78
|
import CallToAction from './extensions/cta'
|
|
78
79
|
import StarterKit from '@tiptap/starter-kit'
|
|
79
80
|
|
|
80
|
-
const DefaultCommands = [
|
|
81
|
+
const DefaultCommands = [
|
|
82
|
+
'heading',
|
|
83
|
+
'bold',
|
|
84
|
+
'italic',
|
|
85
|
+
'superscript',
|
|
86
|
+
'orderedList',
|
|
87
|
+
'bulletList',
|
|
88
|
+
'link',
|
|
89
|
+
'cta',
|
|
90
|
+
]
|
|
81
91
|
const DefaultLabels = { primary: 'Primær', secondary: 'Sekundær' }
|
|
82
92
|
|
|
83
93
|
export { DefaultCommands }
|
|
@@ -139,7 +149,7 @@ export default {
|
|
|
139
149
|
icon: ['far', 'bold'],
|
|
140
150
|
appearance: {
|
|
141
151
|
menu: true,
|
|
142
|
-
bubble:
|
|
152
|
+
bubble: true,
|
|
143
153
|
},
|
|
144
154
|
},
|
|
145
155
|
{
|
|
@@ -148,7 +158,7 @@ export default {
|
|
|
148
158
|
icon: ['far', 'italic'],
|
|
149
159
|
appearance: {
|
|
150
160
|
menu: true,
|
|
151
|
-
bubble:
|
|
161
|
+
bubble: true,
|
|
152
162
|
},
|
|
153
163
|
},
|
|
154
164
|
{
|
|
@@ -169,14 +179,25 @@ export default {
|
|
|
169
179
|
bubble: false,
|
|
170
180
|
},
|
|
171
181
|
},
|
|
182
|
+
{
|
|
183
|
+
stateKey: 'superscript',
|
|
184
|
+
commandKey: 'toggleSuperscript',
|
|
185
|
+
icon: ['far', 'superscript'],
|
|
186
|
+
extension: Superscript,
|
|
187
|
+
appearance: {
|
|
188
|
+
menu: false,
|
|
189
|
+
bubble: true,
|
|
190
|
+
},
|
|
191
|
+
},
|
|
172
192
|
{
|
|
173
193
|
stateKey: 'link',
|
|
174
194
|
commandKey: '---',
|
|
175
195
|
customFunc: () => {
|
|
176
196
|
this.bubbleState = 'link'
|
|
177
197
|
},
|
|
178
|
-
disabled: this.editor.state.selection.empty,
|
|
198
|
+
disabled: this.editor && this.editor.state.selection.empty,
|
|
179
199
|
icon: ['far', 'link'],
|
|
200
|
+
extension: Link,
|
|
180
201
|
appearance: {
|
|
181
202
|
menu: true,
|
|
182
203
|
bubble: false,
|
|
@@ -187,6 +208,7 @@ export default {
|
|
|
187
208
|
commandKey: '---',
|
|
188
209
|
customFunc: () => {},
|
|
189
210
|
icon: ['far', 'image'],
|
|
211
|
+
extension: Image,
|
|
190
212
|
appearance: {
|
|
191
213
|
menu: false,
|
|
192
214
|
bubble: false,
|
|
@@ -198,8 +220,9 @@ export default {
|
|
|
198
220
|
customFunc: () => {
|
|
199
221
|
this.bubbleState = 'cta'
|
|
200
222
|
},
|
|
201
|
-
disabled: this.editor.state.selection.empty,
|
|
223
|
+
disabled: this.editor && this.editor.state.selection.empty,
|
|
202
224
|
icon: ['far', 'mouse-pointer'],
|
|
225
|
+
extension: CallToAction,
|
|
203
226
|
appearance: {
|
|
204
227
|
menu: true,
|
|
205
228
|
bubble: false,
|
|
@@ -243,7 +266,7 @@ export default {
|
|
|
243
266
|
},
|
|
244
267
|
bubbleShouldShow({ editor }) {
|
|
245
268
|
return (
|
|
246
|
-
this.
|
|
269
|
+
this.getCommands()
|
|
247
270
|
.filter(a => a.appearance.bubble)
|
|
248
271
|
.map(a => a.stateKey)
|
|
249
272
|
.some(k => editor.isActive(k)) || !this.editor.state.selection.empty
|
|
@@ -252,12 +275,17 @@ export default {
|
|
|
252
275
|
isInternalUrl(value) {
|
|
253
276
|
if (!typeof value === 'string') return
|
|
254
277
|
return ['/', '#'].some(v => value.startsWith(v))
|
|
255
|
-
}
|
|
278
|
+
},
|
|
256
279
|
},
|
|
257
280
|
mounted() {
|
|
258
281
|
this.editor = new Editor({
|
|
259
282
|
editable: !this.disabled,
|
|
260
|
-
extensions: [
|
|
283
|
+
extensions: [
|
|
284
|
+
StarterKit,
|
|
285
|
+
...this.getCommands()
|
|
286
|
+
.map(({ extension }) => extension)
|
|
287
|
+
.filter(Boolean),
|
|
288
|
+
],
|
|
261
289
|
content: this.value,
|
|
262
290
|
onUpdate: () => {
|
|
263
291
|
let html = this.editor.getHTML().replace(/^<p>\s*<\/p>$/, '')
|
|
@@ -388,10 +416,11 @@ export default {
|
|
|
388
416
|
}
|
|
389
417
|
}
|
|
390
418
|
|
|
391
|
-
|
|
419
|
+
&-button {
|
|
392
420
|
width: initial;
|
|
393
421
|
padding: 0.5rem 0.75rem !important;
|
|
394
422
|
color: white;
|
|
423
|
+
font-size: 0.6em;
|
|
395
424
|
|
|
396
425
|
& + button {
|
|
397
426
|
border-left: 1px solid rgba(white, 0.2) !important;
|