@kvass/rich-text 1.5.0 → 1.5.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kvass/rich-text",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
4
4
  "description": "rich text component for kvass",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/Component.vue CHANGED
@@ -102,7 +102,7 @@ import { Options } from '../index'
102
102
  export { Tiptap }
103
103
  export default {
104
104
  name: 'RichText',
105
- inject: ['RichTextOptions'],
105
+ inject: { RichTextOptions: { default: null } },
106
106
  props: {
107
107
  value: {
108
108
  type: String,
@@ -349,7 +349,10 @@ export default {
349
349
  ],
350
350
  content: this.value,
351
351
  onUpdate: () => {
352
- this.$emit('input', this.editor.getHTML())
352
+ const html = this.editor.getHTML()
353
+ if (/^<p>\s*<\/p>$/.test(html)) return this.$emit('input', '')
354
+
355
+ return this.$emit('input', html)
353
356
  },
354
357
  onSelectionUpdate: ({ editor }) => {
355
358
  if (!this.bubbleShouldShow({ editor })) this.bubbleState = null