Hi, I'm trying to adapt the sample plugin tutorial, which includes inserting HTML inside a plugin.
So far, I've been able to append the "div" tag with the classes, but I cannot insert either the "h4" tag, or wrap the text written by the user with the "p" tag.
I have:
commit: function( element ) {
var h = editor.document.createElement( 'h4' );
h.setHtml( "Comments" );
var p = editor.document.createElement( 'p' );
p.setHtml( this.getValue() );
element.setAttribute( "class", "embed-comment-left tab-open" );
element.insertElement( h + p );
}
Here, "element" is the "div", created in an earlier portion of the code which is identical to the original tutorial.
However, I cannot figure out what the code wants, even after trying to example in a thread here on the forum.
Any advice would be a big help.
I've gone through the
I've gone through the documentation, using the examples, and I'm seeing the exact same messages and errors (undefined).
Undefined
As an example:
objComment.h.setHtml( "Comments" );
console.log(objComment.h);
... at this point, the object has the correct value of: "Comments".
However:
alert(objComment.h.innerHTML);
... at this point, it's value becomes "undefined".
I've tried no end of variations and each causes an error.
How can a variable become undefined between being assigned a value on one line and then referenced in the next?