Merge pull request #1952 from ajaxorg/misc
Sync with cloud9 + better demos
This commit is contained in:
commit
669deb54b2
24 changed files with 411 additions and 229 deletions
|
|
@ -247,6 +247,46 @@ function demo(project) {
|
|||
});
|
||||
|
||||
copyFileSync(ACE_HOME + "/demo/kitchen-sink/logo.png", BUILD_DIR + "/kitchen-sink/logo.png");
|
||||
|
||||
fs.readdirSync(ACE_HOME + "/demo/").forEach(function(x) {
|
||||
if (/\s|requirejs/.test(x) || !/\.(js|html)$/.test(x))
|
||||
return;
|
||||
copy({
|
||||
source: ACE_HOME +"/demo/" + x,
|
||||
dest: BUILD_DIR + "/demo/" + x,
|
||||
filter: [function(source) {
|
||||
if (/\.(js)$/.test(x))
|
||||
return source;
|
||||
var removeRequireJS
|
||||
source = source.replace(/<script src="kitchen-sink\/require.js"[\s\S]+?require\(\[([^\]]+).*/, function(e, m){
|
||||
removeRequireJS = true;
|
||||
var scripts = m.split(/,\s*/);
|
||||
var result = [];
|
||||
function comment(str) {result.push("<!-- " + str + " -->")};
|
||||
function script(str) {result.push('<script src="../src/' + str + '.js"></script>')}
|
||||
scripts.forEach(function(s) {
|
||||
s = s.replace(/"/g, "");
|
||||
if (s == "ace/ace") {
|
||||
comment("load ace")
|
||||
script("ace")
|
||||
} else {
|
||||
var extName = s.match(/[^/]*$/)[0];
|
||||
comment("load ace " + extName + " extension");
|
||||
script("ext-" + extName);
|
||||
}
|
||||
});
|
||||
result.push("<script>")
|
||||
return result.join("\n");
|
||||
});
|
||||
if (removeRequireJS)
|
||||
source = source.replace(/\s*\}\);?\s*(<\/script>)/, "\n$1");
|
||||
source = source.replace(/"\.\.\/build\//g, function(e) {
|
||||
console.log(e); return '"../';
|
||||
});
|
||||
return source;
|
||||
}]
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function jsFileList(path, filter) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@
|
|||
// enable autocompletion and snippets
|
||||
editor.setOptions({
|
||||
enableBasicAutocompletion: true,
|
||||
enableSnippets: true
|
||||
enableSnippets: true,
|
||||
enableLiveAutocompletion: false
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -20,29 +20,37 @@
|
|||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="editor">autoresizing editor</pre>
|
||||
<pre id="editor1">autoresizing editor</pre>
|
||||
<div class="scrollmargin"></div>
|
||||
<pre id="editor2">minHeight = 2 lines</pre>
|
||||
<div class="scrollmargin"></div>
|
||||
<pre id="editor"></pre>
|
||||
|
||||
<script src="../build/src/ace.js"></script>
|
||||
<script>
|
||||
|
||||
// create first editor
|
||||
var editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/tomorrow");
|
||||
editor.session.setMode("ace/mode/html");
|
||||
editor.setAutoScrollEditorIntoView();
|
||||
editor.setOption("maxLines", 100);
|
||||
var editor1 = ace.edit("editor1");
|
||||
editor1.setTheme("ace/theme/tomorrow_night_eighties");
|
||||
editor1.session.setMode("ace/mode/html");
|
||||
editor1.setAutoScrollEditorIntoView(true);
|
||||
editor1.setOption("maxLines", 30);
|
||||
|
||||
var editor2 = ace.edit("editor2");
|
||||
editor2.setTheme("ace/theme/tomorrow_night_blue");
|
||||
editor2.session.setMode("ace/mode/html");
|
||||
editor2.setAutoScrollEditorIntoView();
|
||||
editor2.setAutoScrollEditorIntoView(true);
|
||||
editor2.setOption("maxLines", 30);
|
||||
editor2.setOption("minLines", 2);
|
||||
|
||||
var editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/tomorrow");
|
||||
editor.session.setMode("ace/mode/html");
|
||||
editor.setAutoScrollEditorIntoView(true);
|
||||
editor.setOption("maxLines", 100);
|
||||
|
||||
</script>
|
||||
|
||||
<script src="./show_own_source.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -22,19 +22,20 @@
|
|||
|
||||
<pre id="editor"></pre>
|
||||
|
||||
<!-- load ace -->
|
||||
<script src="../build/src-noconflict/ace.js"></script>
|
||||
<!-- load ace emmet extension -->
|
||||
<script src="../build/src-noconflict/ext-emmet.js"></script>
|
||||
<!-- load core emmet files -->
|
||||
<!-- load emmet code and snippets compiled for browser -->
|
||||
<script src="https://nightwing.github.io/emmet-core/emmet.js"></script>
|
||||
|
||||
<script src="kitchen-sink/require.js"></script>
|
||||
<script>
|
||||
// trigger extension
|
||||
ace.require("ace/ext/emmet");
|
||||
// setup paths
|
||||
require.config({paths: { "ace" : "../lib/ace"}});
|
||||
// load ace and extensions
|
||||
require(["ace/ace", "ace/ext/emmet"], function(ace) {
|
||||
var editor = ace.edit("editor");
|
||||
editor.session.setMode("ace/mode/html");
|
||||
// enable emmet on the current editor
|
||||
editor.setOption("enableEmmet", true);
|
||||
editor.setOption("enableEmmet", true);
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="./show_own_source.js"></script>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>ACE Editor StatusBar Demo</title>
|
||||
<style type="text/css" media="screen">
|
||||
/*!important without this top: 0; bottom: 0 doesn't work */
|
||||
/*!important without this top: 0; bottom: 0 doesn't work on old ie */
|
||||
body, html {
|
||||
position: absolute;
|
||||
top: 0px; bottom: 0; left: 0; right: 0;
|
||||
|
|
|
|||
|
|
@ -22,8 +22,11 @@
|
|||
|
||||
<pre id="editor"></pre>
|
||||
|
||||
<script src="../build/src-noconflict/ace.js"></script>
|
||||
<script src="kitchen-sink/require.js"></script>
|
||||
<script>
|
||||
// setup paths
|
||||
require.config({paths: { "ace" : "../lib/ace"}});
|
||||
require(["ace/ace"], function(ace) {
|
||||
var editor = ace.edit("editor")
|
||||
editor.setTheme("ace/theme/twilight")
|
||||
editor.session.setMode("ace/mode/html")
|
||||
|
|
@ -39,6 +42,8 @@
|
|||
})
|
||||
}
|
||||
})
|
||||
editor.execCommand("showKeyboardShortcuts")
|
||||
})
|
||||
</script>
|
||||
|
||||
<script src="./show_own_source.js"></script>
|
||||
|
|
|
|||
|
|
@ -23,24 +23,27 @@
|
|||
|
||||
<pre id="editor"></pre>
|
||||
|
||||
<script src="../build/src-noconflict/ace.js"></script>
|
||||
<script src="../build/src-noconflict/ext-modelist.js"></script>
|
||||
<script src="kitchen-sink/require.js"></script>
|
||||
<script>
|
||||
// setup paths
|
||||
require.config({paths: { "ace" : "../lib/ace"}});
|
||||
// load ace and extensions
|
||||
require(["ace/ace", "ace/ext/modelist"], function(ace) {
|
||||
var editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
(function () {
|
||||
var modelist = ace.require('ace/ext/modelist');
|
||||
var modelist = ace.require("ace/ext/modelist");
|
||||
// the file path could come from an xmlhttp request, a drop event,
|
||||
// or any other scriptable file loading process.
|
||||
// Extensions could consume the modelist and use it to dynamically
|
||||
// set the editor mode. Webmasters could use it in their scripts
|
||||
// for site specific purposes as well.
|
||||
var filePath = 'blahblah/weee/some.js';
|
||||
var filePath = "blahblah/weee/some.js";
|
||||
var mode = modelist.getModeForPath(filePath).mode;
|
||||
console.log(mode);
|
||||
editor.session.setMode(mode);
|
||||
}());
|
||||
|
||||
})
|
||||
</script>
|
||||
|
||||
<script src="./show_own_source.js"></script>
|
||||
|
|
|
|||
|
|
@ -5,19 +5,18 @@
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>Editor</title>
|
||||
<style type="text/css" media="screen">
|
||||
|
||||
.ace_editor {
|
||||
position: relative !important;
|
||||
border: 1px solid lightgray;
|
||||
margin: auto;
|
||||
height: 200px;
|
||||
width: 80%;
|
||||
}
|
||||
.ace_editor {
|
||||
position: relative !important;
|
||||
border: 1px solid lightgray;
|
||||
margin: auto;
|
||||
height: 200px;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.ace_editor.fullScreen {
|
||||
height: auto;
|
||||
width: auto;
|
||||
border: 0;
|
||||
height: auto;
|
||||
width: auto;
|
||||
border: 0;
|
||||
margin: 0;
|
||||
position: fixed !important;
|
||||
top: 0;
|
||||
|
|
@ -25,17 +24,16 @@
|
|||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.fullScreen {
|
||||
overflow: hidden
|
||||
}
|
||||
.fullScreen {
|
||||
overflow: hidden
|
||||
}
|
||||
|
||||
.scrollmargin {
|
||||
height: 500px;
|
||||
.scrollmargin {
|
||||
height: 500px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
|
||||
.large-button {
|
||||
color: lightblue;
|
||||
|
|
@ -56,7 +54,7 @@
|
|||
<body>
|
||||
<div class="scrollmargin">
|
||||
<span onclick="scroll()" class="large-button">
|
||||
scroll down ⇓
|
||||
scroll down ⇓
|
||||
</span>
|
||||
</div>
|
||||
<pre id="editor">function foo(items) {
|
||||
|
|
@ -76,28 +74,35 @@
|
|||
|
||||
</div>
|
||||
|
||||
<script src="../build/src/ace.js"></script>
|
||||
<script src="kitchen-sink/require.js"></script>
|
||||
<script>
|
||||
require.config({paths: { "ace" : "../lib/ace"}});
|
||||
require(["ace/ace", "ace/ext/themelist"], function(ace) {
|
||||
|
||||
var $ = document.getElementById.bind(document);
|
||||
var dom = require("ace/lib/dom");
|
||||
|
||||
//add command to all new editor instaces
|
||||
require("ace/commands/default_commands").commands.push({
|
||||
name: "Toggle Fullscreen",
|
||||
bindKey: "F11",
|
||||
exec: function(editor) {
|
||||
dom.toggleCssClass(document.body, "fullScreen")
|
||||
dom.toggleCssClass(editor.container, "fullScreen")
|
||||
editor.setAutoScrollEditorIntoView()
|
||||
editor.resize()
|
||||
}
|
||||
name: "Toggle Fullscreen",
|
||||
bindKey: "F11",
|
||||
exec: function(editor) {
|
||||
var fullScreen = dom.toggleCssClass(document.body, "fullScreen")
|
||||
dom.setCssClass(editor.container, "fullScreen", fullScreen)
|
||||
editor.setAutoScrollEditorIntoView(!fullScreen)
|
||||
editor.resize()
|
||||
}
|
||||
})
|
||||
|
||||
// create first editor
|
||||
var editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
editor.session.setMode("ace/mode/javascript");
|
||||
editor.setAutoScrollEditorIntoView();
|
||||
editor.renderer.setScrollMargin(10, 10);
|
||||
editor.setOptions({
|
||||
// "scrollPastEnd": 0.8,
|
||||
autoScrollEditorIntoView: true
|
||||
});
|
||||
|
||||
var count = 1;
|
||||
function add() {
|
||||
|
|
@ -110,12 +115,13 @@ function add() {
|
|||
oldEl.parentNode.insertBefore(el, pad.nextSibling)
|
||||
|
||||
count++
|
||||
var theme = "ace/theme/" + themes[Math.floor(themes.length * Math.random() - 1e-5)]
|
||||
var theme = themes[Math.floor(themes.length * Math.random() - 1e-5)]
|
||||
editor = ace.edit(el)
|
||||
editor.setTheme(theme)
|
||||
editor.session.setMode("ace/mode/javascript")
|
||||
|
||||
editor.setAutoScrollEditorIntoView()
|
||||
editor.setOptions({
|
||||
mode: "ace/mode/javascript",
|
||||
theme: theme,
|
||||
autoScrollEditorIntoView: true
|
||||
})
|
||||
|
||||
editor.setValue([
|
||||
"this is editor number: ", count, "\n",
|
||||
|
|
@ -126,7 +132,6 @@ function add() {
|
|||
scroll()
|
||||
}
|
||||
|
||||
|
||||
function scroll(speed) {
|
||||
var top = editor.container.getBoundingClientRect().top
|
||||
speed = speed || 10
|
||||
|
|
@ -139,14 +144,11 @@ function scroll(speed) {
|
|||
}
|
||||
}
|
||||
|
||||
var themes = {
|
||||
bright: [ "chrome", "clouds", "crimson_editor", "dawn", "dreamweaver", "eclipse", "github",
|
||||
"solarized_light", "textmate", "tomorrow"],
|
||||
dark: [ "clouds_midnight", "cobalt", "idle_fingers", "kr_theme", "merbivore", "merbivore_soft",
|
||||
"mono_industrial", "monokai", "pastel_on_dark", "solarized_dark", "terminal", "tomorrow_night",
|
||||
"tomorrow_night_blue", "tomorrow_night_bright", "tomorrow_night_eighties", "twilight", "vibrant_ink"]
|
||||
}
|
||||
themes = [].concat(themes.bright, themes.dark);
|
||||
var themes = require("ace/ext/themelist").themes.map(function(t){return t.theme});
|
||||
|
||||
window.add = add;
|
||||
window.scroll = scroll;
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -23,9 +23,12 @@
|
|||
|
||||
<pre id="editor"></pre>
|
||||
|
||||
<script src="../build/src-noconflict/ace.js"></script>
|
||||
<script src="../build/src-noconflict/ext-settings_menu.js"></script>
|
||||
<script src="kitchen-sink/require.js"></script>
|
||||
<script>
|
||||
// setup paths
|
||||
require.config({paths: { "ace" : "../lib/ace"}});
|
||||
// load ace and extensions
|
||||
require(["ace/ace", "ace/ext/settings_menu"], function(ace) {
|
||||
var editor = ace.edit("editor");
|
||||
ace.require('ace/ext/settings_menu').init(editor);
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
|
|
@ -38,6 +41,7 @@
|
|||
},
|
||||
readOnly: true
|
||||
}]);
|
||||
})
|
||||
</script>
|
||||
|
||||
<script src="./show_own_source.js"></script>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,16 @@
|
|||
ace.require("ace/lib/net").get(document.baseURI, function(t){
|
||||
editor.setValue(t, 1);
|
||||
})
|
||||
if (typeof ace == "undefined" && typeof require == "undefined") {
|
||||
document.body.innerHTML = "<p style='padding: 20px 50px;'>couldn't find ace.js file, <br>"
|
||||
+ "to build it run <code>node Makefile.dryice.js full<code>"
|
||||
} else if (typeof ace == "undefined" && typeof require != "undefined") {
|
||||
require(["ace/ace"], setValue)
|
||||
} else {
|
||||
require = ace.require;
|
||||
setValue()
|
||||
}
|
||||
|
||||
function setValue() {
|
||||
require("ace/lib/net").get(document.baseURI, function(t){
|
||||
var el = document.getElementById("editor");
|
||||
el.env.editor.setValue(t, 1);
|
||||
})
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
|
|
@ -34,30 +33,31 @@ function wobble (flam) {
|
|||
return flam.wobbled = true;
|
||||
}
|
||||
|
||||
// the scrollbars are from overflow auto on .ace_editor.
|
||||
|
||||
</pre>
|
||||
|
||||
<script src="../../build/src-noconflict/ace.js"></script>
|
||||
<script src="../../build/src-noconflict/ext-static_highlight.js"></script>
|
||||
|
||||
<script src="kitchen-sink/require.js"></script>
|
||||
<script>
|
||||
var highlight = ace.require("ace/ext/static_highlight")
|
||||
var dom = ace.require("ace/lib/dom")
|
||||
function qsa(sel) {
|
||||
return [].slice.call(document.querySelectorAll(sel));
|
||||
}
|
||||
require.config({paths: { "ace" : "../lib/ace"}});
|
||||
|
||||
qsa(".code").forEach(function (codeEl) {
|
||||
highlight(codeEl, {
|
||||
mode: codeEl.getAttribute('ace-mode'),
|
||||
theme: codeEl.getAttribute('ace-theme'),
|
||||
startLineNumber: 1,
|
||||
showGutter: codeEl.getAttribute("ace-gutter"),
|
||||
trim: true
|
||||
}, function (highlighted) {
|
||||
require(["ace/ace", "ace/ext/static_highlight"], function(ace) {
|
||||
var highlight = ace.require("ace/ext/static_highlight")
|
||||
var dom = ace.require("ace/lib/dom")
|
||||
function qsa(sel) {
|
||||
return Array.apply(null, document.querySelectorAll(sel));
|
||||
}
|
||||
|
||||
qsa(".code").forEach(function (codeEl) {
|
||||
highlight(codeEl, {
|
||||
mode: codeEl.getAttribute("ace-mode"),
|
||||
theme: codeEl.getAttribute("ace-theme"),
|
||||
startLineNumber: 1,
|
||||
showGutter: codeEl.getAttribute("ace-gutter"),
|
||||
trim: true
|
||||
}, function (highlighted) {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
@ -41,15 +41,19 @@
|
|||
<pre id="editor"></pre>
|
||||
<div id="statusBar">ace rocks!</div>
|
||||
|
||||
<script src="../build/src-noconflict/ace.js"></script>
|
||||
<script src="../build/src-noconflict/ext-statusbar.js"></script>
|
||||
<script src="kitchen-sink/require.js"></script>
|
||||
<script>
|
||||
// setup paths
|
||||
require.config({paths: { "ace" : "../lib/ace"}});
|
||||
// load ace and extensions
|
||||
require(["ace/ace", "ace/ext/statusbar"], function(ace) {
|
||||
var editor = ace.edit("editor");
|
||||
var StatusBar = ace.require('ace/ext/statusbar').StatusBar;
|
||||
var StatusBar = ace.require("ace/ext/statusbar").StatusBar;
|
||||
// create a simple selection status indicator
|
||||
var statusBar = new StatusBar(editor, document.getElementById('statusBar'));
|
||||
var statusBar = new StatusBar(editor, document.getElementById("statusBar"));
|
||||
editor.setTheme("ace/theme/dawn");
|
||||
editor.session.setMode("ace/mode/html");
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="./show_own_source.js"></script>
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB |
92
index.html
92
index.html
|
|
@ -760,11 +760,6 @@ if (match) {
|
|||
style="left: -5px; top: 10px;" />
|
||||
<a href="http://www.codecademy.com/">Codecademy</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="http://textor.houfeng.net/images/textor.png"
|
||||
style="position: relative; left: 13px; top: -3px; width: 75px" />
|
||||
<a href="http://textor.houfeng.net/">Textor</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="doc/site/images/rstudio_logo_64.png"
|
||||
style="left: 19px; top: 2px;" />
|
||||
|
|
@ -793,7 +788,7 @@ if (match) {
|
|||
<img src="doc/site/images/zorba-logo.png"
|
||||
style="left: -5px; top: 16px;
|
||||
padding: 6px 4px 6px 6px; width: 100px" />
|
||||
<a href="http://www.zorba-xquery.com/html/demo">Zorba XQuery</a>
|
||||
<a href="http://try.zorba.io/queries/xquery">Zorba XQuery</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="doc/site/images/plunker.png"
|
||||
|
|
@ -879,9 +874,9 @@ if (match) {
|
|||
<a href="https://drivenotepad.appspot.com/support">Drive Notepad</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="doc/site/images/FineCut_small_logo.png"
|
||||
style="left: 12px; top: -4px" />
|
||||
<a href="http://finecut.info/">Fine Cut Engine</a>
|
||||
<img src="http://textor.houfeng.net/images/textor.png"
|
||||
style="position: relative; left: 13px; top: -3px; width: 75px" />
|
||||
<a href="http://textor.houfeng.net/">Textor</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="http://phpassist.com/images/logo-large.png"
|
||||
|
|
@ -915,9 +910,9 @@ if (match) {
|
|||
<a href="http://orbit.bonsaijs.org/">BonsaiJS playground</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="doc/site/images/acebug-logo.png"
|
||||
style="left: 20px; top: 5px;">
|
||||
<a href="https://addons.mozilla.org/en-US/firefox/addon/acebug/">Acebug</a>
|
||||
<img src="http://approximatrix.com/products/simplytext/logo-320x320.png"
|
||||
style="width: 106px; left: -4px; top: -22px;">
|
||||
<a href="http://approximatrix.com/products/simplytext">Simply Text</a>
|
||||
</li>
|
||||
<li>
|
||||
<div class="text-logo" style="font-size: 18px;">ShareLaTeX</div>
|
||||
|
|
@ -1117,7 +1112,7 @@ if (match) {
|
|||
<a href="http://bakemycss.mypathforpython.appspot.com/">BakeMyCss</a>
|
||||
</li>
|
||||
<li>
|
||||
<div class="" style="
|
||||
<div style="
|
||||
background: url(https://s3.amazonaws.com/spark-website/spark.png) no-repeat;
|
||||
position: absolute; height: 65px; width: 83px; background-size: 200px 65px;
|
||||
background-position: 19px;"></div>
|
||||
|
|
@ -1136,7 +1131,56 @@ if (match) {
|
|||
<a href=" http://www.praczone.com/editor">pracZone</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="https://github.com/Gozala/sky-edit">Sky Edit</a>
|
||||
<img src="http://resources.qooxdoo.org/images/logo.gif"
|
||||
style="width: 125px; left: -13px; top: 18px;">
|
||||
<a href="http://demo.qooxdoo.org/devel/playground/#">Qooxdoo playground</a>
|
||||
</li>
|
||||
<li>
|
||||
<div class="text-logo">ShareJS</div>
|
||||
<a href="http://sharejs.org/hello-ace.html">ShareJS</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="https://neutron-drive.appspot.com/static/img/neutron_face_high.png"
|
||||
style="width: 86px; left: 7px; top: -11px;">
|
||||
<a href="http://neutronide.com/">Neutron IDE</a>
|
||||
</li>
|
||||
<li>
|
||||
<div style="
|
||||
background: url(https://www.pythonanywhere.com/static/anywhere/images/logo-234x35.png) no-repeat;
|
||||
position: absolute; height: 65px; width: 94px; background-size: 234px 35px;
|
||||
background-position: 19px;"></div>
|
||||
<a href="http://www.pythonanywhere.com/">PythonAnywhere</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="http://subtexteditor.com/images/subtext-icon-4.png"
|
||||
style="width: 86px; left: 7px; top: -11px;">
|
||||
<a href="http://subtexteditor.com/">Subtext Editor</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="http://climbi.com/static/img/logo.png"
|
||||
style="width: 86px; left: 7px; top: -11px;">
|
||||
<a href="http://climbi.com/">Climbi</a>
|
||||
</li>
|
||||
<li>
|
||||
<div style="
|
||||
background: url(http://gpupowered.org/sites/default/files/favicon.png) rgba(0, 0, 0, 0.66) no-repeat;
|
||||
position: absolute;
|
||||
height: 75px;
|
||||
width: 99px; background-size: 27px 32px;
|
||||
background-position: 37px;"></div>
|
||||
<a href="http://www.gpupowered.org/sand2/launch2/#">GPUPowered</a>
|
||||
</li>
|
||||
<li style="width: 248px;">
|
||||
<img src="http://www.codeavengers.com/image/RedLogoSmall.png" style="width: 248px; top: 30px;">
|
||||
<a href="http://www.codeavengers.com/image/RedLogoSmall.png">Code Avengers</a>
|
||||
</li>
|
||||
<li style="width: 248px;">
|
||||
<img src="http://www.codemonkey.co.il/images/logoSmallFaceTop.png" style="width: 248px; top: -3px;">
|
||||
<a href="http://www.codemonkey.co.il/">CodeMonkey</a>
|
||||
</li>
|
||||
<li style="width: 248px;">
|
||||
<img src="http://learn-angular.org/Content/Images/LearnAngular-small.png" style="width: 275px; left: -12px; top: 7px;">
|
||||
<a href="http://learn-angular.org">Learn Angular</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.wavemaker.com/">WaveMaker</a>
|
||||
|
|
@ -1144,35 +1188,15 @@ if (match) {
|
|||
<li>
|
||||
<a href="http://www.playmycode.com/">Play My Code</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="http://resources.qooxdoo.org/images/logo.gif"
|
||||
style="width: 125px; left: -13px; top: 18px;">
|
||||
<a href="http://demo.qooxdoo.org/devel/playground/#">Qooxdoo playground</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://ext.radiantcms.org/extensions/264-ace">Radiant CMS</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://developercompanion.com/">Developer Companion</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.pythonanywhere.com/">PythonAnywhere</a>
|
||||
</li>
|
||||
<li>
|
||||
<div class="text-logo">ShareJS</div>
|
||||
<a href="http://sharejs.org/hello-ace.html">ShareJS</a>
|
||||
</li>
|
||||
<li>
|
||||
<img src="https://neutron-drive.appspot.com/static/img/neutron_face_high.png"
|
||||
style="width: 76px; left: 7px; top: -11px;">
|
||||
<a href="http://neutronide.com/">Neutron IDE</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://www.akshell.com/">Akshell</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="http://beanstalkapp.com/">beanstalk</a>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<div class="text-logo">tmpltr</div>
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ var Autocomplete = function() {
|
|||
|
||||
this.changeTimer = lang.delayedCall(function() {
|
||||
this.updateCompletions(true);
|
||||
}.bind(this))
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
|
@ -270,7 +270,7 @@ var Autocomplete = function() {
|
|||
var _id = this.gatherCompletionsId;
|
||||
this.gatherCompletions(this.editor, function(err, results) {
|
||||
// Only detach if result gathering is finished
|
||||
var doDetach = function() {
|
||||
var detachIfFinished = function() {
|
||||
if (!results.finished) return;
|
||||
return this.detach();
|
||||
}.bind(this);
|
||||
|
|
@ -279,10 +279,10 @@ var Autocomplete = function() {
|
|||
var matches = results && results.matches;
|
||||
|
||||
if (!matches || !matches.length)
|
||||
return doDetach();
|
||||
return detachIfFinished();
|
||||
|
||||
// Wrong prefix or wrong session -> ignore
|
||||
if (prefix.indexOf(results.prefix) != 0 || _id != this.gatherCompletionsId)
|
||||
if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId)
|
||||
return;
|
||||
|
||||
this.completions = new FilteredList(matches);
|
||||
|
|
@ -291,11 +291,11 @@ var Autocomplete = function() {
|
|||
|
||||
// No results
|
||||
if (!filtered.length)
|
||||
return doDetach();
|
||||
return detachIfFinished();
|
||||
|
||||
// One result equals to the prefix
|
||||
if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet)
|
||||
return doDetach();
|
||||
return detachIfFinished();
|
||||
|
||||
// Autoinsert if one result
|
||||
if (this.autoInsert && filtered.length == 1)
|
||||
|
|
|
|||
|
|
@ -141,11 +141,15 @@ exports.commands = [{
|
|||
name: "findnext",
|
||||
bindKey: bindKey("Ctrl-K", "Command-G"),
|
||||
exec: function(editor) { editor.findNext(); },
|
||||
multiSelectAction: "forEach",
|
||||
scrollIntoView: "center",
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "findprevious",
|
||||
bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
|
||||
exec: function(editor) { editor.findPrevious(); },
|
||||
multiSelectAction: "forEach",
|
||||
scrollIntoView: "center",
|
||||
readOnly: true
|
||||
}, {
|
||||
name: "selectOrFindNext",
|
||||
|
|
|
|||
|
|
@ -2363,8 +2363,9 @@ var Editor = function(renderer, session) {
|
|||
var cursorLayer = this.renderer.$cursorLayer;
|
||||
if (!cursorLayer)
|
||||
return;
|
||||
cursorLayer.setSmoothBlinking(style == "smooth");
|
||||
cursorLayer.setSmoothBlinking(/smooth/.test(style));
|
||||
cursorLayer.isBlinking = !this.$readOnly && style != "wide";
|
||||
dom.setCssClass(cursorLayer.element, "ace_slim-cursors", /slim/.test(style));
|
||||
};
|
||||
|
||||
}).call(Editor.prototype);
|
||||
|
|
|
|||
|
|
@ -86,9 +86,8 @@ exports.$detectIndentation = function(lines, fallback) {
|
|||
} else
|
||||
var score = getScore(i) / spaceIndents;
|
||||
|
||||
if (changes[i]) {
|
||||
if (changes[i])
|
||||
score += changes[i] / changesTotal;
|
||||
}
|
||||
|
||||
if (score > first.score)
|
||||
first = {score: score, length: i};
|
||||
|
|
|
|||
|
|
@ -143,15 +143,6 @@ var Keys = (function() {
|
|||
}
|
||||
})();
|
||||
|
||||
(function() {
|
||||
var mods = ["cmd", "ctrl", "alt", "shift"];
|
||||
for (var i = Math.pow(2, mods.length); i--;) {
|
||||
ret.KEY_MODS[i] = mods.filter(function(x) {
|
||||
return i & ret.KEY_MODS[x];
|
||||
}).join("-") + "-";
|
||||
}
|
||||
})();
|
||||
|
||||
return ret;
|
||||
})();
|
||||
oop.mixin(exports, Keys);
|
||||
|
|
|
|||
|
|
@ -464,36 +464,41 @@ var Editor = require("./editor").Editor;
|
|||
|
||||
/**
|
||||
* Executes a command for each selection range.
|
||||
* @param {String} cmd The command to execute
|
||||
* @param {Object} cmd The command to execute
|
||||
* @param {String} args Any arguments for the command
|
||||
* @method Editor.forEachSelection
|
||||
**/
|
||||
this.forEachSelection = function(cmd, args, $byLines) {
|
||||
this.forEachSelection = function(cmd, args, options) {
|
||||
if (this.inVirtualSelectionMode)
|
||||
return;
|
||||
|
||||
var keepOrder = options && options.keepOrder;
|
||||
var $byLines = options == true || options && options.$byLines
|
||||
var session = this.session;
|
||||
var selection = this.selection;
|
||||
var rangeList = selection.rangeList;
|
||||
var ranges = (keepOrder ? selection : rangeList).ranges;
|
||||
var result;
|
||||
|
||||
if (!ranges.length)
|
||||
return cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});
|
||||
|
||||
var reg = selection._eventRegistry;
|
||||
selection._eventRegistry = {};
|
||||
|
||||
var tmpSel = new Selection(session);
|
||||
this.inVirtualSelectionMode = true;
|
||||
for (var i = rangeList.ranges.length; i--;) {
|
||||
for (var i = ranges.length; i--;) {
|
||||
if ($byLines) {
|
||||
while (i > 0 && rangeList.ranges[i].start.row == rangeList.ranges[i - 1].end.row)
|
||||
while (i > 0 && ranges[i].start.row == ranges[i - 1].end.row)
|
||||
i--;
|
||||
}
|
||||
tmpSel.fromOrientedRange(rangeList.ranges[i]);
|
||||
tmpSel.id = rangeList.ranges[i].marker;
|
||||
tmpSel.fromOrientedRange(ranges[i]);
|
||||
tmpSel.index = i;
|
||||
this.selection = session.selection = tmpSel;
|
||||
var cmdResult = cmd.exec(this, args || {});
|
||||
if (result !== undefined)
|
||||
var cmdResult = cmd.exec ? cmd.exec(this, args || {}) : cmd(this, args || {});
|
||||
if (!result && cmdResult !== undefined)
|
||||
result = cmdResult;
|
||||
tmpSel.toOrientedRange(rangeList.ranges[i]);
|
||||
tmpSel.toOrientedRange(ranges[i]);
|
||||
}
|
||||
tmpSel.detach();
|
||||
|
||||
|
|
@ -599,6 +604,10 @@ var Editor = require("./editor").Editor;
|
|||
for (var i = ranges.length; i--; )
|
||||
selection.addRange(ranges[i], true);
|
||||
|
||||
// keep old selection as primary if possible
|
||||
if (range && selection.rangeList.rangeAtPoint(range.start))
|
||||
selection.addRange(range, true);
|
||||
|
||||
this.$blockScrolling -= 1;
|
||||
|
||||
return ranges.length;
|
||||
|
|
|
|||
|
|
@ -30,8 +30,11 @@
|
|||
|
||||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
var lang = require("./lib/lang")
|
||||
var Range = require("./range").Range
|
||||
var oop = require("./lib/oop");
|
||||
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||
var lang = require("./lib/lang");
|
||||
var Range = require("./range").Range;
|
||||
var Anchor = require("./anchor").Anchor;
|
||||
var HashHandler = require("./keyboard/hash_handler").HashHandler;
|
||||
var Tokenizer = require("./tokenizer").Tokenizer;
|
||||
var comparePoints = Range.comparePoints;
|
||||
|
|
@ -42,12 +45,14 @@ var SnippetManager = function() {
|
|||
};
|
||||
|
||||
(function() {
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.getTokenizer = function() {
|
||||
function TabstopToken(str, _, stack) {
|
||||
str = str.substr(1);
|
||||
if (/^\d+$/.test(str) && !stack.inFormatString)
|
||||
return [{tabstopId: parseInt(str, 10)}];
|
||||
return [{text: str}]
|
||||
return [{text: str}];
|
||||
}
|
||||
function escape(ch) {
|
||||
return "(?:[^\\\\" + ch + "]|\\\\.)";
|
||||
|
|
@ -125,7 +130,7 @@ var SnippetManager = function() {
|
|||
});
|
||||
SnippetManager.prototype.getTokenizer = function() {
|
||||
return SnippetManager.$tokenizer;
|
||||
}
|
||||
};
|
||||
return SnippetManager.$tokenizer;
|
||||
};
|
||||
|
||||
|
|
@ -150,7 +155,8 @@ var SnippetManager = function() {
|
|||
var s = editor.session;
|
||||
switch(name) {
|
||||
case "CURRENT_WORD":
|
||||
var r = s.getWordRange();
|
||||
var r = s.getWordRange();
|
||||
/* falls through */
|
||||
case "SELECTION":
|
||||
case "SELECTED_TEXT":
|
||||
return s.getTextRange(r);
|
||||
|
|
@ -166,7 +172,7 @@ var SnippetManager = function() {
|
|||
return s.getUseSoftTabs() ? "YES" : "NO";
|
||||
case "TAB_SIZE":
|
||||
return s.getTabSize();
|
||||
// defult but can't fill :(
|
||||
// default but can't fill :(
|
||||
case "FILENAME":
|
||||
case "FILEPATH":
|
||||
return "";
|
||||
|
|
@ -262,7 +268,7 @@ var SnippetManager = function() {
|
|||
return result;
|
||||
};
|
||||
|
||||
this.insertSnippet = function(editor, snippetText) {
|
||||
this.insertSnippetForSelection = function(editor, snippetText) {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = editor.session.getLine(cursor.row);
|
||||
var tabString = editor.session.getTabString();
|
||||
|
|
@ -313,7 +319,7 @@ var SnippetManager = function() {
|
|||
tabstops.forEach(function(ts) {ts.length = 0});
|
||||
var expanding = {};
|
||||
function copyValue(val) {
|
||||
var copy = []
|
||||
var copy = [];
|
||||
for (var i = 0; i < val.length; i++) {
|
||||
var p = val[i];
|
||||
if (typeof p == "object") {
|
||||
|
|
@ -349,7 +355,7 @@ var SnippetManager = function() {
|
|||
|
||||
if (ts.indexOf(p) === -1)
|
||||
ts.push(p);
|
||||
};
|
||||
}
|
||||
|
||||
// convert to plain text
|
||||
var row = 0, column = 0;
|
||||
|
|
@ -373,8 +379,21 @@ var SnippetManager = function() {
|
|||
var end = editor.session.replace(range, text);
|
||||
|
||||
var tabstopManager = new TabstopManager(editor);
|
||||
tabstopManager.addTabstops(tabstops, range.start, end);
|
||||
tabstopManager.tabNext();
|
||||
var selectionId = editor.inVirtualSelectionMode && editor.selection.index;
|
||||
tabstopManager.addTabstops(tabstops, range.start, end, selectionId);
|
||||
};
|
||||
|
||||
this.insertSnippet = function(editor, snippetText) {
|
||||
var self = this;
|
||||
if (editor.inVirtualSelectionMode)
|
||||
return self.insertSnippetForSelection(editor, snippetText);
|
||||
|
||||
editor.forEachSelection(function() {
|
||||
self.insertSnippetForSelection(editor, snippetText);
|
||||
}, null, {keepOrder: true});
|
||||
|
||||
if (editor.tabstopManager)
|
||||
editor.tabstopManager.tabNext();
|
||||
};
|
||||
|
||||
this.$getScope = function(editor) {
|
||||
|
|
@ -384,7 +403,7 @@ var SnippetManager = function() {
|
|||
// PHP is actually HTML
|
||||
if (scope === "php" && !editor.session.$mode.inlinePhp)
|
||||
scope = "html";
|
||||
var c = editor.getCursorPosition()
|
||||
var c = editor.getCursorPosition();
|
||||
var state = editor.session.getState(c.row);
|
||||
if (typeof state === "object") {
|
||||
state = state[0];
|
||||
|
|
@ -413,7 +432,17 @@ var SnippetManager = function() {
|
|||
return scopes;
|
||||
};
|
||||
|
||||
this.expandWithTab = function(editor) {
|
||||
this.expandWithTab = function(editor, options) {
|
||||
var self = this;
|
||||
var result = editor.forEachSelection(function() {
|
||||
return self.expandSnippetForSelection(editor, options);
|
||||
}, null, {keepOrder: true});
|
||||
if (result && editor.tabstopManager)
|
||||
editor.tabstopManager.tabNext();
|
||||
return result;
|
||||
};
|
||||
|
||||
this.expandSnippetForSelection = function(editor, options) {
|
||||
var cursor = editor.getCursorPosition();
|
||||
var line = editor.session.getLine(cursor.row);
|
||||
var before = line.substring(0, cursor.column);
|
||||
|
|
@ -429,7 +458,8 @@ var SnippetManager = function() {
|
|||
}, this);
|
||||
if (!snippet)
|
||||
return false;
|
||||
|
||||
if (options && options.dryRun)
|
||||
return true;
|
||||
editor.session.doc.removeInLine(cursor.row,
|
||||
cursor.column - snippet.replaceBefore.length,
|
||||
cursor.column + snippet.replaceAfter.length
|
||||
|
|
@ -437,7 +467,7 @@ var SnippetManager = function() {
|
|||
|
||||
this.variables.M__ = snippet.matchBefore;
|
||||
this.variables.T__ = snippet.matchAfter;
|
||||
this.insertSnippet(editor, snippet.content);
|
||||
this.insertSnippetForSelection(editor, snippet.content);
|
||||
|
||||
this.variables.M__ = this.variables.T__ = null;
|
||||
return true;
|
||||
|
|
@ -469,7 +499,7 @@ var SnippetManager = function() {
|
|||
var self = this;
|
||||
function wrapRegexp(src) {
|
||||
if (src && !/^\^?\(.*\)\$?$|^\\b$/.test(src))
|
||||
src = "(?:" + src + ")"
|
||||
src = "(?:" + src + ")";
|
||||
|
||||
return src || "";
|
||||
}
|
||||
|
|
@ -491,7 +521,7 @@ var SnippetManager = function() {
|
|||
function addSnippet(s) {
|
||||
if (!s.scope)
|
||||
s.scope = scope || "_";
|
||||
scope = s.scope
|
||||
scope = s.scope;
|
||||
if (!snippetMap[scope]) {
|
||||
snippetMap[scope] = [];
|
||||
snippetNameMap[scope] = {};
|
||||
|
|
@ -517,12 +547,14 @@ var SnippetManager = function() {
|
|||
|
||||
s.endRe = guardedRegexp(s.endTrigger, s.endGuard, true);
|
||||
s.endTriggerRe = new RegExp(s.endTrigger, "", true);
|
||||
};
|
||||
}
|
||||
|
||||
if (snippets.content)
|
||||
addSnippet(snippets);
|
||||
else if (Array.isArray(snippets))
|
||||
snippets.forEach(addSnippet);
|
||||
|
||||
this._signal("registerSnippets", {scope: scope});
|
||||
};
|
||||
this.unregister = function(snippets, scope) {
|
||||
var snippetMap = this.snippetMap;
|
||||
|
|
@ -551,7 +583,7 @@ var SnippetManager = function() {
|
|||
while (m = re.exec(str)) {
|
||||
if (m[1]) {
|
||||
try {
|
||||
snippet = JSON.parse(m[1])
|
||||
snippet = JSON.parse(m[1]);
|
||||
list.push(snippet);
|
||||
} catch (e) {}
|
||||
} if (m[4]) {
|
||||
|
|
@ -604,9 +636,10 @@ var TabstopManager = function(editor) {
|
|||
};
|
||||
(function() {
|
||||
this.attach = function(editor) {
|
||||
this.index = -1;
|
||||
this.index = 0;
|
||||
this.ranges = [];
|
||||
this.tabstops = [];
|
||||
this.$openTabstops = null;
|
||||
this.selectedTabstop = null;
|
||||
|
||||
this.editor = editor;
|
||||
|
|
@ -646,7 +679,7 @@ var TabstopManager = function(editor) {
|
|||
}
|
||||
if (!this.$inChange && isRemove) {
|
||||
var ts = this.selectedTabstop;
|
||||
var changedOutside = !ts.some(function(r) {
|
||||
var changedOutside = ts && !ts.some(function(r) {
|
||||
return comparePoints(r.start, start) <= 0 && comparePoints(r.end, end) >= 0;
|
||||
});
|
||||
if (changedOutside)
|
||||
|
|
@ -658,7 +691,7 @@ var TabstopManager = function(editor) {
|
|||
if (r.end.row < start.row)
|
||||
continue;
|
||||
|
||||
if (comparePoints(start, r.start) < 0 && comparePoints(end, r.end) > 0) {
|
||||
if (isRemove && comparePoints(start, r.start) < 0 && comparePoints(end, r.end) > 0) {
|
||||
this.removeRange(r);
|
||||
i--;
|
||||
continue;
|
||||
|
|
@ -681,7 +714,7 @@ var TabstopManager = function(editor) {
|
|||
};
|
||||
this.updateLinkedFields = function() {
|
||||
var ts = this.selectedTabstop;
|
||||
if (!ts.hasLinkedRanges)
|
||||
if (!ts || !ts.hasLinkedRanges)
|
||||
return;
|
||||
this.$inChange = true;
|
||||
var session = this.editor.session;
|
||||
|
|
@ -690,7 +723,7 @@ var TabstopManager = function(editor) {
|
|||
var range = ts[i];
|
||||
if (!range.linked)
|
||||
continue;
|
||||
var fmt = exports.snippetManager.tmStrFormat(text, range.original)
|
||||
var fmt = exports.snippetManager.tmStrFormat(text, range.original);
|
||||
session.replace(range, fmt);
|
||||
}
|
||||
this.$inChange = false;
|
||||
|
|
@ -701,7 +734,7 @@ var TabstopManager = function(editor) {
|
|||
};
|
||||
this.onChangeSelection = function() {
|
||||
if (!this.editor)
|
||||
return
|
||||
return;
|
||||
var lead = this.editor.selection.lead;
|
||||
var anchor = this.editor.selection.anchor;
|
||||
var isEmpty = this.editor.selection.isEmpty();
|
||||
|
|
@ -719,14 +752,17 @@ var TabstopManager = function(editor) {
|
|||
this.detach();
|
||||
};
|
||||
this.tabNext = function(dir) {
|
||||
var max = this.tabstops.length - 1;
|
||||
var max = this.tabstops.length;
|
||||
var index = this.index + (dir || 1);
|
||||
index = Math.min(Math.max(index, 0), max);
|
||||
this.selectTabstop(index);
|
||||
index = Math.min(Math.max(index, 1), max);
|
||||
if (index == max)
|
||||
index = 0;
|
||||
this.selectTabstop(index);
|
||||
if (index === 0)
|
||||
this.detach();
|
||||
};
|
||||
this.selectTabstop = function(index) {
|
||||
this.$openTabstops = null;
|
||||
var ts = this.tabstops[this.index];
|
||||
if (ts)
|
||||
this.addTabstopMarkers(ts);
|
||||
|
|
@ -744,6 +780,9 @@ var TabstopManager = function(editor) {
|
|||
continue;
|
||||
sel.addRange(ts[i].clone(), true);
|
||||
}
|
||||
// todo investigate why is this needed
|
||||
if (sel.ranges[0])
|
||||
sel.addRange(sel.ranges[0].clone());
|
||||
} else {
|
||||
this.editor.selection.setRange(ts.firstNonLinked);
|
||||
}
|
||||
|
|
@ -751,6 +790,8 @@ var TabstopManager = function(editor) {
|
|||
this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler);
|
||||
};
|
||||
this.addTabstops = function(tabstops, start, end) {
|
||||
if (!this.$openTabstops)
|
||||
this.$openTabstops = [];
|
||||
// add final tabstop if missing
|
||||
if (!tabstops[0]) {
|
||||
var p = Range.fromPoints(end, end);
|
||||
|
|
@ -761,33 +802,44 @@ var TabstopManager = function(editor) {
|
|||
}
|
||||
|
||||
var i = this.index;
|
||||
var arg = [i, 0];
|
||||
var arg = [i + 1, 0];
|
||||
var ranges = this.ranges;
|
||||
var editor = this.editor;
|
||||
tabstops.forEach(function(ts) {
|
||||
tabstops.forEach(function(ts, index) {
|
||||
var dest = this.$openTabstops[index] || ts;
|
||||
|
||||
for (var i = ts.length; i--;) {
|
||||
var p = ts[i];
|
||||
var range = Range.fromPoints(p.start, p.end || p.start);
|
||||
movePoint(range.start, start);
|
||||
movePoint(range.end, start);
|
||||
range.original = p;
|
||||
range.tabstop = ts;
|
||||
range.tabstop = dest;
|
||||
ranges.push(range);
|
||||
ts[i] = range;
|
||||
if (dest != ts)
|
||||
dest.unshift(range);
|
||||
else
|
||||
dest[i] = range;
|
||||
if (p.fmtString) {
|
||||
range.linked = true;
|
||||
ts.hasLinkedRanges = true;
|
||||
} else if (!ts.firstNonLinked)
|
||||
ts.firstNonLinked = range;
|
||||
dest.hasLinkedRanges = true;
|
||||
} else if (!dest.firstNonLinked)
|
||||
dest.firstNonLinked = range;
|
||||
}
|
||||
if (!ts.firstNonLinked)
|
||||
ts.hasLinkedRanges = false;
|
||||
arg.push(ts);
|
||||
this.addTabstopMarkers(ts);
|
||||
if (!dest.firstNonLinked)
|
||||
dest.hasLinkedRanges = false;
|
||||
if (dest === ts) {
|
||||
arg.push(dest);
|
||||
this.$openTabstops[index] = dest;
|
||||
}
|
||||
this.addTabstopMarkers(dest);
|
||||
}, this);
|
||||
// tabstop 0 is the last one
|
||||
arg.push(arg.splice(2, 1)[0]);
|
||||
this.tabstops.splice.apply(this.tabstops, arg);
|
||||
|
||||
if (arg.length > 2) {
|
||||
// when adding new snippet inside existing one, make sure 0 tabstop is at the end
|
||||
if (this.tabstops.length)
|
||||
arg.push(arg.splice(2, 1)[0]);
|
||||
this.tabstops.splice.apply(this.tabstops, arg);
|
||||
}
|
||||
};
|
||||
|
||||
this.addTabstopMarkers = function(ts) {
|
||||
|
|
@ -810,6 +862,13 @@ var TabstopManager = function(editor) {
|
|||
i = this.ranges.indexOf(range);
|
||||
this.ranges.splice(i, 1);
|
||||
this.editor.session.removeMarker(range.markerId);
|
||||
if (!range.tabstop.length) {
|
||||
i = this.tabstops.indexOf(range.tabstop);
|
||||
if (i != -1)
|
||||
this.tabstops.splice(i, 1);
|
||||
if (!this.tabstops.length)
|
||||
this.detach();
|
||||
}
|
||||
};
|
||||
|
||||
this.keyboardHandler = new HashHandler();
|
||||
|
|
@ -835,6 +894,19 @@ var TabstopManager = function(editor) {
|
|||
}).call(TabstopManager.prototype);
|
||||
|
||||
|
||||
|
||||
var changeTracker = {};
|
||||
changeTracker.onChange = Anchor.prototype.onChange;
|
||||
changeTracker.setPosition = function(row, column) {
|
||||
this.pos.row = row;
|
||||
this.pos.column = column;
|
||||
};
|
||||
changeTracker.update = function(pos, delta, $insertRight) {
|
||||
this.$insertRight = $insertRight;
|
||||
this.pos = pos;
|
||||
this.onChange(delta);
|
||||
};
|
||||
|
||||
var movePoint = function(point, diff) {
|
||||
if (point.row == 0)
|
||||
point.column += diff.column;
|
||||
|
|
@ -860,4 +932,14 @@ require("./lib/dom").importCssString("\
|
|||
exports.snippetManager = new SnippetManager();
|
||||
|
||||
|
||||
var Editor = require("./editor").Editor;
|
||||
(function() {
|
||||
this.insertSnippet = function(content, options) {
|
||||
return exports.snippetManager.insertSnippet(this, content, options);
|
||||
};
|
||||
this.expandSnippet = function(options) {
|
||||
return exports.snippetManager.expandWithTab(this, options);
|
||||
};
|
||||
}).call(Editor.prototype);
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
this.session = session;
|
||||
if (!session)
|
||||
return;
|
||||
|
||||
|
||||
if (this.scrollMargin.top && session.getScrollTop() <= 0)
|
||||
session.setScrollTop(-this.scrollMargin.top);
|
||||
|
||||
|
|
@ -337,8 +337,6 @@ var VirtualRenderer = function(container, theme) {
|
|||
*
|
||||
**/
|
||||
this.onResize = function(force, gutterWidth, width, height) {
|
||||
// if (force)
|
||||
// console.log("force resize requested", width, height)
|
||||
if (this.resizing > 2)
|
||||
return;
|
||||
else if (this.resizing > 0)
|
||||
|
|
@ -353,13 +351,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
if (!width)
|
||||
width = el.clientWidth || el.scrollWidth;
|
||||
var changes = this.$updateCachedSize(force, gutterWidth, width, height);
|
||||
|
||||
// console.log("resizing to", width, height, JSON.stringify(this.$size))
|
||||
|
||||
// setTimeout(function() {
|
||||
// console.log("actual size ", this.container.clientWidth, this.container.clientHeight)
|
||||
|
||||
// }.bind(this), 500)
|
||||
|
||||
if (!this.$size.scrollerHeight || (!width && !height))
|
||||
return this.resizing = 0;
|
||||
|
|
@ -757,7 +749,16 @@ var VirtualRenderer = function(container, theme) {
|
|||
};
|
||||
|
||||
this.$updateScrollBarV = function() {
|
||||
this.scrollBarV.setScrollHeight(this.layerConfig.maxHeight + this.scrollMargin.v);
|
||||
var scrollHeight = this.layerConfig.maxHeight;
|
||||
var scrollerHeight = this.$size.scrollerHeight;
|
||||
if (!this.$maxLines && this.$scrollPastEnd) {
|
||||
scrollHeight -= (scrollerHeight - this.lineHeight) * this.$scrollPastEnd;
|
||||
if (this.scrollTop > scrollHeight - scrollerHeight) {
|
||||
scrollHeight = this.scrollTop + scrollerHeight;
|
||||
this.scrollBarV.scrollTop = null;
|
||||
}
|
||||
}
|
||||
this.scrollBarV.setScrollHeight(scrollHeight + this.scrollMargin.v);
|
||||
this.scrollBarV.setScrollTop(this.scrollTop + this.scrollMargin.top);
|
||||
};
|
||||
this.$updateScrollBarH = function() {
|
||||
|
|
@ -934,11 +935,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
}
|
||||
|
||||
if (!this.$maxLines && this.$scrollPastEnd) {
|
||||
if (this.scrollTop > maxHeight - size.scrollerHeight)
|
||||
maxHeight += Math.min(
|
||||
(size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd,
|
||||
this.scrollTop - maxHeight + size.scrollerHeight
|
||||
);
|
||||
maxHeight += (size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd;
|
||||
}
|
||||
|
||||
var vScroll = !hideScrollbars && (this.$vScrollBarAlwaysVisible ||
|
||||
|
|
@ -1373,8 +1370,7 @@ var VirtualRenderer = function(container, theme) {
|
|||
if (deltaY < 0 && this.session.getScrollTop() >= 1 - this.scrollMargin.top)
|
||||
return true;
|
||||
if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight
|
||||
- this.layerConfig.maxHeight - (this.$size.scrollerHeight - this.lineHeight) * this.$scrollPastEnd
|
||||
< -1 + this.scrollMargin.bottom)
|
||||
- this.layerConfig.maxHeight < -1 + this.scrollMargin.bottom)
|
||||
return true;
|
||||
if (deltaX < 0 && this.session.getScrollLeft() >= 1 - this.scrollMargin.left)
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -111,14 +111,7 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
|
|||
};
|
||||
|
||||
this.$normalizePath = function(path) {
|
||||
if (!location.host) // needed for file:// protocol
|
||||
return path;
|
||||
path = path.replace(/^[a-z]+:\/\/[^\/]+/, ""); // Remove domain name and rebuild it
|
||||
path = location.protocol + "//" + location.host
|
||||
// paths starting with a slash are relative to the root (host)
|
||||
+ (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
|
||||
+ "/" + path.replace(/^[\/]+/, "");
|
||||
return path;
|
||||
return net.qualifyURL(path);
|
||||
};
|
||||
|
||||
this.terminate = function() {
|
||||
|
|
@ -149,7 +142,9 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
|
|||
// TODO: cleanup event
|
||||
this.$worker.postMessage({event: event, data: {data: data.data}});
|
||||
}
|
||||
catch(ex) {}
|
||||
catch(ex) {
|
||||
console.error(ex.stack);
|
||||
}
|
||||
};
|
||||
|
||||
this.attachToDocument = function(doc) {
|
||||
|
|
@ -182,7 +177,7 @@ var WorkerClient = function(topLevelNamespaces, mod, classname, workerUrl) {
|
|||
this.$workerBlob = function(workerUrl) {
|
||||
// workerUrl can be protocol relative
|
||||
// importScripts only takes fully qualified urls
|
||||
var script = "importScripts('" + net.qualifyURL( workerUrl ) + "');";
|
||||
var script = "importScripts('" + net.qualifyURL(workerUrl) + "');";
|
||||
try {
|
||||
return new Blob([script], {"type": "application/javascript"});
|
||||
} catch (e) { // Backwards-compatibility
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue