Skip to content

Commit

Permalink
Merge branch 't/10148b' into major
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Mar 5, 2013
2 parents c321667 + 3e7fc86 commit 6e1a635
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
13 changes: 10 additions & 3 deletions core/editable.js
Expand Up @@ -157,7 +157,7 @@
insertHtml: function( data, mode ) {
beforeInsert( this );
// Default mode is 'html'.
insert( this, mode == 'text' ? 'text' : 'html', data );
insert( this, mode || 'html', data );
},

/**
Expand Down Expand Up @@ -968,7 +968,13 @@
// Note: getRanges will be overwritten for tests since we want to test
// custom ranges and bypass native selections.
// TODO what should we do with others? Remove?
range = selection.getRanges()[ 0 ];
range = selection.getRanges()[ 0 ],
dontFilter = false;

if ( type == 'unfiltered_html' ) {
type = 'html';
dontFilter = true;
}

// Check range spans in non-editable.
if ( range.checkReadOnly() )
Expand All @@ -983,6 +989,7 @@
// The "state" value.
that = {
type: type,
dontFilter: dontFilter,
editable: editable,
editor: editor,
range: range,
Expand Down Expand Up @@ -1124,7 +1131,7 @@
// Process the inserted html, in context of the insertion root.
// Don't use the "fix for body" feature as auto paragraphing must
// be handled during insertion.
data = that.editor.dataProcessor.toHtml( data, null, false );
data = that.editor.dataProcessor.toHtml( data, null, false, that.dontFilter );


// Build the node list for insertion.
Expand Down
1 change: 1 addition & 0 deletions core/editor.js
Expand Up @@ -841,6 +841,7 @@
*
* * `"html"` - content being inserted will completely override styles
* of selected position.
* * `"unfiltered_html"` - like `"html"` but content isn't filtered with {@link CKEDITOR.filter}.
* * `"text"` - content being inserted will inherit styles applied in
* selected position. This mode should be used when inserting "htmlified" plain text
* (HTML without inline styles and styling elements like
Expand Down
4 changes: 2 additions & 2 deletions core/filter.js
Expand Up @@ -145,7 +145,7 @@
// Add element filter before htmlDataProcessor.dataFilter
// when purifying input data to correct html.
this._.toHtmlListener = editor.on( 'toHtml', function( evt ) {
this.applyTo( evt.data.dataValue, true );
this.applyTo( evt.data.dataValue, true, evt.data.dontFilter );
}, this, null, 6 );

// Transform outcoming "data".
Expand Down Expand Up @@ -1901,4 +1901,4 @@
/**
* @method toFeature
* @returns {CKEDITOR.feature}
*/
*/
11 changes: 8 additions & 3 deletions core/htmldataprocessor.js
Expand Up @@ -149,10 +149,13 @@
* @param {String} data The raw data.
* @param {String} [context] The tag name of a context element within which
* the input is to be processed, default to be the editable element.
* If `null` is passed, then data will be parsed without context (as children of {@link CKEDITOR.htmlParser.fragment}).
* See {@link CKEDITOR.htmlParser.fragment#fromHtml} for more details.
* @param {Boolean} [fixForBody] Whether trigger the auto paragraph for non-block contents.
* @param {Boolean} [dontFilter] Don't filter data with {@link CKEDITOR.filter}.
* @returns {String}
*/
toHtml: function( data, context, fixForBody ) {
toHtml: function( data, context, fixForBody, dontFilter ) {
var editor = this.editor;

// Fall back to the editable as context if not specified.
Expand All @@ -162,7 +165,8 @@
return editor.fire( 'toHtml', {
dataValue: data,
context: context,
fixForBody: fixForBody
fixForBody: fixForBody,
dontFilter: !!dontFilter
} ).dataValue;
},

Expand Down Expand Up @@ -822,7 +826,8 @@
* @param data
* @param {String/CKEDITOR.htmlParser.fragment/CKEDITOR.htmlParser.element} data.dataValue Input data to be purified.
* @param {String} data.context See {@link CKEDITOR.htmlDataProcessor#toHtml} `context` argument.
* @param {String} data.fixForBody See {@link CKEDITOR.htmlDataProcessor#toHtml} `fixForBody` argument.
* @param {Bolean} data.fixForBody See {@link CKEDITOR.htmlDataProcessor#toHtml} `fixForBody` argument.
* @param {Boolean} data.dontFilter See {@link CKEDITOR.htmlDataProcessor#toHtml} `dontFilter` argument.
*/

/**
Expand Down
7 changes: 5 additions & 2 deletions core/htmlparser/fragment.js
Expand Up @@ -59,14 +59,17 @@ CKEDITOR.htmlParser.fragment = function() {
* @static
* @param {String} fragmentHtml The HTML to be parsed, filling the fragment.
* @param {CKEDITOR.htmlParser.element/String} [parent] Optional contextual
* element which makes the content been parsed as the content of this element.
* element which makes the content been parsed as the content of this element and fix
* to match it.
* If not provided, then {@link CKEDITOR.htmlParser.fragment} will be used
* as the parent and it will be returned.
* @param {String/Boolean} [fixingBlock] When `parent` is a block limit element,
* and the param is a string value other than `false`, it is to
* avoid having block-less content as the direct children of parent by wrapping
* the content with a block element of the specified tag, e.g.
* when `fixingBlock` specified as `p`, the content `<body><i>foo</i></body>`
* will be fixed into `<body><p><i>foo</i></p></body>`.
* @returns CKEDITOR.htmlParser.fragment The fragment created.
* @returns {CKEDITOR.htmlParser.fragment/CKEDITOR.htmlParser.element} The created fragment or passed `parent`.
*/
CKEDITOR.htmlParser.fragment.fromHtml = function( fragmentHtml, parent, fixingBlock ) {
var parser = new CKEDITOR.htmlParser();
Expand Down

0 comments on commit 6e1a635

Please sign in to comment.