From 1f1963012f87d8229718c94e455aebb1d2492bd7 Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Fri, 7 Feb 2014 16:43:58 +0100 Subject: [PATCH 1/3] Introduced htmlDecode method in CKEDITOR.tools. --- core/tools.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/tools.js b/core/tools.js index 883df95e633..ff3c1829497 100644 --- a/core/tools.js +++ b/core/tools.js @@ -325,6 +325,18 @@ return String( text ).replace( /&/g, '&' ).replace( />/g, '>' ).replace( /' + * + * @param {String} The string to be decoded. + * @returns {String} The decoded string. + */ + htmlDecode: function( text ) { + return text.replace( /&/g, '&' ).replace( />/g, '>' ).replace( /</g, '<' ); + }, + /** * Replaces special HTML characters in HTMLElement attribute with their relative HTML entity values. * From 04a3ecb0c2d44344beec01b40350d4c43091d72c Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Fri, 7 Feb 2014 16:52:01 +0100 Subject: [PATCH 2/3] CKEDITOR.tools encoding functions doc update. --- core/tools.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/tools.js b/core/tools.js index ff3c1829497..38349ffc31f 100644 --- a/core/tools.js +++ b/core/tools.js @@ -340,8 +340,7 @@ /** * Replaces special HTML characters in HTMLElement attribute with their relative HTML entity values. * - * element.setAttribute( 'title', '' ); - * alert( CKEDITOR.tools.htmlEncodeAttr( element.getAttribute( 'title' ) ); // '>a " b <' + * alert( CKEDITOR.tools.htmlEncodeAttr( '' ) ); // '<a " b >' * * @param {String} The attribute value to be encoded. * @returns {String} The encoded value. @@ -355,7 +354,7 @@ * {@link #htmlEncodeAttr htmlEncodeAttr} back to their plain character * representation. * - * alert( CKEDITOR.tools.htmlDecodeAttr( '>a " b <' ); // '' + * alert( CKEDITOR.tools.htmlDecodeAttr( '<a " b>' ) ); // '' * * @param {String} text The text to be decoded. * @returns {String} The decoded text. From fc6c79842da62b33642d382ef2f0947bbee3e493 Mon Sep 17 00:00:00 2001 From: "m.lewandowski" Date: Mon, 10 Feb 2014 16:33:40 +0100 Subject: [PATCH 3/3] Changelog entry. --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 8e25d8a104c..1847bdca5d1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ CKEditor 4 Changelog New Features: +* [#11536](http://dev.ckeditor.com/ticket/11536): Added CKEDITOR.tools.htmlDecode method. * [#11377](http://dev.ckeditor.com/ticket/11377): Unify internal representation of empty anchors using fake objects. * [#11225](http://dev.ckeditor.com/ticket/11225): Introduced the [`CKEDITOR.tools.transparentImageData`](http://localhost/cksource/ckeditor-docs/build/#!/api/CKEDITOR.tools-property-transparentImageData) property which contains transparent image data to be used in CSS or as images' source.