@kvass/rich-text 1.4.1 → 1.4.3
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 +1 -1
- package/src/Component.vue +14 -3
package/package.json
CHANGED
package/src/Component.vue
CHANGED
|
@@ -219,11 +219,21 @@ export default {
|
|
|
219
219
|
let editor = this.editor.chain().focus()
|
|
220
220
|
switch (this.bubbleState) {
|
|
221
221
|
case 'link':
|
|
222
|
-
if (value)
|
|
222
|
+
if (value)
|
|
223
|
+
editor
|
|
224
|
+
.setLink({ href: value, target: value.startsWith('/') ? '_self' : '_blank' })
|
|
225
|
+
.run()
|
|
223
226
|
else editor.unsetLink().run()
|
|
224
227
|
break
|
|
225
228
|
case 'cta':
|
|
226
|
-
if (value)
|
|
229
|
+
if (value)
|
|
230
|
+
editor
|
|
231
|
+
.setCta({
|
|
232
|
+
href: value,
|
|
233
|
+
'data-cta': this.bubbleOptions.theme,
|
|
234
|
+
target: value.startsWith('/') ? '_self' : '_blank',
|
|
235
|
+
})
|
|
236
|
+
.run()
|
|
227
237
|
else editor.unsetCta().run()
|
|
228
238
|
break
|
|
229
239
|
}
|
|
@@ -246,7 +256,8 @@ export default {
|
|
|
246
256
|
extensions: [StarterKit, Link, Image, CallToAction],
|
|
247
257
|
content: this.value,
|
|
248
258
|
onUpdate: () => {
|
|
249
|
-
|
|
259
|
+
let html = this.editor.getHTML().replace(/^<p>\s*<\/p>$/, '')
|
|
260
|
+
this.$emit('input', html)
|
|
250
261
|
},
|
|
251
262
|
})
|
|
252
263
|
},
|