How to prevent CKEditor insertHtml from wrapping an element inside <p> in webkit browsers?
I am trying to create an interface page to allow my users to create smarty templates with the ckeditor wysiwyg editor.
Im using the insertHtml function to add a button with special attributes (you need to parse it in the smarty variable in the backend):
// initialize ckeditor
$('textarea.editor').ckeditor({
contentsCss: '/css/test.css'
});
// get ckeditor instance
ckeditorInstance = $('textarea.editor').ckeditorGet();
// Use some elements (outside the textarea) to add buttons/tokens
// to wysiwyg textarea
$("a.tinymce.tinymce-insert-var").click(function(){
ckeditorInstance.insertHtml(
'<input type="button" readonly="readonly" var="{$user->name}" '
+ 'class="placeholder" value="User Name" />'
);
});
This works fine in Firefox, IE8, and Opera, but with Chrome / Chromium / Safari a button is inserted between the element <p>.
Is there a way to avoid this or a callback that I can use to delete a paragraph?