fix(rich-text-editor): [rich-text-editor] fix data binding doen't work (#1779)

* fix(rich-text-editor): [rich-text-editor] fix double data binding doesn't work

* feat(rich-text-editor): add type for intellisense

* fix: remove renderless extra deps
This commit is contained in:
Gweesin Chan 2024-07-27 11:36:32 +08:00 committed by GitHub
parent db85c86827
commit 5bc79b23a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -2,6 +2,8 @@
<div>
<tiny-rich-text-editor v-model="value"></tiny-rich-text-editor>
<div class="result">
<hr />
<textarea v-model="value" style="width: 100%" rows="5" />
<hr />
<pre>{{ value }}</pre>
</div>

View File

@ -10,6 +10,7 @@ import {
eventClick,
Active
} from './index'
import type { ISharedRenderlessParamHooks } from '@/types'
export const api = [
'state',
@ -26,7 +27,7 @@ export const api = [
]
export const renderless = (
props,
{ computed, onBeforeUnmount, reactive },
{ computed, onBeforeUnmount, reactive, watch }: ISharedRenderlessParamHooks,
{ vm, emit },
{
Editor,
@ -293,5 +294,12 @@ export const renderless = (
state.editor.destroy()
})
watch(
() => props.modelValue,
(value) => {
state.editor.commands.setContent(value)
}
)
return api
}