/dev/qulogic/ckeditor: 9d8e4cd7c650: Override icon paths in defa...

Elliott Sales de Andrade qulogic at pidgin.im
Fri Aug 9 03:13:30 EDT 2013


Changeset: 9d8e4cd7c6507d39bb15dba58cc62719e1edc394
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2013-08-08 04:03 -0400
Branch:	 default
URL: https://hg.pidgin.im/dev/qulogic/ckeditor/rev/9d8e4cd7c650

Description:

Override icon paths in default theme with themed icons.

Some of these (the Pidgin ones) don't work yet as they aren't installed
in the icon theme directory. That will change eventually.

diffstat:

 pidgin/ckeditor/skins/pidgin/skin.js |  47 ++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)

diffs (54 lines):

diff --git a/pidgin/ckeditor/skins/pidgin/skin.js b/pidgin/ckeditor/skins/pidgin/skin.js
--- a/pidgin/ckeditor/skins/pidgin/skin.js
+++ b/pidgin/ckeditor/skins/pidgin/skin.js
@@ -206,3 +206,50 @@ CKEDITOR.skin.chameleon = (function() {
 	};
 })();
 
+CKEDITOR.skin.originalGetIconStyle = CKEDITOR.skin.getIconStyle;
+CKEDITOR.skin.getIconStyle = (function() {
+	var THEME_ICONS = {
+		bold: 'format-text-bold',
+		italic: 'format-text-italic',
+		strike: 'format-text-strikethrough',
+		underline: 'format-text-underline',
+		cut: 'edit-cut',
+		copy: 'edit-copy',
+		paste: 'edit-paste',
+		undo: 'edit-undo',
+		'undo-rtl': 'edit-undo-rtl',
+		redo: 'edit-redo',
+		'redo-rtl': 'edit-redo-rtl',
+		//bgcolor: 'pidgin-bgcolor',
+		//textcolor: 'pidgin-fgcolor',
+		//removeformat: 'pidgin-clear',
+		image: 'insert-image',
+		link: 'insert-link'
+	};
+
+	return function( name, rtl, overridePath, overrideOffset, overrideBgsize ) {
+		var theme;
+
+		if ( name ) {
+			name = name.toLowerCase();
+
+			if ( rtl )
+				theme = THEME_ICONS[ name + '-rtl' ];
+
+			if ( !theme )
+				theme = THEME_ICONS[ name ];
+		}
+
+		if ( theme ) {
+			var icon, bgsize;
+
+			icon = this.icons[ name ];
+			bgsize = overrideBgsize || ( icon && icon.bgsize ) || '16px';
+
+			return 'background-image:url(icon:' + theme + ':' + bgsize + ');background-size:' + bgsize + ';';
+		}
+
+		return this.originalGetIconStyle( name, rtl, overridePath, overrideOffset, overrideBgsize );
+	};
+})();
+



More information about the Commits mailing list