package
This commit is contained in:
parent
5e41503243
commit
e5fdce9dd3
27 changed files with 686 additions and 93 deletions
|
|
@ -31,16 +31,18 @@ If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookma
|
|||
History
|
||||
-------
|
||||
|
||||
Previously known as “Bespin” and “Skywriter” it’s now known as Ace (Ajax.org Cloud9 Editor)! Bespin and Ace started as two independent projects both aiming to build a no compromise code editor component for the web. Bespin started as part of Mozilla Labs and was based on the canvas tag, while Ace is the Editor component of the Cloud9 IDE and is using the DOM for rendering. After the release of Ace at JSConf.eu 2010 in Berlin the Skywriter team decided to merge Ace with a simplified version of Skywriter's plugin system and some of Skywriter's extensibility points. All these changes have been merged back to Ace. Both Ajax.org and Mozilla are actively developing and maintaining Ace.
|
||||
Previously known as “Bespin” and “Skywriter” it’s now known as Ace (Ajax.org Cloud9 Editor)! Bespin and Ace started as two independent projects, both aiming to build a no-compromise code editor component for the web. Bespin started as part of Mozilla Labs and was based on the canvas tag, while Ace is the Editor component of the Cloud9 IDE and is using the DOM for rendering. After the release of Ace at JSConf.eu 2010 in Berlin the Skywriter team decided to merge Ace with a simplified version of Skywriter's plugin system and some of Skywriter's extensibility points. All these changes have been merged back to Ace. Both Ajax.org and Mozilla are actively developing and maintaining Ace.
|
||||
|
||||
Getting the code
|
||||
----------------
|
||||
|
||||
Ace is a community project. We actively encourage and support contributions. The Ace source code is hosted on GitHub. It is released under the Mozilla tri-license (MPL/GPL/LGPL), the same license used by Firefox. This license is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings!
|
||||
|
||||
```bash
|
||||
git clone git://github.com/ajaxorg/ace.git
|
||||
cd ace
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
Embedding Ace
|
||||
-------------
|
||||
|
|
@ -49,6 +51,7 @@ Ace can be easily embedded into any existing web page. The Ace git repository sh
|
|||
|
||||
The easiest version is simply:
|
||||
|
||||
```html
|
||||
<div id="editor">some text</div>
|
||||
<script src="src/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script>
|
||||
|
|
@ -56,32 +59,42 @@ The easiest version is simply:
|
|||
var editor = ace.edit("editor");
|
||||
};
|
||||
</script>
|
||||
```
|
||||
|
||||
With "editor" being the id of the DOM element, which should be converted to an editor. Note that this element must be explicitly sized and positioned `absolute` or `relative` for Ace to work. e.g.
|
||||
|
||||
```css
|
||||
#editor {
|
||||
position: absolute;
|
||||
width: 500px;
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
To change the theme simply include the Theme's JavaScript file
|
||||
|
||||
```html
|
||||
<script src="src/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
|
||||
```
|
||||
|
||||
and configure the editor to use the theme:
|
||||
|
||||
```javascript
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
```
|
||||
|
||||
By default the editor only supports plain text mode; many other languages are available as separate modules. After including the mode's JavaScript file:
|
||||
|
||||
```html
|
||||
<script src="src/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
|
||||
```
|
||||
|
||||
Then the mode can be used like this:
|
||||
|
||||
```javascript
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
editor.getSession().setMode(new JavaScriptMode());
|
||||
```
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
|
@ -97,11 +110,15 @@ Running Ace
|
|||
|
||||
After the checkout Ace works out of the box. No build step is required. Open 'editor.html' in any browser except Google Chrome. Google Chrome doesn't allow XMLHTTPRequests from files loaded from disc (i.e. with a file:/// URL). To open Ace in Chrome simply start the bundled mini HTTP server:
|
||||
|
||||
```bash
|
||||
./static.py
|
||||
```
|
||||
|
||||
Or using Node.JS
|
||||
|
||||
```bash
|
||||
./static.js
|
||||
```
|
||||
|
||||
The editor can then be opened at http://localhost:8888/index.html.
|
||||
|
||||
|
|
@ -110,28 +127,38 @@ Package Ace
|
|||
|
||||
To package Ace we use the dryice build tool developed by the Mozilla Skywriter team. Before you can build you need to make sure that the submodules are up to date.
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
Afterwards Ace can be built by calling
|
||||
|
||||
```bash
|
||||
./Makefile.dryice.js normal
|
||||
```
|
||||
|
||||
The packaged Ace will be put in the 'build' folder.
|
||||
|
||||
To build the bookmarklet version execute
|
||||
|
||||
```bash
|
||||
./Makefile.dryice.js bm
|
||||
```
|
||||
|
||||
Running the Unit Tests
|
||||
----------------------
|
||||
|
||||
The Ace unit tests run on node.js. Before the first run a couple of node modules have to be installed. The easiest way to do this is by using the node package manager (npm). In the Ace base directory simply call
|
||||
|
||||
```bash
|
||||
npm link .
|
||||
```
|
||||
|
||||
To run the tests call:
|
||||
|
||||
```bash
|
||||
node lib/ace/test/all.js
|
||||
```
|
||||
|
||||
You can also run the tests in your browser by serving:
|
||||
|
||||
|
|
@ -139,12 +166,10 @@ You can also run the tests in your browser by serving:
|
|||
|
||||
This makes debugging failing tests way more easier.
|
||||
|
||||
_Note_: Currently (2011-05-21) the tests seem to run on Chrome only.
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Ace wouldn't be where it is now without contributions. Feel free to fork and improve/enhance Ace in any way your want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. To protect the interests of the Ace contributors and users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is the simplest of agreements, requiring that the contributions you make to an ajax.org project are only those you're allowed to make. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes ten minutes, and only needs to be completed once. There are two versions of the agreement:
|
||||
Ace wouldn't be what it is without contributions! Feel free to fork and improve/enhance Ace any way you want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. To protect the interests of the Ace contributors and users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is the simplest of agreements, requiring that the contributions you make to an ajax.org project are only those you're allowed to make. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes ten minutes, and only needs to be completed once. There are two versions of the agreement:
|
||||
|
||||
1. [The Individual CLA](https://github.com/ajaxorg/ace/raw/master/doc/Contributor_License_Agreement-v2.pdf): use this version if you're working on an ajax.org in your spare time, or can clearly claim ownership of copyright in what you'll be submitting.
|
||||
2. [The Corporate CLA](https://github.com/ajaxorg/ace/raw/master/doc/Corporate_Contributor_License_Agreement-v2.pdf): have your corporate lawyer review and submit this if your company is going to be contributing to ajax.org projects
|
||||
|
|
|
|||
|
|
@ -5167,11 +5167,12 @@ exports.create = create;
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
|
||||
define('demo/demo', ['require', 'exports', 'module' , 'pilot/canon', 'pilot/event', 'ace/range', 'ace/editor', 'ace/virtual_renderer', 'ace/theme/textmate', 'ace/edit_session', 'ace/mode/javascript', 'ace/mode/css', 'ace/mode/scss', 'ace/mode/html', 'ace/mode/xml', 'ace/mode/python', 'ace/mode/php', 'ace/mode/java', 'ace/mode/csharp', 'ace/mode/ruby', 'ace/mode/c_cpp', 'ace/mode/coffee', 'ace/mode/json', 'ace/mode/perl', 'ace/mode/clojure', 'ace/mode/ocaml', 'ace/mode/svg', 'ace/mode/textile', 'ace/mode/text', 'ace/mode/groovy', 'ace/mode/scala', 'ace/undomanager', 'ace/keyboard/keybinding/vim', 'ace/keyboard/keybinding/emacs', 'ace/keyboard/hash_handler', 'text!demo/docs/plaintext.txt', 'text!demo/docs/javascript.js', 'text!demo/docs/css.css', 'text!demo/docs/scss.scss', 'text!demo/docs/html.html', 'text!demo/docs/python.py', 'text!demo/docs/php.php', 'text!demo/docs/java.java', 'text!demo/docs/ruby.rb', 'text!demo/docs/csharp.cs', 'text!demo/docs/cpp.cpp', 'text!demo/docs/coffeescript.coffee', 'text!demo/docs/json.json', 'text!demo/docs/perl.pl', 'text!demo/docs/clojure.clj', 'text!demo/docs/ocaml.ml', 'text!demo/docs/svg.svg', 'text!demo/docs/textile.textile', 'text!demo/docs/groovy.groovy', 'text!demo/docs/scala.scala', 'ace/split'], function(require, exports, module) {
|
||||
define('demo/demo', ['require', 'exports', 'module' , 'pilot/canon', 'pilot/event', 'ace/lib/net', 'ace/range', 'ace/editor', 'ace/virtual_renderer', 'ace/theme/textmate', 'ace/edit_session', 'ace/mode/javascript', 'ace/mode/css', 'ace/mode/scss', 'ace/mode/html', 'ace/mode/xml', 'ace/mode/python', 'ace/mode/php', 'ace/mode/java', 'ace/mode/csharp', 'ace/mode/ruby', 'ace/mode/c_cpp', 'ace/mode/coffee', 'ace/mode/json', 'ace/mode/perl', 'ace/mode/clojure', 'ace/mode/ocaml', 'ace/mode/svg', 'ace/mode/textile', 'ace/mode/text', 'ace/mode/groovy', 'ace/mode/scala', 'ace/undomanager', 'ace/keyboard/keybinding/vim', 'ace/keyboard/keybinding/emacs', 'ace/keyboard/hash_handler', 'text/demo/docs/plaintext.txt', 'text/demo/docs/javascript.js', 'text/demo/docs/css.css', 'text/demo/docs/scss.scss', 'text/demo/docs/html.html', 'text/demo/docs/python.py', 'text/demo/docs/php.php', 'text/demo/docs/java.java', 'text/demo/docs/ruby.rb', 'text/demo/docs/csharp.cs', 'text/demo/docs/cpp.cpp', 'text/demo/docs/coffeescript.coffee', 'text/demo/docs/json.json', 'text/demo/docs/perl.pl', 'text/demo/docs/clojure.clj', 'text/demo/docs/ocaml.ml', 'text/demo/docs/svg.svg', 'text/demo/docs/textile.textile', 'text/demo/docs/groovy.groovy', 'text/demo/docs/scala.scala', 'ace/split'], function(require, exports, module) {
|
||||
|
||||
exports.launch = function(env) {
|
||||
var canon = require("pilot/canon");
|
||||
var event = require("pilot/event");
|
||||
var net = require("ace/lib/net");
|
||||
var Range = require("ace/range").Range;
|
||||
var Editor = require("ace/editor").Editor;
|
||||
var Renderer = require("ace/virtual_renderer").VirtualRenderer;
|
||||
|
|
@ -5224,7 +5225,7 @@ exports.launch = function(env) {
|
|||
var docs = {};
|
||||
|
||||
// Make the lorem ipsum text a little bit longer.
|
||||
var loreIpsum = require("text!demo/docs/plaintext.txt");
|
||||
var loreIpsum = require("text/demo/docs/plaintext.txt");
|
||||
for (var i = 0; i < 5; i++) {
|
||||
loreIpsum += loreIpsum;
|
||||
}
|
||||
|
|
@ -5234,80 +5235,80 @@ exports.launch = function(env) {
|
|||
docs.plain.setMode(new TextMode());
|
||||
docs.plain.setUndoManager(new UndoManager());
|
||||
|
||||
docs.js = new EditSession(require("text!demo/docs/javascript.js"));
|
||||
docs.js = new EditSession(require("text/demo/docs/javascript.js"));
|
||||
docs.js.setMode(new JavaScriptMode());
|
||||
docs.js.setUndoManager(new UndoManager());
|
||||
|
||||
docs.css = new EditSession(require("text!demo/docs/css.css"));
|
||||
docs.css = new EditSession(require("text/demo/docs/css.css"));
|
||||
docs.css.setMode(new CssMode());
|
||||
docs.css.setUndoManager(new UndoManager());
|
||||
|
||||
docs.scss = new EditSession(require("text!demo/docs/scss.scss"));
|
||||
docs.scss = new EditSession(require("text/demo/docs/scss.scss"));
|
||||
docs.scss.setMode(new ScssMode());
|
||||
docs.scss.setUndoManager(new UndoManager());
|
||||
|
||||
docs.html = new EditSession(require("text!demo/docs/html.html"));
|
||||
docs.html = new EditSession(require("text/demo/docs/html.html"));
|
||||
docs.html.setMode(new HtmlMode());
|
||||
docs.html.setUndoManager(new UndoManager());
|
||||
|
||||
docs.python = new EditSession(require("text!demo/docs/python.py"));
|
||||
docs.python = new EditSession(require("text/demo/docs/python.py"));
|
||||
docs.python.setMode(new PythonMode());
|
||||
docs.python.setUndoManager(new UndoManager());
|
||||
|
||||
docs.php = new EditSession(require("text!demo/docs/php.php"));
|
||||
docs.php = new EditSession(require("text/demo/docs/php.php"));
|
||||
docs.php.setMode(new PhpMode());
|
||||
docs.php.setUndoManager(new UndoManager());
|
||||
|
||||
docs.java = new EditSession(require("text!demo/docs/java.java"));
|
||||
docs.java = new EditSession(require("text/demo/docs/java.java"));
|
||||
docs.java.setMode(new JavaMode());
|
||||
docs.java.setUndoManager(new UndoManager());
|
||||
docs.java.addFold("...", new Range(8, 44, 13, 4));
|
||||
|
||||
docs.ruby = new EditSession(require("text!demo/docs/ruby.rb"));
|
||||
docs.ruby = new EditSession(require("text/demo/docs/ruby.rb"));
|
||||
docs.ruby.setMode(new RubyMode());
|
||||
docs.ruby.setUndoManager(new UndoManager());
|
||||
|
||||
docs.csharp = new EditSession(require("text!demo/docs/csharp.cs"));
|
||||
docs.csharp = new EditSession(require("text/demo/docs/csharp.cs"));
|
||||
docs.csharp.setMode(new CSharpMode());
|
||||
docs.csharp.setUndoManager(new UndoManager());
|
||||
|
||||
docs.c_cpp = new EditSession(require("text!demo/docs/cpp.cpp"));
|
||||
docs.c_cpp = new EditSession(require("text/demo/docs/cpp.cpp"));
|
||||
docs.c_cpp.setMode(new CCPPMode());
|
||||
docs.c_cpp.setUndoManager(new UndoManager());
|
||||
|
||||
docs.coffee = new EditSession(require("text!demo/docs/coffeescript.coffee"));
|
||||
docs.coffee = new EditSession(require("text/demo/docs/coffeescript.coffee"));
|
||||
docs.coffee.setMode(new CoffeeMode());
|
||||
docs.coffee.setUndoManager(new UndoManager());
|
||||
|
||||
docs.json = new EditSession(require("text!demo/docs/json.json"));
|
||||
docs.json = new EditSession(require("text/demo/docs/json.json"));
|
||||
docs.json.setMode(new JsonMode());
|
||||
docs.json.setUndoManager(new UndoManager());
|
||||
|
||||
docs.perl = new EditSession(require("text!demo/docs/perl.pl"));
|
||||
docs.perl = new EditSession(require("text/demo/docs/perl.pl"));
|
||||
docs.perl.setMode(new PerlMode());
|
||||
docs.perl.setUndoManager(new UndoManager());
|
||||
|
||||
docs.clojure = new EditSession(require("text!demo/docs/clojure.clj"));
|
||||
docs.clojure = new EditSession(require("text/demo/docs/clojure.clj"));
|
||||
docs.clojure.setMode(new ClojureMode());
|
||||
docs.clojure.setUndoManager(new UndoManager());
|
||||
|
||||
docs.ocaml = new EditSession(require("text!demo/docs/ocaml.ml"));
|
||||
docs.ocaml = new EditSession(require("text/demo/docs/ocaml.ml"));
|
||||
docs.ocaml.setMode(new OcamlMode());
|
||||
docs.ocaml.setUndoManager(new UndoManager());
|
||||
|
||||
docs.svg = new EditSession(require("text!demo/docs/svg.svg"));
|
||||
docs.svg = new EditSession(require("text/demo/docs/svg.svg"));
|
||||
docs.svg.setMode(new SvgMode());
|
||||
docs.svg.setUndoManager(new UndoManager());
|
||||
|
||||
docs.textile = new EditSession(require("text!demo/docs/textile.textile"));
|
||||
docs.textile = new EditSession(require("text/demo/docs/textile.textile"));
|
||||
docs.textile.setMode(new TextileMode());
|
||||
docs.textile.setUndoManager(new UndoManager());
|
||||
|
||||
docs.groovy = new EditSession(require("text!demo/docs/groovy.groovy"));
|
||||
docs.groovy = new EditSession(require("text/demo/docs/groovy.groovy"));
|
||||
docs.groovy.setMode(new GroovyMode());
|
||||
docs.groovy.setUndoManager(new UndoManager());
|
||||
|
||||
docs.scala = new EditSession(require("text!demo/docs/scala.scala"));
|
||||
docs.scala = new EditSession(require("text/demo/docs/scala.scala"));
|
||||
docs.scala.setMode(new ScalaMode());
|
||||
docs.scala.setUndoManager(new UndoManager());
|
||||
|
||||
|
|
@ -5814,17 +5815,7 @@ function loadTheme(name, callback) {
|
|||
themes[name] = 1;
|
||||
var base = name.split("/").pop();
|
||||
var fileName = "src/theme-" + base + ".js";
|
||||
loadScriptFile(fileName, callback)
|
||||
}
|
||||
|
||||
function loadScriptFile(path, callback) {
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
var s = document.createElement('script');
|
||||
|
||||
s.src = path;
|
||||
head.appendChild(s);
|
||||
|
||||
s.onload = callback;
|
||||
net.loadScript(fileName, callback)
|
||||
}
|
||||
|
||||
});
|
||||
|
|
@ -6449,7 +6440,68 @@ exports.setSelectionEnd = function(textarea, end) {
|
|||
};
|
||||
|
||||
});
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
|
||||
/**
|
||||
* based on code from:
|
||||
*
|
||||
* @license RequireJS text 0.25.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
|
||||
* Available via the MIT or new BSD license.
|
||||
* see: http://github.com/jrburke/requirejs for details
|
||||
*/
|
||||
define('ace/lib/net', ['require', 'exports', 'module' ], function(require, exports, module) {
|
||||
|
||||
exports.get = function (url, callback) {
|
||||
var xhr = exports.createXhr();
|
||||
xhr.open('GET', url, true);
|
||||
xhr.onreadystatechange = function (evt) {
|
||||
//Do not explicitly handle errors, those should be
|
||||
//visible via console output in the browser.
|
||||
if (xhr.readyState === 4) {
|
||||
callback(xhr.responseText);
|
||||
}
|
||||
};
|
||||
xhr.send(null);
|
||||
};
|
||||
|
||||
var progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];
|
||||
|
||||
exports.createXhr = function () {
|
||||
//Would love to dump the ActiveX crap in here. Need IE 6 to die first.
|
||||
var xhr, i, progId;
|
||||
if (typeof XMLHttpRequest !== "undefined") {
|
||||
return new XMLHttpRequest();
|
||||
} else {
|
||||
for (i = 0; i < 3; i++) {
|
||||
progId = progIds[i];
|
||||
try {
|
||||
xhr = new ActiveXObject(progId);
|
||||
} catch (e) {}
|
||||
|
||||
if (xhr) {
|
||||
progIds = [progId]; // so faster next time
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!xhr) {
|
||||
throw new Error("createXhr(): XMLHttpRequest not available");
|
||||
}
|
||||
|
||||
return xhr;
|
||||
};
|
||||
|
||||
exports.loadScript = function(path, callback) {
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
var s = document.createElement('script');
|
||||
|
||||
s.src = path;
|
||||
head.appendChild(s);
|
||||
|
||||
s.onload = callback;
|
||||
};
|
||||
|
||||
});/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
|
|
@ -8326,7 +8378,7 @@ var MouseHandler = function(editor) {
|
|||
event.addMultiMouseDownListener(mouseTarget, 0, 2, 500, this.onMouseDoubleClick.bind(this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 0, 3, 600, this.onMouseTripleClick.bind(this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 0, 4, 600, this.onMouseQuadClick.bind(this));
|
||||
event.addMouseWheelListener(mouseTarget, this.onMouseWheel.bind(this));
|
||||
event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this));
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
|
@ -8567,7 +8619,8 @@ var MouseHandler = function(editor) {
|
|||
var speed = this.$scrollSpeed * 2;
|
||||
|
||||
this.editor.renderer.scrollBy(e.wheelX * speed, e.wheelY * speed);
|
||||
return event.preventDefault(e);
|
||||
if (this.editor.renderer.isScrollableBy(e.wheelX, e.wheelY))
|
||||
return event.preventDefault(e);
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -14041,7 +14094,7 @@ exports.Search = Search;
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define('ace/virtual_renderer', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/dom', 'pilot/event', 'pilot/useragent', 'ace/layer/gutter', 'ace/layer/marker', 'ace/layer/text', 'ace/layer/cursor', 'ace/scrollbar', 'ace/renderloop', 'pilot/event_emitter', 'text!ace/css/editor.css'], function(require, exports, module) {
|
||||
define('ace/virtual_renderer', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/dom', 'pilot/event', 'pilot/useragent', 'ace/layer/gutter', 'ace/layer/marker', 'ace/layer/text', 'ace/layer/cursor', 'ace/scrollbar', 'ace/renderloop', 'pilot/event_emitter', 'text/ace/css/editor.css'], function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var dom = require("pilot/dom");
|
||||
|
|
@ -14054,7 +14107,7 @@ var CursorLayer = require("ace/layer/cursor").Cursor;
|
|||
var ScrollBar = require("ace/scrollbar").ScrollBar;
|
||||
var RenderLoop = require("ace/renderloop").RenderLoop;
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
var editorCss = require("text!ace/css/editor.css");
|
||||
var editorCss = require("text/ace/css/editor.css");
|
||||
|
||||
// import CSS once
|
||||
dom.importCssString(editorCss);
|
||||
|
|
@ -14715,6 +14768,14 @@ var VirtualRenderer = function(container, theme) {
|
|||
deltaX && this.scrollToX(this.scroller.scrollLeft + deltaX);
|
||||
};
|
||||
|
||||
this.isScrollableBy = function(deltaX, deltaY) {
|
||||
if (deltaY < 0 && this.scrollTop > 0)
|
||||
return true;
|
||||
if (deltaY > 0 && this.scrollTop + this.$size.scrollerHeight < this.layerConfig.maxHeight)
|
||||
return true;
|
||||
// todo: handle horizontal scrolling
|
||||
};
|
||||
|
||||
this.screenToTextCoordinates = function(pageX, pageY) {
|
||||
var canvasPos = this.scroller.getBoundingClientRect();
|
||||
|
||||
|
|
@ -16960,7 +17021,7 @@ var WorkerClient = function(topLevelNamespaces, packagedJs, module, classname) {
|
|||
|
||||
this.$normalizePath = function(path) {
|
||||
if (!path.match(/^\w+:/))
|
||||
path = location.protocol + "//" + location.host + location.pathname.replace(/\/.*?$/, "") + "/" + path.replace(/^\//, "");
|
||||
path = location.protocol + "//" + location.host + location.pathname.replace(/\/[^\/]*$/, "") + "/" + path.replace(/^\//, "");
|
||||
return path;
|
||||
};
|
||||
|
||||
|
|
@ -25194,6 +25255,238 @@ define("text!build/demo/styles.css", [], "html {\n" +
|
|||
" text-align: left;\n" +
|
||||
"}");
|
||||
|
||||
define("text!build/textarea/style.css", [], "body {\n" +
|
||||
" margin:0;\n" +
|
||||
" padding:0;\n" +
|
||||
" background-color:#e6f5fc;\n" +
|
||||
" \n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"H2, H3, H4 {\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-weight:bold;\n" +
|
||||
" margin:0;\n" +
|
||||
" padding:0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"H2 {\n" +
|
||||
" font-size:28px;\n" +
|
||||
" color:#263842;\n" +
|
||||
" padding-bottom:6px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"H3 {\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-weight:bold;\n" +
|
||||
" font-size:22px;\n" +
|
||||
" color:#253741;\n" +
|
||||
" margin-top:43px;\n" +
|
||||
" margin-bottom:8px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"H4 {\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-weight:bold;\n" +
|
||||
" font-size:21px;\n" +
|
||||
" color:#222222;\n" +
|
||||
" margin-bottom:4px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"P {\n" +
|
||||
" padding:13px 0;\n" +
|
||||
" margin:0;\n" +
|
||||
" line-height:22px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL{\n" +
|
||||
" line-height : 22px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"PRE{\n" +
|
||||
" background : #333;\n" +
|
||||
" color : white;\n" +
|
||||
" padding : 10px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header {\n" +
|
||||
" height : 227px;\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" background: url(images/background.png) repeat-x 0 0;\n" +
|
||||
" border-bottom:1px solid #c9e8fa; \n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header .content .signature {\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-size:11px;\n" +
|
||||
" color:#ebe4d6;\n" +
|
||||
" position:absolute;\n" +
|
||||
" bottom:5px;\n" +
|
||||
" right:42px;\n" +
|
||||
" letter-spacing : 1px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".content {\n" +
|
||||
" width:970px;\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" margin:0 auto;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header .content {\n" +
|
||||
" height:184px;\n" +
|
||||
" margin-top:22px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header .content .logo {\n" +
|
||||
" width : 282px;\n" +
|
||||
" height : 184px;\n" +
|
||||
" background:url(images/logo.png) no-repeat 0 0;\n" +
|
||||
" position:absolute;\n" +
|
||||
" top:0;\n" +
|
||||
" left:0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header .content .title {\n" +
|
||||
" width : 605px;\n" +
|
||||
" height : 58px;\n" +
|
||||
" background:url(images/ace.png) no-repeat 0 0;\n" +
|
||||
" position:absolute;\n" +
|
||||
" top:98px;\n" +
|
||||
" left:329px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#wrapper {\n" +
|
||||
" background:url(images/body_background.png) repeat-x 0 0;\n" +
|
||||
" min-height:250px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#wrapper .content {\n" +
|
||||
" font-family:Arial;\n" +
|
||||
" font-size:14px;\n" +
|
||||
" color:#222222;\n" +
|
||||
" width:1000px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#wrapper .content .column1 {\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" float:left;\n" +
|
||||
" width:315px;\n" +
|
||||
" margin-right:31px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#wrapper .content .column2 {\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" float:left;\n" +
|
||||
" width:600px;\n" +
|
||||
" padding-top:47px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".fork_on_github {\n" +
|
||||
" width:310px;\n" +
|
||||
" height:80px;\n" +
|
||||
" background:url(images/fork_on_github.png) no-repeat 0 0;\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" margin-top:49px;\n" +
|
||||
" cursor:pointer;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".fork_on_github:hover {\n" +
|
||||
" background-position:0 -80px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".divider {\n" +
|
||||
" height:3px;\n" +
|
||||
" background-color:#bedaea;\n" +
|
||||
" margin-bottom:3px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".menu {\n" +
|
||||
" padding:23px 0 0 24px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.content-list {\n" +
|
||||
" padding:15px;\n" +
|
||||
" margin:0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-list {\n" +
|
||||
" padding:0;\n" +
|
||||
" margin:0 0 20px 0;\n" +
|
||||
" list-style-type:none;\n" +
|
||||
" line-height : 16px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-list LI {\n" +
|
||||
" color:#2557b4;\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-size:14px;\n" +
|
||||
" padding:7px 0;\n" +
|
||||
" border-bottom:1px dotted #d6e2e7;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-list LI:last-child {\n" +
|
||||
" border-bottom:0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"A {\n" +
|
||||
" color:#2557b4;\n" +
|
||||
" text-decoration:none;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"A:hover {\n" +
|
||||
" text-decoration:underline;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"P#first{\n" +
|
||||
" background : rgba(255,255,255,0.5);\n" +
|
||||
" padding : 20px;\n" +
|
||||
" font-size : 16px;\n" +
|
||||
" line-height : 24px;\n" +
|
||||
" margin : 0 0 20px 0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#footer {\n" +
|
||||
" height:40px;\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" background:url(images/bottombar.png) repeat-x 0 0;\n" +
|
||||
" position:relative;\n" +
|
||||
" margin-top:40px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-footer {\n" +
|
||||
" padding:0;\n" +
|
||||
" margin:8px 11px 0 0;\n" +
|
||||
" list-style-type:none;\n" +
|
||||
" float:right;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-footer LI {\n" +
|
||||
" color:white;\n" +
|
||||
" font-family:Arial;\n" +
|
||||
" font-size:12px;\n" +
|
||||
" display:inline-block;\n" +
|
||||
" margin:0 1px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-footer LI A {\n" +
|
||||
" color:#8dd0ff;\n" +
|
||||
" text-decoration:none;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-footer LI A:hover {\n" +
|
||||
" text-decoration:underline;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"");
|
||||
|
||||
define("text!build_support/style.css", [], "body {\n" +
|
||||
" margin:0;\n" +
|
||||
" padding:0;\n" +
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -7138,7 +7138,7 @@ var MouseHandler = function(editor) {
|
|||
event.addMultiMouseDownListener(mouseTarget, 0, 2, 500, this.onMouseDoubleClick.bind(this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 0, 3, 600, this.onMouseTripleClick.bind(this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 0, 4, 600, this.onMouseQuadClick.bind(this));
|
||||
event.addMouseWheelListener(mouseTarget, this.onMouseWheel.bind(this));
|
||||
event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this));
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
|
@ -7379,7 +7379,8 @@ var MouseHandler = function(editor) {
|
|||
var speed = this.$scrollSpeed * 2;
|
||||
|
||||
this.editor.renderer.scrollBy(e.wheelX * speed, e.wheelY * speed);
|
||||
return event.preventDefault(e);
|
||||
if (this.editor.renderer.isScrollableBy(e.wheelX, e.wheelY))
|
||||
return event.preventDefault(e);
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -13928,6 +13929,14 @@ var VirtualRenderer = function(container, theme) {
|
|||
deltaX && this.scrollToX(this.scroller.scrollLeft + deltaX);
|
||||
};
|
||||
|
||||
this.isScrollableBy = function(deltaX, deltaY) {
|
||||
if (deltaY < 0 && this.scrollTop > 0)
|
||||
return true;
|
||||
if (deltaY > 0 && this.scrollTop + this.$size.scrollerHeight < this.layerConfig.maxHeight)
|
||||
return true;
|
||||
// todo: handle horizontal scrolling
|
||||
};
|
||||
|
||||
this.screenToTextCoordinates = function(pageX, pageY) {
|
||||
var canvasPos = this.scroller.getBoundingClientRect();
|
||||
|
||||
|
|
@ -15564,7 +15573,7 @@ exports.create = create;
|
|||
|
||||
|
||||
});
|
||||
define("text/ace/css/editor.css", [], "@import url(http://fonts.googleapis.com/css?family=Droid+Sans+Mono);\n" +
|
||||
define("text!ace/css/editor.css", [], "@import url(http://fonts.googleapis.com/css?family=Droid+Sans+Mono);\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
".ace_editor {\n" +
|
||||
|
|
@ -15735,7 +15744,7 @@ define("text/ace/css/editor.css", [], "@import url(http://fonts.googleapis.com/c
|
|||
"}\n" +
|
||||
"");
|
||||
|
||||
define("text/build/demo/styles.css", [], "html {\n" +
|
||||
define("text!build/demo/styles.css", [], "html {\n" +
|
||||
" height: 100%;\n" +
|
||||
" width: 100%;\n" +
|
||||
" overflow: hidden;\n" +
|
||||
|
|
@ -15779,7 +15788,7 @@ define("text/build/demo/styles.css", [], "html {\n" +
|
|||
" text-align: left;\n" +
|
||||
"}");
|
||||
|
||||
define("text/build_support/style.css", [], "body {\n" +
|
||||
define("text!build/textarea/style.css", [], "body {\n" +
|
||||
" margin:0;\n" +
|
||||
" padding:0;\n" +
|
||||
" background-color:#e6f5fc;\n" +
|
||||
|
|
@ -16011,13 +16020,245 @@ define("text/build_support/style.css", [], "body {\n" +
|
|||
"\n" +
|
||||
"");
|
||||
|
||||
define("text/demo/docs/css.css", [], ".text-layer {\n" +
|
||||
define("text!build_support/style.css", [], "body {\n" +
|
||||
" margin:0;\n" +
|
||||
" padding:0;\n" +
|
||||
" background-color:#e6f5fc;\n" +
|
||||
" \n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"H2, H3, H4 {\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-weight:bold;\n" +
|
||||
" margin:0;\n" +
|
||||
" padding:0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"H2 {\n" +
|
||||
" font-size:28px;\n" +
|
||||
" color:#263842;\n" +
|
||||
" padding-bottom:6px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"H3 {\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-weight:bold;\n" +
|
||||
" font-size:22px;\n" +
|
||||
" color:#253741;\n" +
|
||||
" margin-top:43px;\n" +
|
||||
" margin-bottom:8px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"H4 {\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-weight:bold;\n" +
|
||||
" font-size:21px;\n" +
|
||||
" color:#222222;\n" +
|
||||
" margin-bottom:4px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"P {\n" +
|
||||
" padding:13px 0;\n" +
|
||||
" margin:0;\n" +
|
||||
" line-height:22px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL{\n" +
|
||||
" line-height : 22px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"PRE{\n" +
|
||||
" background : #333;\n" +
|
||||
" color : white;\n" +
|
||||
" padding : 10px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header {\n" +
|
||||
" height : 227px;\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" background: url(images/background.png) repeat-x 0 0;\n" +
|
||||
" border-bottom:1px solid #c9e8fa; \n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header .content .signature {\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-size:11px;\n" +
|
||||
" color:#ebe4d6;\n" +
|
||||
" position:absolute;\n" +
|
||||
" bottom:5px;\n" +
|
||||
" right:42px;\n" +
|
||||
" letter-spacing : 1px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".content {\n" +
|
||||
" width:970px;\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" margin:0 auto;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header .content {\n" +
|
||||
" height:184px;\n" +
|
||||
" margin-top:22px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header .content .logo {\n" +
|
||||
" width : 282px;\n" +
|
||||
" height : 184px;\n" +
|
||||
" background:url(images/logo.png) no-repeat 0 0;\n" +
|
||||
" position:absolute;\n" +
|
||||
" top:0;\n" +
|
||||
" left:0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#header .content .title {\n" +
|
||||
" width : 605px;\n" +
|
||||
" height : 58px;\n" +
|
||||
" background:url(images/ace.png) no-repeat 0 0;\n" +
|
||||
" position:absolute;\n" +
|
||||
" top:98px;\n" +
|
||||
" left:329px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#wrapper {\n" +
|
||||
" background:url(images/body_background.png) repeat-x 0 0;\n" +
|
||||
" min-height:250px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#wrapper .content {\n" +
|
||||
" font-family:Arial;\n" +
|
||||
" font-size:14px;\n" +
|
||||
" color:#222222;\n" +
|
||||
" width:1000px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#wrapper .content .column1 {\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" float:left;\n" +
|
||||
" width:315px;\n" +
|
||||
" margin-right:31px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#wrapper .content .column2 {\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" float:left;\n" +
|
||||
" width:600px;\n" +
|
||||
" padding-top:47px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".fork_on_github {\n" +
|
||||
" width:310px;\n" +
|
||||
" height:80px;\n" +
|
||||
" background:url(images/fork_on_github.png) no-repeat 0 0;\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" margin-top:49px;\n" +
|
||||
" cursor:pointer;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".fork_on_github:hover {\n" +
|
||||
" background-position:0 -80px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".divider {\n" +
|
||||
" height:3px;\n" +
|
||||
" background-color:#bedaea;\n" +
|
||||
" margin-bottom:3px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
".menu {\n" +
|
||||
" padding:23px 0 0 24px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.content-list {\n" +
|
||||
" padding:15px;\n" +
|
||||
" margin:0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-list {\n" +
|
||||
" padding:0;\n" +
|
||||
" margin:0 0 20px 0;\n" +
|
||||
" list-style-type:none;\n" +
|
||||
" line-height : 16px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-list LI {\n" +
|
||||
" color:#2557b4;\n" +
|
||||
" font-family:Trebuchet MS;\n" +
|
||||
" font-size:14px;\n" +
|
||||
" padding:7px 0;\n" +
|
||||
" border-bottom:1px dotted #d6e2e7;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-list LI:last-child {\n" +
|
||||
" border-bottom:0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"A {\n" +
|
||||
" color:#2557b4;\n" +
|
||||
" text-decoration:none;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"A:hover {\n" +
|
||||
" text-decoration:underline;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"P#first{\n" +
|
||||
" background : rgba(255,255,255,0.5);\n" +
|
||||
" padding : 20px;\n" +
|
||||
" font-size : 16px;\n" +
|
||||
" line-height : 24px;\n" +
|
||||
" margin : 0 0 20px 0;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"#footer {\n" +
|
||||
" height:40px;\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
" background:url(images/bottombar.png) repeat-x 0 0;\n" +
|
||||
" position:relative;\n" +
|
||||
" margin-top:40px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-footer {\n" +
|
||||
" padding:0;\n" +
|
||||
" margin:8px 11px 0 0;\n" +
|
||||
" list-style-type:none;\n" +
|
||||
" float:right;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-footer LI {\n" +
|
||||
" color:white;\n" +
|
||||
" font-family:Arial;\n" +
|
||||
" font-size:12px;\n" +
|
||||
" display:inline-block;\n" +
|
||||
" margin:0 1px;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-footer LI A {\n" +
|
||||
" color:#8dd0ff;\n" +
|
||||
" text-decoration:none;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"UL.menu-footer LI A:hover {\n" +
|
||||
" text-decoration:underline;\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
"");
|
||||
|
||||
define("text!demo/docs/css.css", [], ".text-layer {\n" +
|
||||
" font-family: Monaco, \"Courier New\", monospace;\n" +
|
||||
" font-size: 12px;\n" +
|
||||
" cursor: text;\n" +
|
||||
"}");
|
||||
|
||||
define("text/demo/styles.css", [], "html {\n" +
|
||||
define("text!demo/styles.css", [], "html {\n" +
|
||||
" height: 100%;\n" +
|
||||
" width: 100%;\n" +
|
||||
" overflow: hidden;\n" +
|
||||
|
|
@ -16061,7 +16302,7 @@ define("text/demo/styles.css", [], "html {\n" +
|
|||
" text-align: left;\n" +
|
||||
"}");
|
||||
|
||||
define("text/deps/csslint/demos/demo.css", [], "@charset \"UTF-8\";\n" +
|
||||
define("text!deps/csslint/demos/demo.css", [], "@charset \"UTF-8\";\n" +
|
||||
"\n" +
|
||||
"@import url(\"booya.css\") print,screen;\n" +
|
||||
"@import \"whatup.css\" screen;\n" +
|
||||
|
|
@ -16105,7 +16346,7 @@ define("text/deps/csslint/demos/demo.css", [], "@charset \"UTF-8\";\n" +
|
|||
" }\n" +
|
||||
"}");
|
||||
|
||||
define("text/deps/requirejs/dist/ie.css", [], "\n" +
|
||||
define("text!deps/requirejs/dist/ie.css", [], "\n" +
|
||||
"body .sect {\n" +
|
||||
" display: none;\n" +
|
||||
"}\n" +
|
||||
|
|
@ -16116,7 +16357,7 @@ define("text/deps/requirejs/dist/ie.css", [], "\n" +
|
|||
"}\n" +
|
||||
"");
|
||||
|
||||
define("text/deps/requirejs/dist/main.css", [], "@font-face {\n" +
|
||||
define("text!deps/requirejs/dist/main.css", [], "@font-face {\n" +
|
||||
" font-family: Inconsolata;\n" +
|
||||
" src: url(\"fonts/Inconsolata.ttf\");\n" +
|
||||
"}\n" +
|
||||
|
|
@ -16803,7 +17044,7 @@ define("text/deps/requirejs/dist/main.css", [], "@font-face {\n" +
|
|||
" height: 1%;\n" +
|
||||
"}");
|
||||
|
||||
define("text/doc/site/iphone.css", [], "#wrapper {\n" +
|
||||
define("text!doc/site/iphone.css", [], "#wrapper {\n" +
|
||||
" position:relative;\n" +
|
||||
" overflow:hidden;\n" +
|
||||
"}\n" +
|
||||
|
|
@ -16830,7 +17071,7 @@ define("text/doc/site/iphone.css", [], "#wrapper {\n" +
|
|||
"}\n" +
|
||||
"");
|
||||
|
||||
define("text/doc/site/style.css", [], "body {\n" +
|
||||
define("text!doc/site/style.css", [], "body {\n" +
|
||||
" margin:0;\n" +
|
||||
" padding:0;\n" +
|
||||
" background-color:#e6f5fc;\n" +
|
||||
|
|
@ -17062,7 +17303,7 @@ define("text/doc/site/style.css", [], "body {\n" +
|
|||
"\n" +
|
||||
"");
|
||||
|
||||
define("text/lib/ace/css/editor.css", [], "@import url(http://fonts.googleapis.com/css?family=Droid+Sans+Mono);\n" +
|
||||
define("text!lib/ace/css/editor.css", [], "@import url(http://fonts.googleapis.com/css?family=Droid+Sans+Mono);\n" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
".ace_editor {\n" +
|
||||
|
|
@ -17233,7 +17474,7 @@ define("text/lib/ace/css/editor.css", [], "@import url(http://fonts.googleapis.c
|
|||
"}\n" +
|
||||
"");
|
||||
|
||||
define("text/node_modules/uglify-js/docstyle.css", [], "html { font-family: \"Lucida Grande\",\"Trebuchet MS\",sans-serif; font-size: 12pt; }\n" +
|
||||
define("text!node_modules/uglify-js/docstyle.css", [], "html { font-family: \"Lucida Grande\",\"Trebuchet MS\",sans-serif; font-size: 12pt; }\n" +
|
||||
"body { max-width: 60em; }\n" +
|
||||
".title { text-align: center; }\n" +
|
||||
".todo { color: red; }\n" +
|
||||
|
|
@ -17310,7 +17551,7 @@ define("text/node_modules/uglify-js/docstyle.css", [], "html { font-family: \"Lu
|
|||
"}\n" +
|
||||
"");
|
||||
|
||||
define("text/support/cockpit/lib/cockpit/ui/cli_view.css", [], "\n" +
|
||||
define("text!support/cockpit/lib/cockpit/ui/cli_view.css", [], "\n" +
|
||||
"#cockpitInput { padding-left: 16px; }\n" +
|
||||
"\n" +
|
||||
".cptOutput { overflow: auto; position: absolute; z-index: 999; display: none; }\n" +
|
||||
|
|
@ -17346,7 +17587,7 @@ define("text/support/cockpit/lib/cockpit/ui/cli_view.css", [], "\n" +
|
|||
".cptGt { font-weight: bold; font-size: 120%; }\n" +
|
||||
"");
|
||||
|
||||
define("text/support/cockpit/lib/cockpit/ui/request_view.css", [], "\n" +
|
||||
define("text!support/cockpit/lib/cockpit/ui/request_view.css", [], "\n" +
|
||||
".cptRowIn {\n" +
|
||||
" display: box; display: -moz-box; display: -webkit-box;\n" +
|
||||
" box-orient: horizontal; -moz-box-orient: horizontal; -webkit-box-orient: horizontal;\n" +
|
||||
|
|
@ -17387,7 +17628,7 @@ define("text/support/cockpit/lib/cockpit/ui/request_view.css", [], "\n" +
|
|||
".cptRowOutput .right { text-align: right; }\n" +
|
||||
"");
|
||||
|
||||
define("text/tool/Theme.tmpl.css", [], ".%cssClass% .ace_editor {\n" +
|
||||
define("text!tool/Theme.tmpl.css", [], ".%cssClass% .ace_editor {\n" +
|
||||
" border: 2px solid rgb(159, 159, 159);\n" +
|
||||
"}\n" +
|
||||
"\n" +
|
||||
|
|
@ -17557,13 +17798,13 @@ define("text/tool/Theme.tmpl.css", [], ".%cssClass% .ace_editor {\n" +
|
|||
" %collab.user1% \n" +
|
||||
"}");
|
||||
|
||||
define("text/docs/css.css", [], ".text-layer {\n" +
|
||||
define("text!docs/css.css", [], ".text-layer {\n" +
|
||||
" font-family: Monaco, \"Courier New\", monospace;\n" +
|
||||
" font-size: 12px;\n" +
|
||||
" cursor: text;\n" +
|
||||
"}");
|
||||
|
||||
define("text/styles.css", [], "html {\n" +
|
||||
define("text!styles.css", [], "html {\n" +
|
||||
" height: 100%;\n" +
|
||||
" width: 100%;\n" +
|
||||
" overflow: hidden;\n" +
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -31,16 +31,18 @@ If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookma
|
|||
History
|
||||
-------
|
||||
|
||||
Previously known as “Bespin” and “Skywriter” it’s now known as Ace (Ajax.org Cloud9 Editor)! Bespin and Ace started as two independent projects both aiming to build a no compromise code editor component for the web. Bespin started as part of Mozilla Labs and was based on the canvas tag, while Ace is the Editor component of the Cloud9 IDE and is using the DOM for rendering. After the release of Ace at JSConf.eu 2010 in Berlin the Skywriter team decided to merge Ace with a simplified version of Skywriter's plugin system and some of Skywriter's extensibility points. All these changes have been merged back to Ace. Both Ajax.org and Mozilla are actively developing and maintaining Ace.
|
||||
Previously known as “Bespin” and “Skywriter” it’s now known as Ace (Ajax.org Cloud9 Editor)! Bespin and Ace started as two independent projects, both aiming to build a no-compromise code editor component for the web. Bespin started as part of Mozilla Labs and was based on the canvas tag, while Ace is the Editor component of the Cloud9 IDE and is using the DOM for rendering. After the release of Ace at JSConf.eu 2010 in Berlin the Skywriter team decided to merge Ace with a simplified version of Skywriter's plugin system and some of Skywriter's extensibility points. All these changes have been merged back to Ace. Both Ajax.org and Mozilla are actively developing and maintaining Ace.
|
||||
|
||||
Getting the code
|
||||
----------------
|
||||
|
||||
Ace is a community project. We actively encourage and support contributions. The Ace source code is hosted on GitHub. It is released under the Mozilla tri-license (MPL/GPL/LGPL), the same license used by Firefox. This license is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings!
|
||||
|
||||
```bash
|
||||
git clone git://github.com/ajaxorg/ace.git
|
||||
cd ace
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
Embedding Ace
|
||||
-------------
|
||||
|
|
@ -49,6 +51,7 @@ Ace can be easily embedded into any existing web page. The Ace git repository sh
|
|||
|
||||
The easiest version is simply:
|
||||
|
||||
```html
|
||||
<div id="editor">some text</div>
|
||||
<script src="src/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script>
|
||||
|
|
@ -56,32 +59,42 @@ The easiest version is simply:
|
|||
var editor = ace.edit("editor");
|
||||
};
|
||||
</script>
|
||||
```
|
||||
|
||||
With "editor" being the id of the DOM element, which should be converted to an editor. Note that this element must be explicitly sized and positioned `absolute` or `relative` for Ace to work. e.g.
|
||||
|
||||
```css
|
||||
#editor {
|
||||
position: absolute;
|
||||
width: 500px;
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
To change the theme simply include the Theme's JavaScript file
|
||||
|
||||
```html
|
||||
<script src="src/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
|
||||
```
|
||||
|
||||
and configure the editor to use the theme:
|
||||
|
||||
```javascript
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
```
|
||||
|
||||
By default the editor only supports plain text mode; many other languages are available as separate modules. After including the mode's JavaScript file:
|
||||
|
||||
```html
|
||||
<script src="src/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
|
||||
```
|
||||
|
||||
Then the mode can be used like this:
|
||||
|
||||
```javascript
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
editor.getSession().setMode(new JavaScriptMode());
|
||||
```
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
|
@ -97,11 +110,15 @@ Running Ace
|
|||
|
||||
After the checkout Ace works out of the box. No build step is required. Open 'editor.html' in any browser except Google Chrome. Google Chrome doesn't allow XMLHTTPRequests from files loaded from disc (i.e. with a file:/// URL). To open Ace in Chrome simply start the bundled mini HTTP server:
|
||||
|
||||
```bash
|
||||
./static.py
|
||||
```
|
||||
|
||||
Or using Node.JS
|
||||
|
||||
```bash
|
||||
./static.js
|
||||
```
|
||||
|
||||
The editor can then be opened at http://localhost:8888/index.html.
|
||||
|
||||
|
|
@ -110,28 +127,38 @@ Package Ace
|
|||
|
||||
To package Ace we use the dryice build tool developed by the Mozilla Skywriter team. Before you can build you need to make sure that the submodules are up to date.
|
||||
|
||||
```bash
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
|
||||
Afterwards Ace can be built by calling
|
||||
|
||||
```bash
|
||||
./Makefile.dryice.js normal
|
||||
```
|
||||
|
||||
The packaged Ace will be put in the 'build' folder.
|
||||
|
||||
To build the bookmarklet version execute
|
||||
|
||||
```bash
|
||||
./Makefile.dryice.js bm
|
||||
```
|
||||
|
||||
Running the Unit Tests
|
||||
----------------------
|
||||
|
||||
The Ace unit tests run on node.js. Before the first run a couple of node modules have to be installed. The easiest way to do this is by using the node package manager (npm). In the Ace base directory simply call
|
||||
|
||||
```bash
|
||||
npm link .
|
||||
```
|
||||
|
||||
To run the tests call:
|
||||
|
||||
```bash
|
||||
node lib/ace/test/all.js
|
||||
```
|
||||
|
||||
You can also run the tests in your browser by serving:
|
||||
|
||||
|
|
@ -139,12 +166,10 @@ You can also run the tests in your browser by serving:
|
|||
|
||||
This makes debugging failing tests way more easier.
|
||||
|
||||
_Note_: Currently (2011-05-21) the tests seem to run on Chrome only.
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Ace wouldn't be where it is now without contributions. Feel free to fork and improve/enhance Ace in any way your want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. To protect the interests of the Ace contributors and users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is the simplest of agreements, requiring that the contributions you make to an ajax.org project are only those you're allowed to make. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes ten minutes, and only needs to be completed once. There are two versions of the agreement:
|
||||
Ace wouldn't be what it is without contributions! Feel free to fork and improve/enhance Ace any way you want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. To protect the interests of the Ace contributors and users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is the simplest of agreements, requiring that the contributions you make to an ajax.org project are only those you're allowed to make. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes ten minutes, and only needs to be completed once. There are two versions of the agreement:
|
||||
|
||||
1. [The Individual CLA](https://github.com/ajaxorg/ace/raw/master/doc/Contributor_License_Agreement-v2.pdf): use this version if you're working on an ajax.org in your spare time, or can clearly claim ownership of copyright in what you'll be submitting.
|
||||
2. [The Corporate CLA](https://github.com/ajaxorg/ace/raw/master/doc/Corporate_Contributor_License_Agreement-v2.pdf): have your corporate lawyer review and submit this if your company is going to be contributing to ajax.org projects
|
||||
|
|
|
|||
|
|
@ -7127,7 +7127,7 @@ var MouseHandler = function(editor) {
|
|||
event.addMultiMouseDownListener(mouseTarget, 0, 2, 500, this.onMouseDoubleClick.bind(this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 0, 3, 600, this.onMouseTripleClick.bind(this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 0, 4, 600, this.onMouseQuadClick.bind(this));
|
||||
event.addMouseWheelListener(mouseTarget, this.onMouseWheel.bind(this));
|
||||
event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this));
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
|
@ -7368,7 +7368,8 @@ var MouseHandler = function(editor) {
|
|||
var speed = this.$scrollSpeed * 2;
|
||||
|
||||
this.editor.renderer.scrollBy(e.wheelX * speed, e.wheelY * speed);
|
||||
return event.preventDefault(e);
|
||||
if (this.editor.renderer.isScrollableBy(e.wheelX, e.wheelY))
|
||||
return event.preventDefault(e);
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -13243,7 +13244,7 @@ exports.UndoManager = UndoManager;
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
__ace_shadowed__.define('ace/virtual_renderer', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/dom', 'pilot/event', 'pilot/useragent', 'ace/layer/gutter', 'ace/layer/marker', 'ace/layer/text', 'ace/layer/cursor', 'ace/scrollbar', 'ace/renderloop', 'pilot/event_emitter', 'text!ace/css/editor.css'], function(require, exports, module) {
|
||||
__ace_shadowed__.define('ace/virtual_renderer', ['require', 'exports', 'module' , 'pilot/oop', 'pilot/dom', 'pilot/event', 'pilot/useragent', 'ace/layer/gutter', 'ace/layer/marker', 'ace/layer/text', 'ace/layer/cursor', 'ace/scrollbar', 'ace/renderloop', 'pilot/event_emitter', 'ace/requirejs/text!ace/css/editor.css'], function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var dom = require("pilot/dom");
|
||||
|
|
@ -13256,7 +13257,7 @@ var CursorLayer = require("ace/layer/cursor").Cursor;
|
|||
var ScrollBar = require("ace/scrollbar").ScrollBar;
|
||||
var RenderLoop = require("ace/renderloop").RenderLoop;
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
var editorCss = require("text!ace/css/editor.css");
|
||||
var editorCss = require("ace/requirejs/text!ace/css/editor.css");
|
||||
|
||||
// import CSS once
|
||||
dom.importCssString(editorCss);
|
||||
|
|
@ -13917,6 +13918,14 @@ var VirtualRenderer = function(container, theme) {
|
|||
deltaX && this.scrollToX(this.scroller.scrollLeft + deltaX);
|
||||
};
|
||||
|
||||
this.isScrollableBy = function(deltaX, deltaY) {
|
||||
if (deltaY < 0 && this.scrollTop > 0)
|
||||
return true;
|
||||
if (deltaY > 0 && this.scrollTop + this.$size.scrollerHeight < this.layerConfig.maxHeight)
|
||||
return true;
|
||||
// todo: handle horizontal scrolling
|
||||
};
|
||||
|
||||
this.screenToTextCoordinates = function(pageX, pageY) {
|
||||
var canvasPos = this.scroller.getBoundingClientRect();
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue