jhollingworth / bootstrap-wysihtml5

Simple, beautiful wysiwyg editor
http://jhollingworth.github.com/bootstrap-wysihtml5/
MIT License
4.14k stars 1.01k forks source link

Doing 'insertHTML' on an empty editor, adds the placeholder as text #350

Open pdcmoreira opened 10 years ago

pdcmoreira commented 10 years ago

Imagine an editor with placeholder="foo". I'm doing editor.composer.commands.exec("insertHTML", 'hi'); on it.

Now, two things can happen:

  1. If it already has the text bar, it becomes barhi after the command;
  2. If it is empty (therefore the placeholder is visible), it becomes hifoo.

[EDIT] As a workaround, doing:

if(editor.getValue() === '')
   editor.clear();

Before the insertHTML, works fine.