xrb21 / flutter-html-editor

MIT License
82 stars 64 forks source link

Add insert config #30

Open afandiyusuf opened 3 years ago

afandiyusuf commented 3 years ago

@xrb21 Hello, Great plugin :).

In this pull request, I added insertConfig parameter to HtmlEditor(), so we can disable/enable the insert toolbar. For the value of that parameter, we can check the official documentation from summernote since I just parsing the list string and inject it into the initialization summer note javascript.

example: we can use ['link','picture','vide','table']

I make the bottom toolbar hide/show too depends on how these parameters are set. example: if we use insertConfig: ['link'] the image bottom toolbar would be hidden since we didn't use 'image' for insertConfig.

NB: I change id "summernote" to "summernote-2" for preventing auto initialization, so we can make our own initialization with custom config.

This is how to use HtmlEditor after we merge this pull request

HtmlEditor(
      hint: "Your text here...",
      //value: "text content initial, if any",
      key: keyEditor,
      height: 400,
      insertConfig: ['link','video'],
)

Related Issue #4 #8 Thanks.