Skip to content

Commit 3f161cb

Browse files
committed
Merge branch 't/9923' into major
2 parents 0b15e93 + 32cd201 commit 3f161cb

File tree

325 files changed

+13326
-2217
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

325 files changed

+13326
-2217
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CKEditor 4 Changelog
77
* [#10042](http://dev.ckeditor.com/ticket/10042): Introduced config.title to change the human-readable title of the editor.
88
* [#10370](http://dev.ckeditor.com/ticket/10370): Inconsistency in data events between framed and inline editors.
99
* [#9794](http://dev.ckeditor.com/ticket/9794): OnChange event.
10+
* [#9923](http://dev.ckeditor.com/ticket/9923): HiDPI support in editor UI. HiDPI icons for Moono skin.
1011

1112
## CKEditor 4.1.2
1213

core/env.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,16 @@ if ( !CKEDITOR.env ) {
277277
false
278278
);
279279

280+
/**
281+
* Indicates that CKEditor is running in HiDPI environment.
282+
*
283+
* if ( CKEDITOR.env.hidpi )
284+
* alert( 'You are using a screen with high pixel density.' );
285+
*
286+
* @property {Boolean}
287+
*/
288+
env.hidpi = window.devicePixelRatio >= 2;
289+
280290
/**
281291
* The CSS class to be appended on the main UI containers, making it
282292
* easy to apply browser specific styles to it.
@@ -310,6 +320,9 @@ if ( !CKEDITOR.env ) {
310320
if ( env.iOS )
311321
env.cssClass += ' cke_browser_ios';
312322

323+
if ( env.hidpi )
324+
env.cssClass += ' cke_hidpi';
325+
313326
return env;
314327
})();
315328
}

core/plugindefinition.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,20 @@
7777
* @method init
7878
* @param {CKEDITOR.editor} editor The editor instance being initialized.
7979
*/
80+
81+
/**
82+
* Announces the plugin as HiDPI-ready (optimized for hi-density screens e.g. *Retina*)
83+
* by providing high-resolution icons and images. HiDPI icons must be twice as big
84+
* (defaults are `16px x 16px`) and stored under `plugin_name/icons/hidpi/` directory.
85+
*
86+
* The common place for additional HiDPI images used by the plugin (**but not icons**)
87+
* is `plugin_name/images/hidpi/` directory.
88+
*
89+
* This property is optional and only makes sense if `32px x 32px` icons
90+
* and high-resolution images actually exist. Editor will automatically detect
91+
* the HiDPI environment and attempt to load the high-resolution resources
92+
* if this flag is set `true`.
93+
*
94+
* @since 4.2
95+
* @property {Boolean} hidpi
96+
*/

core/plugins.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,13 @@ CKEDITOR.plugins.load = CKEDITOR.tools.override( CKEDITOR.plugins.load, function
3838
// Register all icons eventually defined by this plugin.
3939
if ( plugin.icons ) {
4040
var icons = plugin.icons.split( ',' );
41-
for ( var ic = 0 ; ic < icons.length ; ic++ ) {
42-
CKEDITOR.skin.addIcon( icons[ ic ], plugin.path + 'icons/' + icons[ ic ] + '.png' );
41+
for ( var ic = icons.length; ic--; ) {
42+
CKEDITOR.skin.addIcon( icons[ ic ],
43+
plugin.path +
44+
'icons/' +
45+
( CKEDITOR.env.hidpi && plugin.hidpi ? 'hidpi/' : '' ) +
46+
icons[ ic ] +
47+
'.png' );
4348
}
4449
}
4550
initialized[ pluginName ] = 1;

core/skin.js

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,16 @@
7676
* @param {String} path The path to reach the icon image file.
7777
* @param {Number} [offset] The vertical offset position of the icon, if
7878
* available inside a strip image.
79+
* @param {String} [bgsize] The value of CSS "background-size" property to
80+
* use for this icon
7981
*/
80-
addIcon: function( name, path, offset ) {
82+
addIcon: function( name, path, offset, bgsize ) {
8183
name = name.toLowerCase();
8284
if ( !this.icons[ name ] ) {
8385
this.icons[ name ] = {
8486
path: path,
85-
offset: offset || 0
87+
offset: offset || 0,
88+
bgsize : bgsize || '16px'
8689
};
8790
}
8891
},
@@ -99,9 +102,12 @@
99102
* @param {Number} [overrideOffset] The vertical offset position of the
100103
* icon. It overrides the offset defined by the named icon, if
101104
* available, and is used if the named icon was not registered.
105+
* @param {String} [overrideBgsize] The value of CSS "background-size" property
106+
* to use for the icon. It overrides the value defined by the named icon,
107+
* if available, and is used if the named icon was not registered.
102108
*/
103-
getIconStyle: function( name, rtl, overridePath, overrideOffset ) {
104-
var icon, path, offset;
109+
getIconStyle: function( name, rtl, overridePath, overrideOffset, overrideBgsize ) {
110+
var icon, path, offset, bgsize;
105111

106112
if ( name ) {
107113
name = name.toLowerCase();
@@ -116,9 +122,10 @@
116122

117123
path = overridePath || ( icon && icon.path ) || '';
118124
offset = overrideOffset || ( icon && icon.offset );
125+
bgsize = overrideBgsize || ( icon && icon.bgsize ) || '16px';
119126

120127
return path &&
121-
( 'background-image:url(' + CKEDITOR.getUrl( path ) + ');background-position:0 ' + offset + 'px;' );
128+
( 'background-image:url(' + CKEDITOR.getUrl( path ) + ');background-position:0 ' + offset + 'px;background-size:' + bgsize + ';' );
122129
}
123130
};
124131

@@ -283,12 +290,12 @@
283290
* @todo type?
284291
*/
285292

286-
/**
287-
* Current skin name.
288-
*
289-
* @property {String} name
290-
* @todo
291-
*/
293+
/**
294+
* Current skin name.
295+
*
296+
* @property {String} name
297+
* @todo
298+
*/
292299

293300
/**
294301
* The editor skin name. Note that is is not possible to have editors with

dev/builder/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set -e
99
echo "CKBuilder - Builds a release version of ckeditor-dev."
1010
echo ""
1111

12-
CKBUILDER_VERSION="1.6.1"
12+
CKBUILDER_VERSION="1.7"
1313
CKBUILDER_URL="http://download.cksource.com/CKBuilder/$CKBUILDER_VERSION/ckbuilder.jar"
1414

1515
PROGNAME=$(basename $0)

dev/iconextractor/iconextractor.py

Lines changed: 0 additions & 232 deletions
This file was deleted.

0 commit comments

Comments
 (0)