angular-ui / ui-tinymce

AngularUI wrapper for TinyMCE
MIT License
488 stars 371 forks source link

clicking Bold and Italic buttons on empty line has no effect #229

Open analyst74 opened 8 years ago

analyst74 commented 8 years ago

This problem can be reproduced on demo.html, open in chrome, click to an empty line, and click bold/italic button. Those buttons are supposed to be highlighted (see tinymce homepage example), but are not.

deeg commented 8 years ago

Just curious, do you see the same effect on this plunker with the latest code?

I don't see the bug you describe.

deeg commented 8 years ago

I'm sorry, I was using an old version of TinyMCE on one of my plunkers. I do see the issue, thanks for reporting.

viveleroi commented 7 years ago

Looks like this is related to calls to ed.save(). When commenting out that call in the debouncedUpdate method, the button stays active as expected.

viveleroi commented 7 years ago

A bit more info...

TinyMCE's save method fires an event:

if (!args.no_events) {
  self.fire('SaveContent', args);
}

I'm not sure why, but it's this event trigger which leads to button state resets.

A temporary workaround could be to disable that event:

ed.save({ no_events: true });

But that likely prevents SaveContent listeners we do want from receiving it.