Skip to content
Permalink
Browse files

Merge branch 't/10032'

  • Loading branch information...
Reinmar committed Dec 17, 2014
2 parents cfae144 + a9d402e commit 13fd47ce40062edbd48657af70d9e7e60754562d
@@ -8,6 +8,7 @@ Fixed Issues:
* [#12747](http://dev.ckeditor.com/ticket/12747): [IE8-10] Fixed: Opening a drop-down for a specific selection when editor is maximized results in incorrect drop-down panel position.
* [#12735](http://dev.ckeditor.com/ticket/12735): Fixed: [`Config.fillEmptyBlocks`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-fillEmptyBlocks) should only apply when outputting data.
* [#12750](http://dev.ckeditor.com/ticket/12750): Fixed: [Paste from Word](http://ckeditor.com/addon/pastefromword): strikethrough and underscore should have the same color as font.
* [#10032](http://dev.ckeditor.com/ticket/10032): Fixed: [Paste from Word](http://ckeditor.com/addon/pastefromword) filter is executed for every paste after using the button.

## CKEditor 4.4.6

@@ -76,6 +76,8 @@
else if ( !editor.config.pasteFromWordPromptCleanup || ( forceFromWord || confirm( editor.lang.pastefromword.confirmCleanup ) ) ) // jshint ignore:line
data.dataValue = CKEDITOR.cleanWord( mswordHtml, editor );

// Reset forceFromWord.
forceFromWord = 0;
} );

// The cleanup rules are to be loaded, we should just cancel
@@ -0,0 +1,80 @@
/* exported testScenario */

'use strict';

// Scenario is a sequence (array) of pasted to be fired. True (1) means paste from word, false (0) means regular paste.
function testScenario( scenario, filterPath ) {
bender.editor = {
config: {
pasteFromWordCleanupFile: filterPath
}
};

var stub;

bender.test( {
tearDown: function() {
if ( stub ) {
stub.restore();
stub = null;
}
},

// #10032
'test reset forceFromWord': function() {
var editor = this.editor,
pasteHtml = '<p>foo</p>',
i = 0;


stub = sinon.stub( editor, 'getClipboardData', function( options, callback ) {
if ( callback ) {
callback( { dataValue: pasteHtml } );
}
} );

editor.once( 'paste', paste, null, null, 999 );

firePaste( editor, scenario[ i ] );

wait();

function paste( evt ) {
resume( function() {
assertPaste( evt.data.dataValue, scenario[ i ], i );

if ( i == scenario.length ) {
return;
}

editor.once( 'paste', paste, null, null, 999 );

i++;

firePaste( editor, scenario[ i ] );

wait();
} );
}

function firePaste( editor, fromWord ) {
if ( fromWord ) {
editor.execCommand( 'pastefromword' );
} else {
editor.fire( 'paste', { dataValue: pasteHtml } );
}
}

function assertPaste( value, fromWord, index ) {
var expectedFromWord = 'ok',
expectedNotFromWord = '<p>foo</p>';

if ( fromWord ) {
assert.areSame( expectedFromWord, value, 'Paste nr ' + index + ' should be from word.' );
} else {
assert.areSame( expectedNotFromWord, value, 'Paste nr ' + index + ' should NOT be from word.' );
}
}
}
} );
}
@@ -0,0 +1,8 @@
/* bender-tags: editor,unit,clipboard */
/* bender-ckeditor-plugins: pastefromword */
/* bender-include: _helpers/resetforcefromword.js */
/* global testScenario */

'use strict';

testScenario( [ 1, 0, 1, 0, 0 ], '%TEST_DIR%_assets/customfilter.js' );
@@ -0,0 +1,8 @@
/* bender-tags: editor,unit,clipboard */
/* bender-ckeditor-plugins: pastefromword */
/* bender-include: _helpers/resetforcefromword.js */
/* global testScenario */

'use strict';

testScenario( [ 0, 1, 0, 1, 1, 0 ], '%TEST_DIR%_assets/customfilter.js' );

0 comments on commit 13fd47c

Please sign in to comment.
You can’t perform that action at this time.