Skip to content
Permalink
Browse files

Merge branch 't/12256'

  • Loading branch information...
Reinmar committed Mar 25, 2015
2 parents 2599ba1 + 29ec90d commit e8a747d426c26782a4780d263d3de51be40b565a
@@ -10,11 +10,12 @@ Fixed Issues:
* [#12885](http://dev.ckeditor.com/ticket/12885): Added missing getData parameter documentation.
* [#11982](http://dev.ckeditor.com/ticket/11982): Bullet added in wrong position after *enter* key pressed in nested list.
* [#13027](http://dev.ckeditor.com/ticket/13027): Fixed: Keyboard Navigation in dialogs with multiple tabs not following CI 162 instructions or [ARIA Authoring practices](http://www.w3.org/TR/2013/WD-wai-aria-practices-20130307/#tabpanel).
* [#12256](http://dev.ckeditor.com/ticket/12256): Fixed: Basic styles' classes are lost when pasting from MS Word if [basics styles](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-coreStyles_bold) were configured to use classes.

Other Changes:

* [#12844](http://dev.ckeditor.com/ticket/12844): Upgraded the [testing environment](http://docs.ckeditor.com/#!/guide/dev_tests) to [Bender.js](https://github.com/benderjs/benderjs) `0.2.*`.
* [#12930](http://dev.ckeditor.com/ticket/12930): Because of licenses, removed truncated-mathjax from the test directory, now `bender.config.mathJaxLibPath` need to be configured manually.
* [#12930](http://dev.ckeditor.com/ticket/12930): Because of licenses, removed `truncated-mathjax/` from the `tests/` directory. Now `bender.config.mathJaxLibPath` must be configured manually in order to run MathJax plugin's tests.

## CKEditor 4.4.7

@@ -596,6 +596,10 @@
element.name = styleDef.element;
CKEDITOR.tools.extend( element.attributes, CKEDITOR.tools.clone( styleDef.attributes ) );
element.addStyle( CKEDITOR.style.getStyleText( styleDef ) );
// Mark style classes as allowed so they will not be filtered out (#12256).
if ( styleDef.attributes && styleDef.attributes[ 'class' ] ) {
element.classWhiteList = ' ' + styleDef.attributes[ 'class' ] + ' ';
}
} : function() {};
},

@@ -1058,7 +1062,13 @@
// Only Firefox carry style sheet from MS-Word, which
// will be applied by us manually. For other browsers
// the css className is useless.
'class': falsyFilter,
// We need to keep classes added as a style (#12256).
'class': function( value, element ) {
if ( element.classWhiteList && element.classWhiteList.indexOf( ' ' + value + ' ' ) != -1 ) {
return value;
}
return false;
},

// MS-Word always generate 'background-color' along with 'bgcolor',
// simply drop the deprecated attributes.
@@ -0,0 +1,4 @@
.myboldclass {
font-weight: bold;
color: red;
}
@@ -0,0 +1,18 @@
<textarea cols="80" id="editor1" name="editor1" rows="10">
&lt;p&gt;&lt;b&gt;Apollo 11&lt;/b&gt; was the spaceflight that landed the first humans, Americans &lt;a href=&quot;http://en.wikipedia.org/wiki/Neil_Armstrong&quot; title=&quot;Neil Armstrong&quot;&gt;Neil Armstrong&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Buzz_Aldrin&quot; title=&quot;Buzz Aldrin&quot;&gt;Buzz Aldrin&lt;/a&gt;, on the Moon on July 20, 1969, at 20:18 UTC. Armstrong became the first to step onto the lunar surface 6 hours later on July 21 at 02:56 UTC.&lt;/p&gt;
</textarea>
<script>
var editor = CKEDITOR.replace( 'editor1', {
coreStyles_bold: {
element: 'span',
attributes: { 'class': 'myboldclass' },
overrides: [ 'strong', 'b' ]
},
contentsCss: '_assets/removedclasses.css',
allowedContent: true
} );
editor.on( 'paste', function( evt ) {
console.log( evt.data.dataValue );
} );
</script>
@@ -0,0 +1,6 @@
@bender-ui: collapsed
@bender-ckeditor-plugins: wysiwygarea, toolbar, undo, basicstyles, pastefromword, sourcearea, elementspath

1. Paste bold text from word.

Expected result: bold text should be bold and red.
@@ -23,6 +23,36 @@
} );

wait();
},

'test keep custom class': function() {
bender.editorBot.create( {
name: 'keep_custom_class',
config: {
coreStyles_bold: {
element: 'span',
attributes: { 'class': 'customboldclass' },
overrides: [ 'strong', 'b' ]
},
allowedContent: true
}
}, function( bot ) {
var editor = bot.editor;

editor.once( 'paste', function( evt ) {
var dataValue = evt.data.dataValue;
resume( function() {
assert.areSame( '<p>Foo <span class="customboldclass">bar</span> bom</p>', dataValue );
} );
}, null, null, 5 ); // Test PFW only.

editor.fire( 'paste', {
type: 'auto',
dataValue: '<p style="margin: 0cm 0cm 8pt;"><font face="Calibri">Foo <b style="mso-bidi-font-weight: normal;">bar</b> bom</font></p>'
} );

wait();
} );
}
} );

0 comments on commit e8a747d

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