Froala和Aurelia整合

时间:2019-04-27 11:30:29

标签: aurelia froala

我在Aurelia应用程序中使用Froala编辑器插件。效果很好。

我们可以将自定义参数传递给main.ts中的插件,如下所示:

// Use the aurelia-froala-editor plugin.
aurelia.use.plugin('aurelia-froala-editor', config => {
  config.options({
    toolbarInline: true
  })
});

然后将froala组件注入页面内:

<froala-editor></froala-editor>

但是现在我直接在页面的froala组件内部传递参数:

<froala-editor value.two-way="post.content" config.bind="{
        toolbarInline: true,
        charCounterCount: false,
        imageUploadURL:         'http://localhost:5000/api/froala/UploadImage',
        fileUploadURL:          'http://localhost:5000/api/froala/UploadFile',
        imageManagerLoadURL:    'http://localhost:5000/api/froala/LoadImages',
        imageManagerDeleteURL:  'http://localhost:5000/api/froala/DeleteImage', 
        imageManagerDeleteMethod: 'POST'
      }" event-handlers.bind = "{
        'image.uploaded': imageUploaded,
        'image.removed': imageRemoved,
        'image.file.unlink': imageFileUnlink
      }"></froala-editor>

它也很好用。

似乎无效的方法是混合在main.ts和页面组件中传递的参数。页面上的组件似乎完全忽略了main.ts中插件初始化时传递的参数。

例如,如果我将charCounterCount参数从页面上的组件移至main.ts中的初始化,则会被忽略。

0 个答案:

没有答案