1- import { addLink , addScript } from '../BootstrapBlazor/modules/utility.js' ;
1+ import { addLink , addScript } from '../BootstrapBlazor/modules/utility.js' ;
22import Data from '../BootstrapBlazor/modules/data.js' ;
33
44export async function init ( id , invoke , options ) {
@@ -10,8 +10,9 @@ export async function init(id, invoke, options) {
1010 await addLink ( './_content/BootstrapBlazor.Vditor/css/vditor.css' ) ;
1111 await addScript ( './_content/BootstrapBlazor.Vditor/js/vditor.js' ) ;
1212
13+ const root = el . querySelector ( '.bb-vditor-container' ) ;
1314 const { options : op , value } = options ;
14- const vditor = new Vditor ( id , getOptions ( invoke , { ...op , value } ) ) ;
15+ const vditor = new Vditor ( root , getOptions ( invoke , { ...op , value } ) ) ;
1516
1617 Data . set ( id , { el, invoke, vditor } ) ;
1718 return vditor ;
@@ -35,11 +36,12 @@ const getOptions = (invoke, options) => {
3536
3637export async function reset ( id , value , options ) {
3738 const md = Data . get ( id ) ;
38- const { invoke, vditor } = md ;
39+ const { el , invoke, vditor } = md ;
3940 if ( vditor ) {
4041 vditor . destroy ( ) ;
4142
42- md . vditor = new Vditor ( id , getOptions ( invoke , { ...options , value } ) ) ;
43+ const root = el . querySelector ( '.bb-vditor-container' ) ;
44+ md . vditor = new Vditor ( root , getOptions ( invoke , { ...options , value } ) ) ;
4345 }
4446 return md . vditor ;
4547}
0 commit comments