Skip to content

Commit 488b2fe

Browse files
author
Sergi Mansilla
committed
Merge pull request #948 from ajaxorg/ext/theme_viewer
Ext/theme viewer
2 parents 72b154e + b2cab08 commit 488b2fe

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

client/ext/themes/themes.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,39 @@ module.exports = ext.register("ext/themes/themes", {
1818
offline : false,
1919
type : ext.GENERAL,
2020
nodes : [],
21+
currTheme : "",
22+
saved : false,
2123

2224
register : function(themes){
25+
var _self = this;
26+
2327
for (var name in themes) {
2428
this.nodes.push(
2529
mnuThemes.appendChild(new apf.item({
2630
caption : name,
27-
type : "radio",
28-
value : themes[name]
31+
type : "item",
32+
value : themes[name],
33+
onmouseover: function(e) {
34+
_self.currTheme = settings.model.queryValue("editors/code/@theme");
35+
settings.model.setQueryValue("editors/code/@theme", this.value);
36+
_self.saved = false;
37+
},
38+
onmouseout: function(e) {
39+
if (!_self.saved) {
40+
settings.model.setQueryValue("editors/code/@theme", _self.currTheme);
41+
_self.saved = false;
42+
}
43+
}
2944
}))
3045
);
3146
}
3247
},
3348

34-
set : function(path){
49+
set : function(path, dispatch){
3550
//Save theme settings
3651
settings.model.setQueryValue("editors/code/@theme", path);
3752
settings.save();
53+
this.saved = true;
3854
ide.dispatchEvent("track_action", {type: "theme change", theme: path});
3955
},
4056

@@ -54,7 +70,7 @@ module.exports = ext.register("ext/themes/themes", {
5470
}))
5571
);
5672
},
57-
73+
5874
enable : function(){
5975
},
6076

0 commit comments

Comments
 (0)