I made plugin with a button than should wrap the selected text like that:

<h2><span>selection</span></h2>

The problem is than the span look like filter out. If I use em instead it works fine.

- no HTML filter in my text style.
- line break on
- use ckeditor

My JS:

invoke: function(data, settings, instanceId) {

        content = this._addWrapper(data.content);
        // Insert new content into the editor.
        if (typeof content != 'undefined') {
            Drupal.wysiwyg.instances[instanceId].insert(content);
        }

    },

    _addWrapper: function(htmlContent) {
        return '<h2><span>' + htmlContent + '</span></h2>';
    }

Comments

twod’s picture

Component: Code » Plugins
Status: Active » Postponed (maintainer needs more info)

When is the span being filtered out?
Is it still there if you "View source/HTML" in the editor?
Is it still there if you click "Disable rich-text"?
If so, is it still there after saving the node, editing it again and clicking "Disable rich-text"?

Btw, note that your if-statment: if (typeof content != 'undefined') { will never be false since you always return a string from _addWrapper() no matter what was passed to it.

marcoka’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

check the textformat, filters. do you use restrict HTML. i am using ckeditor too and also wrote a plugin via the ckeditor api and nothing is beeing stripped out.
reopen if it is still a problem.