Skip to content

Commit e634323

Browse files
committed
Merge branch 't/13361'
2 parents a1cbaa5 + cccaf79 commit e634323

File tree

8 files changed

+124
-2
lines changed

8 files changed

+124
-2
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@ CKEditor 4 Changelog
33

44
## CKEditor 4.5.5
55

6+
Fixed Issues:
7+
68
* [#13790](https://dev.ckeditor.com/ticket/13790): Fixed: Allow for the iframe having been removed already. Thanks to [Stefan Rijnhart](https://github.com/StefanRijnhart)!
79
* [#13803](https://dev.ckeditor.com/ticket/13803): Fixed: Allow the editor to be destroyed before being fully initialized. Thanks to [Cyril Fluck](https://github.com/cyril-sf)!
10+
* [#13361](http://dev.ckeditor.com/ticket/13361): Fixed: Images fail when site path includes parentheses because background-image path needs single-quotes around URL value.
811

912
## CKEditor 4.5.4
1013

core/skin.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/**
1+
/**
22
* @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
33
* For licensing, see LICENSE.md or http://ckeditor.com/license
44
*/
@@ -125,8 +125,12 @@
125125
offset = overrideOffset || ( icon && icon.offset );
126126
bgsize = overrideBgsize || ( icon && icon.bgsize ) || '16px';
127127

128+
// If we use apostrophes in background-image, we must escape apostrophes in path (just to be sure). (#13361)
129+
if ( path )
130+
path = path.replace( /'/g, '\\\'' );
131+
128132
return path &&
129-
( 'background-image:url(' + CKEDITOR.getUrl( path ) + ');background-position:0 ' + offset + 'px;background-size:' + bgsize + ';' );
133+
( 'background-image:url(\'' + CKEDITOR.getUrl( path ) + '\');background-position:0 ' + offset + 'px;background-size:' + bgsize + ';' );
130134
}
131135
};
132136

tests/tickets/13361/1.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/* bender-tags: skin, button, 13361 */
2+
/* bender-ckeditor-plugins: button, toolbar */
3+
4+
( function() {
5+
'use strict';
6+
7+
var globalPath = window.location.protocol + '//' + window.location.host + '%TEST_DIR%' + '_assets/',
8+
saveIcon = globalPath + '(.png',
9+
pasteIcon = globalPath + '\'.png',
10+
undoIcon = globalPath + ').png';
11+
12+
bender.editor = {
13+
config: {
14+
toolbar: [ [ 'custom_save', 'custom_paste', 'custom_undo' ] ],
15+
on: {
16+
pluginsLoaded: function( evt ) {
17+
var ed = evt.editor;
18+
19+
CKEDITOR.skin.addIcon( 'custom_save', saveIcon );
20+
CKEDITOR.skin.addIcon( 'custom_paste', pasteIcon );
21+
CKEDITOR.skin.addIcon( 'custom_undo', undoIcon );
22+
23+
ed.ui.addButton( 'custom_save', {
24+
label: 'simple button with save icon'
25+
} );
26+
ed.ui.addButton( 'custom_paste', {
27+
label: 'simple button with paste icon'
28+
} );
29+
ed.ui.addButton( 'custom_undo', {
30+
label: 'simple button with undo icon'
31+
} );
32+
}
33+
}
34+
}
35+
};
36+
37+
bender.test( {
38+
'test icon with opening parenthesis': function() {
39+
var saveBtn = this.editor.ui.get( 'custom_save' ),
40+
saveBtnEl = CKEDITOR.document.getById( saveBtn._.id ),
41+
saveBtnIcon = saveBtnEl.$.firstChild;
42+
43+
// Strict comparision doesn't make sense as old IEs return URI in other format;
44+
// yet all browsers set elem.style.backgroundImage only if string is syntactically correct.
45+
assert.areNotSame( '', saveBtnIcon.style.backgroundImage,
46+
'check if custom_save button has correctly defined background-image' );
47+
},
48+
49+
'test icon with closing parenthesis': function() {
50+
var undoBtn = this.editor.ui.get( 'custom_undo' ),
51+
undoBtnEl = CKEDITOR.document.getById( undoBtn._.id ),
52+
undoBtnIcon = undoBtnEl.$.firstChild;
53+
54+
assert.areNotSame( '', undoBtnIcon.style.backgroundImage,
55+
'check if custom_undo button has correctly defined background-image' );
56+
},
57+
58+
'test icon with apostrophe': function() {
59+
var pasteBtn = this.editor.ui.get( 'custom_paste' ),
60+
pasteBtnEl = CKEDITOR.document.getById( pasteBtn._.id ),
61+
pasteBtnIcon = pasteBtnEl.$.firstChild;
62+
63+
assert.areNotSame( '', pasteBtnIcon.style.backgroundImage,
64+
'check if custom_paste button has correctly defined background-image' );
65+
}
66+
} );
67+
} )();

tests/tickets/13361/2.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<body>
2+
<div id="editor">
3+
<p>Example text</p>
4+
</div>
5+
6+
<script>
7+
( function() {
8+
'use strict';
9+
10+
var globalPath = window.location.protocol + '//' + window.location.host + '%TEST_DIR%' + '_assets/';
11+
12+
CKEDITOR.replace( 'editor', {
13+
toolbar: [ [ 'custom_save', 'custom_paste', 'custom_undo' ] ],
14+
on: {
15+
pluginsLoaded: function( evt ) {
16+
var ed = evt.editor;
17+
18+
CKEDITOR.skin.addIcon( 'custom_save', globalPath + '(.png' );
19+
CKEDITOR.skin.addIcon( 'custom_paste', globalPath + '\'.png' );
20+
CKEDITOR.skin.addIcon( 'custom_undo', globalPath + ').png');
21+
22+
ed.ui.addButton( 'custom_save', {
23+
label: 'simple button with save icon'
24+
} );
25+
ed.ui.addButton( 'custom_paste', {
26+
label: 'simple button with paste icon'
27+
} );
28+
ed.ui.addButton( 'custom_undo', {
29+
label: 'simple button with undo icon'
30+
} );
31+
}
32+
}
33+
} );
34+
} )();
35+
</script>
36+
</body>

tests/tickets/13361/2.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
@bender-tags: tc, skin, button, 13361, 4.5.5
2+
@bender-ui: collapsed
3+
@bender-ckeditor-plugins: button, toolbar
4+
5+
----
6+
7+
1. Look at the editor's toolbar.
8+
9+
**Expected:**
10+
* The button on the left should contain "save" icon.
11+
* The button in the middle should contain "paste" icon.
12+
* The button on the right should contain "undo" icon.

tests/tickets/13361/_assets/'.png

1.01 KB
Loading

tests/tickets/13361/_assets/(.png

310 Bytes
Loading

tests/tickets/13361/_assets/).png

397 Bytes
Loading

0 commit comments

Comments
 (0)