semicolonify demo files;
This commit is contained in:
parent
753dbbece5
commit
fada97f807
7 changed files with 59 additions and 62 deletions
|
|
@ -34,7 +34,7 @@ define(function(require, exports, module) {
|
|||
|
||||
require("ace/lib/fixoldbrowsers");
|
||||
|
||||
require("ace/multi_select")
|
||||
require("ace/multi_select");
|
||||
require("ace/ext/spellcheck");
|
||||
require("./inline_editor");
|
||||
require("./dev_util");
|
||||
|
|
@ -165,11 +165,11 @@ env.editor.commands.addCommands([{
|
|||
bindKey: "ctrl+enter",
|
||||
exec: function(editor) {
|
||||
try {
|
||||
var r = window.eval(editor.getCopyText()||editor.getValue());
|
||||
var r = window.eval(editor.getCopyText() || editor.getValue());
|
||||
} catch(e) {
|
||||
r = e;
|
||||
}
|
||||
editor.cmdLine.setValue(r + "")
|
||||
editor.cmdLine.setValue(r + "");
|
||||
},
|
||||
readOnly: true
|
||||
}, {
|
||||
|
|
@ -178,8 +178,8 @@ env.editor.commands.addCommands([{
|
|||
exec: function(editor) {
|
||||
config.loadModule("ace/ext/keybinding_menu", function(module) {
|
||||
module.init(editor);
|
||||
editor.showKeyboardShortcuts()
|
||||
})
|
||||
editor.showKeyboardShortcuts();
|
||||
});
|
||||
}
|
||||
}, {
|
||||
name: "increaseFontSize",
|
||||
|
|
@ -225,7 +225,7 @@ commands.addCommand({
|
|||
bindKey: {win: "Ctrl-S", mac: "Command-S"},
|
||||
exec: function(arg) {
|
||||
var session = env.editor.session;
|
||||
name = session.name.match(/[^\/]+$/)
|
||||
var name = session.name.match(/[^\/]+$/);
|
||||
localStorage.setItem(
|
||||
"saved_file:" + name,
|
||||
session.getValue()
|
||||
|
|
@ -239,7 +239,7 @@ commands.addCommand({
|
|||
bindKey: {win: "Ctrl-O", mac: "Command-O"},
|
||||
exec: function(arg) {
|
||||
var session = env.editor.session;
|
||||
name = session.name.match(/[^\/]+$/)
|
||||
var name = session.name.match(/[^\/]+$/);
|
||||
var value = localStorage.getItem("saved_file:" + name);
|
||||
if (typeof value == "string") {
|
||||
session.setValue(value);
|
||||
|
|
@ -314,7 +314,7 @@ doclist.history = doclist.docs.map(function(doc) {
|
|||
});
|
||||
doclist.history.index = 0;
|
||||
doclist.cycleOpen = function(editor, dir) {
|
||||
var h = this.history
|
||||
var h = this.history;
|
||||
h.index += dir;
|
||||
if (h.index >= h.length)
|
||||
h.index = 0;
|
||||
|
|
@ -323,17 +323,16 @@ doclist.cycleOpen = function(editor, dir) {
|
|||
var s = h[h.index];
|
||||
docEl.value = s;
|
||||
docEl.onchange();
|
||||
h.index
|
||||
}
|
||||
};
|
||||
doclist.addToHistory = function(name) {
|
||||
var h = this.history
|
||||
var h = this.history;
|
||||
var i = h.indexOf(name);
|
||||
if (i != h.index) {
|
||||
if (i != -1)
|
||||
h.splice(i, 1);
|
||||
h.index = h.push(name);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
bindDropdown("doc", function(name) {
|
||||
doclist.loadDoc(name, function(session) {
|
||||
|
|
@ -372,15 +371,15 @@ function updateUIEditorOptions() {
|
|||
}
|
||||
|
||||
event.addListener(themeEl, "mouseover", function(e){
|
||||
this.desiredValue = e.target.value;
|
||||
if (!this.$timer)
|
||||
this.$timer = setTimeout(this.updateTheme);
|
||||
themeEl.desiredValue = e.target.value;
|
||||
if (!themeEl.$timer)
|
||||
themeEl.$timer = setTimeout(themeEl.updateTheme);
|
||||
});
|
||||
|
||||
event.addListener(themeEl, "mouseout", function(e){
|
||||
this.desiredValue = null;
|
||||
if (!this.$timer)
|
||||
this.$timer = setTimeout(this.updateTheme, 20);
|
||||
themeEl.desiredValue = null;
|
||||
if (!themeEl.$timer)
|
||||
themeEl.$timer = setTimeout(themeEl.updateTheme, 20);
|
||||
});
|
||||
|
||||
themeEl.updateTheme = function(){
|
||||
|
|
@ -568,24 +567,25 @@ env.editSnippets = function() {
|
|||
var text = m.snippetText;
|
||||
var s = doclist.initDoc(text, "", {});
|
||||
s.setMode("ace/mode/snippets");
|
||||
doclist["snippets/" + id] = s
|
||||
doclist["snippets/" + id] = s;
|
||||
}
|
||||
editor.on("blur", function() {
|
||||
m.snippetText = editor.getValue();
|
||||
snippetManager.unregister(m.snippets);
|
||||
m.snippets = snippetManager.parseSnippetFile(m.snippetText, m.scope);
|
||||
snippetManager.register(m.snippets);
|
||||
})
|
||||
});
|
||||
sp.$editors[0].once("changeMode", function() {
|
||||
sp.setSplits(1);
|
||||
})
|
||||
});
|
||||
editor.setSession(doclist["snippets/" + id], 1);
|
||||
editor.focus();
|
||||
}
|
||||
};
|
||||
|
||||
require("ace/ext/language_tools");
|
||||
env.editor.setOptions({
|
||||
enableBasicAutocompletion: true,
|
||||
enableSnippets: true
|
||||
})
|
||||
});
|
||||
|
||||
});
|
||||
|
|
@ -49,10 +49,10 @@ function def(o, key, get) {
|
|||
}
|
||||
});
|
||||
}
|
||||
def(window, "ace", function(){ warn(); return env.editor });
|
||||
def(window, "editor", function(){ warn(); return env.editor });
|
||||
def(window, "session", function(){ warn(); return env.editor.session });
|
||||
def(window, "split", function(){ warn(); return env.split });
|
||||
def(window, "ace", function(){ warn(); return window.env.editor });
|
||||
def(window, "editor", function(){ warn(); return window.env.editor });
|
||||
def(window, "session", function(){ warn(); return window.env.editor.session });
|
||||
def(window, "split", function(){ warn(); return window.env.split });
|
||||
|
||||
|
||||
/* for textinput debuggging
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ modelist.modes.forEach(function(m) {
|
|||
if (ext[0] === "^") {
|
||||
path = ext.substr(1);
|
||||
} else {
|
||||
var path = m.name + "." + ext
|
||||
var path = m.name + "." + ext;
|
||||
}
|
||||
path = "docs/" + path;
|
||||
if (!docs[path]) {
|
||||
|
|
@ -103,7 +103,7 @@ modelist.modes.forEach(function(m) {
|
|||
} else if (typeof docs[path] == "object" && !docs[path].name) {
|
||||
docs[path].name = m.caption;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
@ -121,7 +121,7 @@ function sort(list) {
|
|||
return list.sort(function(a, b) {
|
||||
var cmp = (b.order || 0) - (a.order || 0);
|
||||
return cmp || a.name && a.name.localeCompare(b.name);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function prepareDocList(docs) {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ module.exports = function(editor) {
|
|||
return event.stopEvent(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var Editor = require("ace/editor").Editor;
|
||||
config.defineOptions(Editor.prototype, "editor", {
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ define(function(require, exports, module) {
|
|||
"use strict";
|
||||
|
||||
var LineWidgets = require("ace/line_widgets").LineWidgets;
|
||||
var Editor = require("ace/editor").Editor
|
||||
var Renderer = require("ace/virtual_renderer").VirtualRenderer
|
||||
var Editor = require("ace/editor").Editor;
|
||||
var Renderer = require("ace/virtual_renderer").VirtualRenderer;
|
||||
var dom = require("ace/lib/dom");
|
||||
|
||||
|
||||
|
|
@ -42,12 +42,12 @@ require("ace/commands/default_commands").commands.push({
|
|||
name: "openInlineEditor",
|
||||
bindKey: "F3",
|
||||
exec: function(editor) {
|
||||
var split = env.split
|
||||
var s = editor.session
|
||||
var inlineEditor = new Editor(new Renderer())
|
||||
var splitSession = split.$cloneSession(s)
|
||||
var split = window.env.split;
|
||||
var s = editor.session;
|
||||
var inlineEditor = new Editor(new Renderer());
|
||||
var splitSession = split.$cloneSession(s);
|
||||
|
||||
var row = editor.getCursorPosition().row
|
||||
var row = editor.getCursorPosition().row;
|
||||
if (editor.session.lineWidgets && editor.session.lineWidgets[row]) {
|
||||
editor.session.lineWidgets[row].destroy();
|
||||
return;
|
||||
|
|
@ -70,36 +70,36 @@ require("ace/commands/default_commands").commands.push({
|
|||
}
|
||||
|
||||
var h = rowCount*editor.renderer.layerConfig.lineHeight;
|
||||
inlineEditor.container.style.height = h + "px"
|
||||
inlineEditor.container.style.height = h + "px";
|
||||
|
||||
el.style.position = "absolute"
|
||||
el.style.zIndex = "4"
|
||||
el.style.borderTop = "solid blue 2px"
|
||||
el.style.borderBottom = "solid blue 2px"
|
||||
el.style.position = "absolute";
|
||||
el.style.zIndex = "4";
|
||||
el.style.borderTop = "solid blue 2px";
|
||||
el.style.borderBottom = "solid blue 2px";
|
||||
|
||||
inlineEditor.setSession(splitSession)
|
||||
inlineEditor.setSession(splitSession);
|
||||
editor.session.widgetManager.addLineWidget(w);
|
||||
|
||||
var kb = {
|
||||
handleKeyboard:function(_,hashId, keyString) {
|
||||
if (hashId == 0 && keyString == "esc") {
|
||||
if (hashId === 0 && keyString === "esc") {
|
||||
w.destroy();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
w.destroy = function() {
|
||||
editor.keyBinding.removeKeyboardHandler(kb);
|
||||
s.widgetManager.removeLineWidget(w);
|
||||
}
|
||||
};
|
||||
|
||||
editor.keyBinding.addKeyboardHandler(kb)
|
||||
inlineEditor.keyBinding.addKeyboardHandler(kb)
|
||||
editor.keyBinding.addKeyboardHandler(kb);
|
||||
inlineEditor.keyBinding.addKeyboardHandler(kb);
|
||||
editor.on("changeSession", function(e) {
|
||||
w.el.parentNode && w.el.parentNode.removeChild(w.el)
|
||||
w.el.parentNode && w.el.parentNode.removeChild(w.el);
|
||||
});
|
||||
inlineEditor.setTheme("ace/theme/solarized_light")
|
||||
inlineEditor.setTheme("ace/theme/solarized_light");
|
||||
}
|
||||
})
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ var TokenTooltip = function(editor) {
|
|||
if (this.lastT - (r.timeStamp || 0) > 1000) {
|
||||
r.rect = null;
|
||||
r.timeStamp = this.lastT;
|
||||
this.maxHeight = innerHeight;
|
||||
this.maxWidth = innerWidth;
|
||||
this.maxHeight = window.innerHeight;
|
||||
this.maxWidth = window.innerWidth;
|
||||
}
|
||||
|
||||
var canvasPos = r.rect || (r.rect = r.scroller.getBoundingClientRect());
|
||||
|
|
@ -145,8 +145,8 @@ var TokenTooltip = function(editor) {
|
|||
this.updateTooltipPosition = function(x, y) {
|
||||
var st = tooltipNode.style;
|
||||
if (x + 10 + this.tooltipWidth > this.maxWidth)
|
||||
x = innerWidth - this.tooltipWidth - 10;
|
||||
if (y > innerHeight * 0.75 || y + 20 + this.tooltipHeight > this.maxHeight)
|
||||
x = window.innerWidth - this.tooltipWidth - 10;
|
||||
if (y > window.innerHeight * 0.75 || y + 20 + this.tooltipHeight > this.maxHeight)
|
||||
y = y - this.tooltipHeight - 30;
|
||||
|
||||
st.left = x + 10 + "px";
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ var MultiSelect = require("ace/multi_select").MultiSelect;
|
|||
|
||||
exports.createEditor = function(el) {
|
||||
return new Editor(new Renderer(el));
|
||||
}
|
||||
};
|
||||
|
||||
exports.createSplitEditor = function(el) {
|
||||
if (typeof(el) == "string")
|
||||
|
|
@ -62,9 +62,6 @@ exports.createSplitEditor = function(el) {
|
|||
split.editor1 = split[1] = new Editor(new Renderer(e1));
|
||||
split.splitter = s;
|
||||
|
||||
MultiSelect(split.editor0);
|
||||
MultiSelect(split.editor1);
|
||||
|
||||
s.ratio = 0.5;
|
||||
|
||||
split.resize = function resize(){
|
||||
|
|
@ -108,8 +105,8 @@ exports.createSplitEditor = function(el) {
|
|||
};
|
||||
|
||||
var onResizeInterval = function() {
|
||||
s.ratio = (x - rect.left) / rect.width
|
||||
split.resize()
|
||||
s.ratio = (x - rect.left) / rect.width;
|
||||
split.resize();
|
||||
};
|
||||
|
||||
event.capture(s, onMouseMove, onResizeEnd);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue