diff --git a/CHANGES.md b/CHANGES.md index e81fdf7bc1f..9d57fbde9c5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -102,7 +102,11 @@ Fixed issues: Fixed Issues: +* [#13232](http://dev.ckeditor.com/ticket/13232): [Safari] Fixed: Method [`element.appendText()`](http://docs.ckeditor.com/#!/api/CKEDITOR.dom.element-method-appendText) work properly for empty elements. +* [#13233](http://dev.ckeditor.com/ticket/13233): Fixed: HTMLDataProcessor can process `foo:href` attributes. * [#12899](http://dev.ckeditor.com/ticket/12899): Fixed: Corrected wrong tag ending for horizontal box definition in the [Dialog User Interface](http://ckeditor.com/addon/dialogui) plugin. Thanks to [mizafish](https://github.com/mizafish)! +* [#13254](http://dev.ckeditor.com/ticket/13254): Fixed: Cannot outdent block after indent when using [Divarea](http://ckeditor.com/addon/divarea) plugin. Thanks to [Jonathan Cottrill](https://github.com/jcttrll)! +* [#13268](http://dev.ckeditor.com/ticket/13268): Fixed: Documentation for `CKEDITOR.dom.text` is incorrect. Thanks to [Ben Kiefer](https://github.com/benkiefer)! * [#12796](http://dev.ckeditor.com/ticket/12796): Fixed: The [Indent List](http://ckeditor.com/addon/indentlist) plugin unwraps parent `
This is some text
' * * @param {String} text The text to be appended. - * @returns {CKEDITOR.dom.node} The appended node. */ appendText: function( text ) { - if ( this.$.text != null ) + // On IE8 it is impossible to append node to script tag, so we use its text. + // On the contrary, on Safari the text property is unpredictable in links. (#13232) + if ( this.$.text != null && CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) this.$.text += text; else this.append( new CKEDITOR.dom.text( text ) ); diff --git a/core/dom/text.js b/core/dom/text.js index 3648c64c13d..7c403f90647 100644 --- a/core/dom/text.js +++ b/core/dom/text.js @@ -12,9 +12,9 @@ * Represents a DOM text node. * * var nativeNode = document.createTextNode( 'Example' ); - * var text = CKEDITOR.dom.text( nativeNode ); + * var text = new CKEDITOR.dom.text( nativeNode ); * - * var text = CKEDITOR.dom.text( 'Example' ); + * var text = new CKEDITOR.dom.text( 'Example' ); * * @class * @extends CKEDITOR.dom.node diff --git a/core/htmldataprocessor.js b/core/htmldataprocessor.js index 928975e3872..51d1d1f6bcd 100644 --- a/core/htmldataprocessor.js +++ b/core/htmldataprocessor.js @@ -772,7 +772,7 @@ // 'data-x' => '<a href="X"' // // which, can be easily filtered out (#11508). - protectAttributeRegex = /([\w-]+)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+))/gi, + protectAttributeRegex = /([\w-:]+)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+))/gi, protectAttributeNameRegex = /^(href|src|name)$/i; // Note: we use lazy star '*?' to prevent eating everything up to the last occurrence of or . diff --git a/plugins/colordialog/dialogs/colordialog.js b/plugins/colordialog/dialogs/colordialog.js index ab66a925035..152423ab7fd 100644 --- a/plugins/colordialog/dialogs/colordialog.js +++ b/plugins/colordialog/dialogs/colordialog.js @@ -236,14 +236,12 @@ CKEDITOR.dialog.add( 'colordialog', function( editor ) { oRow.setAttribute( 'role', 'row' ); // Create the gray scale colors cells. - for ( var n = 0; n < 6; n++ ) { - appendColorCell( oRow.$, '#' + aColors[ n ] + aColors[ n ] + aColors[ n ] ); - } - - // Fill the row with black cells. - for ( var i = 0; i < 12; i++ ) { - appendColorCell( oRow.$, '#000000' ); + appendColorCell( oRow.$, '#000000' ); + for ( var n = 0; n < 16; n++ ) { + var c = n.toString( 16 ); + appendColorCell( oRow.$, '#' + c + c + c + c + c + c ); } + appendColorCell( oRow.$, '#ffffff' ); } var numbering = function( id ) { diff --git a/plugins/forms/dialogs/hiddenfield.js b/plugins/forms/dialogs/hiddenfield.js index 2caa8152ff6..65c259c2f60 100644 --- a/plugins/forms/dialogs/hiddenfield.js +++ b/plugins/forms/dialogs/hiddenfield.js @@ -26,8 +26,9 @@ CKEDITOR.dialog.add( 'hiddenfield', function( editor ) { onOk: function() { var name = this.getValueOf( 'info', '_cke_saved_name' ), editor = this.getParentEditor(), - elementHtml = ( CKEDITOR.document.$.documentMode < 8 ? '' : 'input' ), - element = CKEDITOR.env.ie && editor.document.createElement( elementHtml ); + element = CKEDITOR.env.ie && CKEDITOR.document.$.documentMode < 8 ? + editor.document.createElement( '' ) : + editor.document.createElement( 'input' ); element.setAttribute( 'type', 'hidden' ); this.commitContent( element ); diff --git a/plugins/indentblock/plugin.js b/plugins/indentblock/plugin.js index 0e4f043bc5c..63bb70bf147 100644 --- a/plugins/indentblock/plugin.js +++ b/plugins/indentblock/plugin.js @@ -53,7 +53,9 @@ // Switch context from somewhere inside list item to list item, // if not found just assign self (doing nothing). if ( !firstBlock.is( $listItem ) ) { - firstBlock = firstBlock.getAscendant( $listItem ) || firstBlock; + var ascendant = firstBlock.getAscendant( $listItem ); + + firstBlock = ( ascendant && path.contains( ascendant ) ) || firstBlock; } // Switch context from list item to list diff --git a/tests/_benderjs/ckeditor/static/tools.js b/tests/_benderjs/ckeditor/static/tools.js index c4d6f5852f2..c30507a8fff 100644 --- a/tests/_benderjs/ckeditor/static/tools.js +++ b/tests/_benderjs/ckeditor/static/tools.js @@ -271,7 +271,7 @@ if ( fixStyles ) { html = html.replace( / style="([^"]+)"/g, function( match, style ) { - style = CKEDITOR.tools.writeCssText( CKEDITOR.tools.parseCssText( style, true ) ); + style = CKEDITOR.tools.writeCssText( CKEDITOR.tools.parseCssText( style, true ), true ); // Encode e.g. "" in urls(). style = CKEDITOR.tools.htmlEncodeAttr( style ); diff --git a/tests/core/dom/element/element.js b/tests/core/dom/element/element.js index ad75b6880f9..caf46e05495 100644 --- a/tests/core/dom/element/element.js +++ b/tests/core/dom/element/element.js @@ -133,6 +133,13 @@ bender.test( appendDomObjectTests( assert.areEqual( 'Test appendText', element.$.text ); }, + // #13232 + 'test appendText to link': function() { + var element = newElement( 'a' ); + element.appendText( '@' ); + assert.areEqual( '@', element.getText() ); + }, + test_setHtml: function() { var element = newElement( document.getElementById( 'append' ) ); element.setHtml( 'Test' ); diff --git a/tests/core/dom/range/misc.js b/tests/core/dom/range/misc.js index 1b0dd7516e7..522f7e74b15 100644 --- a/tests/core/dom/range/misc.js +++ b/tests/core/dom/range/misc.js @@ -255,10 +255,27 @@ assert.areEqual( 'some
[]
[]
x
a{}b
x
', 'x
ab
x
', 'tc1a' ); - t.a( 'x
a[]b
x
', 'x
ab
x
', 'tc1b' ); + t.a( 'x
a{}b
x
', 'x
a#b
x
', 'tc1a' ); + t.a( 'x
a[]b
x
', 'x
a#b
x
', 'tc1b' ); t.a( 'x
{ab}
x
', 'x
ab
x
', 'tc2a' ); t.a( 'x
[ab]
x
', 'x
ab
x
', 'tc2b' ); t.a( '{x
a}b
x
', 'x
ab
x
', 'tc3' ); @@ -638,14 +657,14 @@ t.a( '{this is some sample} text
', 'this is some sample text
', 'tc2.1' ); // This behavior is broken. We keep this TC as a backwards compat test. t.a( '{this is some sample} text
', - 'this is some sample text
', 'tc2.2' ); + 'this is some sample text
', 'tc2.2' ); t.a( '{this is some sample} text
this is some sample text
', 'tc3.1' ); t.a( '{this is some sample} text
this is some sample text
', 'tc3.2' ); t.a( '{this is some sample} text
this is some sample text
{this is some sample} text
this is some sample text
this is some sample text
{this is some sample} text
', 'this is some sample text
', 'tc1.1' ); - t.a( '{this is some sample} text
', 'this is some sample text
', 'tc1.2' ); - t.a( '{this is some sample} text
', 'this is some sample text
', 'tc1.3' ); + t.a( '{this is some sample} text
', 'this is some sample text
', 'tc1.1' ); + t.a( '{this is some sample} text
', 'this is some sample text
', 'tc1.2' ); + t.a( '{this is some sample} text
', 'this is some sample text
', 'tc1.3' ); t.a( '{this is some sample} text
', - 'this is some sample text
', 'tc1.4' ); + 'this is some sample text
', 'tc1.4' ); - t.a( '{this is some sample} text
', 'this is some sample text
', 'tc2.1' ); + t.a( '{this is some sample} text
', 'this is some sample text
', 'tc2.1' ); t.a( '{this is some sample} text
', - 'this is some sample text
', 'tc2.2' ); + 'this is some sample text
', 'tc2.2' ); - t.a( '{this is some sample} text
', 'this is some sample text
', 'tc3.1' ); - t.a( '{this is some sample} text
', 'this is some sample text
', 'tc3.2' ); + t.a( '{this is some sample} text
', 'this is some sample text
', 'tc3.1' ); + t.a( '{this is some sample} text
', 'this is some sample text
', 'tc3.2' ); t.a( '{this is some sample} text
', - 'this is some sample text
', 'tc3.3' ); + 'this is some sample text
', 'tc3.3' ); t.a( '{this is some sample} text
', - 'this is some sample text
', 'tc3.4' ); + 'this is some sample text
', 'tc3.4' ); t = createAssertionFunction2( tcs, 'test remove inline style - override style with attrs/styles', @@ -698,7 +717,7 @@ t.r( '{this is some sample} text
', 'this is some sample text
', 'tc2.1' ); // This behavior is broken. We keep this TC as a backwards compat test. t.r( '{this is some sample} text
', - 'this is some sample text
', 'tc2.2' ); + 'this is some sample text
', 'tc2.2' ); // Compare with tc2.1... t.r( '{this is some sample} text
this is some sample text
{this is some sample} text
this is some sample text
{this is some sample} text
this is some sample text
this is some sample text
{this is some sample} text
', 'this is some sample text
', 'tc2' ); t.a( '{this is some sample} text
', 'this is some sample text
', 'tc3' ); t.a( '{this is some sample} text
', - 'this is some sample text
', 'tc4' ); + 'this is some sample text
', 'tc4' ); t = createAssertionFunction2( tcs, 'test remove inline style - override similar style', @@ -771,13 +790,13 @@ // Compare with the previous section... t.r( 'this {is some sample} text
', 'this is some sample text
', 'tc1.3' ); t.r( 'this {is some sample} text
', - 'this is some sample text
', 'tc1.4' ); + 'this is some sample text
', 'tc1.4' ); t.r( '{this is some sample} text
', 'this is some sample text
', 'tc2.1' ); t.r( '{this is some sample} text
', 'this is some sample text
', 'tc2.2' ); t.r( '{this is some sample} text
', 'this is some sample text
', 'tc2.3' ); t.r( '{this is some sample} text
', - 'this is some sample text
', 'tc2.4' ); + 'this is some sample text
', 'tc2.4' ); // diff --git a/tests/tickets/13254/1.html b/tests/tickets/13254/1.html new file mode 100644 index 00000000000..5f8ca7a845c --- /dev/null +++ b/tests/tickets/13254/1.html @@ -0,0 +1,7 @@ +hello{}
' ); + + assert.areSame( 2, editor.getCommand( 'indent' ).state, 'initial indent state' ); + assert.areSame( 0, editor.getCommand( 'outdent' ).state, 'initial outdent state' ); + + editor.execCommand( 'indent' ); + + assert.areSame( 2, editor.getCommand( 'indent' ).state, 'indent state after indenting' ); + assert.areSame( 2, editor.getCommand( 'outdent' ).state, 'outdent state after indenting' ); + + editor.execCommand( 'outdent' ); + + assert.areSame( 2, editor.getCommand( 'indent' ).state, 'indent state after outdenting' ); + assert.areSame( 0, editor.getCommand( 'outdent' ).state, 'outdent state after outdenting' ); + } +} ); diff --git a/tests/tickets/13254/2.html b/tests/tickets/13254/2.html new file mode 100644 index 00000000000..b9a34a53f29 --- /dev/null +++ b/tests/tickets/13254/2.html @@ -0,0 +1,13 @@ +