liluxdev / summernote-addclass

A plugin for summernote editor to allow user to add custom css classes (custom styling) to the selected elements
MIT License
33 stars 16 forks source link

Trigger summernote change event when dropdown buttons are clicked #7

Open clveranis opened 6 years ago

clveranis commented 6 years ago

Issue: Summernote not saving applied classes added via this plugin.

Resolution: After much trial and error I appended the line

context.invoke('triggerEvent', 'change');

to the click function of the addclass plugin within the summernote-ext-addclass.js file.

This (seems to) resolve the issue where summernote does not recognize any additional class styling that is added if you do not trigger the summernote.change event after applying your classes (i.e. by typing other content after applying classes).

Probably should be added to the master branch but I haven't done enough testing on it to create a PR. If not then hopefully this saves someone else time to figure out.