Redactor: Empty custom HTML element

  • Hi,

    I'm looking to add an empty custom HTML element to Redactor, like an img by another name, ideally like

    <myelement data-attr1="value1" data-attr2="value2" data-attr3="value" />

    Can also do <myelement ...></myelement> of course

    Serverside with HTMLPurifier I can do $parameters['definition']->addElement('myelement', 'Inline', 'Empty', '', $myArray in setAttributeDefinitions @ MessageHTMLInputFilter

    In JS I insert the element by this._editor.button.toggle({}, 'myelement', 'func', 'inline.format');, redactor plugin is registered and all that.

    But Redactor puts the caret inside the element and lets me put text and elements there, that's not what I want.

    I just want an empty inline element in Redactor that I can style for click/focus (to edit) and show the data fields as pseudoelements

    Any pointers please? What am I missing? Thank you