update code formatting, and general cleanup
This commit is contained in:
parent
95f822c6d8
commit
5894667b41
19 changed files with 1166 additions and 1237 deletions
|
|
@ -44,9 +44,10 @@ function bindKey(win, mac) {
|
|||
exports.commands = [{
|
||||
name: "showSettingsMenu",
|
||||
bindKey: bindKey("Ctrl-,", "Command-,"),
|
||||
exec: function (editor) {
|
||||
config.loadModule("ace/ext/show_keyboard_shortcuts", function (e) {
|
||||
e(editor);
|
||||
exec: function(editor) {
|
||||
config.loadModule("ace/ext/settings_menu", function(module) {
|
||||
module.init(editor);
|
||||
editor.showSettingsMenu();
|
||||
});
|
||||
},
|
||||
readOnly: true
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ var ElasticTabstopsLite = function(editor) {
|
|||
// todo: support multicursor
|
||||
|
||||
var tabs = [-1].concat(this.$tabsForRow(row));
|
||||
var widths = tabs.map(function (el) { return 0; } ).slice(1);
|
||||
var widths = tabs.map(function(el) { return 0; } ).slice(1);
|
||||
var line = this.$editor.session.getLine(row);
|
||||
|
||||
for (var i = 0, len = tabs.length - 1; i < len; i++) {
|
||||
|
|
|
|||
|
|
@ -30,17 +30,8 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*jslint
|
||||
indent: 4,
|
||||
maxerr: 50,
|
||||
white: true,
|
||||
browser: true,
|
||||
vars: true
|
||||
*/
|
||||
/*global
|
||||
define,
|
||||
require
|
||||
*/
|
||||
/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/
|
||||
/*global define, require */
|
||||
|
||||
/**
|
||||
* Show Keyboard Shortcuts
|
||||
|
|
@ -68,7 +59,7 @@ define(function(require, exports, module) {
|
|||
var getEditorKeybordShortcuts = require('./menu_tools/get_editor_keyboard_shortcuts').getEditorKeybordShortcuts;
|
||||
var kb = getEditorKeybordShortcuts(editor);
|
||||
var el = document.createElement('div');
|
||||
var commands = kb.reduce(function (previous, current) {
|
||||
var commands = kb.reduce(function(previous, current) {
|
||||
return previous + '<div><b>' + current.command + '</b> : ' +
|
||||
current.key + '</div>';
|
||||
}, '');
|
||||
|
|
@ -79,8 +70,8 @@ define(function(require, exports, module) {
|
|||
overlayPage(editor, el, '0', '0', '0', null);
|
||||
}
|
||||
};
|
||||
module.exports.init = function (editor) {
|
||||
Editor.prototype.showKeyboardShortcuts = function () {
|
||||
module.exports.init = function(editor) {
|
||||
Editor.prototype.showKeyboardShortcuts = function() {
|
||||
showKeyboardShortcuts(this);
|
||||
};
|
||||
editor.commands.addCommands([{
|
||||
|
|
@ -30,17 +30,8 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*jslint
|
||||
indent: 4,
|
||||
maxerr: 50,
|
||||
white: true,
|
||||
browser: true,
|
||||
vars: true
|
||||
*/
|
||||
/*global
|
||||
define,
|
||||
require
|
||||
*/
|
||||
/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/
|
||||
/*global define, require */
|
||||
|
||||
/**
|
||||
* Add Editor Menu Options
|
||||
|
|
@ -84,14 +75,14 @@ module.exports.addEditorMenuOptions = function addEditorMenuOptions (editor) {
|
|||
"setMode" : []
|
||||
};
|
||||
|
||||
editor.menuOptions.setTheme = themelist.themes.map(function (theme) {
|
||||
editor.menuOptions.setTheme = themelist.themes.map(function(theme) {
|
||||
return {
|
||||
'textContent' : theme.desc,
|
||||
'value' : theme.theme
|
||||
};
|
||||
});
|
||||
|
||||
editor.menuOptions.setMode = modelist.modes.map(function (mode) {
|
||||
editor.menuOptions.setMode = modelist.modes.map(function(mode) {
|
||||
return {
|
||||
'textContent' : mode.name,
|
||||
'value' : mode.mode
|
||||
|
|
|
|||
|
|
@ -30,17 +30,8 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*jslint
|
||||
indent: 4,
|
||||
maxerr: 50,
|
||||
white: true,
|
||||
browser: true,
|
||||
vars: true
|
||||
*/
|
||||
/*global
|
||||
define,
|
||||
require
|
||||
*/
|
||||
/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/
|
||||
/*global define, require */
|
||||
|
||||
/**
|
||||
* Element Generator
|
||||
|
|
@ -148,7 +139,7 @@ module.exports.createSelection = function createSelection (id, values, clss) {
|
|||
el.setAttribute('id', id);
|
||||
el.setAttribute('name', id);
|
||||
el.setAttribute('class', clss);
|
||||
values.forEach(function (item) {
|
||||
values.forEach(function(item) {
|
||||
el.appendChild(module.exports.createOption(item));
|
||||
});
|
||||
return el;
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ module.exports.generateSettingsMenu = function generateSettingsMenu (editor) {
|
|||
* ☭ Hial Atropa!! ☭
|
||||
*/
|
||||
function cleanupElementsList() {
|
||||
elements.sort(function (a, b) {
|
||||
elements.sort(function(a, b) {
|
||||
var x = a.getAttribute('contains');
|
||||
var y = b.getAttribute('contains');
|
||||
return x.localeCompare(y);
|
||||
|
|
@ -94,7 +94,7 @@ module.exports.generateSettingsMenu = function generateSettingsMenu (editor) {
|
|||
function wrapElements() {
|
||||
var topmenu = document.createElement('div');
|
||||
topmenu.setAttribute('id', 'settingsmenu');
|
||||
elements.forEach(function (element) {
|
||||
elements.forEach(function(element) {
|
||||
topmenu.appendChild(element);
|
||||
});
|
||||
return topmenu;
|
||||
|
|
@ -135,9 +135,9 @@ module.exports.generateSettingsMenu = function generateSettingsMenu (editor) {
|
|||
|
||||
if(Array.isArray(val)) {
|
||||
el = egen.createSelection(item, val, clss);
|
||||
el.addEventListener('change', function (e) {
|
||||
el.addEventListener('change', function(e) {
|
||||
try{
|
||||
editor.menuOptions[e.target.id].forEach(function (x) {
|
||||
editor.menuOptions[e.target.id].forEach(function(x) {
|
||||
if(x.textContent !== e.target.textContent) {
|
||||
delete x.selected;
|
||||
}
|
||||
|
|
@ -150,7 +150,7 @@ module.exports.generateSettingsMenu = function generateSettingsMenu (editor) {
|
|||
});
|
||||
} else if(typeof val === 'boolean') {
|
||||
el = egen.createCheckbox(item, val, clss);
|
||||
el.addEventListener('change', function (e) {
|
||||
el.addEventListener('change', function(e) {
|
||||
try{
|
||||
// renderer['setHighlightGutterLine'](true);
|
||||
obj[e.target.id](!!e.target.checked);
|
||||
|
|
@ -163,7 +163,7 @@ module.exports.generateSettingsMenu = function generateSettingsMenu (editor) {
|
|||
// post and get requests.
|
||||
// /ace_editor.html?setMode=ace/mode/html&setOverwrite=true
|
||||
el = egen.createInput(item, val, clss);
|
||||
el.addEventListener('blur', function (e) {
|
||||
el.addEventListener('blur', function(e) {
|
||||
try{
|
||||
if(e.target.value === 'true') {
|
||||
obj[e.target.id](true);
|
||||
|
|
@ -197,7 +197,7 @@ module.exports.generateSettingsMenu = function generateSettingsMenu (editor) {
|
|||
*/
|
||||
function makeDropdown(item, esr, clss, fn) {
|
||||
var val = editor.menuOptions[item];
|
||||
val = val.map(function (valuex) {
|
||||
val = val.map(function(valuex) {
|
||||
if(valuex.value === esr[fn]()) {
|
||||
valuex.selected = 'selected';
|
||||
} else if(valuex.value === esr.$modeId) {
|
||||
|
|
@ -258,7 +258,7 @@ module.exports.generateSettingsMenu = function generateSettingsMenu (editor) {
|
|||
}
|
||||
addEditorMenuOptions(editor);
|
||||
// gather the set functions
|
||||
getSetFunctions(editor).forEach(function (setObj) {
|
||||
getSetFunctions(editor).forEach(function(setObj) {
|
||||
// populate the elements array with good stuff.
|
||||
handleSet(setObj);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -30,17 +30,8 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*jslint
|
||||
indent: 4,
|
||||
maxerr: 50,
|
||||
white: true,
|
||||
browser: true,
|
||||
vars: true
|
||||
*/
|
||||
/*global
|
||||
define,
|
||||
require
|
||||
*/
|
||||
/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/
|
||||
/*global define, require */
|
||||
|
||||
/**
|
||||
* Get Editor Keyboard Shortcuts
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ module.exports.getSetFunctions = function getSetFunctions (editor) {
|
|||
'renderer',
|
||||
'session',
|
||||
'editor'
|
||||
].forEach(function (esra) {
|
||||
].forEach(function(esra) {
|
||||
var fn;
|
||||
var esr = my[esra];
|
||||
var clss = esra;
|
||||
|
|
|
|||
|
|
@ -30,17 +30,8 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*jslint
|
||||
indent: 4,
|
||||
maxerr: 50,
|
||||
white: true,
|
||||
browser: true,
|
||||
vars: true
|
||||
*/
|
||||
/*global
|
||||
define,
|
||||
require
|
||||
*/
|
||||
/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/
|
||||
/*global define, require */
|
||||
|
||||
/**
|
||||
* Overlay Page
|
||||
|
|
@ -87,7 +78,7 @@ module.exports.overlayPage = function overlayPage (editor, contentElement, top,
|
|||
'position: fixed; top:0; bottom:0; left:0; right:0;' +
|
||||
'z-index: 9990; ' +
|
||||
'background-color: rgba(0, 0, 0, 0.2);';
|
||||
closer.addEventListener('click', function () {
|
||||
closer.addEventListener('click', function() {
|
||||
document.removeEventListener('keydown', documentEscListener);
|
||||
closer.parentNode.removeChild(closer);
|
||||
editor.focus();
|
||||
|
|
@ -103,7 +94,7 @@ module.exports.overlayPage = function overlayPage (editor, contentElement, top,
|
|||
'box-shadow: rgba(126, 126, 126, 0.25) -20px 10px 25px; ' +
|
||||
'background-color: rgba(255, 255, 255, 0.6);' +
|
||||
'color: black; overflow: auto;';
|
||||
contentContainer.addEventListener('click', function (e) {
|
||||
contentContainer.addEventListener('click', function(e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ var SearchBox = function(editor, range, showReplaceForm) {
|
|||
this.editor.replaceAll(this.replaceInput.value);
|
||||
};
|
||||
|
||||
this.hide = function () {
|
||||
this.hide = function() {
|
||||
this.element.style.display = "none";
|
||||
this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb);
|
||||
this.editor.focus();
|
||||
|
|
|
|||
|
|
@ -30,18 +30,8 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*jslint
|
||||
indent: 4,
|
||||
maxerr: 50,
|
||||
white: true,
|
||||
browser: true,
|
||||
vars: true
|
||||
*/
|
||||
/*global
|
||||
define,
|
||||
require,
|
||||
getComputedStyle
|
||||
*/
|
||||
/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/
|
||||
/*global define, require */
|
||||
|
||||
/**
|
||||
* Show Settings Menu
|
||||
|
|
@ -77,18 +67,10 @@ define(function(require, exports, module) {
|
|||
* to the editor with appropriate keyboard shortcuts.
|
||||
* @param {ace.Editor} editor An instance of the Editor.
|
||||
*/
|
||||
module.exports.init = function (editor) {
|
||||
module.exports.init = function(editor) {
|
||||
var Editor = require("ace/editor").Editor;
|
||||
Editor.prototype.showSettingsMenu = function () {
|
||||
Editor.prototype.showSettingsMenu = function() {
|
||||
showSettingsMenu(this);
|
||||
};
|
||||
editor.commands.addCommands([{
|
||||
name: "showSettingsMenu",
|
||||
bindKey: {win: "Ctrl-q", mac: "Command-q"},
|
||||
exec: function(editor, line) {
|
||||
editor.showSettingsMenu();
|
||||
},
|
||||
readOnly: true
|
||||
}]);
|
||||
};
|
||||
});
|
||||
|
|
@ -62,7 +62,7 @@ exports.render = function(input, mode, theme, lineStart, disableGutter, callback
|
|||
// then we need to lazily load them.
|
||||
if (typeof theme == "string") {
|
||||
waiting++;
|
||||
config.loadModule(['theme', theme], function (m) {
|
||||
config.loadModule(['theme', theme], function(m) {
|
||||
theme = m;
|
||||
--waiting || done();
|
||||
});
|
||||
|
|
@ -70,7 +70,7 @@ exports.render = function(input, mode, theme, lineStart, disableGutter, callback
|
|||
|
||||
if (typeof mode == "string") {
|
||||
waiting++;
|
||||
config.loadModule(['mode', mode], function (m) {
|
||||
config.loadModule(['mode', mode], function(m) {
|
||||
mode = new m.Mode()
|
||||
--waiting || done();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ function hello (a, b, c) {\n\
|
|||
next();
|
||||
},
|
||||
|
||||
"test theme classname should be in output html": function (next) {
|
||||
"test theme classname should be in output html": function(next) {
|
||||
var theme = require("../theme/tomorrow");
|
||||
var snippet = "\
|
||||
/** this is a function\n\
|
||||
|
|
|
|||
|
|
@ -30,17 +30,8 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*jslint
|
||||
indent: 4,
|
||||
maxerr: 50,
|
||||
white: true,
|
||||
browser: true,
|
||||
vars: true
|
||||
*/
|
||||
/*global
|
||||
define,
|
||||
require
|
||||
*/
|
||||
/*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/
|
||||
/*global define, require */
|
||||
|
||||
/**
|
||||
* Generates a list of themes available when ace was built.
|
||||
|
|
@ -70,7 +61,7 @@ module.exports.ThemeDescription = function(name) {
|
|||
this.name = name;
|
||||
this.desc = name.split('_'
|
||||
).map(
|
||||
function (namePart) {
|
||||
function(namePart) {
|
||||
return namePart[0].toUpperCase() + namePart.slice(1);
|
||||
}
|
||||
).join(' ');
|
||||
|
|
@ -79,7 +70,7 @@ module.exports.ThemeDescription = function(name) {
|
|||
|
||||
module.exports.themesByName = {};
|
||||
|
||||
module.exports.themes = module.exports.themes.map(function (name) {
|
||||
module.exports.themes = module.exports.themes.map(function(name) {
|
||||
module.exports.themesByName[name] = new module.exports.ThemeDescription(name);
|
||||
return module.exports.themesByName[name];
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue