@kvass/rich-text 1.4.6 → 1.4.8
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/package.json +6 -15
- package/src/Component.vue +6 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kvass/rich-text",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.8",
|
|
4
4
|
"description": "rich text component for kvass",
|
|
5
5
|
"main": "src/Component.vue",
|
|
6
6
|
"scripts": {
|
|
@@ -35,19 +35,10 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@kvass/storage": "^1.0.1",
|
|
38
|
-
"@tiptap/extension-image": "^2.0.0-beta.
|
|
39
|
-
"@tiptap/extension-link": "^2.0.0-beta.
|
|
40
|
-
"@tiptap/starter-kit": "^2.0.0-beta.
|
|
41
|
-
"@tiptap/
|
|
42
|
-
"
|
|
43
|
-
"prosemirror-dropcursor": "^1.6.1",
|
|
44
|
-
"prosemirror-gapcursor": "^1.3.1",
|
|
45
|
-
"prosemirror-history": "^1.3.0",
|
|
46
|
-
"prosemirror-keymap": "^1.2.0",
|
|
47
|
-
"prosemirror-model": "^1.18.3",
|
|
48
|
-
"prosemirror-schema-list": "^1.2.2",
|
|
49
|
-
"prosemirror-state": "^1.4.2",
|
|
50
|
-
"prosemirror-transform": "^1.7.0",
|
|
51
|
-
"prosemirror-view": "^1.29.1"
|
|
38
|
+
"@tiptap/extension-image": "^2.0.0-beta.220",
|
|
39
|
+
"@tiptap/extension-link": "^2.0.0-beta.220",
|
|
40
|
+
"@tiptap/starter-kit": "^2.0.0-beta.220",
|
|
41
|
+
"@tiptap/pm": "^2.0.0-beta.220",
|
|
42
|
+
"@tiptap/vue-2": "^2.0.0-beta.220"
|
|
52
43
|
}
|
|
53
44
|
}
|
package/src/Component.vue
CHANGED
|
@@ -221,7 +221,7 @@ export default {
|
|
|
221
221
|
case 'link':
|
|
222
222
|
if (value)
|
|
223
223
|
editor
|
|
224
|
-
.setLink({ href: value, target:
|
|
224
|
+
.setLink({ href: value, target: this.isInternalUrl(value) ? '_self' : '_blank' })
|
|
225
225
|
.run()
|
|
226
226
|
else editor.unsetLink().run()
|
|
227
227
|
break
|
|
@@ -231,7 +231,7 @@ export default {
|
|
|
231
231
|
.setCta({
|
|
232
232
|
href: value,
|
|
233
233
|
'data-cta': this.bubbleOptions.theme,
|
|
234
|
-
target:
|
|
234
|
+
target: this.isInternalUrl(value) ? '_self' : '_blank',
|
|
235
235
|
})
|
|
236
236
|
.run()
|
|
237
237
|
else editor.unsetCta().run()
|
|
@@ -249,6 +249,10 @@ export default {
|
|
|
249
249
|
.some(k => editor.isActive(k)) || !this.editor.state.selection.empty
|
|
250
250
|
)
|
|
251
251
|
},
|
|
252
|
+
isInternalUrl(value) {
|
|
253
|
+
if (!typeof value === 'string') return
|
|
254
|
+
return ['/', '#'].some(v => value.startsWith(v))
|
|
255
|
+
}
|
|
252
256
|
},
|
|
253
257
|
mounted() {
|
|
254
258
|
this.editor = new Editor({
|