From 60616deec06b22bdf6f1aac9d79f3a2ae171fb79 Mon Sep 17 00:00:00 2001 From: Matthew Kastor Date: Fri, 5 Apr 2013 16:49:18 -0400 Subject: [PATCH] add_editor_menu_options uses themelist to generate theme options --- .../ext/menu_tools/add_editor_menu_options.js | 106 +++--------------- 1 file changed, 13 insertions(+), 93 deletions(-) diff --git a/lib/ace/ext/menu_tools/add_editor_menu_options.js b/lib/ace/ext/menu_tools/add_editor_menu_options.js index 61296124..9e000685 100644 --- a/lib/ace/ext/menu_tools/add_editor_menu_options.js +++ b/lib/ace/ext/menu_tools/add_editor_menu_options.js @@ -52,7 +52,7 @@ * Matthew Christopher Kastor-Inare III
* ☭ Hial Atropa!! ☭ */ - + define(function(require, exports, module) { 'use strict'; @@ -67,6 +67,7 @@ define(function(require, exports, module) { */ module.exports.addEditorMenuOptions = function addEditorMenuOptions (editor) { var modelist = require('../modelist'); + var themelist = require('../themelist'); editor.menuOptions = { "setNewLineMode" : [{ "textContent" : "unix", @@ -79,103 +80,22 @@ module.exports.addEditorMenuOptions = function addEditorMenuOptions (editor) { "value" : "auto" } ], - "setTheme" : [{ - "textContent" : "ambiance", - "value" : "ace/theme/ambiance" - }, { - "textContent" : "chaos", - "value" : "ace/theme/chaos" - }, { - "textContent" : "chrome", - "value" : "ace/theme/chrome" - }, { - "textContent" : "clouds", - "value" : "ace/theme/clouds" - }, { - "textContent" : "clouds_midnight", - "value" : "ace/theme/clouds_midnight" - }, { - "textContent" : "cobalt", - "value" : "ace/theme/cobalt" - }, { - "textContent" : "crimson_editor", - "value" : "ace/theme/crimson_editor" - }, { - "textContent" : "dawn", - "value" : "ace/theme/dawn" - }, { - "textContent" : "dreamweaver", - "value" : "ace/theme/dreamweaver" - }, { - "textContent" : "eclipse", - "value" : "ace/theme/eclipse" - }, { - "textContent" : "github", - "value" : "ace/theme/github" - }, { - "textContent" : "idle_fingers", - "value" : "ace/theme/idle_fingers" - }, { - "textContent" : "kr", - "value" : "ace/theme/kr" - }, { - "textContent" : "merbivore", - "value" : "ace/theme/merbivore" - }, { - "textContent" : "merbivore_soft", - "value" : "ace/theme/merbivore_soft" - }, { - "textContent" : "monokai", - "value" : "ace/theme/monokai" - }, { - "textContent" : "mono_industrial", - "value" : "ace/theme/mono_industrial" - }, { - "textContent" : "pastel_on_dark", - "value" : "ace/theme/pastel_on_dark" - }, { - "textContent" : "solarized_dark", - "value" : "ace/theme/solarized_dark" - }, { - "textContent" : "solarized_light", - "value" : "ace/theme/solarized_light" - }, { - "textContent" : "textmate", - "value" : "ace/theme/textmate" - }, { - "textContent" : "tomorrow", - "value" : "ace/theme/tomorrow" - }, { - "textContent" : "tomorrow_night", - "value" : "ace/theme/tomorrow_night" - }, { - "textContent" : "tomorrow_night_blue", - "value" : "ace/theme/tomorrow_night_blue" - }, { - "textContent" : "tomorrow_night_bright", - "value" : "ace/theme/tomorrow_night_bright" - }, { - "textContent" : "tomorrow_night_eighties", - "value" : "ace/theme/tomorrow_night_eighties" - }, { - "textContent" : "twilight", - "value" : "ace/theme/twilight" - }, { - "textContent" : "vibrant_ink", - "value" : "ace/theme/vibrant_ink" - }, { - "textContent" : "xcode", - "value" : "ace/theme/xcode" - } - ], + "setTheme" : [], "setMode" : [] }; - modelist.modes.forEach(function (mode) { - editor.menuOptions.setMode.push({ + editor.menuOptions.setTheme = themelist.themes.map(function (theme) { + return { + 'textContent' : theme.desc, + 'value' : theme.theme + }; + }); + + editor.menuOptions.setMode = modelist.modes.map(function (mode) { + return { 'textContent' : mode.name, 'value' : mode.mode - }); + }; }); };