Opened 9 years ago

Closed 9 years ago

#7287 closed Bug (invalid)

change href in a tag with htmlFilter doenst work

Reported by: Eric Brüggemann Owned by:
Priority: Normal Milestone:
Component: Core : Output Data Version: 3.5
Keywords: htmlFilter Cc:

Description

If you try to apply a filter for the href attribute auf a tags the new value is not written back to the html so.

CKEDITOR.on( 'instanceReady', function( ev )
{
    var editor = ev.editor,
    dataProcessor = editor.dataProcessor,
    htmlFilter = dataProcessor &&    dataProcessor.htmlFilter;
    htmlFilter.addRules({
        elements :{
            a : function ( element ){
                alert(element.attributes['href']);
                element.attributes['href'] = "http://www.ckeditor.com";
                alert(element.attributes['href']);
            }
        }
    });
});

this will first alert the old href than the changed href but the href attribute itself wont change

Change History (1)

comment:1 Changed 9 years ago by Garry Yao

Resolution: invalid
Status: newclosed

Editor protects certain attributes to avoid browser touching them, so when in html filter, please manipulate "data-cke-saved-href" instead of "href".

Note: See TracTickets for help on using tickets.
© 2003 – 2019 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy