Javascript CKEditor5自定义模式插件

Javascript CKEditor5自定义模式插件,javascript,ckeditor,ckeditor5,Javascript,Ckeditor,Ckeditor5,我按照初始值进行操作,并使图像插入生效,但我希望显示一个带有两个输入字段的自定义模式,而不是设置更多属性的提示。 我如何最好地实现这一点 我知道如何在普通的JS/CSS中实现一个普通的模式,但是我有点困惑,在点击按钮时,模式的HTML应该放在哪里 class Test extends Plugin { init() { editor = this.editor editor.ui.componentFactory.add('SampleView', (locale) =>

我按照初始值进行操作,并使图像插入生效,但我希望显示一个带有两个输入字段的自定义模式,而不是设置更多属性的提示。 我如何最好地实现这一点

我知道如何在普通的JS/CSS中实现一个普通的模式,但是我有点困惑,在点击按钮时,模式的HTML应该放在哪里

class Test extends Plugin {
init() {
    editor = this.editor
    editor.ui.componentFactory.add('SampleView', (locale) => {

        const view = new ButtonView(locale)

        view.set({
            label: 'test',
            icon: imageIcon,
            tooltip: true
        })
        view.on('execute', () => {
     //here I would like to open the modal instead of the prompt
        })

    })
  }
}

例如,您可以尝试使用零依赖纯javascript替换默认弹出窗口

import swal from 'sweetalert2';
...
view.on( 'execute', () => {
    swal( {
        input: 'text',
        inputPlaceholder: 'Your image URL'
    } )
    .then ( result => {
        editor.model.change( writer => {
            const imageElement = writer.createElement( 'image', {
                src: result.value
            } );

            editor.model.insertContent( imageElement, editor.model.document.selection );
        } );
    } )
} );

你找到解决办法了吗?