Browse Source

判断输入内容

lifanagju_citu 1 month ago
parent
commit
9769282241
1 changed files with 2 additions and 3 deletions
  1. 2 3
      components/RichEditor/index.vue

+ 2 - 3
components/RichEditor/index.vue

@@ -127,7 +127,8 @@
 			handleBlur() {
 				this.editorCtx.getContents({
 					success: (res) => {
-						this.$emit('blur', res.html === '<p><br></p>' ? '' : res.html)
+						const _text = res?.text.replace(/\s+/g, '')
+						this.$emit('blur', _text ? res.html : '')
 					}
 				})
 			},
@@ -146,10 +147,8 @@
 				}, 500)
 			},
 			setEditorContent(content) {
-				console.log('setEditorContent-content1:', content)
 				if (!content && !this.inputText) return
 				if (typeof content !== 'string') content = ''
-				console.log('setEditorContent-content2:', content)
 				this.editorCtx.setContents({
 					html: content
 				});