Merge branch 'master' of https://github.com/ajaxorg/ace
Conflicts: Makefile.dryice.js build_support/boot.js build_support/mini_require.js lib/ace/edit_session.js package.json support/pilot
This commit is contained in:
commit
f332454b38
196 changed files with 51983 additions and 2086 deletions
8
.gitignore
vendored
8
.gitignore
vendored
|
|
@ -7,9 +7,15 @@
|
|||
.project
|
||||
.settings/
|
||||
.settings.xml
|
||||
.c9settings.xml
|
||||
.settings.xml.old
|
||||
.*.gz
|
||||
|
||||
# A handy place to put stuff that git should ignore:
|
||||
/ignore/
|
||||
/build/
|
||||
support/async/
|
||||
support/dryice/
|
||||
support/jsdom/
|
||||
support/node-htmlparser/
|
||||
support/node-o3-xml/
|
||||
support/requirejs/
|
||||
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -1,6 +1,3 @@
|
|||
[submodule "support/node-o3-xml"]
|
||||
path = support/node-o3-xml
|
||||
url = git://github.com/ajaxorg/node-o3-xml.git
|
||||
[submodule "support/cockpit"]
|
||||
path = support/cockpit
|
||||
url = git://github.com/ajaxorg/cockpit.git
|
||||
|
|
|
|||
50
ChangeLog.txt
Normal file
50
ChangeLog.txt
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
2011.02.14, Version 0.1.6
|
||||
|
||||
* Floating Anchors
|
||||
- An Anchor is a floating pointer in the document.
|
||||
- Whenever text is inserted or deleted before the cursor, the position of the cursor is updated
|
||||
- Usesd for the cursor and selection
|
||||
- Basis for bookmarks, multiple cursors and snippets in the future
|
||||
* Extensive support for Cocoa style keybindings on the Mac <https://github.com/ajaxorg/ace/issues/closed#issue/116/comment/767803>
|
||||
* New commands:
|
||||
- center selection in viewport
|
||||
- remove to end/start of line
|
||||
- split line
|
||||
- transpose letters
|
||||
* Refator markers
|
||||
- Custom code can be used to render markers
|
||||
- Markers can be in front or behind the text
|
||||
- Markers are now stored in the session (was in the renderer)
|
||||
* Lots of IE8 fixes including copy, cut and selections
|
||||
* Unit tests can also be run in the browser <https://github.com/ajaxorg/ace/blob/master/lib/ace/test/tests.html>
|
||||
* Soft wrap can adapt to the width of the editor (Mike Ratcliffe, Joe Cheng)
|
||||
* Add minimal node server server.js to run the Ace demo in Chrome
|
||||
* The top level editor.html demo has been renamed to index.html
|
||||
* Bug fixes
|
||||
- Fixed gotoLine to consider wrapped lines when calculating where to scroll to (James Allen)
|
||||
- Fixed isues when the editor was scrolled in the web page (Eric Allam)
|
||||
- Highlighting of Python string literals
|
||||
- Syntax rule for PHP comments
|
||||
|
||||
2011.02.08, Version 0.1.5
|
||||
|
||||
* Add Coffeescript Mode (Satoshi Murakami)
|
||||
* Fix word wrap bug (Julian Viereck)
|
||||
* Fix packaged version of the Eclipse mode
|
||||
* Loading of workers is more robust
|
||||
* Fix "click selection"
|
||||
* Allow tokizing empty lines (Daniel Krech)
|
||||
* Make PageUp/Down behavior more consistent with native OS (Joe Cheng)
|
||||
|
||||
2011.02.04, Version 0.1.4
|
||||
|
||||
* Add C/C++ mode contributed by Gastón Kleiman
|
||||
* Fix exception in key input
|
||||
|
||||
2011.02.04, Version 0.1.3
|
||||
|
||||
* Let the packaged version play nice with requireJS
|
||||
* Add Ruby mode contributed by Shlomo Zalman Heigh
|
||||
* Add Java mode contributed by Tom Tasche
|
||||
* Fix annotation bug
|
||||
* Changing a document added a new empty line at the end
|
||||
18
Makefile
Normal file
18
Makefile
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
build:
|
||||
mkdir -p build/src
|
||||
mkdir -p build/textarea/src
|
||||
./Makefile.dryice.js
|
||||
./Makefile.dryice.textarea.js
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
rm -rf ace-*
|
||||
rm -f ace-*.tgz
|
||||
|
||||
ace.tgz: build
|
||||
mv build ace-`./version.js`/
|
||||
cp Readme.md ace-`./version.js`/
|
||||
cp LICENSE ace-`./version.js`/
|
||||
tar cvfz ace-`./version.js`.tgz ace-`./version.js`/
|
||||
|
||||
dist: clean build ace.tgz
|
||||
|
|
@ -36,7 +36,6 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
require("long-stack-traces");
|
||||
var copy = require('dryice').copy;
|
||||
|
||||
var aceHome = __dirname;
|
||||
|
|
@ -49,22 +48,39 @@ var project = copy.createCommonJsProject([
|
|||
aceHome + '/demo'
|
||||
]);
|
||||
|
||||
|
||||
copy({
|
||||
source: "build_support/editor.html",
|
||||
dest: 'build/editor.html'
|
||||
});
|
||||
|
||||
var ace = copy.createDataObject();
|
||||
copy({
|
||||
source: [
|
||||
'build_support/mini_require.js'
|
||||
],
|
||||
dest: ace
|
||||
});
|
||||
copy({
|
||||
source: [
|
||||
copy.source.commonjs({
|
||||
project: project,
|
||||
require: [
|
||||
'pilot/plugin_manager',
|
||||
'pilot/environment',
|
||||
'pilot/index',
|
||||
'startup',
|
||||
"pilot/fixoldbrowsers",
|
||||
"pilot/index",
|
||||
"pilot/plugin_manager",
|
||||
"pilot/environment",
|
||||
"ace/editor",
|
||||
"ace/edit_session",
|
||||
"ace/undomanager",
|
||||
"ace/theme/textmate",
|
||||
"ace/mode/text",
|
||||
"ace/mode/matching_brace_outdent",
|
||||
"ace/virtual_renderer"
|
||||
]
|
||||
}),
|
||||
'build_support/mini_require.js',
|
||||
'build_support/boot.js'
|
||||
})
|
||||
],
|
||||
filter: [ copy.filter.debug, copy.filter.moduleDefines ],
|
||||
filter: [ copy.filter.moduleDefines ],
|
||||
dest: ace
|
||||
});
|
||||
copy({
|
||||
|
|
@ -85,21 +101,28 @@ copy({
|
|||
filter: [ copy.filter.base64 ],
|
||||
dest: ace
|
||||
});
|
||||
copy({
|
||||
source: [
|
||||
'build_support/boot.js'
|
||||
],
|
||||
dest: ace
|
||||
});
|
||||
|
||||
|
||||
// Create the compressed and uncompressed output files
|
||||
copy({
|
||||
source: ace,
|
||||
filter: copy.filter.uglifyjs,
|
||||
dest: 'build/ace.js'
|
||||
dest: 'build/src/ace.js'
|
||||
});
|
||||
copy({
|
||||
source: ace,
|
||||
dest: 'build/ace-uncompressed.js'
|
||||
dest: 'build/src/ace-uncompressed.js'
|
||||
});
|
||||
|
||||
console.log('# cockpit ---------');
|
||||
|
||||
project.assmeAllFilesLoaded();
|
||||
project.assumeAllFilesLoaded();
|
||||
project.addRoot(aceHome + '/support/cockpit/lib');
|
||||
|
||||
var cockpit = copy.createDataObject();
|
||||
|
|
@ -108,9 +131,9 @@ copy({
|
|||
copy.source.commonjs({
|
||||
project: project,
|
||||
require: [ 'cockpit/index' ]
|
||||
}),
|
||||
})
|
||||
],
|
||||
filter: [ copy.filter.debug, copy.filter.moduleDefines ],
|
||||
filter: [ copy.filter.moduleDefines ],
|
||||
dest: cockpit
|
||||
});
|
||||
copy({
|
||||
|
|
@ -136,116 +159,148 @@ copy({
|
|||
copy({
|
||||
source: cockpit,
|
||||
filter: copy.filter.uglifyjs,
|
||||
dest: 'build/cockpit.js'
|
||||
dest: 'build/src/cockpit.js'
|
||||
});
|
||||
copy({
|
||||
source: cockpit,
|
||||
dest: 'build/cockpit-uncompressed.js'
|
||||
dest: 'build/src/cockpit-uncompressed.js'
|
||||
});
|
||||
|
||||
console.log('# conventional ---------');
|
||||
|
||||
// Pilot sources
|
||||
var pilotData = copy.createDataObject();
|
||||
copy({
|
||||
source: {
|
||||
root: aceHome + '/support/pilot/lib',
|
||||
include: /.*\.js$/,
|
||||
exclude: /tests?\//
|
||||
},
|
||||
filter: [ copy.filter.debug, copy.filter.moduleDefines ],
|
||||
dest: pilotData
|
||||
console.log('# ace modes ---------');
|
||||
|
||||
project.assumeAllFilesLoaded();
|
||||
[
|
||||
"css", "html", "javascript", "php", "python", "xml", "ruby", "java", "c_cpp",
|
||||
"coffee", "perl"
|
||||
].forEach(function(mode) {
|
||||
console.log("mode " + mode);
|
||||
copy({
|
||||
source: [
|
||||
copy.source.commonjs({
|
||||
project: project.clone(),
|
||||
require: [ 'ace/mode/' + mode ]
|
||||
})
|
||||
],
|
||||
filter: [ copy.filter.debug, copy.filter.moduleDefines, copy.filter.uglifyjs ],
|
||||
dest: "build/src/mode-" + mode + ".js"
|
||||
});
|
||||
});
|
||||
|
||||
// Cockpit sources
|
||||
var cockpitData = copy.createDataObject();
|
||||
copy({
|
||||
source: {
|
||||
root: aceHome + '/support/cockpit/lib',
|
||||
include: /.*\.js$/,
|
||||
exclude: /tests?\//
|
||||
},
|
||||
filter: [ copy.filter.moduleDefines ],
|
||||
dest: cockpitData
|
||||
});
|
||||
copy({
|
||||
source: {
|
||||
root: aceHome + '/support/cockpit/lib',
|
||||
include: /.*\.css$|.*\.html$/,
|
||||
exclude: /tests?\//
|
||||
},
|
||||
filter: [ copy.filter.addDefines ],
|
||||
dest: cockpitData
|
||||
});
|
||||
copy({
|
||||
source: {
|
||||
root: aceHome + '/support/cockpit/lib',
|
||||
include: /.*\.png$|.*\.gif$/,
|
||||
exclude: /tests?\//
|
||||
},
|
||||
filter: [ copy.filter.base64 ],
|
||||
dest: cockpitData
|
||||
});
|
||||
console.log('# worker ---------');
|
||||
|
||||
// Ace sources
|
||||
var aceData = copy.createDataObject();
|
||||
var jsWorker = copy.createDataObject();
|
||||
var workerProject = copy.createCommonJsProject([
|
||||
aceHome + '/support/pilot/lib',
|
||||
aceHome + '/lib'
|
||||
]);
|
||||
copy({
|
||||
source: [
|
||||
// Exclude all themes/modes so we can just include textmate/js
|
||||
{
|
||||
copy.source.commonjs({
|
||||
project: workerProject,
|
||||
require: [
|
||||
'pilot/fixoldbrowsers',
|
||||
'pilot/event_emitter',
|
||||
'pilot/oop',
|
||||
'ace/mode/javascript_worker'
|
||||
]
|
||||
})
|
||||
],
|
||||
filter: [ copy.filter.moduleDefines],
|
||||
dest: jsWorker
|
||||
});
|
||||
copy({
|
||||
source: [
|
||||
aceHome + "/lib/ace/worker/worker.js",
|
||||
jsWorker
|
||||
],
|
||||
filter: [ copy.filter.uglifyjs ],
|
||||
dest: "build/src/worker-javascript.js"
|
||||
});
|
||||
|
||||
console.log('# ace themes ---------');
|
||||
|
||||
[
|
||||
"clouds", "clouds_midnight", "cobalt", "dawn", "idle_fingers", "kr_theme",
|
||||
"mono_industrial", "monokai", "pastel_on_dark", "twilight", "eclipse"
|
||||
].forEach(function(theme) {
|
||||
copy({
|
||||
source: [{
|
||||
root: aceHome + '/lib',
|
||||
include: /.*\.js$/,
|
||||
exclude: /tests?\/|theme\/|mode\//
|
||||
},
|
||||
{ base: aceHome + '/lib/', path: 'ace/theme/textmate.js' },
|
||||
{ base: aceHome + '/lib/', path: 'ace/mode/text.js' },
|
||||
{ base: aceHome + '/lib/', path: 'ace/mode/javascript.js' },
|
||||
{ base: aceHome + '/lib/', path: 'ace/mode/text_highlight_rules.js' },
|
||||
{ base: aceHome + '/lib/', path: 'ace/mode/javascript_highlight_rules.js' },
|
||||
{ base: aceHome + '/lib/', path: 'ace/mode/doc_comment_highlight_rules.js' },
|
||||
{ base: aceHome + '/lib/', path: 'ace/mode/matching_brace_outdent.js' },
|
||||
{ base: aceHome + '/lib/', path: 'ace/mode/javascript_highlight_rules.js' }
|
||||
],
|
||||
filter: [ copy.filter.moduleDefines ],
|
||||
dest: aceData
|
||||
});
|
||||
copy({
|
||||
source: {
|
||||
root: aceHome + '/lib',
|
||||
include: /tm\.css|editor\.css/,
|
||||
exclude: /tests?\//
|
||||
},
|
||||
filter: [ copy.filter.addDefines ],
|
||||
dest: aceData
|
||||
include: "ace/theme/" + theme + ".js"
|
||||
}],
|
||||
filter: [ copy.filter.moduleDefines, copy.filter.uglifyjs ],
|
||||
dest: "build/src/theme-" + theme + ".js"
|
||||
});
|
||||
});
|
||||
|
||||
// Piece together the parts that we want
|
||||
var data = copy.createDataObject();
|
||||
copy({
|
||||
source: [
|
||||
'build_support/mini_require.js',
|
||||
pilotData,
|
||||
// cockpitData,
|
||||
aceData,
|
||||
'build_support/boot.js'
|
||||
],
|
||||
dest: data
|
||||
// copy key bindings
|
||||
project.assumeAllFilesLoaded();
|
||||
["vim", "emacs"].forEach(function(keybinding) {
|
||||
copy({
|
||||
source: [
|
||||
copy.source.commonjs({
|
||||
project: project.clone(),
|
||||
require: [ 'ace/keyboard/keybinding/' + keybinding ]
|
||||
})
|
||||
],
|
||||
filter: [ copy.filter.moduleDefines, copy.filter.uglifyjs ],
|
||||
dest: "build/src/keybinding-" + keybinding + ".js"
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
console.log('# License | Readme | Changelog ---------');
|
||||
|
||||
copy({
|
||||
source: [
|
||||
'build_support/editor.html'
|
||||
],
|
||||
dest: 'build/editor.html'
|
||||
source: aceHome + "/LICENSE",
|
||||
dest: 'build/LICENSE'
|
||||
});
|
||||
copy({
|
||||
source: aceHome + "/Readme.md",
|
||||
dest: 'build/Readme.md'
|
||||
});
|
||||
copy({
|
||||
source: aceHome + "/ChangeLog.txt",
|
||||
dest: 'build/ChangeLog.txt'
|
||||
});
|
||||
|
||||
// Create the compressed and uncompressed output files
|
||||
copy({
|
||||
source: data,
|
||||
filter: copy.filter.uglifyjs,
|
||||
dest: 'build/old-ace.js'
|
||||
});
|
||||
copy({
|
||||
source: data,
|
||||
dest: 'build/old-ace-uncompressed.js'
|
||||
});
|
||||
// copy complex demo
|
||||
//copy({
|
||||
// source: aceHome + "/editor.html",
|
||||
// filter: [ function(data) {
|
||||
// var includes = [
|
||||
// "ace", "cockpit",
|
||||
// "keybinding-vim", "keybinding-emacs",
|
||||
// "mode-javascript", "mode-css", "mode-html", "mode-php", "mode-python",
|
||||
// "mode-xml",
|
||||
// "theme-clouds", "theme-clouds_midnight", "theme-cobalt",
|
||||
// "theme-dawn", "theme-idle_fingers", "theme-kr_theme",
|
||||
// "theme-mono_industrial", "theme-monokai", "theme-pastel_on_dark",
|
||||
// "theme-twilight"
|
||||
// ].map(function(module) {
|
||||
// return '<script src="src/' + module + '.js" type="text/javascript"></script>';
|
||||
// }).join("\n");
|
||||
// return (
|
||||
// data.replace('<script src="demo/require.js" type="text/javascript" charset="utf-8"></script>', includes)
|
||||
// .replace('<script src="demo/boot.js" type="text/javascript"></script>', '<script src="demo/demo.js" type="text/javascript"></script>\n<script>require("demo").launch()</script>')
|
||||
// )
|
||||
// } ],
|
||||
// dest: "build/editor-demo.html"
|
||||
//});
|
||||
//copy({
|
||||
// source: [{
|
||||
// root: aceHome + '/demo',
|
||||
// include: "demo.js"
|
||||
// }],
|
||||
// filter: [ copy.filter.moduleDefines ],
|
||||
// dest: "build/demo/demo.js"
|
||||
//});
|
||||
//copy({
|
||||
// source: aceHome + '/demo/styles.css',
|
||||
// dest: "build/demo/styles.css"
|
||||
//});
|
||||
//copy({
|
||||
// source: aceHome + '/demo/logo.png',
|
||||
// dest: "build/demo/logo.png"
|
||||
//});
|
||||
|
|
|
|||
182
Makefile.dryice.textarea.js
Executable file
182
Makefile.dryice.textarea.js
Executable file
|
|
@ -0,0 +1,182 @@
|
|||
#!/usr/bin/env node
|
||||
/* ***** 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
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var copy = require('dryice').copy;
|
||||
|
||||
var aceHome = __dirname;
|
||||
|
||||
function shadow(input) {
|
||||
if (typeof input !== 'string') {
|
||||
input = input.toString();
|
||||
}
|
||||
|
||||
return input.replace(/define\(/g, "__ace_shadowed__.define(");
|
||||
}
|
||||
|
||||
console.log('# ace ---------');
|
||||
|
||||
var project = copy.createCommonJsProject([
|
||||
aceHome + '/support/pilot/lib',
|
||||
aceHome + '/lib'
|
||||
]);
|
||||
|
||||
copy({
|
||||
source: "build_support/editor_textarea.html",
|
||||
dest: 'build/textarea/editor.html'
|
||||
});
|
||||
|
||||
var ace = copy.createDataObject();
|
||||
copy({
|
||||
source: [
|
||||
'build_support/mini_require_textarea.js'
|
||||
],
|
||||
dest: ace
|
||||
});
|
||||
copy({
|
||||
source: [
|
||||
copy.source.commonjs({
|
||||
project: project,
|
||||
require: [
|
||||
"pilot/fixoldbrowsers",
|
||||
"pilot/index",
|
||||
"pilot/plugin_manager",
|
||||
"pilot/environment",
|
||||
"ace/editor",
|
||||
"ace/edit_session",
|
||||
"ace/undomanager",
|
||||
"ace/theme/textmate",
|
||||
"ace/mode/text",
|
||||
"ace/mode/matching_brace_outdent",
|
||||
"ace/virtual_renderer"
|
||||
]
|
||||
})
|
||||
],
|
||||
filter: [ copy.filter.moduleDefines ],
|
||||
dest: ace
|
||||
});
|
||||
copy({
|
||||
source: {
|
||||
root: project,
|
||||
include: /.*\.css$|.*\.html$/,
|
||||
exclude: /tests?\//
|
||||
},
|
||||
filter: [ copy.filter.addDefines ],
|
||||
dest: ace
|
||||
});
|
||||
copy({
|
||||
source: {
|
||||
root: project,
|
||||
include: /.*\.png$|.*\.gif$/,
|
||||
exclude: /tests?\//
|
||||
},
|
||||
filter: [ copy.filter.base64 ],
|
||||
dest: ace
|
||||
});
|
||||
copy({
|
||||
source: [
|
||||
'build_support/boot_textarea.js'
|
||||
],
|
||||
dest: ace
|
||||
});
|
||||
|
||||
// Create the compressed and uncompressed output files
|
||||
copy({
|
||||
source: ace,
|
||||
filter: [
|
||||
shadow,
|
||||
copy.filter.uglifyjs
|
||||
],
|
||||
dest: 'build/textarea/src/ace.js'
|
||||
});
|
||||
copy({
|
||||
source: ace,
|
||||
filter: [
|
||||
shadow,
|
||||
],
|
||||
dest: 'build/textarea/src/ace-uncompressed.js'
|
||||
});
|
||||
|
||||
console.log('# ace modes ---------');
|
||||
|
||||
// create modes
|
||||
project.assumeAllFilesLoaded();
|
||||
[
|
||||
"css", "html", "javascript", "php", "python", "xml", "ruby", "java", "c_cpp",
|
||||
"coffee", "perl"
|
||||
].forEach(function(mode) {
|
||||
console.log("mode " + mode);
|
||||
copy({
|
||||
source: [
|
||||
copy.source.commonjs({
|
||||
project: project.clone(),
|
||||
require: [ 'ace/mode/' + mode ]
|
||||
})
|
||||
],
|
||||
filter: [
|
||||
copy.filter.moduleDefines,
|
||||
shadow,
|
||||
copy.filter.uglifyjs
|
||||
],
|
||||
dest: "build/textarea/src/mode-" + mode + ".js"
|
||||
});
|
||||
});
|
||||
|
||||
console.log('# ace themes ---------');
|
||||
|
||||
// create themes
|
||||
[
|
||||
"clouds", "clouds_midnight", "cobalt", "dawn", "idle_fingers", "kr_theme",
|
||||
"mono_industrial", "monokai", "pastel_on_dark", "twilight", "eclipse"
|
||||
].forEach(function(theme) {
|
||||
console.log("theme " + theme);
|
||||
copy({
|
||||
source: [{
|
||||
root: aceHome + '/lib',
|
||||
include: "ace/theme/" + theme + ".js"
|
||||
}],
|
||||
filter: [
|
||||
copy.filter.moduleDefines,
|
||||
shadow,
|
||||
copy.filter.uglifyjs
|
||||
],
|
||||
dest: "build/textarea/src/theme-" + theme + ".js"
|
||||
});
|
||||
});
|
||||
|
||||
console.log('# License | Readme | Changelog ---------');
|
||||
36
Readme.md
36
Readme.md
|
|
@ -20,7 +20,9 @@ Features
|
|||
Take Ace for a spin!
|
||||
--------------------
|
||||
|
||||
Check out the Ace live [demo](http://ajaxorg.github.com/ace/editor-build.html) or get a [Cloud9 IDE account](http://run.cloud9ide.com) to experience Ace while editing one of your own GitHub projects.
|
||||
Check out the Ace live [demo](http://ajaxorg.github.com/ace/build/editor.html) or get a [Cloud9 IDE account](http://run.cloud9ide.com) to experience Ace while editing one of your own GitHub projects.
|
||||
|
||||
If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookmarklet](http://ajaxorg.github.com/ace/build/textarea/editor.html).
|
||||
|
||||
History
|
||||
-------
|
||||
|
|
@ -35,6 +37,38 @@ Ace is a community project. We actively encourage and support contributions. The
|
|||
git clone git://github.com/ajaxorg/ace.git
|
||||
git submodule update --init --recursive
|
||||
|
||||
Embedding Ace
|
||||
-------------
|
||||
|
||||
Ace can be easily embedded into any existing web page. The Ace git repository ships with a pre-packaged version of Ace inside of the `build` directory. The same packaged files are also available as a separate [download](https://github.com/ajaxorg/ace/downloads). Simply copy the contents of the `src` subdirectory somewhere into your project and take a look at the included demos of how to use Ace.
|
||||
|
||||
The easiest version is simply:
|
||||
|
||||
<div id="editor">some text</div>
|
||||
<script src="src/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
var editor = ace.edit("editor");
|
||||
};
|
||||
</script>
|
||||
|
||||
To change the theme simply include the Theme's JavaScript file
|
||||
|
||||
<script src="src/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
and configure the editor to use the theme:
|
||||
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
|
||||
By default the editor only supports plain text mode. However all other language modes are available as separate modules. After including the mode's Javascript file
|
||||
|
||||
<script src="src/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
the mode can be used like this:
|
||||
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
editor.getSession().setMode(new JavaScriptMode());
|
||||
|
||||
Running Ace
|
||||
-----------
|
||||
|
||||
|
|
|
|||
50
build/ChangeLog.txt
Normal file
50
build/ChangeLog.txt
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
2011.02.14, Version 0.1.6
|
||||
|
||||
* Floating Anchors
|
||||
- An Anchor is a floating pointer in the document.
|
||||
- Whenever text is inserted or deleted before the cursor, the position of the cursor is updated
|
||||
- Usesd for the cursor and selection
|
||||
- Basis for bookmarks, multiple cursors and snippets in the future
|
||||
* Extensive support for Cocoa style keybindings on the Mac <https://github.com/ajaxorg/ace/issues/closed#issue/116/comment/767803>
|
||||
* New commands:
|
||||
- center selection in viewport
|
||||
- remove to end/start of line
|
||||
- split line
|
||||
- transpose letters
|
||||
* Refator markers
|
||||
- Custom code can be used to render markers
|
||||
- Markers can be in front or behind the text
|
||||
- Markers are now stored in the session (was in the renderer)
|
||||
* Lots of IE8 fixes including copy, cut and selections
|
||||
* Unit tests can also be run in the browser <https://github.com/ajaxorg/ace/blob/master/lib/ace/test/tests.html>
|
||||
* Soft wrap can adapt to the width of the editor (Mike Ratcliffe, Joe Cheng)
|
||||
* Add minimal node server server.js to run the Ace demo in Chrome
|
||||
* The top level editor.html demo has been renamed to index.html
|
||||
* Bug fixes
|
||||
- Fixed gotoLine to consider wrapped lines when calculating where to scroll to (James Allen)
|
||||
- Fixed isues when the editor was scrolled in the web page (Eric Allam)
|
||||
- Highlighting of Python string literals
|
||||
- Syntax rule for PHP comments
|
||||
|
||||
2011.02.08, Version 0.1.5
|
||||
|
||||
* Add Coffeescript Mode (Satoshi Murakami)
|
||||
* Fix word wrap bug (Julian Viereck)
|
||||
* Fix packaged version of the Eclipse mode
|
||||
* Loading of workers is more robust
|
||||
* Fix "click selection"
|
||||
* Allow tokizing empty lines (Daniel Krech)
|
||||
* Make PageUp/Down behavior more consistent with native OS (Joe Cheng)
|
||||
|
||||
2011.02.04, Version 0.1.4
|
||||
|
||||
* Add C/C++ mode contributed by Gastón Kleiman
|
||||
* Fix exception in key input
|
||||
|
||||
2011.02.04, Version 0.1.3
|
||||
|
||||
* Let the packaged version play nice with requireJS
|
||||
* Add Ruby mode contributed by Shlomo Zalman Heigh
|
||||
* Add Java mode contributed by Tom Tasche
|
||||
* Fix annotation bug
|
||||
* Changing a document added a new empty line at the end
|
||||
476
build/LICENSE
Normal file
476
build/LICENSE
Normal file
|
|
@ -0,0 +1,476 @@
|
|||
Licensed under the tri-license MPL/LGPL/GPL.
|
||||
|
||||
MOZILLA PUBLIC LICENSE
|
||||
Version 1.1
|
||||
|
||||
---------------
|
||||
|
||||
1. Definitions.
|
||||
|
||||
1.0.1. "Commercial Use" means distribution or otherwise making the
|
||||
Covered Code available to a third party.
|
||||
|
||||
1.1. "Contributor" means each entity that creates or contributes to
|
||||
the creation of Modifications.
|
||||
|
||||
1.2. "Contributor Version" means the combination of the Original
|
||||
Code, prior Modifications used by a Contributor, and the Modifications
|
||||
made by that particular Contributor.
|
||||
|
||||
1.3. "Covered Code" means the Original Code or Modifications or the
|
||||
combination of the Original Code and Modifications, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.4. "Electronic Distribution Mechanism" means a mechanism generally
|
||||
accepted in the software development community for the electronic
|
||||
transfer of data.
|
||||
|
||||
1.5. "Executable" means Covered Code in any form other than Source
|
||||
Code.
|
||||
|
||||
1.6. "Initial Developer" means the individual or entity identified
|
||||
as the Initial Developer in the Source Code notice required by Exhibit
|
||||
A.
|
||||
|
||||
1.7. "Larger Work" means a work which combines Covered Code or
|
||||
portions thereof with code not governed by the terms of this License.
|
||||
|
||||
1.8. "License" means this document.
|
||||
|
||||
1.8.1. "Licensable" means having the right to grant, to the maximum
|
||||
extent possible, whether at the time of the initial grant or
|
||||
subsequently acquired, any and all of the rights conveyed herein.
|
||||
|
||||
1.9. "Modifications" means any addition to or deletion from the
|
||||
substance or structure of either the Original Code or any previous
|
||||
Modifications. When Covered Code is released as a series of files, a
|
||||
Modification is:
|
||||
A. Any addition to or deletion from the contents of a file
|
||||
containing Original Code or previous Modifications.
|
||||
|
||||
B. Any new file that contains any part of the Original Code or
|
||||
previous Modifications.
|
||||
|
||||
1.10. "Original Code" means Source Code of computer software code
|
||||
which is described in the Source Code notice required by Exhibit A as
|
||||
Original Code, and which, at the time of its release under this
|
||||
License is not already Covered Code governed by this License.
|
||||
|
||||
1.10.1. "Patent Claims" means any patent claim(s), now owned or
|
||||
hereafter acquired, including without limitation, method, process,
|
||||
and apparatus claims, in any patent Licensable by grantor.
|
||||
|
||||
1.11. "Source Code" means the preferred form of the Covered Code for
|
||||
making modifications to it, including all modules it contains, plus
|
||||
any associated interface definition files, scripts used to control
|
||||
compilation and installation of an Executable, or source code
|
||||
differential comparisons against either the Original Code or another
|
||||
well known, available Covered Code of the Contributor's choice. The
|
||||
Source Code can be in a compressed or archival form, provided the
|
||||
appropriate decompression or de-archiving software is widely available
|
||||
for no charge.
|
||||
|
||||
1.12. "You" (or "Your") means an individual or a legal entity
|
||||
exercising rights under, and complying with all of the terms of, this
|
||||
License or a future version of this License issued under Section 6.1.
|
||||
For legal entities, "You" includes any entity which controls, is
|
||||
controlled by, or is under common control with You. For purposes of
|
||||
this definition, "control" means (a) the power, direct or indirect,
|
||||
to cause the direction or management of such entity, whether by
|
||||
contract or otherwise, or (b) ownership of more than fifty percent
|
||||
(50%) of the outstanding shares or beneficial ownership of such
|
||||
entity.
|
||||
|
||||
2. Source Code License.
|
||||
|
||||
2.1. The Initial Developer Grant.
|
||||
The Initial Developer hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license, subject to third party intellectual property
|
||||
claims:
|
||||
(a) under intellectual property rights (other than patent or
|
||||
trademark) Licensable by Initial Developer to use, reproduce,
|
||||
modify, display, perform, sublicense and distribute the Original
|
||||
Code (or portions thereof) with or without Modifications, and/or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patents Claims infringed by the making, using or
|
||||
selling of Original Code, to make, have made, use, practice,
|
||||
sell, and offer for sale, and/or otherwise dispose of the
|
||||
Original Code (or portions thereof).
|
||||
|
||||
(c) the licenses granted in this Section 2.1(a) and (b) are
|
||||
effective on the date Initial Developer first distributes
|
||||
Original Code under the terms of this License.
|
||||
|
||||
(d) Notwithstanding Section 2.1(b) above, no patent license is
|
||||
granted: 1) for code that You delete from the Original Code; 2)
|
||||
separate from the Original Code; or 3) for infringements caused
|
||||
by: i) the modification of the Original Code or ii) the
|
||||
combination of the Original Code with other software or devices.
|
||||
|
||||
2.2. Contributor Grant.
|
||||
Subject to third party intellectual property claims, each Contributor
|
||||
hereby grants You a world-wide, royalty-free, non-exclusive license
|
||||
|
||||
(a) under intellectual property rights (other than patent or
|
||||
trademark) Licensable by Contributor, to use, reproduce, modify,
|
||||
display, perform, sublicense and distribute the Modifications
|
||||
created by such Contributor (or portions thereof) either on an
|
||||
unmodified basis, with other Modifications, as Covered Code
|
||||
and/or as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims infringed by the making, using, or
|
||||
selling of Modifications made by that Contributor either alone
|
||||
and/or in combination with its Contributor Version (or portions
|
||||
of such combination), to make, use, sell, offer for sale, have
|
||||
made, and/or otherwise dispose of: 1) Modifications made by that
|
||||
Contributor (or portions thereof); and 2) the combination of
|
||||
Modifications made by that Contributor with its Contributor
|
||||
Version (or portions of such combination).
|
||||
|
||||
(c) the licenses granted in Sections 2.2(a) and 2.2(b) are
|
||||
effective on the date Contributor first makes Commercial Use of
|
||||
the Covered Code.
|
||||
|
||||
(d) Notwithstanding Section 2.2(b) above, no patent license is
|
||||
granted: 1) for any code that Contributor has deleted from the
|
||||
Contributor Version; 2) separate from the Contributor Version;
|
||||
3) for infringements caused by: i) third party modifications of
|
||||
Contributor Version or ii) the combination of Modifications made
|
||||
by that Contributor with other software (except as part of the
|
||||
Contributor Version) or other devices; or 4) under Patent Claims
|
||||
infringed by Covered Code in the absence of Modifications made by
|
||||
that Contributor.
|
||||
|
||||
3. Distribution Obligations.
|
||||
|
||||
3.1. Application of License.
|
||||
The Modifications which You create or to which You contribute are
|
||||
governed by the terms of this License, including without limitation
|
||||
Section 2.2. The Source Code version of Covered Code may be
|
||||
distributed only under the terms of this License or a future version
|
||||
of this License released under Section 6.1, and You must include a
|
||||
copy of this License with every copy of the Source Code You
|
||||
distribute. You may not offer or impose any terms on any Source Code
|
||||
version that alters or restricts the applicable version of this
|
||||
License or the recipients' rights hereunder. However, You may include
|
||||
an additional document offering the additional rights described in
|
||||
Section 3.5.
|
||||
|
||||
3.2. Availability of Source Code.
|
||||
Any Modification which You create or to which You contribute must be
|
||||
made available in Source Code form under the terms of this License
|
||||
either on the same media as an Executable version or via an accepted
|
||||
Electronic Distribution Mechanism to anyone to whom you made an
|
||||
Executable version available; and if made available via Electronic
|
||||
Distribution Mechanism, must remain available for at least twelve (12)
|
||||
months after the date it initially became available, or at least six
|
||||
(6) months after a subsequent version of that particular Modification
|
||||
has been made available to such recipients. You are responsible for
|
||||
ensuring that the Source Code version remains available even if the
|
||||
Electronic Distribution Mechanism is maintained by a third party.
|
||||
|
||||
3.3. Description of Modifications.
|
||||
You must cause all Covered Code to which You contribute to contain a
|
||||
file documenting the changes You made to create that Covered Code and
|
||||
the date of any change. You must include a prominent statement that
|
||||
the Modification is derived, directly or indirectly, from Original
|
||||
Code provided by the Initial Developer and including the name of the
|
||||
Initial Developer in (a) the Source Code, and (b) in any notice in an
|
||||
Executable version or related documentation in which You describe the
|
||||
origin or ownership of the Covered Code.
|
||||
|
||||
3.4. Intellectual Property Matters
|
||||
(a) Third Party Claims.
|
||||
If Contributor has knowledge that a license under a third party's
|
||||
intellectual property rights is required to exercise the rights
|
||||
granted by such Contributor under Sections 2.1 or 2.2,
|
||||
Contributor must include a text file with the Source Code
|
||||
distribution titled "LEGAL" which describes the claim and the
|
||||
party making the claim in sufficient detail that a recipient will
|
||||
know whom to contact. If Contributor obtains such knowledge after
|
||||
the Modification is made available as described in Section 3.2,
|
||||
Contributor shall promptly modify the LEGAL file in all copies
|
||||
Contributor makes available thereafter and shall take other steps
|
||||
(such as notifying appropriate mailing lists or newsgroups)
|
||||
reasonably calculated to inform those who received the Covered
|
||||
Code that new knowledge has been obtained.
|
||||
|
||||
(b) Contributor APIs.
|
||||
If Contributor's Modifications include an application programming
|
||||
interface and Contributor has knowledge of patent licenses which
|
||||
are reasonably necessary to implement that API, Contributor must
|
||||
also include this information in the LEGAL file.
|
||||
|
||||
(c) Representations.
|
||||
Contributor represents that, except as disclosed pursuant to
|
||||
Section 3.4(a) above, Contributor believes that Contributor's
|
||||
Modifications are Contributor's original creation(s) and/or
|
||||
Contributor has sufficient rights to grant the rights conveyed by
|
||||
this License.
|
||||
|
||||
3.5. Required Notices.
|
||||
You must duplicate the notice in Exhibit A in each file of the Source
|
||||
Code. If it is not possible to put such notice in a particular Source
|
||||
Code file due to its structure, then You must include such notice in a
|
||||
location (such as a relevant directory) where a user would be likely
|
||||
to look for such a notice. If You created one or more Modification(s)
|
||||
You may add your name as a Contributor to the notice described in
|
||||
Exhibit A. You must also duplicate this License in any documentation
|
||||
for the Source Code where You describe recipients' rights or ownership
|
||||
rights relating to Covered Code. You may choose to offer, and to
|
||||
charge a fee for, warranty, support, indemnity or liability
|
||||
obligations to one or more recipients of Covered Code. However, You
|
||||
may do so only on Your own behalf, and not on behalf of the Initial
|
||||
Developer or any Contributor. You must make it absolutely clear than
|
||||
any such warranty, support, indemnity or liability obligation is
|
||||
offered by You alone, and You hereby agree to indemnify the Initial
|
||||
Developer and every Contributor for any liability incurred by the
|
||||
Initial Developer or such Contributor as a result of warranty,
|
||||
support, indemnity or liability terms You offer.
|
||||
|
||||
3.6. Distribution of Executable Versions.
|
||||
You may distribute Covered Code in Executable form only if the
|
||||
requirements of Section 3.1-3.5 have been met for that Covered Code,
|
||||
and if You include a notice stating that the Source Code version of
|
||||
the Covered Code is available under the terms of this License,
|
||||
including a description of how and where You have fulfilled the
|
||||
obligations of Section 3.2. The notice must be conspicuously included
|
||||
in any notice in an Executable version, related documentation or
|
||||
collateral in which You describe recipients' rights relating to the
|
||||
Covered Code. You may distribute the Executable version of Covered
|
||||
Code or ownership rights under a license of Your choice, which may
|
||||
contain terms different from this License, provided that You are in
|
||||
compliance with the terms of this License and that the license for the
|
||||
Executable version does not attempt to limit or alter the recipient's
|
||||
rights in the Source Code version from the rights set forth in this
|
||||
License. If You distribute the Executable version under a different
|
||||
license You must make it absolutely clear that any terms which differ
|
||||
from this License are offered by You alone, not by the Initial
|
||||
Developer or any Contributor. You hereby agree to indemnify the
|
||||
Initial Developer and every Contributor for any liability incurred by
|
||||
the Initial Developer or such Contributor as a result of any such
|
||||
terms You offer.
|
||||
|
||||
3.7. Larger Works.
|
||||
You may create a Larger Work by combining Covered Code with other code
|
||||
not governed by the terms of this License and distribute the Larger
|
||||
Work as a single product. In such a case, You must make sure the
|
||||
requirements of this License are fulfilled for the Covered Code.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation.
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Code due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description
|
||||
must be included in the LEGAL file described in Section 3.4 and must
|
||||
be included with all distributions of the Source Code. Except to the
|
||||
extent prohibited by statute or regulation, such description must be
|
||||
sufficiently detailed for a recipient of ordinary skill to be able to
|
||||
understand it.
|
||||
|
||||
5. Application of this License.
|
||||
|
||||
This License applies to code to which the Initial Developer has
|
||||
attached the notice in Exhibit A and to related Covered Code.
|
||||
|
||||
6. Versions of the License.
|
||||
|
||||
6.1. New Versions.
|
||||
Netscape Communications Corporation ("Netscape") may publish revised
|
||||
and/or new versions of the License from time to time. Each version
|
||||
will be given a distinguishing version number.
|
||||
|
||||
6.2. Effect of New Versions.
|
||||
Once Covered Code has been published under a particular version of the
|
||||
License, You may always continue to use it under the terms of that
|
||||
version. You may also choose to use such Covered Code under the terms
|
||||
of any subsequent version of the License published by Netscape. No one
|
||||
other than Netscape has the right to modify the terms applicable to
|
||||
Covered Code created under this License.
|
||||
|
||||
6.3. Derivative Works.
|
||||
If You create or use a modified version of this License (which you may
|
||||
only do in order to apply it to code which is not already Covered Code
|
||||
governed by this License), You must (a) rename Your license so that
|
||||
the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
|
||||
"MPL", "NPL" or any confusingly similar phrase do not appear in your
|
||||
license (except to note that your license differs from this License)
|
||||
and (b) otherwise make it clear that Your version of the license
|
||||
contains terms which differ from the Mozilla Public License and
|
||||
Netscape Public License. (Filling in the name of the Initial
|
||||
Developer, Original Code or Contributor in the notice described in
|
||||
Exhibit A shall not of themselves be deemed to be modifications of
|
||||
this License.)
|
||||
|
||||
7. DISCLAIMER OF WARRANTY.
|
||||
|
||||
COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
|
||||
DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
|
||||
THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
|
||||
IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
|
||||
YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
|
||||
COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
|
||||
OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
|
||||
ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
|
||||
|
||||
8. TERMINATION.
|
||||
|
||||
8.1. This License and the rights granted hereunder will terminate
|
||||
automatically if You fail to comply with terms herein and fail to cure
|
||||
such breach within 30 days of becoming aware of the breach. All
|
||||
sublicenses to the Covered Code which are properly granted shall
|
||||
survive any termination of this License. Provisions which, by their
|
||||
nature, must remain in effect beyond the termination of this License
|
||||
shall survive.
|
||||
|
||||
8.2. If You initiate litigation by asserting a patent infringement
|
||||
claim (excluding declatory judgment actions) against Initial Developer
|
||||
or a Contributor (the Initial Developer or Contributor against whom
|
||||
You file such action is referred to as "Participant") alleging that:
|
||||
|
||||
(a) such Participant's Contributor Version directly or indirectly
|
||||
infringes any patent, then any and all rights granted by such
|
||||
Participant to You under Sections 2.1 and/or 2.2 of this License
|
||||
shall, upon 60 days notice from Participant terminate prospectively,
|
||||
unless if within 60 days after receipt of notice You either: (i)
|
||||
agree in writing to pay Participant a mutually agreeable reasonable
|
||||
royalty for Your past and future use of Modifications made by such
|
||||
Participant, or (ii) withdraw Your litigation claim with respect to
|
||||
the Contributor Version against such Participant. If within 60 days
|
||||
of notice, a reasonable royalty and payment arrangement are not
|
||||
mutually agreed upon in writing by the parties or the litigation claim
|
||||
is not withdrawn, the rights granted by Participant to You under
|
||||
Sections 2.1 and/or 2.2 automatically terminate at the expiration of
|
||||
the 60 day notice period specified above.
|
||||
|
||||
(b) any software, hardware, or device, other than such Participant's
|
||||
Contributor Version, directly or indirectly infringes any patent, then
|
||||
any rights granted to You by such Participant under Sections 2.1(b)
|
||||
and 2.2(b) are revoked effective as of the date You first made, used,
|
||||
sold, distributed, or had made, Modifications made by that
|
||||
Participant.
|
||||
|
||||
8.3. If You assert a patent infringement claim against Participant
|
||||
alleging that such Participant's Contributor Version directly or
|
||||
indirectly infringes any patent where such claim is resolved (such as
|
||||
by license or settlement) prior to the initiation of patent
|
||||
infringement litigation, then the reasonable value of the licenses
|
||||
granted by such Participant under Sections 2.1 or 2.2 shall be taken
|
||||
into account in determining the amount or value of any payment or
|
||||
license.
|
||||
|
||||
8.4. In the event of termination under Sections 8.1 or 8.2 above,
|
||||
all end user license agreements (excluding distributors and resellers)
|
||||
which have been validly granted by You or any distributor hereunder
|
||||
prior to termination shall survive termination.
|
||||
|
||||
9. LIMITATION OF LIABILITY.
|
||||
|
||||
UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
|
||||
(INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
|
||||
DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
|
||||
OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
|
||||
ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
|
||||
CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
|
||||
WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
|
||||
COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
|
||||
INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
|
||||
LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
|
||||
RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
|
||||
PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
|
||||
EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
|
||||
THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
|
||||
|
||||
10. U.S. GOVERNMENT END USERS.
|
||||
|
||||
The Covered Code is a "commercial item," as that term is defined in
|
||||
48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
|
||||
software" and "commercial computer software documentation," as such
|
||||
terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
|
||||
C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
|
||||
all U.S. Government End Users acquire Covered Code with only those
|
||||
rights set forth herein.
|
||||
|
||||
11. MISCELLANEOUS.
|
||||
|
||||
This License represents the complete agreement concerning subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. This License shall be governed by
|
||||
California law provisions (except to the extent applicable law, if
|
||||
any, provides otherwise), excluding its conflict-of-law provisions.
|
||||
With respect to disputes in which at least one party is a citizen of,
|
||||
or an entity chartered or registered to do business in the United
|
||||
States of America, any litigation relating to this License shall be
|
||||
subject to the jurisdiction of the Federal Courts of the Northern
|
||||
District of California, with venue lying in Santa Clara County,
|
||||
California, with the losing party responsible for costs, including
|
||||
without limitation, court costs and reasonable attorneys' fees and
|
||||
expenses. The application of the United Nations Convention on
|
||||
Contracts for the International Sale of Goods is expressly excluded.
|
||||
Any law or regulation which provides that the language of a contract
|
||||
shall be construed against the drafter shall not apply to this
|
||||
License.
|
||||
|
||||
12. RESPONSIBILITY FOR CLAIMS.
|
||||
|
||||
As between Initial Developer and the Contributors, each party is
|
||||
responsible for claims and damages arising, directly or indirectly,
|
||||
out of its utilization of rights under this License and You agree to
|
||||
work with Initial Developer and Contributors to distribute such
|
||||
responsibility on an equitable basis. Nothing herein is intended or
|
||||
shall be deemed to constitute any admission of liability.
|
||||
|
||||
13. MULTIPLE-LICENSED CODE.
|
||||
|
||||
Initial Developer may designate portions of the Covered Code as
|
||||
"Multiple-Licensed". "Multiple-Licensed" means that the Initial
|
||||
Developer permits you to utilize portions of the Covered Code under
|
||||
Your choice of the NPL or the alternative licenses, if any, specified
|
||||
by the Initial Developer in the file described in Exhibit A.
|
||||
|
||||
EXHIBIT A -Mozilla Public License.
|
||||
|
||||
``The contents of this file are subject to the Mozilla Public License
|
||||
Version 1.1 (the "License"); you may not use this file except in
|
||||
compliance with the License. You may obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS"
|
||||
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
||||
License for the specific language governing rights and limitations
|
||||
under the License.
|
||||
|
||||
The Original Code is ______________________________________.
|
||||
|
||||
The Initial Developer of the Original Code is ________________________.
|
||||
Portions created by ______________________ are Copyright (C) ______
|
||||
_______________________. All Rights Reserved.
|
||||
|
||||
Contributor(s): ______________________________________.
|
||||
|
||||
Alternatively, the contents of this file may be used under the terms
|
||||
of the _____ license (the "[___] License"), in which case the
|
||||
provisions of [______] License are applicable instead of those
|
||||
above. If you wish to allow use of your version of this file only
|
||||
under the terms of the [____] License and not to allow others to use
|
||||
your version of this file under the MPL, indicate your decision by
|
||||
deleting the provisions above and replace them with the notice and
|
||||
other provisions required by the [___] License. If you do not delete
|
||||
the provisions above, a recipient may use your version of this file
|
||||
under either the MPL or the [___] License."
|
||||
|
||||
[NOTE: The text of this Exhibit A may differ slightly from the text of
|
||||
the notices in the Source Code files of the Original Code. You should
|
||||
use the text of this Exhibit A rather than the text found in the
|
||||
Original Code Source Code for Your Modifications.]
|
||||
|
||||
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
104
build/Readme.md
Normal file
104
build/Readme.md
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
Ace (Ajax.org Cloud9 Editor)
|
||||
============================
|
||||
|
||||
Ace is a standalone code editor written in JavaScript. Our goal is to create a web based code editor that matches and extends the features, usability and performance of existing native editors such as TextMate, Vim or Eclipse. It can be easily embedded in any web page and JavaScript application. Ace is developed as the primary editor for [Cloud9 IDE](http://www.cloud9ide.com/) and the successor of the Mozilla Skywriter (Bespin) Project.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* Syntax highlighting
|
||||
* Auto indentation and outdent
|
||||
* An optional command line
|
||||
* Work with huge documents (100,000 lines and more are no problem)
|
||||
* Fully customizable key bindings including VI and Emacs modes
|
||||
* Themes (TextMate themes can be imported)
|
||||
* Search and replace with regular expressions
|
||||
* Highlight matching parentheses
|
||||
* Toggle between soft tabs and real tabs
|
||||
* Displays hidden characters
|
||||
|
||||
Take Ace for a spin!
|
||||
--------------------
|
||||
|
||||
Check out the Ace live [demo](http://ajaxorg.github.com/ace/build/editor.html) or get a [Cloud9 IDE account](http://run.cloud9ide.com) to experience Ace while editing one of your own GitHub projects.
|
||||
|
||||
If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookmarklet][http://ajaxorg.github.com/ace/build/textarea/editor.html].
|
||||
|
||||
History
|
||||
-------
|
||||
|
||||
Previously known as “Bespin” or lately “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 now, which supersedes Skywriter. 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). This is 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!
|
||||
|
||||
git clone git://github.com/ajaxorg/ace.git
|
||||
git submodule update --init --recursive
|
||||
|
||||
Embedding Ace
|
||||
-------------
|
||||
|
||||
Ace can be easily embedded into any existing web page. The Ace git repository ships with a pre-packaged version of Ace inside of the `build` directory. The same packaged files are also available as a separate [download](https://github.com/ajaxorg/ace/downloads). Simply copy the contents of the `src` subdirectory somewhere into your project and take a look at the included demos of how to use Ace.
|
||||
|
||||
The easiest version is simply:
|
||||
|
||||
<div id="editor">some text</div>
|
||||
<script src="src/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
var editor = ace.edit("editor");
|
||||
};
|
||||
</script>
|
||||
|
||||
To change the theme simply include the Theme's JavaScript file
|
||||
|
||||
<script src="src/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
and configure the editor to use the theme:
|
||||
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
|
||||
By default the editor only supports plain text mode. However all other language modes are available as separate modules. After including the mode's Javascript file
|
||||
|
||||
<script src="src/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
the mode can be used like this:
|
||||
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
editor.getSession().setMode(new JavaScriptMode());
|
||||
|
||||
Running Ace
|
||||
-----------
|
||||
|
||||
After the checkout Ace works out of the box. No build step is required. Simply 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 the Ace in Chrome simply start the bundled mini HTTP server:
|
||||
|
||||
./static.py
|
||||
|
||||
The editor can then be opened at http://localhost:9999/editor.html.
|
||||
|
||||
Package Ace
|
||||
-----------
|
||||
|
||||
To package Ace we use the dryice build tool developed by the Mozilla Skywriter team. To install dryice and all its dependencies simply call:
|
||||
|
||||
npm link .
|
||||
|
||||
Afterwards Ace can by build by calling
|
||||
|
||||
./Makefile.dryice.js
|
||||
|
||||
The packaged Ace will be put in the 'build' folder.
|
||||
|
||||
Running the Unit Tests
|
||||
----------------------
|
||||
|
||||
The Ace unit tests run on node.js. Before the first run a couple of node mudules 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
|
||||
|
||||
npm link .
|
||||
|
||||
To run the tests call:
|
||||
|
||||
node lib/ace/test/all.js
|
||||
|
||||
45
build/editor.html
Normal file
45
build/editor.html
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>Editor</title>
|
||||
<style type="text/css" media="screen">
|
||||
body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#editor {
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<pre id="editor">function foo(items) {
|
||||
var i;
|
||||
for (i = 0; i < items.length; i++) {
|
||||
alert("Ace Rocks " + items[i]);
|
||||
}
|
||||
}</pre>
|
||||
|
||||
<script src="src/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="src/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="src/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
var editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
editor.getSession().setMode(new JavaScriptMode());
|
||||
};
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
12825
build/src/ace-uncompressed.js
Normal file
12825
build/src/ace-uncompressed.js
Normal file
File diff suppressed because one or more lines are too long
1
build/src/ace.js
Normal file
1
build/src/ace.js
Normal file
File diff suppressed because one or more lines are too long
2486
build/src/cockpit-uncompressed.js
Normal file
2486
build/src/cockpit-uncompressed.js
Normal file
File diff suppressed because one or more lines are too long
1
build/src/cockpit.js
Normal file
1
build/src/cockpit.js
Normal file
File diff suppressed because one or more lines are too long
1
build/src/keybinding-emacs.js
Normal file
1
build/src/keybinding-emacs.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/keyboard/keybinding/emacs",function(a,b,c){var d=a("ace/keyboard/state_handler").StateHandler,e=a("ace/keyboard/state_handler").matchCharacterOnly,f={start:[{key:"ctrl-x",then:"c-x"},{regex:["(?:command-([0-9]*))*","(down|ctrl-n)"],exec:"golinedown",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(right|ctrl-f)"],exec:"gotoright",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(up|ctrl-p)"],exec:"golineup",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["(?:command-([0-9]*))*","(left|ctrl-b)"],exec:"gotoleft",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{comment:"This binding matches all printable characters except numbers as long as they are no numbers and print them n times.",regex:["(?:command-([0-9]*))","([^0-9]+)*"],match:e,exec:"inserttext",params:[{name:"times",match:1,type:"number",defaultValue:"1"},{name:"text",match:2}]},{comment:"This binding matches numbers as long as there is no meta_number in the buffer.",regex:["(command-[0-9]*)*","([0-9]+)"],match:e,disallowMatches:[1],exec:"inserttext",params:[{name:"text",match:2,type:"text"}]},{regex:["command-([0-9]*)","(command-[0-9]|[0-9])"],comment:"Stops execution if the regex /meta_[0-9]+/ matches to avoid resetting the buffer."}],"c-x":[{key:"ctrl-g",then:"start"},{key:"ctrl-s",exec:"save",then:"start"}]};b.Emacs=new d(f)}),define("ace/keyboard/state_handler",function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(state in a)this.$buildBindingsRegex(a[state]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?(a.key=new RegExp("^"+a.regex[1]+"$"),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var d=[];b&1&&d.push("ctrl"),b&8&&d.push("command"),b&2&&d.push("option"),b&4&&d.push("shift"),c&&d.push(c);var e=d.join("-"),f=a.buffer+e;b!=2&&(a.buffer=f);return{bufferToUse:f,symbolicName:e}},$find:function(a,b,c,e,f){var g={};this.keymapping[a.state].some(function(h){var i;if(h.key&&!h.key.test(c))return!1;if(h.regex&&!(i=h.regex.exec(b)))return!1;if(h.match&&!h.match(b,e,f,c))return!1;if(h.disallowMatches)for(var j=0;j<h.disallowMatches.length;j++)if(!!i[h.disallowMatches[j]])return!1;if(h.exec){g.command=h.exec;if(h.params){var k;g.args={},h.params.forEach(function(a){a.match!=null&&i!=null?k=i[a.match]||a.defaultValue:k=a.defaultValue,a.type==="number"&&(k=parseInt(k)),g.args[a.name]=k})}a.buffer=""}h.then&&(a.state=h.then,a.buffer=""),g.command==null&&(g.command="null"),d&&console.log("KeyboardStateMapper#find",h);return!0});if(g.command)return g;a.buffer="";return!1},handleKeyboard:function(a,b,c){if(b!=0&&(c==""||String.fromCharCode(0)))return null;var e=this.$composeBuffer(a,b,c),f=e.bufferToUse,g=e.symbolicName;e=this.$find(a,f,g,b,c),d&&console.log("KeyboardStateMapper#match",f,g,e);return e}},b.matchCharacterOnly=function(a,b,c,d){return b==0?!0:b==4&&c.length==1?!0:!1},b.StateHandler=e})
|
||||
1
build/src/keybinding-vim.js
Normal file
1
build/src/keybinding-vim.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/keyboard/keybinding/vim",function(a,b,c){var d=a("ace/keyboard/state_handler").StateHandler,e=a("ace/keyboard/state_handler").matchCharacterOnly,f={start:[{key:"i",then:"insertMode"},{regex:["([0-9]*)","(k|up)"],exec:"golineup",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["([0-9]*)","(j|down|enter)"],exec:"golinedown",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["([0-9]*)","(l|right)"],exec:"gotoright",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{regex:["([0-9]*)","(h|left)"],exec:"gotoleft",params:[{name:"times",match:1,type:"number",defaultValue:1}]},{comment:"Catch some keyboard input to stop it here",match:e}],insertMode:[{key:"esc",then:"start"}]};b.Vim=new d(f)}),define("ace/keyboard/state_handler",function(a,b,c){function e(a){this.keymapping=this.$buildKeymappingRegex(a)}var d=!1;e.prototype={$buildKeymappingRegex:function(a){for(state in a)this.$buildBindingsRegex(a[state]);return a},$buildBindingsRegex:function(a){a.forEach(function(a){a.key?a.key=new RegExp("^"+a.key+"$"):Array.isArray(a.regex)?(a.key=new RegExp("^"+a.regex[1]+"$"),a.regex=new RegExp(a.regex.join("")+"$")):a.regex&&(a.regex=new RegExp(a.regex+"$"))})},$composeBuffer:function(a,b,c){if(a.state==null||a.buffer==null)a.state="start",a.buffer="";var d=[];b&1&&d.push("ctrl"),b&8&&d.push("command"),b&2&&d.push("option"),b&4&&d.push("shift"),c&&d.push(c);var e=d.join("-"),f=a.buffer+e;b!=2&&(a.buffer=f);return{bufferToUse:f,symbolicName:e}},$find:function(a,b,c,e,f){var g={};this.keymapping[a.state].some(function(h){var i;if(h.key&&!h.key.test(c))return!1;if(h.regex&&!(i=h.regex.exec(b)))return!1;if(h.match&&!h.match(b,e,f,c))return!1;if(h.disallowMatches)for(var j=0;j<h.disallowMatches.length;j++)if(!!i[h.disallowMatches[j]])return!1;if(h.exec){g.command=h.exec;if(h.params){var k;g.args={},h.params.forEach(function(a){a.match!=null&&i!=null?k=i[a.match]||a.defaultValue:k=a.defaultValue,a.type==="number"&&(k=parseInt(k)),g.args[a.name]=k})}a.buffer=""}h.then&&(a.state=h.then,a.buffer=""),g.command==null&&(g.command="null"),d&&console.log("KeyboardStateMapper#find",h);return!0});if(g.command)return g;a.buffer="";return!1},handleKeyboard:function(a,b,c){if(b!=0&&(c==""||String.fromCharCode(0)))return null;var e=this.$composeBuffer(a,b,c),f=e.bufferToUse,g=e.symbolicName;e=this.$find(a,f,g,b,c),d&&console.log("KeyboardStateMapper#match",f,g,e);return e}},b.matchCharacterOnly=function(a,b,c,d){return b==0?!0:b==4&&c.length==1?!0:!1},b.StateHandler=e})
|
||||
1
build/src/mode-c_cpp.js
Normal file
1
build/src/mode-c_cpp.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/mode/c_cpp",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/c_cpp_highlight_rules").c_cppHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\/\//;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"//")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}else if(a=="doc-start"){if(g=="start")return"";var h=b.match(/^\s*(\/?)\*/);h&&(h[1]&&(d+=" "),d+="* ")}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/c_cpp_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules,g=a("ace/mode/text_highlight_rules").TextHighlightRules,h=function(){var a=new f,b=e.arrayToMap("and|double|not_eq|throw|and_eq|dynamic_cast|operator|true|asm|else|or|try|auto|enum|or_eq|typedef|bitand|explicit|private|typeid|bitor|extern|protected|typename|bool|false|public|union|break|float|register|unsigned|case|fro|reinterpret-cast|using|catch|friend|return|virtual|char|goto|short|void|class|if|signed|volatile|compl|inline|sizeof|wchar_t|const|int|static|while|const-cast|long|static_cast|xor|continue|mutable|struct|xor_eq|default|namespace|switch|delete|new|template|do|not|this|for".split("|")),c=e.arrayToMap("NULL".split("|"));this.$rules={start:[{token:"comment",regex:"\\/\\/.*$"},a.getStartRule("doc-start"),{token:"comment",regex:"\\/\\*",next:"comment"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:'["].*\\\\$',next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"string",regex:"['].*\\\\$",next:"qstring"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant",regex:"<[a-zA-Z0-9.]+>"},{token:"keyword",regex:"(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"},{token:function(a){return a=="this"?"variable.language":b.hasOwnProperty(a)?"keyword":c.hasOwnProperty(a)?"constant.language":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]},this.addRules(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"};d.inherits(h,g),b.c_cppHighlightRules=h}),define("ace/mode/doc_comment_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"comment.doc",regex:"\\*\\/",next:"start"},{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",regex:"s+"},{token:"comment.doc",regex:"TODO"},{token:"comment.doc",regex:"[^@\\*]+"},{token:"comment.doc",regex:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f})
|
||||
1
build/src/mode-coffee.js
Normal file
1
build/src/mode-coffee.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/mode/coffee",function(a,b,c){function j(){this.$tokenizer=new d((new e).getRules()),this.$outdent=new f}var d=a("ace/tokenizer").Tokenizer,e=a("ace/mode/coffee_highlight_rules").CoffeeHighlightRules,f=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,g=a("ace/range").Range,h=a("ace/mode/text").Mode,i=a("pilot/oop");i.inherits(j,h);var k=j.prototype,l=/(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/,m=/^(\s*)#/,n=/^\s*###(?!#)/,o=/^\s*/;k.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a).tokens;(!e.length||e[e.length-1].type!=="comment")&&a==="start"&&l.test(b)&&(d+=c);return d},k.toggleCommentLines=function(a,b,c,d){console.log("toggle");var e=new g(0,0,0,0);for(var f=c;f<=d;++f){var h=b.getLine(f);if(n.test(h))continue;m.test(h)?h=h.replace(m,"$1"):h=h.replace(o,"$&#"),e.end.row=e.start.row=f,e.end.column=h.length+1,b.replace(e,h)}},k.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},k.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)},b.Mode=j}),define("ace/mode/coffee_highlight_rules",function(a,b,c){function d(){var a="[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*",b="(?![$\\w]|\\s*:)",c={token:"string",regex:".+"};this.$rules={start:[{token:"identifier",regex:"(?:@|(?:\\.|::)\\s*)"+a},{token:"keyword",regex:"(?:t(?:h(?:is|row|en)|ry|ypeof)|s(?:uper|witch)|return|b(?:reak|y)|c(?:ontinue|atch|lass)|i(?:n(?:stanceof)?|s(?:nt)?|f)|e(?:lse|xtends)|f(?:or (?:own)?|inally|unction)|wh(?:ile|en)|n(?:ew|ot?)|d(?:e(?:lete|bugger)|o)|loop|o(?:ff?|[rn])|un(?:less|til)|and|yes)"+b},{token:"constant.language",regex:"(?:true|false|null|undefined)"+b},{token:"invalid.illegal",regex:"(?:c(?:ase|onst)|default|function|v(?:ar|oid)|with|e(?:num|xport)|i(?:mplements|nterface)|let|p(?:ackage|r(?:ivate|otected)|ublic)|static|yield|__(?:hasProp|extends|slice|bind|indexOf))"+b},{token:"language.support.class",regex:"(?:Array|Boolean|Date|Function|Number|Object|R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|TypeError|URIError)"+b},{token:"language.support.function",regex:"(?:Math|JSON|is(?:NaN|Finite)|parse(?:Int|Float)|encodeURI(?:Component)?|decodeURI(?:Component)?)"+b},{token:"identifier",regex:a},{token:"constant.numeric",regex:"(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"},{token:"string",regex:"'''",next:"qdoc"},{token:"string",regex:'"""',next:"qqdoc"},{token:"string",regex:"'",next:"qstring"},{token:"string",regex:'"',next:"qqstring"},{token:"string",regex:"`",next:"js"},{token:"string.regex",regex:"///",next:"heregex"},{token:"string.regex",regex:"/(?!\\s)[^[/\\n\\\\]*(?: (?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[/\\n\\\\]*)*/[imgy]{0,4}(?!\\w)"},{token:"comment",regex:"###(?!#)",next:"comment"},{token:"comment",regex:"#.*"},{token:"lparen",regex:"[({[]"},{token:"rparen",regex:"[\\]})]"},{token:"keyword.operator",regex:"\\S+"},{token:"text",regex:"\\s+"}],qdoc:[{token:"string",regex:".*?'''",next:"start"},c],qqdoc:[{token:"string",regex:'.*?"""',next:"start"},c],qstring:[{token:"string",regex:"[^\\\\']*(?:\\\\.[^\\\\']*)*'",next:"start"},c],qqstring:[{token:"string",regex:'[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',next:"start"},c],js:[{token:"string",regex:"[^\\\\`]*(?:\\\\.[^\\\\`]*)*`",next:"start"},c],heregex:[{token:"string.regex",regex:".*?///[imgy]{0,4}",next:"start"},{token:"comment.regex",regex:"\\s+(?:#.*)?"},{token:"string.regex",regex:"\\S+"}],comment:[{token:"comment",regex:".*?###",next:"start"},{token:"comment",regex:".+"}]}}a("pilot/oop").inherits(d,a("ace/mode/text_highlight_rules").TextHighlightRules),b.CoffeeHighlightRules=d})
|
||||
1
build/src/mode-css.js
Normal file
1
build/src/mode-css.js
Normal file
File diff suppressed because one or more lines are too long
1
build/src/mode-html.js
Normal file
1
build/src/mode-html.js
Normal file
File diff suppressed because one or more lines are too long
1
build/src/mode-java.js
Normal file
1
build/src/mode-java.js
Normal file
File diff suppressed because one or more lines are too long
1
build/src/mode-javascript.js
Normal file
1
build/src/mode-javascript.js
Normal file
File diff suppressed because one or more lines are too long
1
build/src/mode-perl.js
Normal file
1
build/src/mode-perl.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/mode/perl",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/perl_highlight_rules").PerlHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[\:]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/perl_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars".split("|")),b=e.arrayToMap("ARGV|ENV|INC|SIG".split("|")),c=e.arrayToMap("getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|getpeername|setpriority|getprotoent|setprotoent|getpriority|endprotoent|getservent|setservent|endservent|sethostent|socketpair|getsockopt|gethostent|endhostent|setsockopt|setnetent|quotemeta|localtime|prototype|getnetent|endnetent|rewinddir|wantarray|getpwuid|closedir|getlogin|readlink|endgrent|getgrgid|getgrnam|shmwrite|shutdown|readline|endpwent|setgrent|readpipe|formline|truncate|dbmclose|syswrite|setpwent|getpwnam|getgrent|getpwent|ucfirst|sysread|setpgrp|shmread|sysseek|sysopen|telldir|defined|opendir|connect|lcfirst|getppid|binmode|syscall|sprintf|getpgrp|readdir|seekdir|waitpid|reverse|unshift|symlink|dbmopen|semget|msgrcv|rename|listen|chroot|msgsnd|shmctl|accept|unpack|exists|fileno|shmget|system|unlink|printf|gmtime|msgctl|semctl|values|rindex|substr|splice|length|msgget|select|socket|return|caller|delete|alarm|ioctl|index|undef|lstat|times|srand|chown|fcntl|close|write|umask|rmdir|study|sleep|chomp|untie|print|utime|mkdir|atan2|split|crypt|flock|chmod|BEGIN|bless|chdir|semop|shift|reset|link|stat|chop|grep|fork|dump|join|open|tell|pipe|exit|glob|warn|each|bind|sort|pack|eval|push|keys|getc|kill|seek|sqrt|send|wait|rand|tied|read|time|exec|recv|eof|chr|int|ord|exp|pos|pop|sin|log|abs|oct|hex|tie|cos|vec|END|ref|map|die|uc|lc|do".split("|"));this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string.regexp",regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:'["].*\\\\$',next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"string",regex:"['].*\\\\$",next:"qstring"},{token:"constant.numeric",regex:"0x[0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:function(d){return a.hasOwnProperty(d)?"keyword":b.hasOwnProperty(d)?"constant.language":c.hasOwnProperty(d)?"support.function":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\.\\.\\.|\\|\\|=|>>=|<<=|<=>|&&=|=>|!~|\\^=|&=|\\|=|\\.=|x=|%=|\\/=|\\*=|\\-=|\\+=|=~|\\*\\*|\\-\\-|\\.\\.|\\|\\||&&|\\+\\+|\\->|!=|==|>=|<=|>>|<<|,|=|\\?\\:|\\^|\\||x|%|\\/|\\*|<|&|\\\\|~|!|>|\\.|\\-|\\+|\\-C|\\-b|\\-S|\\-u|\\-t|\\-p|\\-l|\\-d|\\-f|\\-g|\\-s|\\-z|\\-k|\\-e|\\-O|\\-T|\\-B|\\-M|\\-A|\\-X|\\-W|\\-c|\\-R|\\-o|\\-x|\\-w|\\-r|\\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]}};d.inherits(g,f),b.PerlHighlightRules=g})
|
||||
1
build/src/mode-php.js
Normal file
1
build/src/mode-php.js
Normal file
File diff suppressed because one or more lines are too long
1
build/src/mode-python.js
Normal file
1
build/src/mode-python.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/mode/python",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/python_highlight_rules").PythonHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[\:]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/python_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield".split("|")),b=e.arrayToMap("True|False|None|NotImplemented|Ellipsis|__debug__".split("|")),c=e.arrayToMap("abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern".split("|")),d=e.arrayToMap("".split("|")),f="(?:r|u|ur|R|U|UR|Ur|uR)?",g="(?:(?:[1-9]\\d*)|(?:0))",h="(?:0[oO]?[0-7]+)",i="(?:0[xX][\\dA-Fa-f]+)",j="(?:0[bB][01]+)",k="(?:"+g+"|"+h+"|"+i+"|"+j+")",l="(?:[eE][+-]?\\d+)",m="(?:\\.\\d+)",n="(?:\\d+)",o="(?:(?:"+n+"?"+m+")|(?:"+n+"\\.))",p="(?:(?:"+o+"|"+n+")"+l+")",q="(?:"+p+"|"+o+")";this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string",regex:f+'"{3}(?:[^\\\\]|\\\\.)*?"{3}'},{token:"string",regex:f+'"{3}.*$',next:"qqstring"},{token:"string",regex:f+'"(?:[^\\\\]|\\\\.)*?"'},{token:"string",regex:f+"'{3}(?:[^\\\\]|\\\\.)*?'{3}"},{token:"string",regex:f+"'{3}.*$",next:"qstring"},{token:"string",regex:f+"'(?:[^\\\\]|\\\\.)*?'"},{token:"constant.numeric",regex:"(?:"+q+"|\\d+)[jJ]\\b"},{token:"constant.numeric",regex:q},{token:"constant.numeric",regex:k+"[lL]\\b"},{token:"constant.numeric",regex:k+"\\b"},{token:function(e){return a.hasOwnProperty(e)?"keyword":b.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"invalid.illegal":c.hasOwnProperty(e)?"support.function":e=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"lparen",regex:"[\\[\\(\\{]"},{token:"rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:[^\\\\]|\\\\.)*?"{3}',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:[^\\\\]|\\\\.)*?'{3}",next:"start"},{token:"string",regex:".+"}]}};d.inherits(g,f),b.PythonHighlightRules=g})
|
||||
1
build/src/mode-ruby.js
Normal file
1
build/src/mode-ruby.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/mode/ruby",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/ruby_highlight_rules").RubyHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),define("ace/mode/ruby_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("abort|Array|at_exit|autoload|binding|block_given?|callcc|caller|catch|chomp|chomp!|chop|chop!|eval|exec|exit|exit!fail|Float|fork|format|gets|global_variables|gsub|gsub!|Integer|lambda|load|local_variables|loop|open|p|print|printf|proc|putc|puts|raise|rand|readline|readlines|require|scan|select|set_trace_func|sleep|split|sprintf|srand|String|syscall|system|sub|sub!|test|throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan".split("|")),b=e.arrayToMap("alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|__FILE__|finally|for|if|in|__LINE__|module|next|not|or|redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield".split("|")),c=e.arrayToMap("true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING".split("|")),d=e.arrayToMap("$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE".split("|"));this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"comment",regex:"^=begin$",next:"comment"},{token:"string.regexp",regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:function(e){return e=="self"?"variable.language":b.hasOwnProperty(e)?"keyword":c.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"variable.language":a.hasOwnProperty(e)?"support.function":e=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:"^=end$",next:"start"},{token:"comment",regex:".+"}]}};d.inherits(g,f),b.RubyHighlightRules=g})
|
||||
1
build/src/mode-xml.js
Normal file
1
build/src/mode-xml.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/mode/xml",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/xml_highlight_rules").XmlHighlightRules,h=function(){this.$tokenizer=new f((new g).getRules())};d.inherits(h,e),function(){this.getNextLineIndent=function(a,b,c){return this.$getIndent(b)}}.call(h.prototype),b.Mode=h}),define("ace/mode/xml_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"text",regex:"<\\!\\[CDATA\\[",next:"cdata"},{token:"xml_pe",regex:"<\\?.*?\\?>"},{token:"comment",regex:"<\\!--",next:"comment"},{token:"text",regex:"<\\/?",next:"tag"},{token:"text",regex:"\\s+"},{token:"text",regex:"[^<]+"}],tag:[{token:"text",regex:">",next:"start"},{token:"keyword",regex:"[-_a-zA-Z0-9:]+"},{token:"text",regex:"\\s+"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"}],cdata:[{token:"text",regex:"\\]\\]>",next:"start"},{token:"text",regex:"\\s+"},{token:"text",regex:"(?:[^\\]]|\\](?!\\]>))+"}],comment:[{token:"comment",regex:".*?-->",next:"start"},{token:"comment",regex:".+"}]}};d.inherits(f,e),b.XmlHighlightRules=f})
|
||||
1
build/src/theme-clouds.js
Normal file
1
build/src/theme-clouds.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/theme/clouds",function(a,b,c){var d=a("pilot/dom"),e=".ace-clouds .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-clouds .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-clouds .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-clouds .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-clouds .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-clouds .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-clouds .ace_scroller {\n background-color: #FFFFFF;\n}\n\n.ace-clouds .ace_text-layer {\n cursor: text;\n color: #000000;\n}\n\n.ace-clouds .ace_cursor {\n border-left: 2px solid #000000;\n}\n\n.ace-clouds .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #000000;\n}\n \n.ace-clouds .ace_marker-layer .ace_selection {\n background: #BDD5FC;\n}\n\n.ace-clouds .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-clouds .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #BFBFBF;\n}\n\n.ace-clouds .ace_marker-layer .ace_active_line {\n background: #FFFBD1;\n}\n\n \n.ace-clouds .ace_invisible {\n color: #BFBFBF;\n}\n\n.ace-clouds .ace_keyword {\n color:#AF956F;\n}\n\n.ace-clouds .ace_keyword.ace_operator {\n color:#484848;\n}\n\n.ace-clouds .ace_constant {\n \n}\n\n.ace-clouds .ace_constant.ace_language {\n color:#39946A;\n}\n\n.ace-clouds .ace_constant.ace_library {\n \n}\n\n.ace-clouds .ace_constant.ace_numeric {\n color:#46A609;\n}\n\n.ace-clouds .ace_invalid {\n background-color:#FF002A;\n}\n\n.ace-clouds .ace_invalid.ace_illegal {\n \n}\n\n.ace-clouds .ace_invalid.ace_deprecated {\n \n}\n\n.ace-clouds .ace_support {\n \n}\n\n.ace-clouds .ace_support.ace_function {\n color:#C52727;\n}\n\n.ace-clouds .ace_function.ace_buildin {\n \n}\n\n.ace-clouds .ace_string {\n color:#5D90CD;\n}\n\n.ace-clouds .ace_string.ace_regexp {\n \n}\n\n.ace-clouds .ace_comment {\n color:#BCC8BA;\n}\n\n.ace-clouds .ace_comment.ace_doc {\n \n}\n\n.ace-clouds .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-clouds .ace_variable {\n \n}\n\n.ace-clouds .ace_variable.ace_language {\n \n}\n\n.ace-clouds .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-clouds"})
|
||||
1
build/src/theme-clouds_midnight.js
Normal file
1
build/src/theme-clouds_midnight.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/theme/clouds_midnight",function(a,b,c){var d=a("pilot/dom"),e=".ace-clouds-midnight .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-clouds-midnight .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-clouds-midnight .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-clouds-midnight .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-clouds-midnight .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-clouds-midnight .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-clouds-midnight .ace_scroller {\n background-color: #191919;\n}\n\n.ace-clouds-midnight .ace_text-layer {\n cursor: text;\n color: #929292;\n}\n\n.ace-clouds-midnight .ace_cursor {\n border-left: 2px solid #7DA5DC;\n}\n\n.ace-clouds-midnight .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #7DA5DC;\n}\n \n.ace-clouds-midnight .ace_marker-layer .ace_selection {\n background: #000000;\n}\n\n.ace-clouds-midnight .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-clouds-midnight .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #BFBFBF;\n}\n\n.ace-clouds-midnight .ace_marker-layer .ace_active_line {\n background: rgba(215, 215, 215, 0.031);\n}\n\n \n.ace-clouds-midnight .ace_invisible {\n color: #BFBFBF;\n}\n\n.ace-clouds-midnight .ace_keyword {\n color:#927C5D;\n}\n\n.ace-clouds-midnight .ace_keyword.ace_operator {\n color:#4B4B4B;\n}\n\n.ace-clouds-midnight .ace_constant {\n \n}\n\n.ace-clouds-midnight .ace_constant.ace_language {\n color:#39946A;\n}\n\n.ace-clouds-midnight .ace_constant.ace_library {\n \n}\n\n.ace-clouds-midnight .ace_constant.ace_numeric {\n color:#46A609;\n}\n\n.ace-clouds-midnight .ace_invalid {\n color:#FFFFFF;\nbackground-color:#E92E2E;\n}\n\n.ace-clouds-midnight .ace_invalid.ace_illegal {\n \n}\n\n.ace-clouds-midnight .ace_invalid.ace_deprecated {\n \n}\n\n.ace-clouds-midnight .ace_support {\n \n}\n\n.ace-clouds-midnight .ace_support.ace_function {\n color:#E92E2E;\n}\n\n.ace-clouds-midnight .ace_function.ace_buildin {\n \n}\n\n.ace-clouds-midnight .ace_string {\n color:#5D90CD;\n}\n\n.ace-clouds-midnight .ace_string.ace_regexp {\n \n}\n\n.ace-clouds-midnight .ace_comment {\n color:#3C403B;\n}\n\n.ace-clouds-midnight .ace_comment.ace_doc {\n \n}\n\n.ace-clouds-midnight .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-clouds-midnight .ace_variable {\n \n}\n\n.ace-clouds-midnight .ace_variable.ace_language {\n \n}\n\n.ace-clouds-midnight .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-clouds-midnight"})
|
||||
1
build/src/theme-cobalt.js
Normal file
1
build/src/theme-cobalt.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/theme/cobalt",function(a,b,c){var d=a("pilot/dom"),e=".ace-cobalt .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-cobalt .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-cobalt .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-cobalt .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-cobalt .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-cobalt .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-cobalt .ace_scroller {\n background-color: #002240;\n}\n\n.ace-cobalt .ace_text-layer {\n cursor: text;\n color: #FFFFFF;\n}\n\n.ace-cobalt .ace_cursor {\n border-left: 2px solid #FFFFFF;\n}\n\n.ace-cobalt .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FFFFFF;\n}\n \n.ace-cobalt .ace_marker-layer .ace_selection {\n background: rgba(179, 101, 57, 0.75);\n}\n\n.ace-cobalt .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-cobalt .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 255, 255, 0.15);\n}\n\n.ace-cobalt .ace_marker-layer .ace_active_line {\n background: rgba(0, 0, 0, 0.35);\n}\n\n \n.ace-cobalt .ace_invisible {\n color: rgba(255, 255, 255, 0.15);\n}\n\n.ace-cobalt .ace_keyword {\n color:#FF9D00;\n}\n\n.ace-cobalt .ace_keyword.ace_operator {\n \n}\n\n.ace-cobalt .ace_constant {\n color:#FF628C;\n}\n\n.ace-cobalt .ace_constant.ace_language {\n \n}\n\n.ace-cobalt .ace_constant.ace_library {\n \n}\n\n.ace-cobalt .ace_constant.ace_numeric {\n \n}\n\n.ace-cobalt .ace_invalid {\n color:#F8F8F8;\nbackground-color:#800F00;\n}\n\n.ace-cobalt .ace_invalid.ace_illegal {\n \n}\n\n.ace-cobalt .ace_invalid.ace_deprecated {\n \n}\n\n.ace-cobalt .ace_support {\n color:#80FFBB;\n}\n\n.ace-cobalt .ace_support.ace_function {\n color:#FFB054;\n}\n\n.ace-cobalt .ace_function.ace_buildin {\n \n}\n\n.ace-cobalt .ace_string {\n \n}\n\n.ace-cobalt .ace_string.ace_regexp {\n color:#80FFC2;\n}\n\n.ace-cobalt .ace_comment {\n font-style:italic;\ncolor:#0088FF;\n}\n\n.ace-cobalt .ace_comment.ace_doc {\n \n}\n\n.ace-cobalt .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-cobalt .ace_variable {\n color:#CCCCCC;\n}\n\n.ace-cobalt .ace_variable.ace_language {\n color:#FF80E1;\n}\n\n.ace-cobalt .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-cobalt"})
|
||||
1
build/src/theme-dawn.js
Normal file
1
build/src/theme-dawn.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/theme/dawn",function(a,b,c){var d=a("pilot/dom"),e=".ace-dawn .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-dawn .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-dawn .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-dawn .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-dawn .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-dawn .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-dawn .ace_scroller {\n background-color: #F9F9F9;\n}\n\n.ace-dawn .ace_text-layer {\n cursor: text;\n color: #080808;\n}\n\n.ace-dawn .ace_cursor {\n border-left: 2px solid #000000;\n}\n\n.ace-dawn .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #000000;\n}\n \n.ace-dawn .ace_marker-layer .ace_selection {\n background: rgba(39, 95, 255, 0.30);\n}\n\n.ace-dawn .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-dawn .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(75, 75, 126, 0.50);\n}\n\n.ace-dawn .ace_marker-layer .ace_active_line {\n background: rgba(36, 99, 180, 0.12);\n}\n\n \n.ace-dawn .ace_invisible {\n color: rgba(75, 75, 126, 0.50);\n}\n\n.ace-dawn .ace_keyword {\n color:#794938;\n}\n\n.ace-dawn .ace_keyword.ace_operator {\n \n}\n\n.ace-dawn .ace_constant {\n color:#811F24;\n}\n\n.ace-dawn .ace_constant.ace_language {\n \n}\n\n.ace-dawn .ace_constant.ace_library {\n \n}\n\n.ace-dawn .ace_constant.ace_numeric {\n \n}\n\n.ace-dawn .ace_invalid {\n \n}\n\n.ace-dawn .ace_invalid.ace_illegal {\n text-decoration:underline;\nfont-style:italic;\ncolor:#F8F8F8;\nbackground-color:#B52A1D;\n}\n\n.ace-dawn .ace_invalid.ace_deprecated {\n text-decoration:underline;\nfont-style:italic;\ncolor:#B52A1D;\n}\n\n.ace-dawn .ace_support {\n color:#691C97;\n}\n\n.ace-dawn .ace_support.ace_function {\n color:#693A17;\n}\n\n.ace-dawn .ace_function.ace_buildin {\n \n}\n\n.ace-dawn .ace_string {\n color:#0B6125;\n}\n\n.ace-dawn .ace_string.ace_regexp {\n color:#CF5628;\n}\n\n.ace-dawn .ace_comment {\n font-style:italic;\ncolor:#5A525F;\n}\n\n.ace-dawn .ace_comment.ace_doc {\n \n}\n\n.ace-dawn .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-dawn .ace_variable {\n color:#234A97;\n}\n\n.ace-dawn .ace_variable.ace_language {\n \n}\n\n.ace-dawn .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-dawn"})
|
||||
1
build/src/theme-eclipse.js
Normal file
1
build/src/theme-eclipse.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/theme/eclipse",function(a,b,c){var d=a("pilot/dom"),e=".ace-eclipse .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-eclipse .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-eclipse .ace_gutter {\n width: 50px;\n background: rgb(227, 227, 227);\n border-right: 1px solid rgb(159, 159, 159);\t \n color: rgb(136, 136, 136);\n}\n\n.ace-eclipse .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-eclipse .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-eclipse .ace_text-layer {\n cursor: text;\n}\n\n.ace-eclipse .ace_cursor {\n border-left: 1px solid black;\n}\n\n.ace-eclipse .ace_line .ace_keyword, .ace-eclipse .ace_line .ace_variable {\n color: rgb(127, 0, 85);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_buildin {\n color: rgb(88, 72, 246);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_library {\n color: rgb(6, 150, 14);\n}\n\n.ace-eclipse .ace_line .ace_function {\n color: rgb(60, 76, 114);\n}\n\n.ace-eclipse .ace_line .ace_string {\n color: rgb(42, 0, 255);\n}\n\n.ace-eclipse .ace_line .ace_comment {\n color: rgb(63, 127, 95);\n}\n\n.ace-eclipse .ace_line .ace_comment.ace_doc {\n color: rgb(63, 95, 191);\n}\n\n.ace-eclipse .ace_line .ace_comment.ace_doc.ace_tag {\n color: rgb(127, 159, 191);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_numeric {\n}\n\n.ace-eclipse .ace_line .ace_tag {\n\tcolor: rgb(63, 127, 127);\n}\n\n.ace-eclipse .ace_line .ace_xml_pe {\n color: rgb(104, 104, 91);\n}\n\n.ace-eclipse .ace_marker-layer .ace_selection {\n background: rgb(181, 213, 255);\n}\n\n.ace-eclipse .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-eclipse .ace_marker-layer .ace_active_line {\n background: rgb(232, 242, 254);\n}";d.importCssString(e),b.cssClass="ace-eclipse"})
|
||||
1
build/src/theme-idle_fingers.js
Normal file
1
build/src/theme-idle_fingers.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/theme/idle_fingers",function(a,b,c){var d=a("pilot/dom"),e=".ace-idle-fingers .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-idle-fingers .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-idle-fingers .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-idle-fingers .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-idle-fingers .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-idle-fingers .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-idle-fingers .ace_scroller {\n background-color: #323232;\n}\n\n.ace-idle-fingers .ace_text-layer {\n cursor: text;\n color: #FFFFFF;\n}\n\n.ace-idle-fingers .ace_cursor {\n border-left: 2px solid #91FF00;\n}\n\n.ace-idle-fingers .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #91FF00;\n}\n \n.ace-idle-fingers .ace_marker-layer .ace_selection {\n background: rgba(90, 100, 126, 0.88);\n}\n\n.ace-idle-fingers .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-idle-fingers .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #404040;\n}\n\n.ace-idle-fingers .ace_marker-layer .ace_active_line {\n background: #353637;\n}\n\n \n.ace-idle-fingers .ace_invisible {\n color: #404040;\n}\n\n.ace-idle-fingers .ace_keyword {\n color:#CC7833;\n}\n\n.ace-idle-fingers .ace_keyword.ace_operator {\n \n}\n\n.ace-idle-fingers .ace_constant {\n color:#6C99BB;\n}\n\n.ace-idle-fingers .ace_constant.ace_language {\n \n}\n\n.ace-idle-fingers .ace_constant.ace_library {\n \n}\n\n.ace-idle-fingers .ace_constant.ace_numeric {\n \n}\n\n.ace-idle-fingers .ace_invalid {\n color:#FFFFFF;\nbackground-color:#FF0000;\n}\n\n.ace-idle-fingers .ace_invalid.ace_illegal {\n \n}\n\n.ace-idle-fingers .ace_invalid.ace_deprecated {\n \n}\n\n.ace-idle-fingers .ace_support {\n color:#bc9458;\n}\n\n.ace-idle-fingers .ace_support.ace_function {\n color:#B83426;\n}\n\n.ace-idle-fingers .ace_function.ace_buildin {\n \n}\n\n.ace-idle-fingers .ace_string {\n color:#A5C261;\n}\n\n.ace-idle-fingers .ace_string.ace_regexp {\n color:#CCCC33;\n}\n\n.ace-idle-fingers .ace_comment {\n font-style:italic;\n color:#BC9458;\n}\n\n.ace-idle-fingers .ace_comment.ace_doc {\n \n}\n\n.ace-idle-fingers .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-idle-fingers .ace_variable {\n color:#b7dff8;\n}\n\n.ace-idle-fingers .ace_variable.ace_language {\n color:#b7dff8;\n}\n\n.ace-idle-fingers .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-idle-fingers"})
|
||||
1
build/src/theme-kr_theme.js
Normal file
1
build/src/theme-kr_theme.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/theme/kr_theme",function(a,b,c){var d=a("pilot/dom"),e=".ace-kr-theme .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-kr-theme .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-kr-theme .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-kr-theme .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-kr-theme .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-kr-theme .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-kr-theme .ace_scroller {\n background-color: #0B0A09;\n}\n\n.ace-kr-theme .ace_text-layer {\n cursor: text;\n color: #FCFFE0;\n}\n\n.ace-kr-theme .ace_cursor {\n border-left: 2px solid #FF9900;\n}\n\n.ace-kr-theme .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FF9900;\n}\n \n.ace-kr-theme .ace_marker-layer .ace_selection {\n background: rgba(170, 0, 255, 0.45);\n}\n\n.ace-kr-theme .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-kr-theme .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 177, 111, 0.32);\n}\n\n.ace-kr-theme .ace_marker-layer .ace_active_line {\n background: #38403D;\n}\n\n \n.ace-kr-theme .ace_invisible {\n color: rgba(255, 177, 111, 0.32);\n}\n\n.ace-kr-theme .ace_keyword {\n color:#949C8B;\n}\n\n.ace-kr-theme .ace_keyword.ace_operator {\n \n}\n\n.ace-kr-theme .ace_constant {\n color:rgba(210, 117, 24, 0.76);\n}\n\n.ace-kr-theme .ace_constant.ace_language {\n \n}\n\n.ace-kr-theme .ace_constant.ace_library {\n \n}\n\n.ace-kr-theme .ace_constant.ace_numeric {\n \n}\n\n.ace-kr-theme .ace_invalid {\n color:#F8F8F8;\nbackground-color:#A41300;\n}\n\n.ace-kr-theme .ace_invalid.ace_illegal {\n \n}\n\n.ace-kr-theme .ace_invalid.ace_deprecated {\n \n}\n\n.ace-kr-theme .ace_support {\n color:#9FC28A;\n}\n\n.ace-kr-theme .ace_support.ace_function {\n color:#85873A;\n}\n\n.ace-kr-theme .ace_function.ace_buildin {\n \n}\n\n.ace-kr-theme .ace_string {\n \n}\n\n.ace-kr-theme .ace_string.ace_regexp {\n color:rgba(125, 255, 192, 0.65);\n}\n\n.ace-kr-theme .ace_comment {\n font-style:italic;\ncolor:#706D5B;\n}\n\n.ace-kr-theme .ace_comment.ace_doc {\n \n}\n\n.ace-kr-theme .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-kr-theme .ace_variable {\n color:#D1A796;\n}\n\n.ace-kr-theme .ace_variable.ace_language {\n color:#FF80E1;\n}\n\n.ace-kr-theme .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-kr-theme"})
|
||||
1
build/src/theme-mono_industrial.js
Normal file
1
build/src/theme-mono_industrial.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/theme/mono_industrial",function(a,b,c){var d=a("pilot/dom"),e=".ace-mono-industrial .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-mono-industrial .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-mono-industrial .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-mono-industrial .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-mono-industrial .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-mono-industrial .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-mono-industrial .ace_scroller {\n background-color: #222C28;\n}\n\n.ace-mono-industrial .ace_text-layer {\n cursor: text;\n color: #FFFFFF;\n}\n\n.ace-mono-industrial .ace_cursor {\n border-left: 2px solid #FFFFFF;\n}\n\n.ace-mono-industrial .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FFFFFF;\n}\n \n.ace-mono-industrial .ace_marker-layer .ace_selection {\n background: rgba(145, 153, 148, 0.40);\n}\n\n.ace-mono-industrial .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-mono-industrial .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(102, 108, 104, 0.50);\n}\n\n.ace-mono-industrial .ace_marker-layer .ace_active_line {\n background: rgba(12, 13, 12, 0.25);\n}\n\n \n.ace-mono-industrial .ace_invisible {\n color: rgba(102, 108, 104, 0.50);\n}\n\n.ace-mono-industrial .ace_keyword {\n color:#A39E64;\n}\n\n.ace-mono-industrial .ace_keyword.ace_operator {\n color:#A8B3AB;\n}\n\n.ace-mono-industrial .ace_constant {\n color:#E98800;\n}\n\n.ace-mono-industrial .ace_constant.ace_language {\n \n}\n\n.ace-mono-industrial .ace_constant.ace_library {\n \n}\n\n.ace-mono-industrial .ace_constant.ace_numeric {\n color:#E98800;\n}\n\n.ace-mono-industrial .ace_invalid {\n color:#FFFFFF;\nbackground-color:rgba(153, 0, 0, 0.68);\n}\n\n.ace-mono-industrial .ace_invalid.ace_illegal {\n \n}\n\n.ace-mono-industrial .ace_invalid.ace_deprecated {\n \n}\n\n.ace-mono-industrial .ace_support {\n \n}\n\n.ace-mono-industrial .ace_support.ace_function {\n color:#588E60;\n}\n\n.ace-mono-industrial .ace_function.ace_buildin {\n \n}\n\n.ace-mono-industrial .ace_string {\n \n}\n\n.ace-mono-industrial .ace_string.ace_regexp {\n \n}\n\n.ace-mono-industrial .ace_comment {\n color:#666C68;\nbackground-color:#151C19;\n}\n\n.ace-mono-industrial .ace_comment.ace_doc {\n \n}\n\n.ace-mono-industrial .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-mono-industrial .ace_variable {\n \n}\n\n.ace-mono-industrial .ace_variable.ace_language {\n color:#648BD2;\n}\n\n.ace-mono-industrial .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-mono-industrial"})
|
||||
1
build/src/theme-monokai.js
Normal file
1
build/src/theme-monokai.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/theme/monokai",function(a,b,c){var d=a("pilot/dom"),e=".ace-monokai .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-monokai .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-monokai .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-monokai .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-monokai .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-monokai .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-monokai .ace_scroller {\n background-color: #272822;\n}\n\n.ace-monokai .ace_text-layer {\n cursor: text;\n color: #F8F8F2;\n}\n\n.ace-monokai .ace_cursor {\n border-left: 2px solid #F8F8F0;\n}\n\n.ace-monokai .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #F8F8F0;\n}\n \n.ace-monokai .ace_marker-layer .ace_selection {\n background: #49483E;\n}\n\n.ace-monokai .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-monokai .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #49483E;\n}\n\n.ace-monokai .ace_marker-layer .ace_active_line {\n background: #49483E;\n}\n\n \n.ace-monokai .ace_invisible {\n color: #49483E;\n}\n\n.ace-monokai .ace_keyword {\n color:#F92672;\n}\n\n.ace-monokai .ace_keyword.ace_operator {\n \n}\n\n.ace-monokai .ace_constant {\n \n}\n\n.ace-monokai .ace_constant.ace_language {\n color:#AE81FF;\n}\n\n.ace-monokai .ace_constant.ace_library {\n \n}\n\n.ace-monokai .ace_constant.ace_numeric {\n color:#AE81FF;\n}\n\n.ace-monokai .ace_invalid {\n color:#F8F8F0;\nbackground-color:#F92672;\n}\n\n.ace-monokai .ace_invalid.ace_illegal {\n \n}\n\n.ace-monokai .ace_invalid.ace_deprecated {\n color:#F8F8F0;\nbackground-color:#AE81FF;\n}\n\n.ace-monokai .ace_support {\n \n}\n\n.ace-monokai .ace_support.ace_function {\n color:#66D9EF;\n}\n\n.ace-monokai .ace_function.ace_buildin {\n \n}\n\n.ace-monokai .ace_string {\n color:#E6DB74;\n}\n\n.ace-monokai .ace_string.ace_regexp {\n \n}\n\n.ace-monokai .ace_comment {\n color:#75715E;\n}\n\n.ace-monokai .ace_comment.ace_doc {\n \n}\n\n.ace-monokai .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-monokai .ace_variable {\n \n}\n\n.ace-monokai .ace_variable.ace_language {\n \n}\n\n.ace-monokai .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-monokai"})
|
||||
1
build/src/theme-pastel_on_dark.js
Normal file
1
build/src/theme-pastel_on_dark.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/theme/pastel_on_dark",function(a,b,c){var d=a("pilot/dom"),e=".ace-pastel-on-dark .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-pastel-on-dark .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-pastel-on-dark .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-pastel-on-dark .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-pastel-on-dark .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-pastel-on-dark .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-pastel-on-dark .ace_scroller {\n background-color: #2c2828;\n}\n\n.ace-pastel-on-dark .ace_text-layer {\n cursor: text;\n color: #8f938f;\n}\n\n.ace-pastel-on-dark .ace_cursor {\n border-left: 2px solid #A7A7A7;\n}\n\n.ace-pastel-on-dark .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #A7A7A7;\n}\n \n.ace-pastel-on-dark .ace_marker-layer .ace_selection {\n background: rgba(221, 240, 255, 0.20);\n}\n\n.ace-pastel-on-dark .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-pastel-on-dark .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 255, 255, 0.25);\n}\n\n.ace-pastel-on-dark .ace_marker-layer .ace_active_line {\n background: rgba(255, 255, 255, 0.031);\n}\n\n \n.ace-pastel-on-dark .ace_invisible {\n color: rgba(255, 255, 255, 0.25);\n}\n\n.ace-pastel-on-dark .ace_keyword {\n color:#757ad8;\n}\n\n.ace-pastel-on-dark .ace_keyword.ace_operator {\n color:#797878;\n}\n\n.ace-pastel-on-dark .ace_constant {\n color:#4fb7c5;\n}\n\n.ace-pastel-on-dark .ace_constant.ace_language {\n \n}\n\n.ace-pastel-on-dark .ace_constant.ace_library {\n \n}\n\n.ace-pastel-on-dark .ace_constant.ace_numeric {\n \n}\n\n.ace-pastel-on-dark .ace_invalid {\n \n}\n\n.ace-pastel-on-dark .ace_invalid.ace_illegal {\n color:#F8F8F8;\nbackground-color:rgba(86, 45, 86, 0.75);\n}\n\n.ace-pastel-on-dark .ace_invalid.ace_deprecated {\n text-decoration:underline;\nfont-style:italic;\ncolor:#D2A8A1;\n}\n\n.ace-pastel-on-dark .ace_support {\n color:#9a9a9a;\n}\n\n.ace-pastel-on-dark .ace_support.ace_function {\n color:#aeb2f8;\n}\n\n.ace-pastel-on-dark .ace_function.ace_buildin {\n \n}\n\n.ace-pastel-on-dark .ace_string {\n color:#66a968;\n}\n\n.ace-pastel-on-dark .ace_string.ace_regexp {\n color:#E9C062;\n}\n\n.ace-pastel-on-dark .ace_comment {\n color:#656865;\n}\n\n.ace-pastel-on-dark .ace_comment.ace_doc {\n color:A6C6FF;\n}\n\n.ace-pastel-on-dark .ace_comment.ace_doc.ace_tag {\n color:A6C6FF;\n}\n\n.ace-pastel-on-dark .ace_variable {\n color:#bebf55;\n}\n\n.ace-pastel-on-dark .ace_variable.ace_language {\n color:#bebf55;\n}\n\n.ace-pastel-on-dark .ace_xml_pe {\n color:#494949;\n}";d.importCssString(e),b.cssClass="ace-pastel-on-dark"})
|
||||
1
build/src/theme-twilight.js
Normal file
1
build/src/theme-twilight.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
define("ace/theme/twilight",function(a,b,c){var d=a("pilot/dom"),e=".ace-twilight .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-twilight .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-twilight .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-twilight .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-twilight .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-twilight .ace_print_margin {\n border-left: 1px solid #3C3C3C;\n width: 100%;\n background: #242424;\n}\n\n.ace-twilight .ace_scroller {\n background-color: #141414;\n}\n\n.ace-twilight .ace_text-layer {\n cursor: text;\n color: #F8F8F8;\n}\n\n.ace-twilight .ace_cursor {\n border-left: 2px solid #A7A7A7;\n}\n\n.ace-twilight .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #A7A7A7;\n}\n.ace-twilight.normal-mode .ace_cursor.ace_overwrite {\n border: 1px solid #FFE300;\n background: #766B13;\n}\n.ace-twilight.normal-mode .ace_cursor-layer {\n z-index: 0;\n}\n \n.ace-twilight .ace_marker-layer .ace_selection {\n background: rgba(221, 240, 255, 0.20);\n}\n\n.ace-twilight .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-twilight .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 255, 255, 0.25);\n}\n\n.ace-twilight .ace_marker-layer .ace_active_line {\n background: rgba(255, 255, 255, 0.031);\n}\n\n \n.ace-twilight .ace_invisible {\n color: rgba(255, 255, 255, 0.25);\n}\n\n.ace-twilight .ace_keyword {\n color:#CDA869;\n}\n\n.ace-twilight .ace_keyword.ace_operator {\n \n}\n\n.ace-twilight .ace_constant {\n color:#CF6A4C;\n}\n\n.ace-twilight .ace_constant.ace_language {\n \n}\n\n.ace-twilight .ace_constant.ace_library {\n \n}\n\n.ace-twilight .ace_constant.ace_numeric {\n \n}\n\n.ace-twilight .ace_invalid {\n \n}\n\n.ace-twilight .ace_invalid.ace_illegal {\n color:#F8F8F8;\nbackground-color:rgba(86, 45, 86, 0.75);\n}\n\n.ace-twilight .ace_invalid.ace_deprecated {\n text-decoration:underline;\nfont-style:italic;\ncolor:#D2A8A1;\n}\n\n.ace-twilight .ace_support {\n color:#9B859D;\n}\n\n.ace-twilight .ace_support.ace_function {\n color:#DAD085;\n}\n\n.ace-twilight .ace_function.ace_buildin {\n \n}\n\n.ace-twilight .ace_string {\n color:#8F9D6A;\n}\n\n.ace-twilight .ace_string.ace_regexp {\n color:#E9C062;\n}\n\n.ace-twilight .ace_comment {\n font-style:italic;\ncolor:#5F5A60;\n}\n\n.ace-twilight .ace_comment.ace_doc {\n \n}\n\n.ace-twilight .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-twilight .ace_variable {\n color:#7587A6;\n}\n\n.ace-twilight .ace_variable.ace_language {\n \n}\n\n.ace-twilight .ace_xml_pe {\n color:#494949;\n}";d.importCssString(e),b.cssClass="ace-twilight"})
|
||||
1
build/src/worker-javascript.js
Normal file
1
build/src/worker-javascript.js
Normal file
File diff suppressed because one or more lines are too long
129
build/textarea/editor.html
Normal file
129
build/textarea/editor.html
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>Editor</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Ace Bookmarklet Builder</h1>
|
||||
|
||||
<p>
|
||||
WARNING: Currently, this is only fully supported in non IE browsers.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
How to use it:
|
||||
<ul>
|
||||
<li>Select the options below as you want them to be by default.</li>
|
||||
<li>Enter the "SourceUrl" where you placed the source data which you find under build/textarea/src (you can also leave the default to server the scripts from GitHub).</li>
|
||||
<li>Click the "Build Link" button to generate your custom Ace Bookmarklet.</li>
|
||||
<li>Drag the generated link to your toolbar or store it somewhere else.</li>
|
||||
<li>Go to a page with an textarea element and click the bookmarklet - wait a little bit till the files are loaded.</li>
|
||||
<li>Click 3 times on the textarea you want to replace - Ace will replace it.</li>
|
||||
<li>To change settings, just click the red icon in the bottom right corner.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<textarea id="textarea" style="width:300px; height:300px">
|
||||
function foo() {
|
||||
var bar = true;
|
||||
}
|
||||
</textarea><br>
|
||||
SourceUrl: <input id="srcURL" value="http://ajaxorg.github.com/ace/build/textarea/src/"></input>
|
||||
|
||||
<button id="buBuild">Build Link</button> <br> <a href="#"></a>
|
||||
|
||||
<script>
|
||||
function inject() {
|
||||
var baseUrl = "src/";
|
||||
function load(path, module, callback) {
|
||||
path = baseUrl + path;
|
||||
if (!load.scripts[path]) {
|
||||
load.scripts[path] = {
|
||||
loaded: false,
|
||||
callbacks: [ callback ]
|
||||
};
|
||||
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
var s = document.createElement('script');
|
||||
|
||||
function c() {
|
||||
if (window.__ace_shadowed__ && window.__ace_shadowed__.define.modules[module]) {
|
||||
load.scripts[path].loaded = true;
|
||||
load.scripts[path].callbacks.forEach(function(callback) {
|
||||
callback();
|
||||
});
|
||||
} else {
|
||||
setTimeout(c, 50);
|
||||
}
|
||||
};
|
||||
s.src = path;
|
||||
head.appendChild(s);
|
||||
|
||||
c();
|
||||
} else if (load.scripts[path].loaded) {
|
||||
callback();
|
||||
} else {
|
||||
load.scripts[path].callbacks.push(callback);
|
||||
}
|
||||
};
|
||||
|
||||
load.scripts = {};
|
||||
window.__ace_shadowed_load__ = load;
|
||||
|
||||
load('ace.js', 'text!ace/css/editor.css', function() {
|
||||
var ace = window.__ace_shadowed__;
|
||||
var Event = ace.require('pilot/event');
|
||||
var areas = document.getElementsByTagName("textarea");
|
||||
for (var i = 0; i < areas.length; i++) {
|
||||
Event.addListener(areas[i], "click", function(e) {
|
||||
if (e.detail == 3) {
|
||||
ace.transformTextarea(e.target);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Call the inject function to load the ace files.
|
||||
inject();
|
||||
|
||||
var textAce;
|
||||
function initAce() {
|
||||
var ace = window.__ace_shadowed__;
|
||||
// Check if the ace.js file was loaded already, otherwise check back later.
|
||||
if (ace && ace.transformTextarea) {
|
||||
var t = document.querySelector("textarea");
|
||||
textAce = ace.transformTextarea(t);
|
||||
textAce.setDisplaySettings(true);
|
||||
} else {
|
||||
setTimeout(initAce, 100);
|
||||
}
|
||||
}
|
||||
|
||||
// Transform the textarea on the page into an ace editor.
|
||||
initAce();
|
||||
|
||||
document.getElementById("buBuild").onclick = function() {
|
||||
var injectSrc = inject.toString().split("\n").join("");
|
||||
injectSrc = injectSrc.replace('baseUrl = "src/"', 'baseUrl="' + document.getElementById("srcURL").value + '"');
|
||||
|
||||
var aceOptions = textAce.getOptions();
|
||||
var opt = [];
|
||||
for (var option in aceOptions) {
|
||||
opt.push(option + ":'" + aceOptions[option] + "'");
|
||||
}
|
||||
injectSrc = injectSrc.replace('ace.options.mode = "javascript"', 'ace.options = { ' + opt.join(",") + ' }');
|
||||
injectSrc = injectSrc.replace(/\s+/g, " ");
|
||||
|
||||
var a = document.querySelector("a");
|
||||
a.href = "javascript:(" + injectSrc + ")()";
|
||||
a.innerHTML = "Ace Bookmarklet Link";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
12927
build/textarea/src/ace-uncompressed.js
Normal file
12927
build/textarea/src/ace-uncompressed.js
Normal file
File diff suppressed because it is too large
Load diff
1
build/textarea/src/ace.js
Normal file
1
build/textarea/src/ace.js
Normal file
File diff suppressed because one or more lines are too long
1
build/textarea/src/mode-c_cpp.js
Normal file
1
build/textarea/src/mode-c_cpp.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/mode/c_cpp",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/c_cpp_highlight_rules").c_cppHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\/\//;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"//")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}else if(a=="doc-start"){if(g=="start")return"";var h=b.match(/^\s*(\/?)\*/);h&&(h[1]&&(d+=" "),d+="* ")}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),__ace_shadowed__.define("ace/mode/c_cpp_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/doc_comment_highlight_rules").DocCommentHighlightRules,g=a("ace/mode/text_highlight_rules").TextHighlightRules,h=function(){var a=new f,b=e.arrayToMap("and|double|not_eq|throw|and_eq|dynamic_cast|operator|true|asm|else|or|try|auto|enum|or_eq|typedef|bitand|explicit|private|typeid|bitor|extern|protected|typename|bool|false|public|union|break|float|register|unsigned|case|fro|reinterpret-cast|using|catch|friend|return|virtual|char|goto|short|void|class|if|signed|volatile|compl|inline|sizeof|wchar_t|const|int|static|while|const-cast|long|static_cast|xor|continue|mutable|struct|xor_eq|default|namespace|switch|delete|new|template|do|not|this|for".split("|")),c=e.arrayToMap("NULL".split("|"));this.$rules={start:[{token:"comment",regex:"\\/\\/.*$"},a.getStartRule("doc-start"),{token:"comment",regex:"\\/\\*",next:"comment"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:'["].*\\\\$',next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"string",regex:"['].*\\\\$",next:"qstring"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant",regex:"<[a-zA-Z0-9.]+>"},{token:"keyword",regex:"(?:#include|#pragma|#line|#define|#undef|#ifdef|#else|#elif|#endif|#ifndef)"},{token:function(a){return a=="this"?"variable.language":b.hasOwnProperty(a)?"keyword":c.hasOwnProperty(a)?"constant.language":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|new|delete|typeof|void)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:".*?\\*\\/",next:"start"},{token:"comment",regex:".+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]},this.addRules(a.getRules(),"doc-"),this.$rules["doc-start"][0].next="start"};d.inherits(h,g),b.c_cppHighlightRules=h}),__ace_shadowed__.define("ace/mode/doc_comment_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"comment.doc",regex:"\\*\\/",next:"start"},{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},{token:"comment.doc",regex:"s+"},{token:"comment.doc",regex:"TODO"},{token:"comment.doc",regex:"[^@\\*]+"},{token:"comment.doc",regex:"."}]}};d.inherits(f,e),function(){this.getStartRule=function(a){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:a}}}.call(f.prototype),b.DocCommentHighlightRules=f})
|
||||
1
build/textarea/src/mode-coffee.js
Normal file
1
build/textarea/src/mode-coffee.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/mode/coffee",function(a,b,c){function j(){this.$tokenizer=new d((new e).getRules()),this.$outdent=new f}var d=a("ace/tokenizer").Tokenizer,e=a("ace/mode/coffee_highlight_rules").CoffeeHighlightRules,f=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,g=a("ace/range").Range,h=a("ace/mode/text").Mode,i=a("pilot/oop");i.inherits(j,h);var k=j.prototype,l=/(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/,m=/^(\s*)#/,n=/^\s*###(?!#)/,o=/^\s*/;k.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a).tokens;(!e.length||e[e.length-1].type!=="comment")&&a==="start"&&l.test(b)&&(d+=c);return d},k.toggleCommentLines=function(a,b,c,d){console.log("toggle");var e=new g(0,0,0,0);for(var f=c;f<=d;++f){var h=b.getLine(f);if(n.test(h))continue;m.test(h)?h=h.replace(m,"$1"):h=h.replace(o,"$&#"),e.end.row=e.start.row=f,e.end.column=h.length+1,b.replace(e,h)}},k.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},k.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)},b.Mode=j}),__ace_shadowed__.define("ace/mode/coffee_highlight_rules",function(a,b,c){function d(){var a="[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*",b="(?![$\\w]|\\s*:)",c={token:"string",regex:".+"};this.$rules={start:[{token:"identifier",regex:"(?:@|(?:\\.|::)\\s*)"+a},{token:"keyword",regex:"(?:t(?:h(?:is|row|en)|ry|ypeof)|s(?:uper|witch)|return|b(?:reak|y)|c(?:ontinue|atch|lass)|i(?:n(?:stanceof)?|s(?:nt)?|f)|e(?:lse|xtends)|f(?:or (?:own)?|inally|unction)|wh(?:ile|en)|n(?:ew|ot?)|d(?:e(?:lete|bugger)|o)|loop|o(?:ff?|[rn])|un(?:less|til)|and|yes)"+b},{token:"constant.language",regex:"(?:true|false|null|undefined)"+b},{token:"invalid.illegal",regex:"(?:c(?:ase|onst)|default|function|v(?:ar|oid)|with|e(?:num|xport)|i(?:mplements|nterface)|let|p(?:ackage|r(?:ivate|otected)|ublic)|static|yield|__(?:hasProp|extends|slice|bind|indexOf))"+b},{token:"language.support.class",regex:"(?:Array|Boolean|Date|Function|Number|Object|R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|TypeError|URIError)"+b},{token:"language.support.function",regex:"(?:Math|JSON|is(?:NaN|Finite)|parse(?:Int|Float)|encodeURI(?:Component)?|decodeURI(?:Component)?)"+b},{token:"identifier",regex:a},{token:"constant.numeric",regex:"(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)"},{token:"string",regex:"'''",next:"qdoc"},{token:"string",regex:'"""',next:"qqdoc"},{token:"string",regex:"'",next:"qstring"},{token:"string",regex:'"',next:"qqstring"},{token:"string",regex:"`",next:"js"},{token:"string.regex",regex:"///",next:"heregex"},{token:"string.regex",regex:"/(?!\\s)[^[/\\n\\\\]*(?: (?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[/\\n\\\\]*)*/[imgy]{0,4}(?!\\w)"},{token:"comment",regex:"###(?!#)",next:"comment"},{token:"comment",regex:"#.*"},{token:"lparen",regex:"[({[]"},{token:"rparen",regex:"[\\]})]"},{token:"keyword.operator",regex:"\\S+"},{token:"text",regex:"\\s+"}],qdoc:[{token:"string",regex:".*?'''",next:"start"},c],qqdoc:[{token:"string",regex:'.*?"""',next:"start"},c],qstring:[{token:"string",regex:"[^\\\\']*(?:\\\\.[^\\\\']*)*'",next:"start"},c],qqstring:[{token:"string",regex:'[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',next:"start"},c],js:[{token:"string",regex:"[^\\\\`]*(?:\\\\.[^\\\\`]*)*`",next:"start"},c],heregex:[{token:"string.regex",regex:".*?///[imgy]{0,4}",next:"start"},{token:"comment.regex",regex:"\\s+(?:#.*)?"},{token:"string.regex",regex:"\\S+"}],comment:[{token:"comment",regex:".*?###",next:"start"},{token:"comment",regex:".+"}]}}a("pilot/oop").inherits(d,a("ace/mode/text_highlight_rules").TextHighlightRules),b.CoffeeHighlightRules=d})
|
||||
1
build/textarea/src/mode-css.js
Normal file
1
build/textarea/src/mode-css.js
Normal file
File diff suppressed because one or more lines are too long
1
build/textarea/src/mode-html.js
Normal file
1
build/textarea/src/mode-html.js
Normal file
File diff suppressed because one or more lines are too long
1
build/textarea/src/mode-java.js
Normal file
1
build/textarea/src/mode-java.js
Normal file
File diff suppressed because one or more lines are too long
1
build/textarea/src/mode-javascript.js
Normal file
1
build/textarea/src/mode-javascript.js
Normal file
File diff suppressed because one or more lines are too long
1
build/textarea/src/mode-perl.js
Normal file
1
build/textarea/src/mode-perl.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/mode/perl",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/perl_highlight_rules").PerlHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[\:]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),__ace_shadowed__.define("ace/mode/perl_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars".split("|")),b=e.arrayToMap("ARGV|ENV|INC|SIG".split("|")),c=e.arrayToMap("getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|getpeername|setpriority|getprotoent|setprotoent|getpriority|endprotoent|getservent|setservent|endservent|sethostent|socketpair|getsockopt|gethostent|endhostent|setsockopt|setnetent|quotemeta|localtime|prototype|getnetent|endnetent|rewinddir|wantarray|getpwuid|closedir|getlogin|readlink|endgrent|getgrgid|getgrnam|shmwrite|shutdown|readline|endpwent|setgrent|readpipe|formline|truncate|dbmclose|syswrite|setpwent|getpwnam|getgrent|getpwent|ucfirst|sysread|setpgrp|shmread|sysseek|sysopen|telldir|defined|opendir|connect|lcfirst|getppid|binmode|syscall|sprintf|getpgrp|readdir|seekdir|waitpid|reverse|unshift|symlink|dbmopen|semget|msgrcv|rename|listen|chroot|msgsnd|shmctl|accept|unpack|exists|fileno|shmget|system|unlink|printf|gmtime|msgctl|semctl|values|rindex|substr|splice|length|msgget|select|socket|return|caller|delete|alarm|ioctl|index|undef|lstat|times|srand|chown|fcntl|close|write|umask|rmdir|study|sleep|chomp|untie|print|utime|mkdir|atan2|split|crypt|flock|chmod|BEGIN|bless|chdir|semop|shift|reset|link|stat|chop|grep|fork|dump|join|open|tell|pipe|exit|glob|warn|each|bind|sort|pack|eval|push|keys|getc|kill|seek|sqrt|send|wait|rand|tied|read|time|exec|recv|eof|chr|int|ord|exp|pos|pop|sin|log|abs|oct|hex|tie|cos|vec|END|ref|map|die|uc|lc|do".split("|"));this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string.regexp",regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:'["].*\\\\$',next:"qqstring"},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"string",regex:"['].*\\\\$",next:"qstring"},{token:"constant.numeric",regex:"0x[0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:function(d){return a.hasOwnProperty(d)?"keyword":b.hasOwnProperty(d)?"constant.language":c.hasOwnProperty(d)?"support.function":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\.\\.\\.|\\|\\|=|>>=|<<=|<=>|&&=|=>|!~|\\^=|&=|\\|=|\\.=|x=|%=|\\/=|\\*=|\\-=|\\+=|=~|\\*\\*|\\-\\-|\\.\\.|\\|\\||&&|\\+\\+|\\->|!=|==|>=|<=|>>|<<|,|=|\\?\\:|\\^|\\||x|%|\\/|\\*|<|&|\\\\|~|!|>|\\.|\\-|\\+|\\-C|\\-b|\\-S|\\-u|\\-t|\\-p|\\-l|\\-d|\\-f|\\-g|\\-s|\\-z|\\-k|\\-e|\\-O|\\-T|\\-B|\\-M|\\-A|\\-X|\\-W|\\-c|\\-R|\\-o|\\-x|\\-w|\\-r|\\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:(?:\\\\.)|(?:[^"\\\\]))*?"',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:(?:\\\\.)|(?:[^'\\\\]))*?'",next:"start"},{token:"string",regex:".+"}]}};d.inherits(g,f),b.PerlHighlightRules=g})
|
||||
1
build/textarea/src/mode-php.js
Normal file
1
build/textarea/src/mode-php.js
Normal file
File diff suppressed because one or more lines are too long
1
build/textarea/src/mode-python.js
Normal file
1
build/textarea/src/mode-python.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/mode/python",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/python_highlight_rules").PythonHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[\:]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),__ace_shadowed__.define("ace/mode/python_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield".split("|")),b=e.arrayToMap("True|False|None|NotImplemented|Ellipsis|__debug__".split("|")),c=e.arrayToMap("abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern".split("|")),d=e.arrayToMap("".split("|")),f="(?:r|u|ur|R|U|UR|Ur|uR)?",g="(?:(?:[1-9]\\d*)|(?:0))",h="(?:0[oO]?[0-7]+)",i="(?:0[xX][\\dA-Fa-f]+)",j="(?:0[bB][01]+)",k="(?:"+g+"|"+h+"|"+i+"|"+j+")",l="(?:[eE][+-]?\\d+)",m="(?:\\.\\d+)",n="(?:\\d+)",o="(?:(?:"+n+"?"+m+")|(?:"+n+"\\.))",p="(?:(?:"+o+"|"+n+")"+l+")",q="(?:"+p+"|"+o+")";this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"string",regex:f+'"{3}(?:[^\\\\]|\\\\.)*?"{3}'},{token:"string",regex:f+'"{3}.*$',next:"qqstring"},{token:"string",regex:f+'"(?:[^\\\\]|\\\\.)*?"'},{token:"string",regex:f+"'{3}(?:[^\\\\]|\\\\.)*?'{3}"},{token:"string",regex:f+"'{3}.*$",next:"qstring"},{token:"string",regex:f+"'(?:[^\\\\]|\\\\.)*?'"},{token:"constant.numeric",regex:"(?:"+q+"|\\d+)[jJ]\\b"},{token:"constant.numeric",regex:q},{token:"constant.numeric",regex:k+"[lL]\\b"},{token:"constant.numeric",regex:k+"\\b"},{token:function(e){return a.hasOwnProperty(e)?"keyword":b.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"invalid.illegal":c.hasOwnProperty(e)?"support.function":e=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="},{token:"lparen",regex:"[\\[\\(\\{]"},{token:"rparen",regex:"[\\]\\)\\}]"},{token:"text",regex:"\\s+"}],qqstring:[{token:"string",regex:'(?:[^\\\\]|\\\\.)*?"{3}',next:"start"},{token:"string",regex:".+"}],qstring:[{token:"string",regex:"(?:[^\\\\]|\\\\.)*?'{3}",next:"start"},{token:"string",regex:".+"}]}};d.inherits(g,f),b.PythonHighlightRules=g})
|
||||
1
build/textarea/src/mode-ruby.js
Normal file
1
build/textarea/src/mode-ruby.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/mode/ruby",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/ruby_highlight_rules").RubyHighlightRules,h=a("ace/mode/matching_brace_outdent").MatchingBraceOutdent,i=a("ace/range").Range,j=function(){this.$tokenizer=new f((new g).getRules()),this.$outdent=new h};d.inherits(j,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)#/;for(var h=c;h<=d;h++)if(!g.test(b.getLine(h))){e=!1;break}if(e){var j=new i(0,0,0,0);for(var h=c;h<=d;h++){var k=b.getLine(h),l=k.match(g);j.start.row=h,j.end.row=h,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"#")},this.getNextLineIndent=function(a,b,c){var d=this.$getIndent(b),e=this.$tokenizer.getLineTokens(b,a),f=e.tokens,g=e.state;if(f.length&&f[f.length-1].type=="comment")return d;if(a=="start"){var h=b.match(/^.*[\{\(\[]\s*$/);h&&(d+=c)}return d},this.checkOutdent=function(a,b,c){return this.$outdent.checkOutdent(b,c)},this.autoOutdent=function(a,b,c){this.$outdent.autoOutdent(b,c)}}.call(j.prototype),b.Mode=j}),__ace_shadowed__.define("ace/mode/ruby_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("pilot/lang"),f=a("ace/mode/text_highlight_rules").TextHighlightRules,g=function(){var a=e.arrayToMap("abort|Array|at_exit|autoload|binding|block_given?|callcc|caller|catch|chomp|chomp!|chop|chop!|eval|exec|exit|exit!fail|Float|fork|format|gets|global_variables|gsub|gsub!|Integer|lambda|load|local_variables|loop|open|p|print|printf|proc|putc|puts|raise|rand|readline|readlines|require|scan|select|set_trace_func|sleep|split|sprintf|srand|String|syscall|system|sub|sub!|test|throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan".split("|")),b=e.arrayToMap("alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|__FILE__|finally|for|if|in|__LINE__|module|next|not|or|redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield".split("|")),c=e.arrayToMap("true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING".split("|")),d=e.arrayToMap("$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE".split("|"));this.$rules={start:[{token:"comment",regex:"#.*$"},{token:"comment",regex:"^=begin$",next:"comment"},{token:"string.regexp",regex:"[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)"},{token:"string",regex:'["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'},{token:"string",regex:"['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"},{token:"constant.numeric",regex:"0[xX][0-9a-fA-F]+\\b"},{token:"constant.numeric",regex:"[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"},{token:"constant.language.boolean",regex:"(?:true|false)\\b"},{token:function(e){return e=="self"?"variable.language":b.hasOwnProperty(e)?"keyword":c.hasOwnProperty(e)?"constant.language":d.hasOwnProperty(e)?"variable.language":a.hasOwnProperty(e)?"support.function":e=="debugger"?"invalid.deprecated":"identifier"},regex:"[a-zA-Z_$][a-zA-Z0-9_$]*\\b"},{token:"keyword.operator",regex:"!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"text",regex:"\\s+"}],comment:[{token:"comment",regex:"^=end$",next:"start"},{token:"comment",regex:".+"}]}};d.inherits(g,f),b.RubyHighlightRules=g})
|
||||
1
build/textarea/src/mode-xml.js
Normal file
1
build/textarea/src/mode-xml.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/mode/xml",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/xml_highlight_rules").XmlHighlightRules,h=function(){this.$tokenizer=new f((new g).getRules())};d.inherits(h,e),function(){this.getNextLineIndent=function(a,b,c){return this.$getIndent(b)}}.call(h.prototype),b.Mode=h}),__ace_shadowed__.define("ace/mode/xml_highlight_rules",function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"text",regex:"<\\!\\[CDATA\\[",next:"cdata"},{token:"xml_pe",regex:"<\\?.*?\\?>"},{token:"comment",regex:"<\\!--",next:"comment"},{token:"text",regex:"<\\/?",next:"tag"},{token:"text",regex:"\\s+"},{token:"text",regex:"[^<]+"}],tag:[{token:"text",regex:">",next:"start"},{token:"keyword",regex:"[-_a-zA-Z0-9:]+"},{token:"text",regex:"\\s+"},{token:"string",regex:'".*?"'},{token:"string",regex:"'.*?'"}],cdata:[{token:"text",regex:"\\]\\]>",next:"start"},{token:"text",regex:"\\s+"},{token:"text",regex:"(?:[^\\]]|\\](?!\\]>))+"}],comment:[{token:"comment",regex:".*?-->",next:"start"},{token:"comment",regex:".+"}]}};d.inherits(f,e),b.XmlHighlightRules=f})
|
||||
1
build/textarea/src/theme-clouds.js
Normal file
1
build/textarea/src/theme-clouds.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/clouds",function(a,b,c){var d=a("pilot/dom"),e=".ace-clouds .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-clouds .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-clouds .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-clouds .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-clouds .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-clouds .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-clouds .ace_scroller {\n background-color: #FFFFFF;\n}\n\n.ace-clouds .ace_text-layer {\n cursor: text;\n color: #000000;\n}\n\n.ace-clouds .ace_cursor {\n border-left: 2px solid #000000;\n}\n\n.ace-clouds .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #000000;\n}\n \n.ace-clouds .ace_marker-layer .ace_selection {\n background: #BDD5FC;\n}\n\n.ace-clouds .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-clouds .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #BFBFBF;\n}\n\n.ace-clouds .ace_marker-layer .ace_active_line {\n background: #FFFBD1;\n}\n\n \n.ace-clouds .ace_invisible {\n color: #BFBFBF;\n}\n\n.ace-clouds .ace_keyword {\n color:#AF956F;\n}\n\n.ace-clouds .ace_keyword.ace_operator {\n color:#484848;\n}\n\n.ace-clouds .ace_constant {\n \n}\n\n.ace-clouds .ace_constant.ace_language {\n color:#39946A;\n}\n\n.ace-clouds .ace_constant.ace_library {\n \n}\n\n.ace-clouds .ace_constant.ace_numeric {\n color:#46A609;\n}\n\n.ace-clouds .ace_invalid {\n background-color:#FF002A;\n}\n\n.ace-clouds .ace_invalid.ace_illegal {\n \n}\n\n.ace-clouds .ace_invalid.ace_deprecated {\n \n}\n\n.ace-clouds .ace_support {\n \n}\n\n.ace-clouds .ace_support.ace_function {\n color:#C52727;\n}\n\n.ace-clouds .ace_function.ace_buildin {\n \n}\n\n.ace-clouds .ace_string {\n color:#5D90CD;\n}\n\n.ace-clouds .ace_string.ace_regexp {\n \n}\n\n.ace-clouds .ace_comment {\n color:#BCC8BA;\n}\n\n.ace-clouds .ace_comment.ace_doc {\n \n}\n\n.ace-clouds .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-clouds .ace_variable {\n \n}\n\n.ace-clouds .ace_variable.ace_language {\n \n}\n\n.ace-clouds .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-clouds"})
|
||||
1
build/textarea/src/theme-clouds_midnight.js
Normal file
1
build/textarea/src/theme-clouds_midnight.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/clouds_midnight",function(a,b,c){var d=a("pilot/dom"),e=".ace-clouds-midnight .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-clouds-midnight .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-clouds-midnight .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-clouds-midnight .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-clouds-midnight .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-clouds-midnight .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-clouds-midnight .ace_scroller {\n background-color: #191919;\n}\n\n.ace-clouds-midnight .ace_text-layer {\n cursor: text;\n color: #929292;\n}\n\n.ace-clouds-midnight .ace_cursor {\n border-left: 2px solid #7DA5DC;\n}\n\n.ace-clouds-midnight .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #7DA5DC;\n}\n \n.ace-clouds-midnight .ace_marker-layer .ace_selection {\n background: #000000;\n}\n\n.ace-clouds-midnight .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-clouds-midnight .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #BFBFBF;\n}\n\n.ace-clouds-midnight .ace_marker-layer .ace_active_line {\n background: rgba(215, 215, 215, 0.031);\n}\n\n \n.ace-clouds-midnight .ace_invisible {\n color: #BFBFBF;\n}\n\n.ace-clouds-midnight .ace_keyword {\n color:#927C5D;\n}\n\n.ace-clouds-midnight .ace_keyword.ace_operator {\n color:#4B4B4B;\n}\n\n.ace-clouds-midnight .ace_constant {\n \n}\n\n.ace-clouds-midnight .ace_constant.ace_language {\n color:#39946A;\n}\n\n.ace-clouds-midnight .ace_constant.ace_library {\n \n}\n\n.ace-clouds-midnight .ace_constant.ace_numeric {\n color:#46A609;\n}\n\n.ace-clouds-midnight .ace_invalid {\n color:#FFFFFF;\nbackground-color:#E92E2E;\n}\n\n.ace-clouds-midnight .ace_invalid.ace_illegal {\n \n}\n\n.ace-clouds-midnight .ace_invalid.ace_deprecated {\n \n}\n\n.ace-clouds-midnight .ace_support {\n \n}\n\n.ace-clouds-midnight .ace_support.ace_function {\n color:#E92E2E;\n}\n\n.ace-clouds-midnight .ace_function.ace_buildin {\n \n}\n\n.ace-clouds-midnight .ace_string {\n color:#5D90CD;\n}\n\n.ace-clouds-midnight .ace_string.ace_regexp {\n \n}\n\n.ace-clouds-midnight .ace_comment {\n color:#3C403B;\n}\n\n.ace-clouds-midnight .ace_comment.ace_doc {\n \n}\n\n.ace-clouds-midnight .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-clouds-midnight .ace_variable {\n \n}\n\n.ace-clouds-midnight .ace_variable.ace_language {\n \n}\n\n.ace-clouds-midnight .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-clouds-midnight"})
|
||||
1
build/textarea/src/theme-cobalt.js
Normal file
1
build/textarea/src/theme-cobalt.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/cobalt",function(a,b,c){var d=a("pilot/dom"),e=".ace-cobalt .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-cobalt .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-cobalt .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-cobalt .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-cobalt .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-cobalt .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-cobalt .ace_scroller {\n background-color: #002240;\n}\n\n.ace-cobalt .ace_text-layer {\n cursor: text;\n color: #FFFFFF;\n}\n\n.ace-cobalt .ace_cursor {\n border-left: 2px solid #FFFFFF;\n}\n\n.ace-cobalt .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FFFFFF;\n}\n \n.ace-cobalt .ace_marker-layer .ace_selection {\n background: rgba(179, 101, 57, 0.75);\n}\n\n.ace-cobalt .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-cobalt .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 255, 255, 0.15);\n}\n\n.ace-cobalt .ace_marker-layer .ace_active_line {\n background: rgba(0, 0, 0, 0.35);\n}\n\n \n.ace-cobalt .ace_invisible {\n color: rgba(255, 255, 255, 0.15);\n}\n\n.ace-cobalt .ace_keyword {\n color:#FF9D00;\n}\n\n.ace-cobalt .ace_keyword.ace_operator {\n \n}\n\n.ace-cobalt .ace_constant {\n color:#FF628C;\n}\n\n.ace-cobalt .ace_constant.ace_language {\n \n}\n\n.ace-cobalt .ace_constant.ace_library {\n \n}\n\n.ace-cobalt .ace_constant.ace_numeric {\n \n}\n\n.ace-cobalt .ace_invalid {\n color:#F8F8F8;\nbackground-color:#800F00;\n}\n\n.ace-cobalt .ace_invalid.ace_illegal {\n \n}\n\n.ace-cobalt .ace_invalid.ace_deprecated {\n \n}\n\n.ace-cobalt .ace_support {\n color:#80FFBB;\n}\n\n.ace-cobalt .ace_support.ace_function {\n color:#FFB054;\n}\n\n.ace-cobalt .ace_function.ace_buildin {\n \n}\n\n.ace-cobalt .ace_string {\n \n}\n\n.ace-cobalt .ace_string.ace_regexp {\n color:#80FFC2;\n}\n\n.ace-cobalt .ace_comment {\n font-style:italic;\ncolor:#0088FF;\n}\n\n.ace-cobalt .ace_comment.ace_doc {\n \n}\n\n.ace-cobalt .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-cobalt .ace_variable {\n color:#CCCCCC;\n}\n\n.ace-cobalt .ace_variable.ace_language {\n color:#FF80E1;\n}\n\n.ace-cobalt .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-cobalt"})
|
||||
1
build/textarea/src/theme-dawn.js
Normal file
1
build/textarea/src/theme-dawn.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/dawn",function(a,b,c){var d=a("pilot/dom"),e=".ace-dawn .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-dawn .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-dawn .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-dawn .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-dawn .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-dawn .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-dawn .ace_scroller {\n background-color: #F9F9F9;\n}\n\n.ace-dawn .ace_text-layer {\n cursor: text;\n color: #080808;\n}\n\n.ace-dawn .ace_cursor {\n border-left: 2px solid #000000;\n}\n\n.ace-dawn .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #000000;\n}\n \n.ace-dawn .ace_marker-layer .ace_selection {\n background: rgba(39, 95, 255, 0.30);\n}\n\n.ace-dawn .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-dawn .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(75, 75, 126, 0.50);\n}\n\n.ace-dawn .ace_marker-layer .ace_active_line {\n background: rgba(36, 99, 180, 0.12);\n}\n\n \n.ace-dawn .ace_invisible {\n color: rgba(75, 75, 126, 0.50);\n}\n\n.ace-dawn .ace_keyword {\n color:#794938;\n}\n\n.ace-dawn .ace_keyword.ace_operator {\n \n}\n\n.ace-dawn .ace_constant {\n color:#811F24;\n}\n\n.ace-dawn .ace_constant.ace_language {\n \n}\n\n.ace-dawn .ace_constant.ace_library {\n \n}\n\n.ace-dawn .ace_constant.ace_numeric {\n \n}\n\n.ace-dawn .ace_invalid {\n \n}\n\n.ace-dawn .ace_invalid.ace_illegal {\n text-decoration:underline;\nfont-style:italic;\ncolor:#F8F8F8;\nbackground-color:#B52A1D;\n}\n\n.ace-dawn .ace_invalid.ace_deprecated {\n text-decoration:underline;\nfont-style:italic;\ncolor:#B52A1D;\n}\n\n.ace-dawn .ace_support {\n color:#691C97;\n}\n\n.ace-dawn .ace_support.ace_function {\n color:#693A17;\n}\n\n.ace-dawn .ace_function.ace_buildin {\n \n}\n\n.ace-dawn .ace_string {\n color:#0B6125;\n}\n\n.ace-dawn .ace_string.ace_regexp {\n color:#CF5628;\n}\n\n.ace-dawn .ace_comment {\n font-style:italic;\ncolor:#5A525F;\n}\n\n.ace-dawn .ace_comment.ace_doc {\n \n}\n\n.ace-dawn .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-dawn .ace_variable {\n color:#234A97;\n}\n\n.ace-dawn .ace_variable.ace_language {\n \n}\n\n.ace-dawn .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-dawn"})
|
||||
1
build/textarea/src/theme-eclipse.js
Normal file
1
build/textarea/src/theme-eclipse.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/eclipse",function(a,b,c){var d=a("pilot/dom"),e=".ace-eclipse .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-eclipse .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-eclipse .ace_gutter {\n width: 50px;\n background: rgb(227, 227, 227);\n border-right: 1px solid rgb(159, 159, 159);\t \n color: rgb(136, 136, 136);\n}\n\n.ace-eclipse .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-eclipse .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-eclipse .ace_text-layer {\n cursor: text;\n}\n\n.ace-eclipse .ace_cursor {\n border-left: 1px solid black;\n}\n\n.ace-eclipse .ace_line .ace_keyword, .ace-eclipse .ace_line .ace_variable {\n color: rgb(127, 0, 85);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_buildin {\n color: rgb(88, 72, 246);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_library {\n color: rgb(6, 150, 14);\n}\n\n.ace-eclipse .ace_line .ace_function {\n color: rgb(60, 76, 114);\n}\n\n.ace-eclipse .ace_line .ace_string {\n color: rgb(42, 0, 255);\n}\n\n.ace-eclipse .ace_line .ace_comment {\n color: rgb(63, 127, 95);\n}\n\n.ace-eclipse .ace_line .ace_comment.ace_doc {\n color: rgb(63, 95, 191);\n}\n\n.ace-eclipse .ace_line .ace_comment.ace_doc.ace_tag {\n color: rgb(127, 159, 191);\n}\n\n.ace-eclipse .ace_line .ace_constant.ace_numeric {\n}\n\n.ace-eclipse .ace_line .ace_tag {\n\tcolor: rgb(63, 127, 127);\n}\n\n.ace-eclipse .ace_line .ace_xml_pe {\n color: rgb(104, 104, 91);\n}\n\n.ace-eclipse .ace_marker-layer .ace_selection {\n background: rgb(181, 213, 255);\n}\n\n.ace-eclipse .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgb(192, 192, 192);\n}\n\n.ace-eclipse .ace_marker-layer .ace_active_line {\n background: rgb(232, 242, 254);\n}";d.importCssString(e),b.cssClass="ace-eclipse"})
|
||||
1
build/textarea/src/theme-idle_fingers.js
Normal file
1
build/textarea/src/theme-idle_fingers.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/idle_fingers",function(a,b,c){var d=a("pilot/dom"),e=".ace-idle-fingers .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-idle-fingers .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-idle-fingers .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-idle-fingers .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-idle-fingers .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-idle-fingers .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-idle-fingers .ace_scroller {\n background-color: #323232;\n}\n\n.ace-idle-fingers .ace_text-layer {\n cursor: text;\n color: #FFFFFF;\n}\n\n.ace-idle-fingers .ace_cursor {\n border-left: 2px solid #91FF00;\n}\n\n.ace-idle-fingers .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #91FF00;\n}\n \n.ace-idle-fingers .ace_marker-layer .ace_selection {\n background: rgba(90, 100, 126, 0.88);\n}\n\n.ace-idle-fingers .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-idle-fingers .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #404040;\n}\n\n.ace-idle-fingers .ace_marker-layer .ace_active_line {\n background: #353637;\n}\n\n \n.ace-idle-fingers .ace_invisible {\n color: #404040;\n}\n\n.ace-idle-fingers .ace_keyword {\n color:#CC7833;\n}\n\n.ace-idle-fingers .ace_keyword.ace_operator {\n \n}\n\n.ace-idle-fingers .ace_constant {\n color:#6C99BB;\n}\n\n.ace-idle-fingers .ace_constant.ace_language {\n \n}\n\n.ace-idle-fingers .ace_constant.ace_library {\n \n}\n\n.ace-idle-fingers .ace_constant.ace_numeric {\n \n}\n\n.ace-idle-fingers .ace_invalid {\n color:#FFFFFF;\nbackground-color:#FF0000;\n}\n\n.ace-idle-fingers .ace_invalid.ace_illegal {\n \n}\n\n.ace-idle-fingers .ace_invalid.ace_deprecated {\n \n}\n\n.ace-idle-fingers .ace_support {\n color:#bc9458;\n}\n\n.ace-idle-fingers .ace_support.ace_function {\n color:#B83426;\n}\n\n.ace-idle-fingers .ace_function.ace_buildin {\n \n}\n\n.ace-idle-fingers .ace_string {\n color:#A5C261;\n}\n\n.ace-idle-fingers .ace_string.ace_regexp {\n color:#CCCC33;\n}\n\n.ace-idle-fingers .ace_comment {\n font-style:italic;\n color:#BC9458;\n}\n\n.ace-idle-fingers .ace_comment.ace_doc {\n \n}\n\n.ace-idle-fingers .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-idle-fingers .ace_variable {\n color:#b7dff8;\n}\n\n.ace-idle-fingers .ace_variable.ace_language {\n color:#b7dff8;\n}\n\n.ace-idle-fingers .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-idle-fingers"})
|
||||
1
build/textarea/src/theme-kr_theme.js
Normal file
1
build/textarea/src/theme-kr_theme.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/kr_theme",function(a,b,c){var d=a("pilot/dom"),e=".ace-kr-theme .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-kr-theme .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-kr-theme .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-kr-theme .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-kr-theme .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-kr-theme .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-kr-theme .ace_scroller {\n background-color: #0B0A09;\n}\n\n.ace-kr-theme .ace_text-layer {\n cursor: text;\n color: #FCFFE0;\n}\n\n.ace-kr-theme .ace_cursor {\n border-left: 2px solid #FF9900;\n}\n\n.ace-kr-theme .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FF9900;\n}\n \n.ace-kr-theme .ace_marker-layer .ace_selection {\n background: rgba(170, 0, 255, 0.45);\n}\n\n.ace-kr-theme .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-kr-theme .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 177, 111, 0.32);\n}\n\n.ace-kr-theme .ace_marker-layer .ace_active_line {\n background: #38403D;\n}\n\n \n.ace-kr-theme .ace_invisible {\n color: rgba(255, 177, 111, 0.32);\n}\n\n.ace-kr-theme .ace_keyword {\n color:#949C8B;\n}\n\n.ace-kr-theme .ace_keyword.ace_operator {\n \n}\n\n.ace-kr-theme .ace_constant {\n color:rgba(210, 117, 24, 0.76);\n}\n\n.ace-kr-theme .ace_constant.ace_language {\n \n}\n\n.ace-kr-theme .ace_constant.ace_library {\n \n}\n\n.ace-kr-theme .ace_constant.ace_numeric {\n \n}\n\n.ace-kr-theme .ace_invalid {\n color:#F8F8F8;\nbackground-color:#A41300;\n}\n\n.ace-kr-theme .ace_invalid.ace_illegal {\n \n}\n\n.ace-kr-theme .ace_invalid.ace_deprecated {\n \n}\n\n.ace-kr-theme .ace_support {\n color:#9FC28A;\n}\n\n.ace-kr-theme .ace_support.ace_function {\n color:#85873A;\n}\n\n.ace-kr-theme .ace_function.ace_buildin {\n \n}\n\n.ace-kr-theme .ace_string {\n \n}\n\n.ace-kr-theme .ace_string.ace_regexp {\n color:rgba(125, 255, 192, 0.65);\n}\n\n.ace-kr-theme .ace_comment {\n font-style:italic;\ncolor:#706D5B;\n}\n\n.ace-kr-theme .ace_comment.ace_doc {\n \n}\n\n.ace-kr-theme .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-kr-theme .ace_variable {\n color:#D1A796;\n}\n\n.ace-kr-theme .ace_variable.ace_language {\n color:#FF80E1;\n}\n\n.ace-kr-theme .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-kr-theme"})
|
||||
1
build/textarea/src/theme-mono_industrial.js
Normal file
1
build/textarea/src/theme-mono_industrial.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/mono_industrial",function(a,b,c){var d=a("pilot/dom"),e=".ace-mono-industrial .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-mono-industrial .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-mono-industrial .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-mono-industrial .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-mono-industrial .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-mono-industrial .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-mono-industrial .ace_scroller {\n background-color: #222C28;\n}\n\n.ace-mono-industrial .ace_text-layer {\n cursor: text;\n color: #FFFFFF;\n}\n\n.ace-mono-industrial .ace_cursor {\n border-left: 2px solid #FFFFFF;\n}\n\n.ace-mono-industrial .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #FFFFFF;\n}\n \n.ace-mono-industrial .ace_marker-layer .ace_selection {\n background: rgba(145, 153, 148, 0.40);\n}\n\n.ace-mono-industrial .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-mono-industrial .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(102, 108, 104, 0.50);\n}\n\n.ace-mono-industrial .ace_marker-layer .ace_active_line {\n background: rgba(12, 13, 12, 0.25);\n}\n\n \n.ace-mono-industrial .ace_invisible {\n color: rgba(102, 108, 104, 0.50);\n}\n\n.ace-mono-industrial .ace_keyword {\n color:#A39E64;\n}\n\n.ace-mono-industrial .ace_keyword.ace_operator {\n color:#A8B3AB;\n}\n\n.ace-mono-industrial .ace_constant {\n color:#E98800;\n}\n\n.ace-mono-industrial .ace_constant.ace_language {\n \n}\n\n.ace-mono-industrial .ace_constant.ace_library {\n \n}\n\n.ace-mono-industrial .ace_constant.ace_numeric {\n color:#E98800;\n}\n\n.ace-mono-industrial .ace_invalid {\n color:#FFFFFF;\nbackground-color:rgba(153, 0, 0, 0.68);\n}\n\n.ace-mono-industrial .ace_invalid.ace_illegal {\n \n}\n\n.ace-mono-industrial .ace_invalid.ace_deprecated {\n \n}\n\n.ace-mono-industrial .ace_support {\n \n}\n\n.ace-mono-industrial .ace_support.ace_function {\n color:#588E60;\n}\n\n.ace-mono-industrial .ace_function.ace_buildin {\n \n}\n\n.ace-mono-industrial .ace_string {\n \n}\n\n.ace-mono-industrial .ace_string.ace_regexp {\n \n}\n\n.ace-mono-industrial .ace_comment {\n color:#666C68;\nbackground-color:#151C19;\n}\n\n.ace-mono-industrial .ace_comment.ace_doc {\n \n}\n\n.ace-mono-industrial .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-mono-industrial .ace_variable {\n \n}\n\n.ace-mono-industrial .ace_variable.ace_language {\n color:#648BD2;\n}\n\n.ace-mono-industrial .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-mono-industrial"})
|
||||
1
build/textarea/src/theme-monokai.js
Normal file
1
build/textarea/src/theme-monokai.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/monokai",function(a,b,c){var d=a("pilot/dom"),e=".ace-monokai .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-monokai .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-monokai .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-monokai .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-monokai .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-monokai .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-monokai .ace_scroller {\n background-color: #272822;\n}\n\n.ace-monokai .ace_text-layer {\n cursor: text;\n color: #F8F8F2;\n}\n\n.ace-monokai .ace_cursor {\n border-left: 2px solid #F8F8F0;\n}\n\n.ace-monokai .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #F8F8F0;\n}\n \n.ace-monokai .ace_marker-layer .ace_selection {\n background: #49483E;\n}\n\n.ace-monokai .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-monokai .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid #49483E;\n}\n\n.ace-monokai .ace_marker-layer .ace_active_line {\n background: #49483E;\n}\n\n \n.ace-monokai .ace_invisible {\n color: #49483E;\n}\n\n.ace-monokai .ace_keyword {\n color:#F92672;\n}\n\n.ace-monokai .ace_keyword.ace_operator {\n \n}\n\n.ace-monokai .ace_constant {\n \n}\n\n.ace-monokai .ace_constant.ace_language {\n color:#AE81FF;\n}\n\n.ace-monokai .ace_constant.ace_library {\n \n}\n\n.ace-monokai .ace_constant.ace_numeric {\n color:#AE81FF;\n}\n\n.ace-monokai .ace_invalid {\n color:#F8F8F0;\nbackground-color:#F92672;\n}\n\n.ace-monokai .ace_invalid.ace_illegal {\n \n}\n\n.ace-monokai .ace_invalid.ace_deprecated {\n color:#F8F8F0;\nbackground-color:#AE81FF;\n}\n\n.ace-monokai .ace_support {\n \n}\n\n.ace-monokai .ace_support.ace_function {\n color:#66D9EF;\n}\n\n.ace-monokai .ace_function.ace_buildin {\n \n}\n\n.ace-monokai .ace_string {\n color:#E6DB74;\n}\n\n.ace-monokai .ace_string.ace_regexp {\n \n}\n\n.ace-monokai .ace_comment {\n color:#75715E;\n}\n\n.ace-monokai .ace_comment.ace_doc {\n \n}\n\n.ace-monokai .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-monokai .ace_variable {\n \n}\n\n.ace-monokai .ace_variable.ace_language {\n \n}\n\n.ace-monokai .ace_xml_pe {\n \n}";d.importCssString(e),b.cssClass="ace-monokai"})
|
||||
1
build/textarea/src/theme-pastel_on_dark.js
Normal file
1
build/textarea/src/theme-pastel_on_dark.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/pastel_on_dark",function(a,b,c){var d=a("pilot/dom"),e=".ace-pastel-on-dark .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-pastel-on-dark .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-pastel-on-dark .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-pastel-on-dark .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-pastel-on-dark .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-pastel-on-dark .ace_print_margin {\n width: 1px;\n background: #e8e8e8;\n}\n\n.ace-pastel-on-dark .ace_scroller {\n background-color: #2c2828;\n}\n\n.ace-pastel-on-dark .ace_text-layer {\n cursor: text;\n color: #8f938f;\n}\n\n.ace-pastel-on-dark .ace_cursor {\n border-left: 2px solid #A7A7A7;\n}\n\n.ace-pastel-on-dark .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #A7A7A7;\n}\n \n.ace-pastel-on-dark .ace_marker-layer .ace_selection {\n background: rgba(221, 240, 255, 0.20);\n}\n\n.ace-pastel-on-dark .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-pastel-on-dark .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 255, 255, 0.25);\n}\n\n.ace-pastel-on-dark .ace_marker-layer .ace_active_line {\n background: rgba(255, 255, 255, 0.031);\n}\n\n \n.ace-pastel-on-dark .ace_invisible {\n color: rgba(255, 255, 255, 0.25);\n}\n\n.ace-pastel-on-dark .ace_keyword {\n color:#757ad8;\n}\n\n.ace-pastel-on-dark .ace_keyword.ace_operator {\n color:#797878;\n}\n\n.ace-pastel-on-dark .ace_constant {\n color:#4fb7c5;\n}\n\n.ace-pastel-on-dark .ace_constant.ace_language {\n \n}\n\n.ace-pastel-on-dark .ace_constant.ace_library {\n \n}\n\n.ace-pastel-on-dark .ace_constant.ace_numeric {\n \n}\n\n.ace-pastel-on-dark .ace_invalid {\n \n}\n\n.ace-pastel-on-dark .ace_invalid.ace_illegal {\n color:#F8F8F8;\nbackground-color:rgba(86, 45, 86, 0.75);\n}\n\n.ace-pastel-on-dark .ace_invalid.ace_deprecated {\n text-decoration:underline;\nfont-style:italic;\ncolor:#D2A8A1;\n}\n\n.ace-pastel-on-dark .ace_support {\n color:#9a9a9a;\n}\n\n.ace-pastel-on-dark .ace_support.ace_function {\n color:#aeb2f8;\n}\n\n.ace-pastel-on-dark .ace_function.ace_buildin {\n \n}\n\n.ace-pastel-on-dark .ace_string {\n color:#66a968;\n}\n\n.ace-pastel-on-dark .ace_string.ace_regexp {\n color:#E9C062;\n}\n\n.ace-pastel-on-dark .ace_comment {\n color:#656865;\n}\n\n.ace-pastel-on-dark .ace_comment.ace_doc {\n color:A6C6FF;\n}\n\n.ace-pastel-on-dark .ace_comment.ace_doc.ace_tag {\n color:A6C6FF;\n}\n\n.ace-pastel-on-dark .ace_variable {\n color:#bebf55;\n}\n\n.ace-pastel-on-dark .ace_variable.ace_language {\n color:#bebf55;\n}\n\n.ace-pastel-on-dark .ace_xml_pe {\n color:#494949;\n}";d.importCssString(e),b.cssClass="ace-pastel-on-dark"})
|
||||
1
build/textarea/src/theme-twilight.js
Normal file
1
build/textarea/src/theme-twilight.js
Normal file
|
|
@ -0,0 +1 @@
|
|||
__ace_shadowed__.define("ace/theme/twilight",function(a,b,c){var d=a("pilot/dom"),e=".ace-twilight .ace_editor {\n border: 2px solid rgb(159, 159, 159);\n}\n\n.ace-twilight .ace_editor.ace_focus {\n border: 2px solid #327fbd;\n}\n\n.ace-twilight .ace_gutter {\n width: 50px;\n background: #e8e8e8;\n color: #333;\n overflow : hidden;\n}\n\n.ace-twilight .ace_gutter-layer {\n width: 100%;\n text-align: right;\n}\n\n.ace-twilight .ace_gutter-layer .ace_gutter-cell {\n padding-right: 6px;\n}\n\n.ace-twilight .ace_print_margin {\n border-left: 1px solid #3C3C3C;\n width: 100%;\n background: #242424;\n}\n\n.ace-twilight .ace_scroller {\n background-color: #141414;\n}\n\n.ace-twilight .ace_text-layer {\n cursor: text;\n color: #F8F8F8;\n}\n\n.ace-twilight .ace_cursor {\n border-left: 2px solid #A7A7A7;\n}\n\n.ace-twilight .ace_cursor.ace_overwrite {\n border-left: 0px;\n border-bottom: 1px solid #A7A7A7;\n}\n.ace-twilight.normal-mode .ace_cursor.ace_overwrite {\n border: 1px solid #FFE300;\n background: #766B13;\n}\n.ace-twilight.normal-mode .ace_cursor-layer {\n z-index: 0;\n}\n \n.ace-twilight .ace_marker-layer .ace_selection {\n background: rgba(221, 240, 255, 0.20);\n}\n\n.ace-twilight .ace_marker-layer .ace_step {\n background: rgb(198, 219, 174);\n}\n\n.ace-twilight .ace_marker-layer .ace_bracket {\n margin: -1px 0 0 -1px;\n border: 1px solid rgba(255, 255, 255, 0.25);\n}\n\n.ace-twilight .ace_marker-layer .ace_active_line {\n background: rgba(255, 255, 255, 0.031);\n}\n\n \n.ace-twilight .ace_invisible {\n color: rgba(255, 255, 255, 0.25);\n}\n\n.ace-twilight .ace_keyword {\n color:#CDA869;\n}\n\n.ace-twilight .ace_keyword.ace_operator {\n \n}\n\n.ace-twilight .ace_constant {\n color:#CF6A4C;\n}\n\n.ace-twilight .ace_constant.ace_language {\n \n}\n\n.ace-twilight .ace_constant.ace_library {\n \n}\n\n.ace-twilight .ace_constant.ace_numeric {\n \n}\n\n.ace-twilight .ace_invalid {\n \n}\n\n.ace-twilight .ace_invalid.ace_illegal {\n color:#F8F8F8;\nbackground-color:rgba(86, 45, 86, 0.75);\n}\n\n.ace-twilight .ace_invalid.ace_deprecated {\n text-decoration:underline;\nfont-style:italic;\ncolor:#D2A8A1;\n}\n\n.ace-twilight .ace_support {\n color:#9B859D;\n}\n\n.ace-twilight .ace_support.ace_function {\n color:#DAD085;\n}\n\n.ace-twilight .ace_function.ace_buildin {\n \n}\n\n.ace-twilight .ace_string {\n color:#8F9D6A;\n}\n\n.ace-twilight .ace_string.ace_regexp {\n color:#E9C062;\n}\n\n.ace-twilight .ace_comment {\n font-style:italic;\ncolor:#5F5A60;\n}\n\n.ace-twilight .ace_comment.ace_doc {\n \n}\n\n.ace-twilight .ace_comment.ace_doc.ace_tag {\n \n}\n\n.ace-twilight .ace_variable {\n color:#7587A6;\n}\n\n.ace-twilight .ace_variable.ace_language {\n \n}\n\n.ace-twilight .ace_xml_pe {\n color:#494949;\n}";d.importCssString(e),b.cssClass="ace-twilight"})
|
||||
|
|
@ -35,40 +35,57 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var deps = [ "pilot/plugin_manager", "pilot/environment" ];
|
||||
var deps = [
|
||||
"pilot/fixoldbrowsers",
|
||||
"pilot/index",
|
||||
"pilot/plugin_manager",
|
||||
"pilot/environment",
|
||||
"ace/editor",
|
||||
"ace/edit_session",
|
||||
"ace/virtual_renderer",
|
||||
"ace/undomanager",
|
||||
"ace/theme/textmate"
|
||||
];
|
||||
|
||||
require(deps, function() {
|
||||
var catalog = require("pilot/plugin_manager").catalog;
|
||||
catalog.registerPlugins([ "pilot/index" ]);
|
||||
});
|
||||
|
||||
var ace = {
|
||||
edit: function(el) {
|
||||
if (typeof(el) == "string") {
|
||||
el = document.getElementById(el);
|
||||
}
|
||||
var env = require("pilot/environment").create();
|
||||
var catalog = require("pilot/plugin_manager").catalog;
|
||||
catalog.startupPlugins({ env: env }).then(function() {
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
var UndoManager = require("ace/undomanager").UndoManager;
|
||||
var Editor = require("ace/editor").Editor;
|
||||
var Renderer = require("ace/virtual_renderer").VirtualRenderer;
|
||||
var theme = require("ace/theme/textmate");
|
||||
var Dom = require("pilot/dom");
|
||||
var Event = require("pilot/event");
|
||||
|
||||
var doc = new EditSession(el.innerHTML);
|
||||
el.innerHTML = '';
|
||||
doc.setMode(new JavaScriptMode());
|
||||
var Editor = require("ace/editor").Editor;
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var UndoManager = require("ace/undomanager").UndoManager;
|
||||
var Renderer = require("ace/virtual_renderer").VirtualRenderer;
|
||||
|
||||
window.ace = {
|
||||
edit: function(el) {
|
||||
if (typeof(el) == "string") {
|
||||
el = document.getElementById(el);
|
||||
}
|
||||
|
||||
var doc = new EditSession(Dom.getInnerText(el));
|
||||
doc.setUndoManager(new UndoManager());
|
||||
env.document = doc;
|
||||
env.editor = new Editor(new Renderer(el, theme));
|
||||
env.editor.setSession(doc);
|
||||
env.editor.resize();
|
||||
window.addEventListener("resize", function() {
|
||||
env.editor.resize();
|
||||
}, false);
|
||||
el.env = env;
|
||||
});
|
||||
}
|
||||
};
|
||||
el.innerHTML = '';
|
||||
|
||||
var editor = new Editor(new Renderer(el, "ace/theme/textmate"));
|
||||
editor.setSession(doc);
|
||||
|
||||
var env = require("pilot/environment").create();
|
||||
catalog.startupPlugins({ env: env }).then(function() {
|
||||
env.document = doc;
|
||||
env.editor = editor;
|
||||
editor.resize();
|
||||
Event.addListener(window, "resize", function() {
|
||||
editor.resize();
|
||||
});
|
||||
el.env = env;
|
||||
});
|
||||
// Store env on editor such that it can be accessed later on from
|
||||
// the returned object.
|
||||
editor.env = env;
|
||||
return editor;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
|
|
|||
525
build_support/boot_textarea.js
Normal file
525
build_support/boot_textarea.js
Normal file
|
|
@ -0,0 +1,525 @@
|
|||
/* ***** 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
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Skywriter.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Kevin Dangoor (kdangoor@mozilla.com)
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
(function() {
|
||||
|
||||
var require = window.__ace_shadowed__.require;
|
||||
var deps = [
|
||||
"pilot/fixoldbrowsers",
|
||||
"pilot/index",
|
||||
"pilot/plugin_manager",
|
||||
"pilot/environment",
|
||||
"ace/editor",
|
||||
"ace/edit_session",
|
||||
"ace/virtual_renderer",
|
||||
"ace/undomanager",
|
||||
"ace/theme/textmate"
|
||||
];
|
||||
|
||||
require(deps, function() {
|
||||
|
||||
var catalog = require("pilot/plugin_manager").catalog;
|
||||
catalog.registerPlugins([ "pilot/index" ]);
|
||||
|
||||
var Dom = require("pilot/dom");
|
||||
var Event = require("pilot/event");
|
||||
var UA = require("pilot/useragent")
|
||||
|
||||
var Editor = require("ace/editor").Editor;
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var UndoManager = require("ace/undomanager").UndoManager;
|
||||
var Renderer = require("ace/virtual_renderer").VirtualRenderer;
|
||||
|
||||
window.__ace_shadowed__.edit = function(el) {
|
||||
if (typeof(el) == "string") {
|
||||
el = document.getElementById(el);
|
||||
}
|
||||
|
||||
var doc = new EditSession(Dom.getInnerText(el));
|
||||
doc.setUndoManager(new UndoManager());
|
||||
el.innerHTML = '';
|
||||
|
||||
var editor = new Editor(new Renderer(el, "ace/theme/textmate"));
|
||||
editor.setSession(doc);
|
||||
|
||||
var env = require("pilot/environment").create();
|
||||
catalog.startupPlugins({ env: env }).then(function() {
|
||||
env.document = doc;
|
||||
env.editor = env;
|
||||
editor.resize();
|
||||
Event.addListener(window, "resize", function() {
|
||||
editor.resize();
|
||||
});
|
||||
el.env = env;
|
||||
});
|
||||
return editor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the CSS property of element.
|
||||
* 1) If the CSS property is on the style object of the element, use it, OR
|
||||
* 2) Compute the CSS property
|
||||
*
|
||||
* If the property can't get computed, is 'auto' or 'intrinsic', the former
|
||||
* calculated property is uesd (this can happen in cases where the textarea
|
||||
* is hidden and has no dimension styles).
|
||||
*/
|
||||
var getCSSProperty = function(element, container, property) {
|
||||
var ret = element.style[property];
|
||||
|
||||
if (!ret) {
|
||||
if (window.getComputedStyle) {
|
||||
ret = window.getComputedStyle(element, '').getPropertyValue(property);
|
||||
} else {
|
||||
ret = element.currentStyle[property];
|
||||
}
|
||||
}
|
||||
|
||||
if (!ret || ret == 'auto' || ret == 'intrinsic') {
|
||||
ret = container.style[property];
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
function applyStyles(elm, styles) {
|
||||
for (style in styles) {
|
||||
elm.style[style] = styles[style];
|
||||
}
|
||||
}
|
||||
|
||||
function setupContainer(element, getValue) {
|
||||
if (element.type != 'textarea') {
|
||||
throw "Textarea required!";
|
||||
}
|
||||
|
||||
var parentNode = element.parentNode;
|
||||
|
||||
// This will hold the editor.
|
||||
var container = document.createElement('div');
|
||||
|
||||
// To put Ace in the place of the textarea, we have to copy a few of the
|
||||
// textarea's style attributes to the div container.
|
||||
//
|
||||
// The problem is that the properties have to get computed (they might be
|
||||
// defined by a CSS file on the page - you can't access such rules that
|
||||
// apply to an element via elm.style). Computed properties are converted to
|
||||
// pixels although the dimension might be given as percentage. When the
|
||||
// window resizes, the dimensions defined by percentages changes, so the
|
||||
// properties have to get recomputed to get the new/true pixels.
|
||||
var resizeEvent = function() {
|
||||
var style = 'position:relative;';
|
||||
[
|
||||
'margin-top', 'margin-left', 'margin-right', 'margin-bottom'
|
||||
].forEach(function(item) {
|
||||
style += item + ':' +
|
||||
getCSSProperty(element, container, item) + ';';
|
||||
});
|
||||
|
||||
// Calculating the width/height of the textarea is somewhat tricky. To
|
||||
// do it right, you have to include the paddings to the sides as well
|
||||
// (eg. width = width + padding-left, -right). This works well, as
|
||||
// long as the width of the element is not set or given in pixels. In
|
||||
// this case and after the textarea is hidden, getCSSProperty(element,
|
||||
// container, 'width') will still return pixel value. If the element
|
||||
// has realtiv dimensions (e.g. width='95<percent>')
|
||||
// getCSSProperty(...) will return pixel values only as long as the
|
||||
// textarea is visible. After it is hidden getCSSProperty will return
|
||||
// the relative dimensions as they are set on the element (in the case
|
||||
// of width, 95<percent>).
|
||||
// Making the sum of pixel vaules (e.g. padding) and realtive values
|
||||
// (e.g. <percent>) is not possible. As such the padding styles are
|
||||
// ignored.
|
||||
|
||||
// The complete width is the width of the textarea + the padding
|
||||
// to the left and right.
|
||||
var width = getCSSProperty(element, container, 'width') || (element.clientWidth + "px");
|
||||
var height = getCSSProperty(element, container, 'height') || (element.clientHeight + "px");
|
||||
style += 'height:' + height + ';width:' + width + ';';
|
||||
|
||||
// Set the display property to 'inline-block'.
|
||||
style += 'display:inline-block;';
|
||||
container.setAttribute('style', style);
|
||||
};
|
||||
Event.addListener(window, 'resize', resizeEvent);
|
||||
|
||||
// Call the resizeEvent once, so that the size of the container is
|
||||
// calculated.
|
||||
resizeEvent();
|
||||
|
||||
// Insert the div container after the element.
|
||||
if (element.nextSibling) {
|
||||
parentNode.insertBefore(container, element.nextSibling);
|
||||
} else {
|
||||
parentNode.appendChild(container);
|
||||
}
|
||||
|
||||
// Override the forms onsubmit function. Set the innerHTML and value
|
||||
// of the textarea before submitting.
|
||||
while (parentNode !== document) {
|
||||
if (parentNode.tagName.toUpperCase() === 'FORM') {
|
||||
var oldSumit = parentNode.onsubmit;
|
||||
// Override the onsubmit function of the form.
|
||||
parentNode.onsubmit = function(evt) {
|
||||
element.value = getValue();
|
||||
element.innerHTML = getValue();
|
||||
// If there is a onsubmit function already, then call
|
||||
// it with the current context and pass the event.
|
||||
if (oldSumit) {
|
||||
oldSumit.call(this, evt);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
parentNode = parentNode.parentNode;
|
||||
}
|
||||
return container;
|
||||
}
|
||||
|
||||
window.__ace_shadowed__.transformTextarea = function(element) {
|
||||
var session;
|
||||
var container = setupContainer(element, function() {
|
||||
return session.getValue();
|
||||
});
|
||||
|
||||
// Hide the element.
|
||||
element.style.display = 'none';
|
||||
container.style.background = 'white';
|
||||
|
||||
//
|
||||
var editorDiv = document.createElement("div");
|
||||
applyStyles(editorDiv, {
|
||||
top: "0px",
|
||||
left: "0px",
|
||||
right: "0px",
|
||||
bottom: "0px",
|
||||
border: "1px solid gray"
|
||||
});
|
||||
container.appendChild(editorDiv);
|
||||
|
||||
var settingOpener = document.createElement("div");
|
||||
applyStyles(settingOpener, {
|
||||
position: "absolute",
|
||||
width: "15px",
|
||||
right: "0px",
|
||||
bottom: "0px",
|
||||
background: "red",
|
||||
cursor: "pointer",
|
||||
textAlign: "center",
|
||||
fontSize: "12px"
|
||||
});
|
||||
settingOpener.innerHTML = "I";
|
||||
|
||||
var settingDiv = document.createElement("div");
|
||||
var settingDivStyles = {
|
||||
top: "0px",
|
||||
left: "0px",
|
||||
right: "0px",
|
||||
bottom: "0px",
|
||||
position: "absolute",
|
||||
padding: "5px",
|
||||
zIndex: 100,
|
||||
color: "white",
|
||||
display: "none",
|
||||
overflow: "auto",
|
||||
fontSize: "14px"
|
||||
};
|
||||
if (!UA.isIE) {
|
||||
settingDivStyles.backgroundColor = "rgba(0, 0, 0, 0.6)";
|
||||
} else {
|
||||
settingDivStyles.backgroundColor = "#333";
|
||||
}
|
||||
|
||||
applyStyles(settingDiv, settingDivStyles);
|
||||
container.appendChild(settingDiv);
|
||||
|
||||
// Power up ace on the textarea:
|
||||
var ace = window.__ace_shadowed__;
|
||||
var require = ace.require;
|
||||
var define = ace.define;
|
||||
var options = {};
|
||||
|
||||
var editor = ace.edit(editorDiv);
|
||||
session = editor.getSession();
|
||||
|
||||
session.setValue(element.value || element.innerHTML);
|
||||
editor.focus();
|
||||
|
||||
// Add the settingPanel opener to the editor's div.
|
||||
editorDiv.appendChild(settingOpener);
|
||||
|
||||
// Create the API.
|
||||
var api = setupApi(editor, editorDiv, settingDiv, ace, options)
|
||||
|
||||
// Create the setting's panel.
|
||||
setupSettingPanel(settingDiv, settingOpener, api, options);
|
||||
|
||||
return api;
|
||||
}
|
||||
|
||||
function setupApi(editor, editorDiv, settingDiv, ace, options) {
|
||||
var session = editor.getSession();
|
||||
var renderer = editor.renderer;
|
||||
|
||||
function toBool(value) {
|
||||
return value == "true";
|
||||
}
|
||||
|
||||
var ret = {
|
||||
setDisplaySettings: function(display) {
|
||||
settingDiv.style.display = display ? "block" : "none";
|
||||
},
|
||||
|
||||
setOption: function(key, value) {
|
||||
if (options[key] == value) return;
|
||||
|
||||
var load = window.__ace_shadowed_load__;
|
||||
|
||||
switch (key) {
|
||||
case "gutter":
|
||||
renderer.setShowGutter(toBool(value));
|
||||
break;
|
||||
|
||||
case "mode":
|
||||
if (value != "text") {
|
||||
// Load the required mode file. Files get loaded only once.
|
||||
load("mode-" + value + ".js", "ace/mode/" + value, function() {
|
||||
var aceMode = require("ace/mode/" + value).Mode;
|
||||
session.setMode(new aceMode());
|
||||
});
|
||||
} else {
|
||||
session.setMode(new (require("ace/mode/text").Mode));
|
||||
}
|
||||
break;
|
||||
|
||||
case "theme":
|
||||
if (value != "textmate") {
|
||||
// Load the required theme file. Files get loaded only once.
|
||||
load("theme-" + value + ".js", "ace/theme/" + value, function() {
|
||||
editor.setTheme("ace/theme/" + value);
|
||||
});
|
||||
} else {
|
||||
editor.setTheme("ace/theme/textmate");
|
||||
}
|
||||
break;
|
||||
|
||||
case "fontSize":
|
||||
editorDiv.style.fontSize = value;
|
||||
break;
|
||||
|
||||
case "softWrap":
|
||||
switch (value) {
|
||||
case "off":
|
||||
session.setUseWrapMode(false);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
case "40":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(40, 40);
|
||||
renderer.setPrintMarginColumn(40);
|
||||
break;
|
||||
case "80":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(80, 80);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
case "free":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(null, null);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case "useSoftTabs":
|
||||
session.setUseSoftTabs(toBool(value));
|
||||
break;
|
||||
|
||||
case "showPrintMargin":
|
||||
renderer.setShowPrintMargin(toBool(value));
|
||||
break
|
||||
}
|
||||
|
||||
options[key] = value;
|
||||
},
|
||||
|
||||
getOption: function(key) {
|
||||
return options[key];
|
||||
},
|
||||
|
||||
getOptions: function() {
|
||||
return options;
|
||||
}
|
||||
}
|
||||
|
||||
for (option in ace.options) {
|
||||
ret.setOption(option, ace.options[option]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
function setupSettingPanel(settingDiv, settingOpener, api, options) {
|
||||
var BOOL = {
|
||||
"true": true,
|
||||
"false": false
|
||||
}
|
||||
|
||||
var desc = {
|
||||
mode: "Mode:",
|
||||
gutter: "Display Gutter:",
|
||||
theme: "Theme:",
|
||||
fontSize: "Font Size:",
|
||||
softWrap: "Soft Wrap:",
|
||||
showPrintMargin: "Show Print Margin:",
|
||||
useSoftTabs: "Use Soft Tabs:"
|
||||
}
|
||||
|
||||
var optionValues = {
|
||||
mode: {
|
||||
text: "Plain",
|
||||
javascript: "JavaScript",
|
||||
coffee: "CoffeeScript",
|
||||
html: "HTML",
|
||||
css: "CSS",
|
||||
c_cpp: "C++",
|
||||
php: "PHP",
|
||||
ruby: "Ruby",
|
||||
python: "Python"
|
||||
|
||||
},
|
||||
theme: {
|
||||
textmate: "Textmate",
|
||||
eclipse: "Eclipse",
|
||||
clouds: "Clouds",
|
||||
clouds_midnight: "Clouds Midnight",
|
||||
cobalt: "Cobalt",
|
||||
dawn: "Dawn",
|
||||
idle_fingers: "Idle Fingers",
|
||||
kr_theme: "Kr Theme",
|
||||
mono_industrial: "Mono Industrial",
|
||||
monokai: "Monokai",
|
||||
pastel_on_dark: "Pastel On Dark",
|
||||
twilight: "Twilight"
|
||||
},
|
||||
gutter: BOOL,
|
||||
fontSize: {
|
||||
"10px": "10px",
|
||||
"11px": "11px",
|
||||
"12px": "12px",
|
||||
"14px": "14px",
|
||||
"16px": "16px"
|
||||
},
|
||||
softWrap: {
|
||||
off: "Off",
|
||||
40: "40",
|
||||
80: "80",
|
||||
free: "Free"
|
||||
},
|
||||
showPrintMargin: BOOL,
|
||||
useSoftTabs: BOOL
|
||||
}
|
||||
|
||||
var table = [];
|
||||
table.push("<table><tr><th>Setting</th><th>Value</th></tr>");
|
||||
|
||||
function renderOption(builder, option, obj, cValue) {
|
||||
builder.push("<select title='" + option + "'>")
|
||||
for (var value in obj) {
|
||||
builder.push("<option value='" + value + "' ");
|
||||
|
||||
if (cValue == value) {
|
||||
builder.push(" selected ");
|
||||
}
|
||||
|
||||
builder.push(">",
|
||||
obj[value],
|
||||
"</option>");
|
||||
}
|
||||
builder.push("</select>")
|
||||
}
|
||||
|
||||
for (var option in options) {
|
||||
table.push("<tr><td>", desc[option], "</td>");
|
||||
table.push("<td>");
|
||||
renderOption(table, option, optionValues[option], options[option]);
|
||||
table.push("</td></tr>");
|
||||
}
|
||||
table.push("</table>");
|
||||
settingDiv.innerHTML = table.join("");
|
||||
|
||||
var selects = settingDiv.getElementsByTagName("select");
|
||||
for (var i = 0; i < selects.length; i++) {
|
||||
var onChange = (function() {
|
||||
var select = selects[i];
|
||||
return function() {
|
||||
var option = select.title;
|
||||
var value = select.value;
|
||||
api.setOption(option, value);
|
||||
}
|
||||
})();
|
||||
selects[i].onchange = onChange;
|
||||
}
|
||||
|
||||
var button = document.createElement("input");
|
||||
button.type = "button";
|
||||
button.value = "Hide";
|
||||
button.onclick = function() {
|
||||
api.setDisplaySettings(false);
|
||||
}
|
||||
settingDiv.appendChild(button);
|
||||
|
||||
settingOpener.onclick = function() {
|
||||
api.setDisplaySettings(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Default startup options.
|
||||
window.__ace_shadowed__.options = {
|
||||
mode: "text",
|
||||
theme: "textmate",
|
||||
gutter: "false",
|
||||
fontSize: "12px",
|
||||
softWrap: "off",
|
||||
showPrintMargin: "false",
|
||||
useSoftTabs: "true"
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
})()
|
||||
|
|
@ -5,23 +5,40 @@
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>Editor</title>
|
||||
<style type="text/css" media="screen">
|
||||
body { overflow: hidden; }
|
||||
#editor { position: absolute; top: 0; bottom: 0; left: 0; right: 0; }
|
||||
body {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#editor {
|
||||
margin: 0;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="editor">function foo(items) {
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
<pre id="editor">function foo(items) {
|
||||
var i;
|
||||
for (i = 0; i < items.length; i++) {
|
||||
alert("Ace Rocks " + items[i]);
|
||||
}
|
||||
}</div>
|
||||
}</pre>
|
||||
|
||||
<script src="ace-uncompressed.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="src/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="src/theme-twilight.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="src/mode-javascript.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
ace.edit("editor");
|
||||
}, false);
|
||||
window.onload = function() {
|
||||
var editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/twilight");
|
||||
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
editor.getSession().setMode(new JavaScriptMode());
|
||||
};
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
|
|
|||
129
build_support/editor_textarea.html
Normal file
129
build_support/editor_textarea.html
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<title>Editor</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Ace Bookmarklet Builder</h1>
|
||||
|
||||
<p>
|
||||
WARNING: Currently, this is only fully supported in non IE browsers.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
How to use it:
|
||||
<ul>
|
||||
<li>Select the options below as you want them to be by default.</li>
|
||||
<li>Enter the "SourceUrl" where you placed the source data which you find under build/textarea/src (you can also leave the default to server the scripts from GitHub).</li>
|
||||
<li>Click the "Build Link" button to generate your custom Ace Bookmarklet.</li>
|
||||
<li>Drag the generated link to your toolbar or store it somewhere else.</li>
|
||||
<li>Go to a page with an textarea element and click the bookmarklet - wait a little bit till the files are loaded.</li>
|
||||
<li>Click 3 times on the textarea you want to replace - Ace will replace it.</li>
|
||||
<li>To change settings, just click the red icon in the bottom right corner.</li>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<textarea id="textarea" style="width:300px; height:300px">
|
||||
function foo() {
|
||||
var bar = true;
|
||||
}
|
||||
</textarea><br>
|
||||
SourceUrl: <input id="srcURL" value="http://ajaxorg.github.com/ace/build/textarea/src/"></input>
|
||||
|
||||
<button id="buBuild">Build Link</button> <br> <a href="#"></a>
|
||||
|
||||
<script>
|
||||
function inject() {
|
||||
var baseUrl = "src/";
|
||||
function load(path, module, callback) {
|
||||
path = baseUrl + path;
|
||||
if (!load.scripts[path]) {
|
||||
load.scripts[path] = {
|
||||
loaded: false,
|
||||
callbacks: [ callback ]
|
||||
};
|
||||
|
||||
var head = document.getElementsByTagName('head')[0];
|
||||
var s = document.createElement('script');
|
||||
|
||||
function c() {
|
||||
if (window.__ace_shadowed__ && window.__ace_shadowed__.define.modules[module]) {
|
||||
load.scripts[path].loaded = true;
|
||||
load.scripts[path].callbacks.forEach(function(callback) {
|
||||
callback();
|
||||
});
|
||||
} else {
|
||||
setTimeout(c, 50);
|
||||
}
|
||||
};
|
||||
s.src = path;
|
||||
head.appendChild(s);
|
||||
|
||||
c();
|
||||
} else if (load.scripts[path].loaded) {
|
||||
callback();
|
||||
} else {
|
||||
load.scripts[path].callbacks.push(callback);
|
||||
}
|
||||
};
|
||||
|
||||
load.scripts = {};
|
||||
window.__ace_shadowed_load__ = load;
|
||||
|
||||
load('ace.js', 'text!ace/css/editor.css', function() {
|
||||
var ace = window.__ace_shadowed__;
|
||||
var Event = ace.require('pilot/event');
|
||||
var areas = document.getElementsByTagName("textarea");
|
||||
for (var i = 0; i < areas.length; i++) {
|
||||
Event.addListener(areas[i], "click", function(e) {
|
||||
if (e.detail == 3) {
|
||||
ace.transformTextarea(e.target);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Call the inject function to load the ace files.
|
||||
inject();
|
||||
|
||||
var textAce;
|
||||
function initAce() {
|
||||
var ace = window.__ace_shadowed__;
|
||||
// Check if the ace.js file was loaded already, otherwise check back later.
|
||||
if (ace && ace.transformTextarea) {
|
||||
var t = document.querySelector("textarea");
|
||||
textAce = ace.transformTextarea(t);
|
||||
textAce.setDisplaySettings(true);
|
||||
} else {
|
||||
setTimeout(initAce, 100);
|
||||
}
|
||||
}
|
||||
|
||||
// Transform the textarea on the page into an ace editor.
|
||||
initAce();
|
||||
|
||||
document.getElementById("buBuild").onclick = function() {
|
||||
var injectSrc = inject.toString().split("\n").join("");
|
||||
injectSrc = injectSrc.replace('baseUrl = "src/"', 'baseUrl="' + document.getElementById("srcURL").value + '"');
|
||||
|
||||
var aceOptions = textAce.getOptions();
|
||||
var opt = [];
|
||||
for (var option in aceOptions) {
|
||||
opt.push(option + ":'" + aceOptions[option] + "'");
|
||||
}
|
||||
injectSrc = injectSrc.replace('ace.options.mode = "javascript"', 'ace.options = { ' + opt.join(",") + ' }');
|
||||
injectSrc = injectSrc.replace(/\s+/g, " ");
|
||||
|
||||
var a = document.querySelector("a");
|
||||
a.href = "javascript:(" + injectSrc + ")()";
|
||||
a.innerHTML = "Ace Bookmarklet Link";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -35,53 +35,80 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
(function() {
|
||||
|
||||
|
||||
/**
|
||||
* Define a module along with a payload
|
||||
* @param module a name for the payload
|
||||
* @param payload a function to call with (require, exports, module) params
|
||||
*/
|
||||
function define(module, payload) {
|
||||
var _define = function(module, payload) {
|
||||
if (typeof module !== 'string') {
|
||||
console.error('dropping module because define wasn\'t a string.');
|
||||
console.trace();
|
||||
if (_define.original)
|
||||
_define.original.apply(window, arguments);
|
||||
else {
|
||||
console.error('dropping module because define wasn\'t a string.');
|
||||
console.trace();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!define.modules) {
|
||||
define.modules = {};
|
||||
}
|
||||
|
||||
define.modules[module] = payload;
|
||||
};
|
||||
if (window.define) {
|
||||
_define.original = window.define;
|
||||
}
|
||||
|
||||
window.define = _define;
|
||||
|
||||
|
||||
/**
|
||||
* Get at functionality define()ed using the function above
|
||||
*/
|
||||
function require(module, callback) {
|
||||
if (Array.isArray(module)) {
|
||||
var _require = function(module, callback) {
|
||||
if (Object.prototype.toString.call(module) === "[object Array]") {
|
||||
var params = [];
|
||||
module.forEach(function(m) {
|
||||
params.push(define.lookup(m));
|
||||
}, this);
|
||||
|
||||
for (var i = 0, l = module.length; i < l; ++i) {
|
||||
var dep = lookup(module[i]);
|
||||
if (!dep && _require.original)
|
||||
return _require.original.apply(window, arguments);
|
||||
params.push(dep);
|
||||
};
|
||||
if (callback) {
|
||||
callback.apply(null, params);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof module === 'string') {
|
||||
var payload = define.lookup(module);
|
||||
var payload = lookup(module);
|
||||
if (!payload && _require.original)
|
||||
return _require.original.apply(window, arguments);
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
|
||||
return payload;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
if (window.require) {
|
||||
_require.original = window.require;
|
||||
}
|
||||
|
||||
window.require = _require;
|
||||
require.packaged = true;
|
||||
|
||||
/**
|
||||
* Internal function to lookup moduleNames and resolve them by calling the
|
||||
* definition function if needed.
|
||||
*/
|
||||
define.lookup = function(moduleName) {
|
||||
var lookup = function(moduleName) {
|
||||
var module = define.modules[moduleName];
|
||||
if (module == null) {
|
||||
console.error('Missing module: ' + moduleName);
|
||||
|
|
@ -98,3 +125,6 @@ define.lookup = function(moduleName) {
|
|||
|
||||
return module;
|
||||
};
|
||||
|
||||
|
||||
})();
|
||||
|
|
|
|||
128
build_support/mini_require_textarea.js
Normal file
128
build_support/mini_require_textarea.js
Normal file
|
|
@ -0,0 +1,128 @@
|
|||
/* ***** 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
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Define a module along with a payload
|
||||
* @param module a name for the payload
|
||||
* @param payload a function to call with (require, exports, module) params
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
var _define = function(module, payload) {
|
||||
if (typeof module !== 'string') {
|
||||
if (_define.original)
|
||||
_define.original.apply(window, arguments);
|
||||
else {
|
||||
console.error('dropping module because define wasn\'t a string.');
|
||||
console.trace();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_define.modules)
|
||||
_define.modules = {};
|
||||
|
||||
_define.modules[module] = payload;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get at functionality define()ed using the function above
|
||||
*/
|
||||
var _require = function(module, callback) {
|
||||
if (Object.prototype.toString.call(module) === "[object Array]") {
|
||||
var params = [];
|
||||
for (var i = 0, l = module.length; i < l; ++i) {
|
||||
var dep = lookup(module[i]);
|
||||
if (!dep && _require.original)
|
||||
return _require.original.apply(window, arguments);
|
||||
params.push(dep);
|
||||
};
|
||||
if (callback) {
|
||||
callback.apply(null, params);
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof module === 'string') {
|
||||
var payload = lookup(module);
|
||||
if (!payload && _require.original)
|
||||
return _require.original.apply(window, arguments);
|
||||
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
|
||||
return payload;
|
||||
};
|
||||
}
|
||||
|
||||
_require.packaged = true;
|
||||
_require.noWorker = true;
|
||||
|
||||
/**
|
||||
* Internal function to lookup moduleNames and resolve them by calling the
|
||||
* definition function if needed.
|
||||
*/
|
||||
var lookup = function(moduleName) {
|
||||
var module = _define.modules[moduleName];
|
||||
if (module == null) {
|
||||
console.error('Missing module: ' + moduleName);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (typeof module === 'function') {
|
||||
var exports = {};
|
||||
module(_require, exports, { id: moduleName, uri: '' });
|
||||
// cache the resulting module object for next time
|
||||
_define.modules[moduleName] = exports;
|
||||
return exports;
|
||||
}
|
||||
|
||||
return module;
|
||||
};
|
||||
|
||||
/**
|
||||
* Expose as "shadowed" object to the outside world.
|
||||
*/
|
||||
|
||||
window.__ace_shadowed__ = {
|
||||
require: _require,
|
||||
define: _define
|
||||
};
|
||||
|
||||
})();
|
||||
16
demo/boot.js
16
demo/boot.js
|
|
@ -35,25 +35,25 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
var config = {
|
||||
paths: {
|
||||
require({
|
||||
paths: {
|
||||
demo: "../demo",
|
||||
ace: "../lib/ace",
|
||||
cockpit: "../support/cockpit/lib/cockpit",
|
||||
pilot: "../support/pilot/lib/pilot"
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
var deps = [ "pilot/fixoldbrowsers", "pilot/plugin_manager", "pilot/settings",
|
||||
"pilot/environment", "demo/startup" ];
|
||||
"pilot/environment", "demo/demo" ];
|
||||
|
||||
require(config);
|
||||
var plugins = [ "pilot/index", "cockpit/index", "ace/defaults" ];
|
||||
require(deps, function() {
|
||||
var catalog = require("pilot/plugin_manager").catalog;
|
||||
catalog.registerPlugins([ "pilot/index", "cockpit/index" ]).then(function() {
|
||||
catalog.registerPlugins(plugins).then(function() {
|
||||
var env = require("pilot/environment").create();
|
||||
catalog.startupPlugins({ env: env }).then(function() {
|
||||
require("demo/startup").launch(env);
|
||||
require("demo/demo").launch(env);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -44,14 +44,20 @@ exports.launch = function(env) {
|
|||
var event = require("pilot/event");
|
||||
var Editor = require("ace/editor").Editor;
|
||||
var Renderer = require("ace/virtual_renderer").VirtualRenderer;
|
||||
var theme = require("ace/theme/textmate");
|
||||
var theme = require("ace/theme/textmate");
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
|
||||
var JavaScriptMode = require("ace/mode/javascript").Mode;
|
||||
var CssMode = require("ace/mode/css").Mode;
|
||||
var HtmlMode = require("ace/mode/html").Mode;
|
||||
var XmlMode = require("ace/mode/xml").Mode;
|
||||
var PythonMode = require("ace/mode/python").Mode;
|
||||
var PhpMode = require("ace/mode/php").Mode;
|
||||
var JavaMode = require("ace/mode/java").Mode;
|
||||
var RubyMode = require("ace/mode/ruby").Mode;
|
||||
var CCPPMode = require("ace/mode/c_cpp").Mode;
|
||||
var CoffeeMode = require("ace/mode/coffee").Mode;
|
||||
var PerlMode = require("ace/mode/perl").Mode;
|
||||
var TextMode = require("ace/mode/text").Mode;
|
||||
var UndoManager = require("ace/undomanager").UndoManager;
|
||||
|
||||
|
|
@ -59,8 +65,30 @@ exports.launch = function(env) {
|
|||
var emacs = require("ace/keyboard/keybinding/emacs").Emacs;
|
||||
var HashHandler = require("ace/keyboard/hash_handler").HashHandler;
|
||||
|
||||
var keybindings = {
|
||||
// Null = use "default" keymapping
|
||||
ace: null,
|
||||
vim: vim,
|
||||
emacs: emacs,
|
||||
// This is a way to define simple keyboard remappings
|
||||
custom: new HashHandler({
|
||||
"gotoright": "Tab"
|
||||
})
|
||||
}
|
||||
|
||||
var docs = {};
|
||||
|
||||
// Make the lorem ipsum text a little bit longer.
|
||||
var loreIpsum = document.getElementById("plaintext").innerHTML;
|
||||
for (var i = 0; i < 5; i++) {
|
||||
loreIpsum += loreIpsum;
|
||||
}
|
||||
docs.plain = new EditSession(loreIpsum);
|
||||
docs.plain.setUseWrapMode(true);
|
||||
docs.plain.setWrapLimitRange(80, 80)
|
||||
docs.plain.setMode(new TextMode());
|
||||
docs.plain.setUndoManager(new UndoManager());
|
||||
|
||||
docs.js = new EditSession(document.getElementById("jstext").innerHTML);
|
||||
docs.js.setMode(new JavaScriptMode());
|
||||
docs.js.setUndoManager(new UndoManager());
|
||||
|
|
@ -81,10 +109,29 @@ exports.launch = function(env) {
|
|||
docs.php.setMode(new PhpMode());
|
||||
docs.php.setUndoManager(new UndoManager());
|
||||
|
||||
docs.java = new EditSession(document.getElementById("javatext").innerHTML);
|
||||
docs.java.setMode(new JavaMode());
|
||||
docs.java.setUndoManager(new UndoManager());
|
||||
|
||||
docs.ruby = new EditSession(document.getElementById("rubytext").innerHTML);
|
||||
docs.ruby.setMode(new RubyMode());
|
||||
docs.ruby.setUndoManager(new UndoManager());
|
||||
|
||||
docs.c_cpp = new EditSession(document.getElementById("cpptext").innerHTML);
|
||||
docs.c_cpp.setMode(new CCPPMode());
|
||||
docs.c_cpp.setUndoManager(new UndoManager());
|
||||
|
||||
docs.coffee = new EditSession(document.getElementById("coffeetext").innerHTML);
|
||||
docs.coffee.setMode(new CoffeeMode());
|
||||
docs.coffee.setUndoManager(new UndoManager());
|
||||
|
||||
docs.perl = new EditSession(document.getElementById("perltext").innerHTML);
|
||||
docs.perl.setMode(new PerlMode());
|
||||
docs.perl.setUndoManager(new UndoManager());
|
||||
|
||||
var container = document.getElementById("editor");
|
||||
env.editor = new Editor(new Renderer(container, theme));
|
||||
|
||||
|
||||
var modes = {
|
||||
text: new TextMode(),
|
||||
xml: new XmlMode(),
|
||||
|
|
@ -92,36 +139,25 @@ exports.launch = function(env) {
|
|||
css: new CssMode(),
|
||||
javascript: new JavaScriptMode(),
|
||||
python: new PythonMode(),
|
||||
php: new PhpMode()
|
||||
php: new PhpMode(),
|
||||
java: new JavaMode(),
|
||||
ruby: new RubyMode(),
|
||||
c_cpp: new CCPPMode(),
|
||||
coffee: new CoffeeMode(),
|
||||
perl: new PerlMode()
|
||||
};
|
||||
|
||||
function getMode() {
|
||||
return modes[modeEl.value];
|
||||
}
|
||||
|
||||
|
||||
var modeEl = document.getElementById("mode");
|
||||
function setMode() {
|
||||
env.editor.getSession().setMode(modes[modeEl.value] || modes.text);
|
||||
}
|
||||
modeEl.onchange = setMode;
|
||||
setMode();
|
||||
var wrapModeEl = document.getElementById("soft_wrap");
|
||||
|
||||
// This is how you can set a custom keyboardHandler.
|
||||
//
|
||||
// Define some basic keymapping using a hash:
|
||||
// env.editor.setKeyboardHandler(new HashHandler({
|
||||
// "gotoright": "Tab"
|
||||
// }));
|
||||
//
|
||||
// Use a more complex keymapping:
|
||||
// env.editor.setKeyboardHandler(vim);
|
||||
|
||||
var docEl = document.getElementById("doc");
|
||||
function onDocChange() {
|
||||
var doc = docs[docEl.value];
|
||||
bindDropdown("doc", function(value) {
|
||||
var doc = docs[value];
|
||||
env.editor.setSession(doc);
|
||||
|
||||
|
||||
var mode = doc.getMode();
|
||||
if (mode instanceof JavaScriptMode) {
|
||||
modeEl.value = "javascript";
|
||||
|
|
@ -141,65 +177,124 @@ exports.launch = function(env) {
|
|||
else if (mode instanceof PhpMode) {
|
||||
modeEl.value = "php";
|
||||
}
|
||||
else if (mode instanceof JavaMode) {
|
||||
modeEl.value = "java";
|
||||
}
|
||||
else if (mode instanceof RubyMode) {
|
||||
modeEl.value = "ruby";
|
||||
}
|
||||
else if (mode instanceof CCPPMode) {
|
||||
modeEl.value = "c_cpp";
|
||||
}
|
||||
else if (mode instanceof CoffeeMode) {
|
||||
modeEl.value = "coffee";
|
||||
}
|
||||
else if (mode instanceof PerlMode) {
|
||||
modeEl.value = "perl";
|
||||
}
|
||||
else {
|
||||
modeEl.value = "text";
|
||||
}
|
||||
|
||||
env.editor.focus();
|
||||
}
|
||||
docEl.onchange = onDocChange;
|
||||
onDocChange();
|
||||
|
||||
|
||||
var themeEl = document.getElementById("theme");
|
||||
function setTheme() {
|
||||
env.editor.setTheme(themeEl.value);
|
||||
};
|
||||
themeEl.onchange = setTheme;
|
||||
setTheme();
|
||||
|
||||
|
||||
var selectEl = document.getElementById("select_style");
|
||||
function setSelectionStyle() {
|
||||
if (selectEl.checked) {
|
||||
env.editor.setSelectionStyle("line");
|
||||
if (!doc.getUseWrapMode()) {
|
||||
wrapModeEl.value = "off";
|
||||
} else {
|
||||
env.editor.setSelectionStyle("text");
|
||||
wrapModeEl.value = doc.getWrapLimitRange().min || "free";
|
||||
}
|
||||
};
|
||||
selectEl.onclick = setSelectionStyle;
|
||||
setSelectionStyle();
|
||||
env.editor.focus();
|
||||
});
|
||||
|
||||
bindDropdown("mode", function(value) {
|
||||
env.editor.getSession().setMode(modes[value] || modes.text);
|
||||
});
|
||||
|
||||
var activeEl = document.getElementById("highlight_active");
|
||||
function setHighlightActiveLine() {
|
||||
env.editor.setHighlightActiveLine(!!activeEl.checked);
|
||||
};
|
||||
activeEl.onclick = setHighlightActiveLine;
|
||||
setHighlightActiveLine();
|
||||
bindDropdown("theme", function(value) {
|
||||
env.editor.setTheme(value);
|
||||
});
|
||||
|
||||
bindDropdown("keybinding", function(value) {
|
||||
env.editor.setKeyboardHandler(keybindings[value]);
|
||||
});
|
||||
|
||||
var showHiddenEl = document.getElementById("show_hidden");
|
||||
function setShowInvisibles() {
|
||||
env.editor.setShowInvisibles(!!showHiddenEl.checked);
|
||||
};
|
||||
showHiddenEl.onclick = setShowInvisibles;
|
||||
setShowInvisibles();
|
||||
bindDropdown("fontsize", function(value) {
|
||||
document.getElementById("editor").style.fontSize = value;
|
||||
});
|
||||
|
||||
bindDropdown("soft_wrap", function(value) {
|
||||
var session = env.editor.getSession();
|
||||
var renderer = env.editor.renderer;
|
||||
switch (value) {
|
||||
case "off":
|
||||
session.setUseWrapMode(false);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
case "40":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(40, 40);
|
||||
renderer.setPrintMarginColumn(40);
|
||||
break;
|
||||
case "80":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(80, 80);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
case "free":
|
||||
session.setUseWrapMode(true);
|
||||
session.setWrapLimitRange(null, null);
|
||||
renderer.setPrintMarginColumn(80);
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
// for debugging
|
||||
window.jump = function() {
|
||||
var jump = document.getElementById("jump");
|
||||
var cursor = env.editor.getCursorPosition();
|
||||
var pos = env.editor.renderer.textToScreenCoordinates(cursor.row, cursor.column);
|
||||
jump.style.left = pos.pageX + "px";
|
||||
jump.style.top = pos.pageY + "px";
|
||||
jump.style.display = "block";
|
||||
};
|
||||
bindCheckbox("select_style", function(checked) {
|
||||
env.editor.setSelectionStyle(checked ? "line" : "text");
|
||||
});
|
||||
|
||||
bindCheckbox("highlight_active", function(checked) {
|
||||
env.editor.setHighlightActiveLine(checked);
|
||||
});
|
||||
|
||||
bindCheckbox("show_hidden", function(checked) {
|
||||
env.editor.setShowInvisibles(checked);
|
||||
});
|
||||
|
||||
bindCheckbox("show_gutter", function(checked) {
|
||||
env.editor.renderer.setShowGutter(checked);
|
||||
});
|
||||
|
||||
bindCheckbox("show_print_margin", function(checked) {
|
||||
env.editor.renderer.setShowPrintMargin(checked);
|
||||
});
|
||||
|
||||
bindCheckbox("highlight_selected_word", function(checked) {
|
||||
env.editor.setHighlightSelectedWord(checked);
|
||||
});
|
||||
|
||||
bindCheckbox("show_hscroll", function(checked) {
|
||||
env.editor.renderer.setHScrollBarAlwaysVisible(checked);
|
||||
});
|
||||
|
||||
function bindCheckbox(id, callback) {
|
||||
var el = document.getElementById(id);
|
||||
var onCheck = function() {
|
||||
callback(!!el.checked);
|
||||
};
|
||||
el.onclick = onCheck;
|
||||
onCheck();
|
||||
}
|
||||
|
||||
function bindDropdown(id, callback) {
|
||||
var el = document.getElementById(id);
|
||||
var onChange = function() {
|
||||
callback(el.value);
|
||||
};
|
||||
el.onchange = onChange;
|
||||
onChange();
|
||||
}
|
||||
|
||||
function onResize() {
|
||||
container.style.width = (document.documentElement.clientWidth - 4) + "px";
|
||||
container.style.height = (document.documentElement.clientHeight - 55 - 4 - 23) + "px";
|
||||
container.style.width = (document.documentElement.clientWidth) + "px";
|
||||
container.style.height = (document.documentElement.clientHeight - 60 - 22) + "px";
|
||||
env.editor.resize();
|
||||
};
|
||||
|
||||
|
|
@ -235,6 +330,16 @@ exports.launch = function(env) {
|
|||
mode = "python";
|
||||
} else if (/^.*\.php$/i.test(file.name)) {
|
||||
mode = "php";
|
||||
} else if (/^.*\.java$/i.test(file.name)) {
|
||||
mode = "java";
|
||||
} else if (/^.*\.rb$/i.test(file.name)) {
|
||||
mode = "ruby";
|
||||
} else if (/^.*\.(c|cpp|h|hpp|cxx)$/i.test(file.name)) {
|
||||
mode = "c_cpp";
|
||||
} else if (/^.*\.coffee$/i.test(file.name)) {
|
||||
mode = "coffee";
|
||||
} else if (/^.*\.(pl|pm)$/i.test(file.name)) {
|
||||
mode = "perl";
|
||||
}
|
||||
|
||||
env.editor.onTextInput(reader.result);
|
||||
|
|
@ -247,6 +352,8 @@ exports.launch = function(env) {
|
|||
|
||||
return event.preventDefault(e);
|
||||
});
|
||||
|
||||
window.env = env;
|
||||
};
|
||||
|
||||
});
|
||||
1
demo/icons/Readme.txt
Normal file
1
demo/icons/Readme.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
The icons in this folder are from the Eclipse project and licensed under the Eclipse public license version 1.0 (EPL).
|
||||
260
demo/icons/epl.html
Normal file
260
demo/icons/epl.html
Normal file
|
|
@ -0,0 +1,260 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<!-- saved from url=(0049)http://www.eclipse.org/org/documents/epl-v10.html -->
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
<title>Eclipse Public License - Version 1.0</title>
|
||||
<style type="text/css">
|
||||
body {
|
||||
size: 8.5in 11.0in;
|
||||
margin: 0.25in 0.5in 0.25in 0.5in;
|
||||
tab-interval: 0.5in;
|
||||
}
|
||||
p {
|
||||
margin-left: auto;
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
p.list {
|
||||
margin-left: 0.5in;
|
||||
margin-top: 0.05em;
|
||||
margin-bottom: 0.05em;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="chrome-extension://jgghnecdoiloelcogfmgjgcacadpaejf/inject.js"></script></head>
|
||||
|
||||
<body lang="EN-US">
|
||||
|
||||
<h2>Eclipse Public License - v 1.0</h2>
|
||||
|
||||
<p>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
|
||||
PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
|
||||
DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS
|
||||
AGREEMENT.</p>
|
||||
|
||||
<p><b>1. DEFINITIONS</b></p>
|
||||
|
||||
<p>"Contribution" means:</p>
|
||||
|
||||
<p class="list">a) in the case of the initial Contributor, the initial
|
||||
code and documentation distributed under this Agreement, and</p>
|
||||
<p class="list">b) in the case of each subsequent Contributor:</p>
|
||||
<p class="list">i) changes to the Program, and</p>
|
||||
<p class="list">ii) additions to the Program;</p>
|
||||
<p class="list">where such changes and/or additions to the Program
|
||||
originate from and are distributed by that particular Contributor. A
|
||||
Contribution 'originates' from a Contributor if it was added to the
|
||||
Program by such Contributor itself or anyone acting on such
|
||||
Contributor's behalf. Contributions do not include additions to the
|
||||
Program which: (i) are separate modules of software distributed in
|
||||
conjunction with the Program under their own license agreement, and (ii)
|
||||
are not derivative works of the Program.</p>
|
||||
|
||||
<p>"Contributor" means any person or entity that distributes
|
||||
the Program.</p>
|
||||
|
||||
<p>"Licensed Patents" mean patent claims licensable by a
|
||||
Contributor which are necessarily infringed by the use or sale of its
|
||||
Contribution alone or when combined with the Program.</p>
|
||||
|
||||
<p>"Program" means the Contributions distributed in accordance
|
||||
with this Agreement.</p>
|
||||
|
||||
<p>"Recipient" means anyone who receives the Program under
|
||||
this Agreement, including all Contributors.</p>
|
||||
|
||||
<p><b>2. GRANT OF RIGHTS</b></p>
|
||||
|
||||
<p class="list">a) Subject to the terms of this Agreement, each
|
||||
Contributor hereby grants Recipient a non-exclusive, worldwide,
|
||||
royalty-free copyright license to reproduce, prepare derivative works
|
||||
of, publicly display, publicly perform, distribute and sublicense the
|
||||
Contribution of such Contributor, if any, and such derivative works, in
|
||||
source code and object code form.</p>
|
||||
|
||||
<p class="list">b) Subject to the terms of this Agreement, each
|
||||
Contributor hereby grants Recipient a non-exclusive, worldwide,
|
||||
royalty-free patent license under Licensed Patents to make, use, sell,
|
||||
offer to sell, import and otherwise transfer the Contribution of such
|
||||
Contributor, if any, in source code and object code form. This patent
|
||||
license shall apply to the combination of the Contribution and the
|
||||
Program if, at the time the Contribution is added by the Contributor,
|
||||
such addition of the Contribution causes such combination to be covered
|
||||
by the Licensed Patents. The patent license shall not apply to any other
|
||||
combinations which include the Contribution. No hardware per se is
|
||||
licensed hereunder.</p>
|
||||
|
||||
<p class="list">c) Recipient understands that although each Contributor
|
||||
grants the licenses to its Contributions set forth herein, no assurances
|
||||
are provided by any Contributor that the Program does not infringe the
|
||||
patent or other intellectual property rights of any other entity. Each
|
||||
Contributor disclaims any liability to Recipient for claims brought by
|
||||
any other entity based on infringement of intellectual property rights
|
||||
or otherwise. As a condition to exercising the rights and licenses
|
||||
granted hereunder, each Recipient hereby assumes sole responsibility to
|
||||
secure any other intellectual property rights needed, if any. For
|
||||
example, if a third party patent license is required to allow Recipient
|
||||
to distribute the Program, it is Recipient's responsibility to acquire
|
||||
that license before distributing the Program.</p>
|
||||
|
||||
<p class="list">d) Each Contributor represents that to its knowledge it
|
||||
has sufficient copyright rights in its Contribution, if any, to grant
|
||||
the copyright license set forth in this Agreement.</p>
|
||||
|
||||
<p><b>3. REQUIREMENTS</b></p>
|
||||
|
||||
<p>A Contributor may choose to distribute the Program in object code
|
||||
form under its own license agreement, provided that:</p>
|
||||
|
||||
<p class="list">a) it complies with the terms and conditions of this
|
||||
Agreement; and</p>
|
||||
|
||||
<p class="list">b) its license agreement:</p>
|
||||
|
||||
<p class="list">i) effectively disclaims on behalf of all Contributors
|
||||
all warranties and conditions, express and implied, including warranties
|
||||
or conditions of title and non-infringement, and implied warranties or
|
||||
conditions of merchantability and fitness for a particular purpose;</p>
|
||||
|
||||
<p class="list">ii) effectively excludes on behalf of all Contributors
|
||||
all liability for damages, including direct, indirect, special,
|
||||
incidental and consequential damages, such as lost profits;</p>
|
||||
|
||||
<p class="list">iii) states that any provisions which differ from this
|
||||
Agreement are offered by that Contributor alone and not by any other
|
||||
party; and</p>
|
||||
|
||||
<p class="list">iv) states that source code for the Program is available
|
||||
from such Contributor, and informs licensees how to obtain it in a
|
||||
reasonable manner on or through a medium customarily used for software
|
||||
exchange.</p>
|
||||
|
||||
<p>When the Program is made available in source code form:</p>
|
||||
|
||||
<p class="list">a) it must be made available under this Agreement; and</p>
|
||||
|
||||
<p class="list">b) a copy of this Agreement must be included with each
|
||||
copy of the Program.</p>
|
||||
|
||||
<p>Contributors may not remove or alter any copyright notices contained
|
||||
within the Program.</p>
|
||||
|
||||
<p>Each Contributor must identify itself as the originator of its
|
||||
Contribution, if any, in a manner that reasonably allows subsequent
|
||||
Recipients to identify the originator of the Contribution.</p>
|
||||
|
||||
<p><b>4. COMMERCIAL DISTRIBUTION</b></p>
|
||||
|
||||
<p>Commercial distributors of software may accept certain
|
||||
responsibilities with respect to end users, business partners and the
|
||||
like. While this license is intended to facilitate the commercial use of
|
||||
the Program, the Contributor who includes the Program in a commercial
|
||||
product offering should do so in a manner which does not create
|
||||
potential liability for other Contributors. Therefore, if a Contributor
|
||||
includes the Program in a commercial product offering, such Contributor
|
||||
("Commercial Contributor") hereby agrees to defend and
|
||||
indemnify every other Contributor ("Indemnified Contributor")
|
||||
against any losses, damages and costs (collectively "Losses")
|
||||
arising from claims, lawsuits and other legal actions brought by a third
|
||||
party against the Indemnified Contributor to the extent caused by the
|
||||
acts or omissions of such Commercial Contributor in connection with its
|
||||
distribution of the Program in a commercial product offering. The
|
||||
obligations in this section do not apply to any claims or Losses
|
||||
relating to any actual or alleged intellectual property infringement. In
|
||||
order to qualify, an Indemnified Contributor must: a) promptly notify
|
||||
the Commercial Contributor in writing of such claim, and b) allow the
|
||||
Commercial Contributor to control, and cooperate with the Commercial
|
||||
Contributor in, the defense and any related settlement negotiations. The
|
||||
Indemnified Contributor may participate in any such claim at its own
|
||||
expense.</p>
|
||||
|
||||
<p>For example, a Contributor might include the Program in a commercial
|
||||
product offering, Product X. That Contributor is then a Commercial
|
||||
Contributor. If that Commercial Contributor then makes performance
|
||||
claims, or offers warranties related to Product X, those performance
|
||||
claims and warranties are such Commercial Contributor's responsibility
|
||||
alone. Under this section, the Commercial Contributor would have to
|
||||
defend claims against the other Contributors related to those
|
||||
performance claims and warranties, and if a court requires any other
|
||||
Contributor to pay any damages as a result, the Commercial Contributor
|
||||
must pay those damages.</p>
|
||||
|
||||
<p><b>5. NO WARRANTY</b></p>
|
||||
|
||||
<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
|
||||
PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
|
||||
OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
|
||||
ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
|
||||
OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
|
||||
responsible for determining the appropriateness of using and
|
||||
distributing the Program and assumes all risks associated with its
|
||||
exercise of rights under this Agreement , including but not limited to
|
||||
the risks and costs of program errors, compliance with applicable laws,
|
||||
damage to or loss of data, programs or equipment, and unavailability or
|
||||
interruption of operations.</p>
|
||||
|
||||
<p><b>6. DISCLAIMER OF LIABILITY</b></p>
|
||||
|
||||
<p>EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
|
||||
NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING
|
||||
WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR
|
||||
DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
|
||||
HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</p>
|
||||
|
||||
<p><b>7. GENERAL</b></p>
|
||||
|
||||
<p>If any provision of this Agreement is invalid or unenforceable under
|
||||
applicable law, it shall not affect the validity or enforceability of
|
||||
the remainder of the terms of this Agreement, and without further action
|
||||
by the parties hereto, such provision shall be reformed to the minimum
|
||||
extent necessary to make such provision valid and enforceable.</p>
|
||||
|
||||
<p>If Recipient institutes patent litigation against any entity
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that the
|
||||
Program itself (excluding combinations of the Program with other
|
||||
software or hardware) infringes such Recipient's patent(s), then such
|
||||
Recipient's rights granted under Section 2(b) shall terminate as of the
|
||||
date such litigation is filed.</p>
|
||||
|
||||
<p>All Recipient's rights under this Agreement shall terminate if it
|
||||
fails to comply with any of the material terms or conditions of this
|
||||
Agreement and does not cure such failure in a reasonable period of time
|
||||
after becoming aware of such noncompliance. If all Recipient's rights
|
||||
under this Agreement terminate, Recipient agrees to cease use and
|
||||
distribution of the Program as soon as reasonably practicable. However,
|
||||
Recipient's obligations under this Agreement and any licenses granted by
|
||||
Recipient relating to the Program shall continue and survive.</p>
|
||||
|
||||
<p>Everyone is permitted to copy and distribute copies of this
|
||||
Agreement, but in order to avoid inconsistency the Agreement is
|
||||
copyrighted and may only be modified in the following manner. The
|
||||
Agreement Steward reserves the right to publish new versions (including
|
||||
revisions) of this Agreement from time to time. No one other than the
|
||||
Agreement Steward has the right to modify this Agreement. The Eclipse
|
||||
Foundation is the initial Agreement Steward. The Eclipse Foundation may
|
||||
assign the responsibility to serve as the Agreement Steward to a
|
||||
suitable separate entity. Each new version of the Agreement will be
|
||||
given a distinguishing version number. The Program (including
|
||||
Contributions) may always be distributed subject to the version of the
|
||||
Agreement under which it was received. In addition, after a new version
|
||||
of the Agreement is published, Contributor may elect to distribute the
|
||||
Program (including its Contributions) under the new version. Except as
|
||||
expressly stated in Sections 2(a) and 2(b) above, Recipient receives no
|
||||
rights or licenses to the intellectual property of any Contributor under
|
||||
this Agreement, whether expressly, by implication, estoppel or
|
||||
otherwise. All rights in the Program not expressly granted under this
|
||||
Agreement are reserved.</p>
|
||||
|
||||
<p>This Agreement is governed by the laws of the State of New York and
|
||||
the intellectual property laws of the United States of America. No party
|
||||
to this Agreement will bring a legal action under this Agreement more
|
||||
than one year after the cause of action arose. Each party waives its
|
||||
rights to a jury trial in any resulting litigation.</p>
|
||||
|
||||
|
||||
|
||||
|
||||
</body></html>
|
||||
BIN
demo/icons/error_obj.gif
Normal file
BIN
demo/icons/error_obj.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 339 B |
BIN
demo/icons/warning_obj.gif
Normal file
BIN
demo/icons/warning_obj.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 324 B |
47
demo/styles.css
Normal file
47
demo/styles.css
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
html {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
overflow: hidden;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
font-family: Arial, Helvetica, sans-serif, Tahoma, Verdana, sans-serif;
|
||||
font-size: 12px;
|
||||
background: rgb(14, 98, 165);
|
||||
color: white;
|
||||
}
|
||||
|
||||
#editor {
|
||||
position: absolute;
|
||||
top: 60px;
|
||||
left: 0px;
|
||||
background: white;
|
||||
}
|
||||
|
||||
#controls {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#cockpitInput {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
bottom: 0;
|
||||
|
||||
border: none; outline: none;
|
||||
font-family: consolas, courier, monospace;
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
#cockpitOutput {
|
||||
padding: 10px;
|
||||
margin: 0 15px;
|
||||
border: 1px solid #AAA;
|
||||
-moz-border-radius-topleft: 10px;
|
||||
-moz-border-radius-topright: 10px;
|
||||
border-top-left-radius: 4px; border-top-right-radius: 4px;
|
||||
background: #DDD; color: #000;
|
||||
}
|
||||
|
|
@ -1,207 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Editor</title>
|
||||
<meta name="author" content="Fabian Jakobs">
|
||||
|
||||
<style type="text/css" media="screen">
|
||||
|
||||
html {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
overflow: hidden;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
font-family: Arial, Helvetica, sans-serif, Tahoma, Verdana, sans-serif;
|
||||
font-size: 12px;
|
||||
background: rgb(14, 98, 165);
|
||||
color: white;
|
||||
}
|
||||
|
||||
#editor {
|
||||
top: 55px;
|
||||
left: 0px;
|
||||
background: white;
|
||||
}
|
||||
|
||||
#controls {
|
||||
width: 100%;
|
||||
height: 55px;
|
||||
}
|
||||
|
||||
#jump {
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border: 1px solid red;
|
||||
z-index: 10000;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#cockpitInput {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
bottom: 0;
|
||||
|
||||
border: none; outline: none;
|
||||
font-family: consolas, courier, monospace;
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
#cockpitOutput {
|
||||
padding: 10px;
|
||||
margin: 0 15px;
|
||||
border: 1px solid #AAA;
|
||||
-moz-border-radius-topleft: 10px;
|
||||
-moz-border-radius-topright: 10px;
|
||||
border-top-left-radius: 4px; border-top-right-radius: 4px;
|
||||
background: #DDD; color: #000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="jump"></div>
|
||||
|
||||
<table id="controls">
|
||||
<tr>
|
||||
<td>
|
||||
<label for="doc">Document:</label>
|
||||
<select id="doc" size="1">
|
||||
<option value="js">JS Document</option>
|
||||
<option value="html">HTML Document</option>
|
||||
<option value="css">CSS Document</option>
|
||||
<option value="python">Python Document</option>
|
||||
<option value="php">PHP Document</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<label for="mode">Mode:</label>
|
||||
<select id="mode" size="1">
|
||||
<option value="text">Plain Text</option>
|
||||
<option value="javascript">JavaScript</option>
|
||||
<option value="xml">XML</option>
|
||||
<option value="html">HTML</option>
|
||||
<option value="css">CSS</option>
|
||||
<option value="python">Python</option>
|
||||
<option value="php">PHP</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<label for="theme">Theme:</label>
|
||||
<select id="theme" size="1">
|
||||
<option value="ace/theme/textmate">TextMate</option>
|
||||
<option value="ace/theme/eclipse">Eclipse</option>
|
||||
<option value="ace/theme/dawn">Dawn</option>
|
||||
<option value="ace/theme/idle_fingers">idleFingers</option>
|
||||
<option value="ace/theme/pastel_on_dark">Pastel on dark</option>
|
||||
<option value="ace/theme/twilight">Twilight</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<label for="select_style">Full line selections</label>
|
||||
<input type="checkbox" name="select_style" id="select_style" checked>
|
||||
</td>
|
||||
<td>
|
||||
<label for="highlight_active">Highlight active line</label>
|
||||
<input type="checkbox" name="highlight_active" id="highlight_active" checked>
|
||||
</td>
|
||||
<td>
|
||||
<label for="show_hidden">Show invisibles</label>
|
||||
<input type="checkbox" name="show_hidden" id="show_hidden">
|
||||
</td>
|
||||
<td align="right">
|
||||
<img src="demo/logo.png">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="editor">
|
||||
</div>
|
||||
|
||||
<script type="text/editor" id="jstext">function foo(items) {
|
||||
for (var i=0; i<items.length; i++) {
|
||||
alert(items[i] + "juhu");
|
||||
}
|
||||
}</script>
|
||||
|
||||
<script type="text/editor" id="csstext">.text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
cursor: text;
|
||||
}</script>
|
||||
|
||||
<script type="text/editor" id="htmltext"><html>
|
||||
<head>
|
||||
|
||||
<style type="text/css">
|
||||
.text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
cursor: text;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="color:red">Juhu Kinners</h1>
|
||||
</body>
|
||||
</html></script>
|
||||
|
||||
<script type="text/editor" id="pythontext">#!/usr/local/bin/python
|
||||
|
||||
import string, sys
|
||||
|
||||
# If no arguments were given, print a helpful message
|
||||
if len(sys.argv)==1:
|
||||
print 'Usage: celsius temp1 temp2 ...'
|
||||
sys.exit(0)
|
||||
|
||||
# Loop over the arguments
|
||||
for i in sys.argv[1:]:
|
||||
try:
|
||||
fahrenheit=float(string.atoi(i))
|
||||
except string.atoi_error:
|
||||
print repr(i), "not a numeric value"
|
||||
else:
|
||||
celsius=(fahrenheit-32)*5.0/9.0
|
||||
print '%i\260F = %i\260C' % (int(fahrenheit), int(celsius+.5))
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="phptext"><?php
|
||||
|
||||
function nfact($n) {
|
||||
if ($n == 0) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return $n * nfact($n - 1);
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n\nPlease enter a whole number ... ";
|
||||
$num = trim(fgets(STDIN));
|
||||
|
||||
// ===== PROCESS - Determing the factorial of the input number =====
|
||||
$output = "\n\nFactorial " . $num . " = " . nfact($num) . "\n\n";
|
||||
echo $output;
|
||||
|
||||
?></script>
|
||||
|
||||
<input id="cockpitInput" type="text"/>
|
||||
|
||||
<script src="demo/require.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="demo/boot.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script type="text/javascript">
|
||||
require("demo/boot");
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
204
editor.html
204
editor.html
|
|
@ -1,204 +0,0 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Editor</title>
|
||||
<meta name="author" content="Fabian Jakobs">
|
||||
|
||||
<style type="text/css" media="screen">
|
||||
|
||||
html {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
overflow: hidden;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
font-family: Arial, Helvetica, sans-serif, Tahoma, Verdana, sans-serif;
|
||||
font-size: 12px;
|
||||
background: rgb(14, 98, 165);
|
||||
color: white;
|
||||
}
|
||||
|
||||
#editor {
|
||||
top: 55px;
|
||||
left: 0px;
|
||||
background: white;
|
||||
}
|
||||
|
||||
#controls {
|
||||
width: 100%;
|
||||
height: 55px;
|
||||
}
|
||||
|
||||
#jump {
|
||||
position: absolute;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
border: 1px solid red;
|
||||
z-index: 10000;
|
||||
display: none;
|
||||
}
|
||||
|
||||
#cockpitInput {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
bottom: 0;
|
||||
|
||||
border: none; outline: none;
|
||||
font-family: consolas, courier, monospace;
|
||||
font-size: 120%;
|
||||
}
|
||||
|
||||
#cockpitOutput {
|
||||
padding: 10px;
|
||||
margin: 0 15px;
|
||||
border: 1px solid #AAA;
|
||||
-moz-border-radius-topleft: 10px;
|
||||
-moz-border-radius-topright: 10px;
|
||||
border-top-left-radius: 4px; border-top-right-radius: 4px;
|
||||
background: #DDD; color: #000;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="jump"></div>
|
||||
|
||||
<table id="controls">
|
||||
<tr>
|
||||
<td>
|
||||
<label for="doc">Document:</label>
|
||||
<select id="doc" size="1">
|
||||
<option value="js">JS Document</option>
|
||||
<option value="html">HTML Document</option>
|
||||
<option value="css">CSS Document</option>
|
||||
<option value="python">Python Document</option>
|
||||
<option value="php">PHP Document</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<label for="mode">Mode:</label>
|
||||
<select id="mode" size="1">
|
||||
<option value="text">Plain Text</option>
|
||||
<option value="javascript">JavaScript</option>
|
||||
<option value="xml">XML</option>
|
||||
<option value="html">HTML</option>
|
||||
<option value="css">CSS</option>
|
||||
<option value="python">Python</option>
|
||||
<option value="php">PHP</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<label for="theme">Theme:</label>
|
||||
<select id="theme" size="1">
|
||||
<option value="ace/theme/textmate">TextMate</option>
|
||||
<option value="ace/theme/eclipse">Eclipse</option>
|
||||
<option value="ace/theme/dawn">Dawn</option>
|
||||
<option value="ace/theme/idle_fingers">idleFingers</option>
|
||||
<option value="ace/theme/pastel_on_dark">Pastel on dark</option>
|
||||
<option value="ace/theme/twilight">Twilight</option>
|
||||
</select>
|
||||
</td>
|
||||
<td>
|
||||
<label for="select_style">Full line selections</label>
|
||||
<input type="checkbox" name="select_style" id="select_style" checked>
|
||||
</td>
|
||||
<td>
|
||||
<label for="highlight_active">Highlight active line</label>
|
||||
<input type="checkbox" name="highlight_active" id="highlight_active" checked>
|
||||
</td>
|
||||
<td>
|
||||
<label for="show_hidden">Show invisibles</label>
|
||||
<input type="checkbox" name="show_hidden" id="show_hidden">
|
||||
</td>
|
||||
<td align="right">
|
||||
<img src="demo/logo.png">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="editor">
|
||||
</div>
|
||||
|
||||
<script type="text/editor" id="jstext">function foo(items) {
|
||||
for (var i=0; i<items.length; i++) {
|
||||
alert(items[i] + "juhu");
|
||||
}
|
||||
}</script>
|
||||
|
||||
<script type="text/editor" id="csstext">.text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
cursor: text;
|
||||
}</script>
|
||||
|
||||
<script type="text/editor" id="htmltext"><html>
|
||||
<head>
|
||||
|
||||
<style type="text/css">
|
||||
.text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
cursor: text;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="color:red">Juhu Kinners</h1>
|
||||
</body>
|
||||
</html></script>
|
||||
|
||||
<script type="text/editor" id="pythontext">#!/usr/local/bin/python
|
||||
|
||||
import string, sys
|
||||
|
||||
# If no arguments were given, print a helpful message
|
||||
if len(sys.argv)==1:
|
||||
print 'Usage: celsius temp1 temp2 ...'
|
||||
sys.exit(0)
|
||||
|
||||
# Loop over the arguments
|
||||
for i in sys.argv[1:]:
|
||||
try:
|
||||
fahrenheit=float(string.atoi(i))
|
||||
except string.atoi_error:
|
||||
print repr(i), "not a numeric value"
|
||||
else:
|
||||
celsius=(fahrenheit-32)*5.0/9.0
|
||||
print '%i\260F = %i\260C' % (int(fahrenheit), int(celsius+.5))
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="phptext"><?php
|
||||
|
||||
function nfact($n) {
|
||||
if ($n == 0) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return $n * nfact($n - 1);
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n\nPlease enter a whole number ... ";
|
||||
$num = trim(fgets(STDIN));
|
||||
|
||||
// ===== PROCESS - Determing the factorial of the input number =====
|
||||
$output = "\n\nFactorial " . $num . " = " . nfact($num) . "\n\n";
|
||||
echo $output;
|
||||
|
||||
?></script>
|
||||
|
||||
<input id="cockpitInput" type="text"/>
|
||||
|
||||
<script src="demo/require.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="demo/boot.js" type="text/javascript"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
45
experiments/capture.html
Normal file
45
experiments/capture.html
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="author" content="Fabian Jakobs">
|
||||
<!-- Date: 2010-04-07 -->
|
||||
|
||||
<style type="text/css" media="screen">
|
||||
#juhu {
|
||||
width: 100px;
|
||||
height: 50px;
|
||||
background: yellow;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="juhu">
|
||||
|
||||
</div>
|
||||
|
||||
<script src="../src/ace.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
|
||||
var el = document.getElementById("juhu");
|
||||
|
||||
ace.addListener(el, "mousedown", function(e) {
|
||||
el.innerHTML = ace.getDocumentX(e) + " " + ace.getDocumentY(e);
|
||||
ace.capture(
|
||||
el,
|
||||
function(e) {
|
||||
el.innerHTML = ace.getDocumentX(e) + " " + ace.getDocumentY(e);
|
||||
}, function() {
|
||||
el.innerHTML = "";
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
105
experiments/cut_copy.html
Normal file
105
experiments/cut_copy.html
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Text Events</title>
|
||||
<meta name="author" content="Fabian Jakobs">
|
||||
|
||||
<style type="text/css" media="screen">
|
||||
|
||||
#container {
|
||||
border: 1px solid black;
|
||||
width: 600px;
|
||||
}
|
||||
|
||||
#canvas {
|
||||
border: 1px solid black;
|
||||
margin: 4px;
|
||||
width: 590px;
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="container">
|
||||
<textarea id="text"></textarea>
|
||||
<div id="canvas"></div>
|
||||
</div>
|
||||
|
||||
<input type="button" value="Clear" id="some_name" onclick="document.getElementById('logger').innerHTML = ''">
|
||||
<div id="logger">
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
|
||||
if (!window.console) window.console = {};
|
||||
if (!console.log) {
|
||||
var logger = document.getElementById("logger");
|
||||
console.log = function() {
|
||||
logger.innerHTML += Array.prototype.join.call(arguments, ", ") + "<br>";
|
||||
}
|
||||
}
|
||||
|
||||
function addListener(elem, type, callback) {
|
||||
if (elem.addEventListener) {
|
||||
return elem.addEventListener(type, callback, false);
|
||||
}
|
||||
if (elem.attachEvent) {
|
||||
elem.attachEvent("on" + type, function() {
|
||||
callback(window.event);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var container = document.getElementById("container");
|
||||
var canvas = document.getElementById("canvas");
|
||||
var text = document.getElementById("text");
|
||||
|
||||
function log(e) {
|
||||
console.log(e.type, e);
|
||||
}
|
||||
|
||||
function logKey(e) {
|
||||
console.log(e.type, e.charCode, e.keyCode, e);
|
||||
}
|
||||
|
||||
addListener(text, "keydown", logKey, false);
|
||||
addListener(text, "keyup", logKey, false);
|
||||
addListener(text, "keypress", logKey, false);
|
||||
|
||||
addListener(text, "textInput", function(e) {
|
||||
console.log(e.type, e.data, e);
|
||||
}, false);
|
||||
|
||||
function fillSelection() {
|
||||
text.value = "Juhu Kinners";
|
||||
text.select();
|
||||
}
|
||||
|
||||
addListener(text, "copy", fillSelection, false);
|
||||
addListener(text, "paste", log, false);
|
||||
addListener(text, "cut", fillSelection, false);
|
||||
|
||||
addListener(text, "beforecopy", log, false);
|
||||
addListener(text, "beforepaste", log, false);
|
||||
addListener(text, "beforecut", log, false);
|
||||
|
||||
addListener(text, "compositionstart", log, false);
|
||||
addListener(text, "compositionupdate", log, false);
|
||||
addListener(text, "compositionend", log, false);
|
||||
|
||||
addListener(text, "propertychange", function(e) {
|
||||
console.log(e.type, e.propertyName, e);
|
||||
}, false);
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
34
experiments/triple_click.html
Normal file
34
experiments/triple_click.html
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>triple_click</title>
|
||||
<meta name="author" content="Fabian Jakobs">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<div id="juhu">
|
||||
Juhu Kinners
|
||||
</div>
|
||||
|
||||
<script src="../src/ace/lib/core.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="../src/ace/lib/event.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
|
||||
var el = document.getElementById("juhu");
|
||||
ace.addTripleClickListener(el, function() {
|
||||
console.log("triple");
|
||||
});
|
||||
|
||||
ace.addListener(el, "selectstart", function(e) {
|
||||
return ace.preventDefault(e);
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
33
experiments/worker.html
Normal file
33
experiments/worker.html
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>worker</title>
|
||||
<meta name="generator" content="TextMate http://macromates.com/">
|
||||
<meta name="author" content="Fabian Jakobs">
|
||||
<!-- Date: 2010-04-08 -->
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
|
||||
var worker = new Worker("worker.js");
|
||||
|
||||
worker.onmessage = function(e) {
|
||||
console.log(e.data);
|
||||
};
|
||||
|
||||
worker.onerror = function(e) {
|
||||
console.log(e.data);
|
||||
};
|
||||
|
||||
worker.postMessage("postMessage('juhu')");
|
||||
worker.postMessage("postMessage('juhu')");
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
3
experiments/worker.js
Normal file
3
experiments/worker.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
onmessage = function(e) {
|
||||
onmessage = new Function("e", e.data);
|
||||
};
|
||||
378
index.html
378
index.html
|
|
@ -1,90 +1,320 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
|
||||
"http://www.w3.org/TR/html4/strict.dtd">
|
||||
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
|
||||
<title>ajaxorg/ace @ GitHub</title>
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin-top: 1.0em;
|
||||
background-color: rgb(14, 98, 165);
|
||||
font-family: "Helvetica,Arial,FreeSans";
|
||||
color: #ffffff;
|
||||
}
|
||||
#container {
|
||||
margin: 0 auto;
|
||||
width: 700px;
|
||||
}
|
||||
h1 { font-size: 3.8em; color: #d5f1c8; margin-bottom: 3px; }
|
||||
h1 .small { font-size: 0.4em; }
|
||||
h1 a { text-decoration: none }
|
||||
h2 { font-size: 1.5em; color: #d5f1c8; }
|
||||
h3 { text-align: center; color: #d5f1c8; }
|
||||
a { color: #d5f1c8; }
|
||||
.description { font-size: 1.2em; margin-bottom: 30px; margin-top: 30px; font-style: italic;}
|
||||
.download { float: right; }
|
||||
pre { background: #000; color: #fff; padding: 15px;}
|
||||
hr { border: 0; width: 80%; border-bottom: 1px solid #aaa}
|
||||
.footer { text-align:center; padding-top:30px; font-style: italic; }
|
||||
</style>
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Editor</title>
|
||||
<meta name="author" content="Fabian Jakobs">
|
||||
<link rel="stylesheet" href="demo/styles.css" type="text/css" media="screen" charset="utf-8">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<a href="http://github.com/ajaxorg/ace"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub" /></a>
|
||||
<table id="controls">
|
||||
<tr>
|
||||
<td align="right">
|
||||
<label for="doc">Document:</label>
|
||||
<select id="doc" size="1">
|
||||
<option value="js">JS Document</option>
|
||||
<option value="html">HTML Document</option>
|
||||
<option value="css">CSS Document</option>
|
||||
<option value="python">Python Document</option>
|
||||
<option value="php">PHP Document</option>
|
||||
<option value="java">Java Document</option>
|
||||
<option value="ruby">Ruby Document</option>
|
||||
<option value="c_cpp">C++ Document</option>
|
||||
<option value="coffee">CoffeeScript Document</option>
|
||||
<option value="perl">Perl Document</option>
|
||||
<option value="plain">Text Document</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="theme">Theme:</label>
|
||||
<select id="theme" size="1">
|
||||
<option value="ace/theme/textmate">TextMate</option>
|
||||
<option value="ace/theme/eclipse">Eclipse</option>
|
||||
<option value="ace/theme/dawn">Dawn</option>
|
||||
<option value="ace/theme/idle_fingers">idleFingers</option>
|
||||
<option value="ace/theme/pastel_on_dark">Pastel on dark</option>
|
||||
<option value="ace/theme/twilight">Twilight</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="fontsize">Font Size:</label>
|
||||
<select id="fontsize" size="1">
|
||||
<option value="10px">10px</option>
|
||||
<option value="11px">11px</option>
|
||||
<option value="12px" selected="selected">12px</option>
|
||||
<option value="14px">14px</option>
|
||||
<option value="16px">16px</option>
|
||||
<option value="20px">20px</option>
|
||||
<option value="24px">24px</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="select_style">Full Line Selection</label>
|
||||
<input type="checkbox" name="select_style" id="select_style" checked>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="highlight_active">Highlight Active Line</label>
|
||||
<input type="checkbox" name="highlight_active" id="highlight_active" checked>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="show_hidden">Show Invisibles</label>
|
||||
<input type="checkbox" name="show_hidden" id="show_hidden">
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="show_hscroll">Persistent HScroll</label>
|
||||
<input type="checkbox" name="show_hscroll" id="show_hscroll">
|
||||
</td>
|
||||
<td align="right" rowspan="2">
|
||||
<img src="demo/logo.png">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">
|
||||
<label for="mode">Mode:</label>
|
||||
<select id="mode" size="1">
|
||||
<option value="text">Plain Text</option>
|
||||
<option value="javascript">JavaScript</option>
|
||||
<option value="xml">XML</option>
|
||||
<option value="html">HTML</option>
|
||||
<option value="css">CSS</option>
|
||||
<option value="python">Python</option>
|
||||
<option value="php">PHP</option>
|
||||
<option value="java">Java</option>
|
||||
<option value="ruby">Ruby</option>
|
||||
<option value="c_cpp">C/C++</option>
|
||||
<option value="coffee">CoffeeScript</option>
|
||||
<option value="perl">Perl</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="keybinding">Key Binding:</label>
|
||||
<select id="keybinding" size="1">
|
||||
<option value="ace">Ace</option>
|
||||
<option value="vim">Vim</option>
|
||||
<option value="emacs">Emacs</option>
|
||||
<option value="custom">Custom</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="soft_wrap">Soft Wrap:</label>
|
||||
<select id="soft_wrap" size="1">
|
||||
<option value="off">Off</option>
|
||||
<option value="40">40 Chars</option>
|
||||
<option value="80">80 Chars</option>
|
||||
<option value="free">Free</option>
|
||||
</select>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="show_gutter">Show Gutter</label>
|
||||
<input type="checkbox" id="show_gutter" checked>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="show_print_margin">Show Print Margin</label>
|
||||
<input type="checkbox" id="show_print_margin" checked>
|
||||
</td>
|
||||
<td align="right">
|
||||
<label for="highlight_selected_word">Highlight selected word</label>
|
||||
<input type="checkbox" id="highlight_selected_word" checked>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div id="container">
|
||||
|
||||
<div class="download">
|
||||
<a href="http://github.com/ajaxorg/ace/zipball/master">
|
||||
<img border="0" width="90" src="http://github.com/images/modules/download/zip.png"></a>
|
||||
<a href="http://github.com/ajaxorg/ace/tarball/master">
|
||||
<img border="0" width="90" src="http://github.com/images/modules/download/tar.png"></a>
|
||||
<div id="editor">
|
||||
</div>
|
||||
|
||||
<h1><a href="http://github.com/ajaxorg/ace">ace</a>
|
||||
<span class="small">by <a href="http://github.com/ajaxorg">ajax.org</a></span></h1>
|
||||
<script type="text/editor" id="jstext">function foo(items) {
|
||||
for (var i=0; i<items.length; i++) {
|
||||
alert(items[i] + "juhu");
|
||||
}
|
||||
}
|
||||
// A magic character: >> ぁ <<
|
||||
</script>
|
||||
|
||||
<div class="description">
|
||||
Ajax.org Code Editor
|
||||
</div>
|
||||
<script type="text/editor" id="csstext">.text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
cursor: text;
|
||||
}</script>
|
||||
|
||||
<h2>License</h2>
|
||||
<p>LGPL</p>
|
||||
<h2>Authors</h2>
|
||||
<p>Fabian Jakobs (fabian.jakobs@web.de)
|
||||
<br/>Mike de Boer (info@mikedeboer.nl)
|
||||
<br/>Rik Arends (rik@ajax.org)
|
||||
<br/>Ruben Daniels (ruben@ajax.org)
|
||||
<br/>
|
||||
<br/> </p>
|
||||
<h2>Demo</h2>
|
||||
Check out the <a href="editor-build.html">demo</a>.
|
||||
<h2>Contact</h2>
|
||||
<p>Fabian Jakobs (fabian.jakobs@web.de)
|
||||
<br/> </p>
|
||||
<script type="text/editor" id="htmltext"><html>
|
||||
<head>
|
||||
|
||||
<style type="text/css">
|
||||
.text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
cursor: text;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h2>Download</h2>
|
||||
<p>
|
||||
You can download this project in either
|
||||
<a href="http://github.com/ajaxorg/ace/zipball/master">zip</a> or
|
||||
<a href="http://github.com/ajaxorg/ace/tarball/master">tar</a> formats.
|
||||
</p>
|
||||
<p>You can also clone the project with <a href="http://git-scm.com">Git</a>
|
||||
by running:
|
||||
<pre>$ git clone git://github.com/ajaxorg/ace</pre>
|
||||
</p>
|
||||
</head>
|
||||
<body>
|
||||
<h1 style="color:red">Juhu Kinners</h1>
|
||||
</body>
|
||||
</html></script>
|
||||
|
||||
<div class="footer">
|
||||
get the source code on GitHub : <a href="http://github.com/ajaxorg/ace">ajaxorg/ace</a>
|
||||
</div>
|
||||
<script type="text/editor" id="javatext">public class InfiniteLoop {
|
||||
|
||||
</div>
|
||||
/*
|
||||
* This will cause the program to hang...
|
||||
*
|
||||
* Taken from:
|
||||
* http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
double d = Double.parseDouble("2.2250738585072012e-308");
|
||||
|
||||
|
||||
// unreachable code
|
||||
System.out.println("Value: " + d);
|
||||
}
|
||||
}</script>
|
||||
|
||||
<script type="text/editor" id="pythontext">#!/usr/local/bin/python
|
||||
|
||||
import string, sys
|
||||
|
||||
# If no arguments were given, print a helpful message
|
||||
if len(sys.argv)==1:
|
||||
print 'Usage: celsius temp1 temp2 ...'
|
||||
sys.exit(0)
|
||||
|
||||
# Loop over the arguments
|
||||
for i in sys.argv[1:]:
|
||||
try:
|
||||
fahrenheit=float(string.atoi(i))
|
||||
except string.atoi_error:
|
||||
print repr(i), "not a numeric value"
|
||||
else:
|
||||
celsius=(fahrenheit-32)*5.0/9.0
|
||||
print '%i\260F = %i\260C' % (int(fahrenheit), int(celsius+.5))
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="phptext"><?php
|
||||
|
||||
function nfact($n) {
|
||||
if ($n == 0) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return $n * nfact($n - 1);
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n\nPlease enter a whole number ... ";
|
||||
$num = trim(fgets(STDIN));
|
||||
|
||||
// ===== PROCESS - Determing the factorial of the input number =====
|
||||
$output = "\n\nFactorial " . $num . " = " . nfact($num) . "\n\n";
|
||||
echo $output;
|
||||
|
||||
?></script>
|
||||
|
||||
<script type="text/editor" id="plaintext">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
|
||||
|
||||
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
|
||||
|
||||
Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.
|
||||
|
||||
Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.
|
||||
|
||||
Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.
|
||||
|
||||
At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="rubytext">#!/usr/bin/ruby
|
||||
|
||||
# Program to find the factorial of a number
|
||||
def fact(n)
|
||||
if n == 0
|
||||
1
|
||||
else
|
||||
n * fact(n-1)
|
||||
end
|
||||
end
|
||||
|
||||
puts fact(ARGV[0].to_i)
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="cpptext">// compound assignment operators
|
||||
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main ()
|
||||
{
|
||||
int a, b=3; /* foobar */
|
||||
a = b;
|
||||
a+=2; // equivalent to a=a+2
|
||||
cout << a;
|
||||
return 0;
|
||||
}
|
||||
</script>
|
||||
|
||||
<script type="text/editor" id="coffeetext">#!/usr/bin/env coffee
|
||||
|
||||
try
|
||||
throw URIError decodeURI(0xC0ffee * 123456.7e-8 / .9)
|
||||
catch e
|
||||
console.log 'qstring' + "qqstring" + '''
|
||||
qdoc
|
||||
''' + """
|
||||
qqdoc
|
||||
"""
|
||||
|
||||
do ->
|
||||
###
|
||||
herecomment
|
||||
###
|
||||
re = /regex/imgy.test ///
|
||||
heregex # comment
|
||||
///imgy
|
||||
this isnt: `just JavaScript`
|
||||
undefined
|
||||
|
||||
var illegal</script>
|
||||
|
||||
<script type="text/editor" id="perltext">
|
||||
#!/usr/bin/perl
|
||||
use strict;
|
||||
use warnings;
|
||||
my $num_primes = 0;
|
||||
my @primes;
|
||||
|
||||
# Put 2 as the first prime so we won't have an empty array
|
||||
$primes[$num_primes] = 2;
|
||||
$num_primes++;
|
||||
|
||||
MAIN_LOOP:
|
||||
for my $number_to_check (3 .. 200)
|
||||
{
|
||||
for my $p (0 .. ($num_primes-1))
|
||||
{
|
||||
if ($number_to_check % $primes[$p] == 0)
|
||||
{
|
||||
next MAIN_LOOP;
|
||||
}
|
||||
}
|
||||
|
||||
# If we reached this point it means $number_to_check is not
|
||||
# divisable by any prime number that came before it.
|
||||
$primes[$num_primes] = $number_to_check;
|
||||
$num_primes++;
|
||||
}
|
||||
|
||||
for my $p (0 .. ($num_primes-1))
|
||||
{
|
||||
print $primes[$p], ", ";
|
||||
}
|
||||
print "\n";
|
||||
|
||||
</script>
|
||||
|
||||
<input id="cockpitInput" type="text"/>
|
||||
|
||||
<script src="demo/require.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="demo/boot.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
182
lib/ace/anchor.js
Normal file
182
lib/ace/anchor.js
Normal file
|
|
@ -0,0 +1,182 @@
|
|||
/* ***** 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
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
|
||||
/**
|
||||
* An Anchor is a floating pointer in the document. Whenever text is inserted or
|
||||
* deleted before the cursor, the position of the cursor is updated
|
||||
*/
|
||||
var Anchor = exports.Anchor = function(doc, row, column) {
|
||||
this.document = doc;
|
||||
|
||||
if (typeof column == "undefined")
|
||||
this.setPosition(row.row, row.column)
|
||||
else
|
||||
this.setPosition(row, column);
|
||||
|
||||
this.$onChange = this.onChange.bind(this);
|
||||
doc.on("change", this.$onChange);
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
||||
oop.implement(this, EventEmitter);
|
||||
|
||||
this.getPosition = function() {
|
||||
return this.$clipPositionToDocument(this.row, this.column);
|
||||
};
|
||||
|
||||
this.getDocument = function() {
|
||||
return this.document;
|
||||
};
|
||||
|
||||
this.onChange = function(e) {
|
||||
var delta = e.data;
|
||||
var range = delta.range;
|
||||
|
||||
if (range.start.row == range.end.row && range.start.row != this.row)
|
||||
return;
|
||||
|
||||
if (range.start.row > this.row)
|
||||
return;
|
||||
|
||||
if (range.start.row == this.row && range.start.column > this.column)
|
||||
return;
|
||||
|
||||
var row = this.row;
|
||||
var column = this.column;
|
||||
|
||||
if (delta.action === "insertText") {
|
||||
if (range.start.row === row && range.start.column <= column) {
|
||||
if (range.start.row === range.end.row) {
|
||||
column += range.end.column - range.start.column;
|
||||
}
|
||||
else {
|
||||
column -= range.start.column;
|
||||
row += range.end.row - range.start.row;
|
||||
}
|
||||
}
|
||||
else if (range.start.row !== range.end.row && range.start.row < row) {
|
||||
row += range.end.row - range.start.row;
|
||||
}
|
||||
} else if (delta.action === "insertLines") {
|
||||
if (range.start.row <= row) {
|
||||
row += range.end.row - range.start.row;
|
||||
}
|
||||
}
|
||||
else if (delta.action == "removeText") {
|
||||
if (range.start.row == row && range.start.column < column) {
|
||||
if (range.end.column >= column)
|
||||
column = range.start.column;
|
||||
else
|
||||
column = Math.max(0, column - (range.end.column - range.start.column));
|
||||
|
||||
} else if (range.start.row !== range.end.row && range.start.row < row) {
|
||||
if (range.end.row == row) {
|
||||
column = Math.max(0, column - range.end.column) + range.start.column;
|
||||
}
|
||||
row -= (range.end.row - range.start.row);
|
||||
}
|
||||
else if (range.end.row == row) {
|
||||
row -= range.end.row - range.start.row;
|
||||
column = Math.max(0, column - range.end.column) + range.start.column;
|
||||
}
|
||||
} else if (delta.action == "removeLines") {
|
||||
if (range.start.row <= row) {
|
||||
if (range.end.row <= row)
|
||||
row -= range.end.row - range.start.row;
|
||||
else {
|
||||
row = range.start.row;
|
||||
column = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.setPosition(row, column);
|
||||
};
|
||||
|
||||
this.setPosition = function(row, column) {
|
||||
pos = this.$clipPositionToDocument(row, column);
|
||||
if (this.row == pos.row && this.column == pos.column)
|
||||
return;
|
||||
|
||||
var old = {
|
||||
row: this.row,
|
||||
column: this.column
|
||||
};
|
||||
|
||||
this.row = pos.row;
|
||||
this.column = pos.column;
|
||||
this._dispatchEvent("change", {
|
||||
old: old,
|
||||
value: pos
|
||||
});
|
||||
};
|
||||
|
||||
this.detach = function() {
|
||||
this.document.removeEventListener("change", this.$onChange);
|
||||
};
|
||||
|
||||
this.$clipPositionToDocument = function(row, column) {
|
||||
var pos = {};
|
||||
|
||||
if (row >= this.document.getLength()) {
|
||||
pos.row = Math.max(0, this.document.getLength() - 1);
|
||||
pos.column = this.document.getLine(pos.row).length;
|
||||
}
|
||||
else if (row < 0) {
|
||||
pos.row = 0;
|
||||
pos.column = 0;
|
||||
}
|
||||
else {
|
||||
pos.row = row;
|
||||
pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
|
||||
}
|
||||
|
||||
if (column < 0)
|
||||
pos.column = 0;
|
||||
|
||||
return pos;
|
||||
};
|
||||
|
||||
}).call(Anchor.prototype);
|
||||
|
||||
});
|
||||
|
|
@ -41,8 +41,7 @@ var oop = require("pilot/oop");
|
|||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
|
||||
var BackgroundTokenizer = function(tokenizer, editor) {
|
||||
this.running = false;
|
||||
this.doc = [];
|
||||
this.running = false;
|
||||
this.lines = [];
|
||||
this.currentLine = 0;
|
||||
this.tokenizer = tokenizer;
|
||||
|
|
@ -134,6 +133,9 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
};
|
||||
|
||||
this.$tokenizeRows = function(firstRow, lastRow) {
|
||||
if (!this.doc)
|
||||
return [];
|
||||
|
||||
var rows = [];
|
||||
|
||||
// determine start state
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** 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
|
||||
|
|
@ -21,6 +22,7 @@
|
|||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
* Mihai Sucan <mihai.sucan@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
|
@ -48,7 +50,7 @@ canon.addCommand({
|
|||
|
||||
canon.addCommand({
|
||||
name: "selectall",
|
||||
exec: function(env, args, request) { env.editor.getSelection().selectAll(); }
|
||||
exec: function(env, args, request) { env.editor.selectAll(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "removeline",
|
||||
|
|
@ -82,6 +84,30 @@ canon.addCommand({
|
|||
env.editor.find(needle);
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "replace",
|
||||
exec: function(env, args, request) {
|
||||
var needle = prompt("Find:");
|
||||
if (!needle)
|
||||
return;
|
||||
var replacement = prompt("Replacement:");
|
||||
if (!replacement)
|
||||
return;
|
||||
env.editor.replace(replacement, {needle: needle});
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "replaceall",
|
||||
exec: function(env, args, request) {
|
||||
var needle = prompt("Find:");
|
||||
if (!needle)
|
||||
return;
|
||||
var replacement = prompt("Replacement:");
|
||||
if (!replacement)
|
||||
return;
|
||||
env.editor.replaceAll(replacement, {needle: needle});
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "undo",
|
||||
exec: function(env, args, request) { env.editor.undo(); }
|
||||
|
|
@ -242,6 +268,22 @@ canon.addCommand({
|
|||
name: "backspace",
|
||||
exec: function(env, args, request) { env.editor.removeLeft(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "removetolinestart",
|
||||
exec: function(env, args, request) { env.editor.removeToLineStart(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "removetolineend",
|
||||
exec: function(env, args, request) { env.editor.removeToLineEnd(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "removewordleft",
|
||||
exec: function(env, args, request) { env.editor.removeWordLeft(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "removewordright",
|
||||
exec: function(env, args, request) { env.editor.removeWordRight(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "outdent",
|
||||
exec: function(env, args, request) { env.editor.blockOutdent(); }
|
||||
|
|
@ -253,9 +295,21 @@ canon.addCommand({
|
|||
canon.addCommand({
|
||||
name: "inserttext",
|
||||
exec: function(env, args, request) {
|
||||
env.editor.insert(lang.stringRepeat(args.text || "",
|
||||
args.times || 1));
|
||||
env.editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
|
||||
}
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "centerselection",
|
||||
exec: function(env, args, request) { env.editor.centerSelection(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "splitline",
|
||||
exec: function(env, args, request) { env.editor.splitLine(); }
|
||||
});
|
||||
canon.addCommand({
|
||||
name: "transposeletters",
|
||||
exec: function(env, args, request) { env.editor.transposeLetters(); }
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,98 +1,154 @@
|
|||
.ace_editor {
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
|
||||
font-family: "Menlo", "Monaco", "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
font-family: "Menlo", "Monaco", "Courier New", monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.ace_scroller {
|
||||
position: absolute;
|
||||
overflow-x: scroll;
|
||||
overflow-y: hidden;
|
||||
position: absolute;
|
||||
overflow-x: scroll;
|
||||
overflow-y: hidden;
|
||||
}
|
||||
|
||||
.ace_content {
|
||||
position: absolute;
|
||||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
}
|
||||
|
||||
.ace_composition {
|
||||
position: absolute;
|
||||
background: #555;
|
||||
color: #DDD;
|
||||
z-index: 4;
|
||||
}
|
||||
|
||||
.ace_gutter {
|
||||
position: absolute;
|
||||
overflow-x: hidden;
|
||||
overflow-y: hidden;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
overflow-x: hidden;
|
||||
overflow-y: hidden;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.ace_gutter-cell.ace_error {
|
||||
background-image: url("data:image/gif,GIF89a%10%00%10%00%D5%00%00%F5or%F5%87%88%F5nr%F4ns%EBmq%F5z%7F%DDJT%DEKS%DFOW%F1Yc%F2ah%CE(7%CE)8%D18E%DD%40M%F2KZ%EBU%60%F4%60m%DCir%C8%16(%C8%19*%CE%255%F1%3FR%F1%3FS%E6%AB%B5%CA%5DI%CEn%5E%F7%A2%9A%C9G%3E%E0a%5B%F7%89%85%F5yy%F6%82%80%ED%82%80%FF%BF%BF%E3%C4%C4%FF%FF%FF%FF%FF%FF%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00!%F9%04%01%00%00%25%00%2C%00%00%00%00%10%00%10%00%00%06p%C0%92pH%2C%1A%8F%C8%D2H%93%E1d4%23%E4%88%D3%09mB%1DN%B48%F5%90%40%60%92G%5B%94%20%3E%22%D2%87%24%FA%20%24%C5%06A%00%20%B1%07%02B%A38%89X.v%17%82%11%13q%10%0Fi%24%0F%8B%10%7BD%12%0Ei%09%92%09%0EpD%18%15%24%0A%9Ci%05%0C%18F%18%0B%07%04%01%04%06%A0H%18%12%0D%14%0D%12%A1I%B3%B4%B5IA%00%3B");
|
||||
background-repeat: no-repeat;
|
||||
background-position: 4px center;
|
||||
}
|
||||
|
||||
.ace_gutter-cell.ace_warning {
|
||||
background-image: url("data:image/gif,GIF89a%10%00%10%00%D5%00%00%FF%DBr%FF%DE%81%FF%E2%8D%FF%E2%8F%FF%E4%96%FF%E3%97%FF%E5%9D%FF%E6%9E%FF%EE%C1%FF%C8Z%FF%CDk%FF%D0s%FF%D4%81%FF%D5%82%FF%D5%83%FF%DC%97%FF%DE%9D%FF%E7%B8%FF%CCl%7BQ%13%80U%15%82W%16%81U%16%89%5B%18%87%5B%18%8C%5E%1A%94d%1D%C5%83-%C9%87%2F%C6%84.%C6%85.%CD%8B2%C9%871%CB%8A3%CD%8B5%DC%98%3F%DF%9BB%E0%9CC%E1%A5U%CB%871%CF%8B5%D1%8D6%DB%97%40%DF%9AB%DD%99B%E3%B0p%E7%CC%AE%FF%FF%FF%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00!%F9%04%01%00%00%2F%00%2C%00%00%00%00%10%00%10%00%00%06a%C0%97pH%2C%1A%8FH%A1%ABTr%25%87%2B%04%82%F4%7C%B9X%91%08%CB%99%1C!%26%13%84*iJ9(%15G%CA%84%14%01%1A%97%0C%03%80%3A%9A%3E%81%84%3E%11%08%B1%8B%20%02%12%0F%18%1A%0F%0A%03'F%1C%04%0B%10%16%18%10%0B%05%1CF%1D-%06%07%9A%9A-%1EG%1B%A0%A1%A0U%A4%A5%A6BA%00%3B");
|
||||
background-repeat: no-repeat;
|
||||
background-position: 4px center;
|
||||
}
|
||||
|
||||
.ace_editor .ace_sb {
|
||||
position: absolute;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
right: 0;
|
||||
position: absolute;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
right: 0;
|
||||
}
|
||||
|
||||
.ace_editor .ace_sb div {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
left: 0px;
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.ace_editor .ace_print_margin_layer {
|
||||
z-index: 0;
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
margin: 0px;
|
||||
left: 0px;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
z-index: 0;
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
margin: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ace_editor .ace_print_margin {
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.ace_editor textarea {
|
||||
position: fixed;
|
||||
z-index: -1;
|
||||
width: 10px;
|
||||
height: 30px;
|
||||
opacity: 0;
|
||||
background: transparent;
|
||||
appearance: none;
|
||||
border: none;
|
||||
resize: none;
|
||||
outline: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.ace_layer {
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
z-index: 1;
|
||||
position: absolute;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ace_text-layer {
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
color: black;
|
||||
font-family: Monaco, "Courier New", monospace;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.ace_cjk {
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ace_cursor-layer {
|
||||
cursor: text;
|
||||
z-index: 4;
|
||||
cursor: text;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.ace_cursor {
|
||||
z-index: 4;
|
||||
position: absolute;
|
||||
z-index: 4;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.ace_line {
|
||||
white-space: nowrap;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ace_marker-layer {
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.ace_marker-layer .ace_step {
|
||||
position: absolute;
|
||||
z-index: 3;
|
||||
position: absolute;
|
||||
z-index: 3;
|
||||
}
|
||||
|
||||
.ace_marker-layer .ace_selection {
|
||||
position: absolute;
|
||||
z-index: 4;
|
||||
position: absolute;
|
||||
z-index: 4;
|
||||
}
|
||||
|
||||
.ace_marker-layer .ace_bracket {
|
||||
position: absolute;
|
||||
z-index: 5;
|
||||
position: absolute;
|
||||
z-index: 5;
|
||||
}
|
||||
|
||||
.ace_marker-layer .ace_active_line {
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
position: absolute;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.ace_marker-layer .ace_selected_word {
|
||||
position: absolute;
|
||||
z-index: 6;
|
||||
box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
}
|
||||
|
|
|
|||
51
lib/ace/defaults.js
Normal file
51
lib/ace/defaults.js
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** 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
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Ajax.org Code Editor (ACE).
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ajax.org B.V.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
var settings = require("ace/settings/default-settings")
|
||||
|
||||
exports.startup = function startup(data, reason) {
|
||||
settings.startup(data, reason)
|
||||
}
|
||||
|
||||
exports.shutdown = function shutdown(data, reason) {
|
||||
settings.shutdown(data, reason)
|
||||
}
|
||||
|
||||
})
|
||||
|
|
@ -40,12 +40,18 @@ define(function(require, exports, module) {
|
|||
var oop = require("pilot/oop");
|
||||
var EventEmitter = require("pilot/event_emitter").EventEmitter;
|
||||
var Range = require("ace/range").Range;
|
||||
var Anchor = require("ace/anchor").Anchor;
|
||||
|
||||
var Document = function(text) {
|
||||
this.$lines = [];
|
||||
|
||||
if (Array.isArray(text)) {
|
||||
this.insertLines(0, text);
|
||||
}
|
||||
// There has to be one line at least in the document. If you pass an empty
|
||||
// string to the insert function, nothing will happen. Workaround.
|
||||
else if (text.length == 0) {
|
||||
this.$lines = [""];
|
||||
} else {
|
||||
this.insert({row: 0, column:0}, text);
|
||||
}
|
||||
|
|
@ -58,15 +64,19 @@ var Document = function(text) {
|
|||
this.setValue = function(text) {
|
||||
var len = this.getLength();
|
||||
this.remove(new Range(0, 0, len, this.getLine(len-1).length));
|
||||
this.insertLines(0, this.$split(text));
|
||||
this.insert({row: 0, column:0}, text);
|
||||
};
|
||||
|
||||
this.getValue = function() {
|
||||
return this.$lines.join(this.getNewLineCharacter());
|
||||
return this.getAllLines().join(this.getNewLineCharacter());
|
||||
};
|
||||
|
||||
this.createAnchor = function(row, column) {
|
||||
return new Anchor(this, row, column);
|
||||
};
|
||||
|
||||
// check for IE split bug
|
||||
if ("aaa".split(/a/).length == 0)
|
||||
if ("aaa".split(/a/).length == 0)
|
||||
this.$split = function(text) {
|
||||
return text.replace(/\r\n|\r/g, "\n").split("\n");
|
||||
}
|
||||
|
|
@ -75,7 +85,7 @@ var Document = function(text) {
|
|||
return text.split(/\r\n|\r|\n/);
|
||||
};
|
||||
|
||||
|
||||
|
||||
this.$detectNewLine = function(text) {
|
||||
var match = text.match(/^.*?(\r?\n)/m);
|
||||
if (match) {
|
||||
|
|
@ -84,7 +94,7 @@ var Document = function(text) {
|
|||
this.$autoNewLine = "\n";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.getNewLineCharacter = function() {
|
||||
switch (this.$newLineMode) {
|
||||
case "windows":
|
||||
|
|
@ -109,28 +119,28 @@ var Document = function(text) {
|
|||
this.getNewLineMode = function() {
|
||||
return this.$newLineMode;
|
||||
};
|
||||
|
||||
|
||||
this.isNewLine = function(text) {
|
||||
return (text == "\r\n" || text == "\r" || text == "\n");
|
||||
};
|
||||
|
||||
/**
|
||||
* Get a verbatim copy of the given line as it is in the document
|
||||
* Get a verbatim copy of the given line as it is in the document
|
||||
*/
|
||||
this.getLine = function(row) {
|
||||
return this.$lines[row] || "";
|
||||
return this.getLines(row, row + 1)[0] || "";
|
||||
};
|
||||
|
||||
|
||||
this.getLines = function(firstRow, lastRow) {
|
||||
return this.$lines.slice(firstRow, lastRow+1);
|
||||
return this.$lines.slice(firstRow, lastRow + 1);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Returns all lines in the document as string array. Warning: The caller
|
||||
* Returns all lines in the document as string array. Warning: The caller
|
||||
* should not modify this array!
|
||||
*/
|
||||
this.getAllLines = function() {
|
||||
return this.$lines;
|
||||
return this.getLines(0, this.getLength());
|
||||
};
|
||||
|
||||
this.getLength = function() {
|
||||
|
|
@ -157,81 +167,74 @@ var Document = function(text) {
|
|||
position.row = Math.max(0, length - 1);
|
||||
position.column = this.getLine(length-1).length;
|
||||
}
|
||||
return position;
|
||||
return position;
|
||||
}
|
||||
|
||||
this.insert = function(position, text) {
|
||||
if (text.length == 0)
|
||||
return position;
|
||||
|
||||
|
||||
position = this.$clipPosition(position);
|
||||
|
||||
|
||||
if (this.getLength() <= 1)
|
||||
this.$detectNewLine(text);
|
||||
|
||||
var newLines = this.$split(text);
|
||||
var lines = this.$split(text);
|
||||
var firstLine = lines.splice(0, 1)[0];
|
||||
var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0];
|
||||
|
||||
if (this.isNewLine(text)) {
|
||||
var end = this.insertNewLine(position);
|
||||
position = this.insertInLine(position, firstLine);
|
||||
if (lastLine !== null) {
|
||||
position = this.insertNewLine(position); // terminate first line
|
||||
position = this.insertLines(position.row, lines);
|
||||
position = this.insertInLine(position, lastLine || "");
|
||||
}
|
||||
else if (newLines.length == 1) {
|
||||
var end = this.insertInLine(position, text);
|
||||
}
|
||||
else {
|
||||
var end = this.insertInLine(position, newLines[0]);
|
||||
this.insertNewLine(end);
|
||||
if (newLines.length > 2)
|
||||
this.insertLines(position.row+1, newLines.slice(1, newLines.length-1));
|
||||
|
||||
var end = this.insertInLine({row: position.row + newLines.length - 1, column: 0}, newLines[newLines.length-1]);
|
||||
}
|
||||
|
||||
return end;
|
||||
return position;
|
||||
};
|
||||
|
||||
|
||||
this.insertLines = function(row, lines) {
|
||||
if (lines.length == 0)
|
||||
return {row: row, column: 0};
|
||||
|
||||
|
||||
var args = [row, 0];
|
||||
args.push.apply(args, lines);
|
||||
this.$lines.splice.apply(this.$lines, args);
|
||||
|
||||
var range = new Range(row, 0, row + lines.length - 1, 0);
|
||||
|
||||
var range = new Range(row, 0, row + lines.length, 0);
|
||||
var delta = {
|
||||
action: "insertLines",
|
||||
range: range,
|
||||
lines: lines
|
||||
};
|
||||
this._dispatchEvent("change", { data: delta });
|
||||
this._dispatchEvent("change", { data: delta });
|
||||
return range.end;
|
||||
},
|
||||
|
||||
|
||||
this.insertNewLine = function(position) {
|
||||
position = this.$clipPosition(position);
|
||||
var line = this.$lines[position.row] || "";
|
||||
this.$lines[position.row] = line.substring(0, position.column);
|
||||
this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length));
|
||||
|
||||
|
||||
var end = {
|
||||
row : position.row + 1,
|
||||
column : 0
|
||||
};
|
||||
|
||||
|
||||
var delta = {
|
||||
action: "insertText",
|
||||
range: Range.fromPoints(position, end),
|
||||
text: this.getNewLineCharacter()
|
||||
};
|
||||
this._dispatchEvent("change", { data: delta });
|
||||
|
||||
|
||||
return end;
|
||||
};
|
||||
|
||||
|
||||
this.insertInLine = function(position, text) {
|
||||
if (text.length == 0)
|
||||
return position;
|
||||
|
||||
|
||||
var line = this.$lines[position.row] || "";
|
||||
this.$lines[position.row] = line.substring(0, position.column) + text
|
||||
+ line.substring(position.column);
|
||||
|
|
@ -240,14 +243,14 @@ var Document = function(text) {
|
|||
row : position.row,
|
||||
column : position.column + text.length
|
||||
};
|
||||
|
||||
|
||||
var delta = {
|
||||
action: "insertText",
|
||||
range: Range.fromPoints(position, end),
|
||||
text: text
|
||||
};
|
||||
this._dispatchEvent("change", { data: delta });
|
||||
|
||||
|
||||
return end;
|
||||
};
|
||||
|
||||
|
|
@ -258,35 +261,41 @@ var Document = function(text) {
|
|||
|
||||
if (range.isEmpty())
|
||||
return range.start;
|
||||
|
||||
|
||||
var firstRow = range.start.row;
|
||||
var lastRow = range.end.row;
|
||||
|
||||
if (range.isMultiLine()) {
|
||||
|
||||
// TODO removeInLine can be optimized away!
|
||||
this.removeInLine(lastRow, 0, range.end.column);
|
||||
if (lastRow - firstRow >= 2)
|
||||
this.removeLines(firstRow + 1, lastRow - 1);
|
||||
this.removeInLine(firstRow, range.start.column, this.$lines[firstRow].length);
|
||||
this.removeNewLine(range.start.row);
|
||||
var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1;
|
||||
var lastFullRow = lastRow - 1;
|
||||
|
||||
if (range.end.column > 0)
|
||||
this.removeInLine(lastRow, 0, range.end.column);
|
||||
|
||||
if (lastFullRow >= firstFullRow)
|
||||
this.removeLines(firstFullRow, lastFullRow);
|
||||
|
||||
if (firstFullRow != firstRow) {
|
||||
this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);
|
||||
this.removeNewLine(range.start.row);
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.removeInLine(firstRow, range.start.column, range.end.column);
|
||||
}
|
||||
return range.start;
|
||||
};
|
||||
|
||||
|
||||
this.removeInLine = function(row, startColumn, endColumn) {
|
||||
if (startColumn == endColumn)
|
||||
return;
|
||||
|
||||
|
||||
var range = new Range(row, startColumn, row, endColumn);
|
||||
var line = this.getLine(row);
|
||||
var removed = line.substring(startColumn, endColumn);
|
||||
var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length);
|
||||
this.$lines.splice(row, 1, newLine);
|
||||
|
||||
|
||||
var delta = {
|
||||
action: "removeText",
|
||||
range: range,
|
||||
|
|
@ -295,18 +304,18 @@ var Document = function(text) {
|
|||
this._dispatchEvent("change", { data: delta });
|
||||
return range.start;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Removes a range of full lines
|
||||
*
|
||||
*
|
||||
* @param firstRow {Integer} The first row to be removed
|
||||
* @param lastRow {Integer} The last row to be removed
|
||||
* @return {String[]} The removed lines
|
||||
*/
|
||||
this.removeLines = function(firstRow, lastRow) {
|
||||
var range = new Range(firstRow, 0, lastRow, this.$lines[lastRow].length);
|
||||
var range = new Range(firstRow, 0, lastRow + 1, 0);
|
||||
var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
|
||||
|
||||
|
||||
var delta = {
|
||||
action: "removeLines",
|
||||
range: range,
|
||||
|
|
@ -316,16 +325,16 @@ var Document = function(text) {
|
|||
this._dispatchEvent("change", { data: delta });
|
||||
return removed;
|
||||
};
|
||||
|
||||
|
||||
this.removeNewLine = function(row) {
|
||||
var firstLine = this.getLine(row);
|
||||
var secondLine = this.getLine(row+1);
|
||||
|
||||
|
||||
var range = new Range(row, firstLine.length, row+1, 0);
|
||||
var line = firstLine + secondLine;
|
||||
|
||||
|
||||
this.$lines.splice(row, 2, line);
|
||||
|
||||
|
||||
var delta = {
|
||||
action: "removeText",
|
||||
range: range,
|
||||
|
|
@ -333,16 +342,16 @@ var Document = function(text) {
|
|||
};
|
||||
this._dispatchEvent("change", { data: delta });
|
||||
};
|
||||
|
||||
|
||||
this.replace = function(range, text) {
|
||||
if (text.length == 0 && range.isEmpty())
|
||||
return range.start;
|
||||
|
||||
|
||||
// Shortcut: If the text we want to insert is the same as it is already
|
||||
// in the document, we don't have to replace anything.
|
||||
if (text == this.getTextRange(range))
|
||||
return range.end;
|
||||
|
||||
|
||||
this.remove(range);
|
||||
if (text) {
|
||||
var end = this.insert(range.start, text);
|
||||
|
|
@ -350,40 +359,40 @@ var Document = function(text) {
|
|||
else {
|
||||
end = range.start;
|
||||
}
|
||||
|
||||
|
||||
return end;
|
||||
};
|
||||
|
||||
|
||||
this.applyDeltas = function(deltas) {
|
||||
for (var i=0; i<deltas.length; i++) {
|
||||
var delta = deltas[i];
|
||||
var range = Range.fromPoints(delta.range.start, delta.range.end);
|
||||
|
||||
|
||||
if (delta.action == "insertLines")
|
||||
this.insertLines(range.start.row, delta.lines)
|
||||
else if (delta.action == "insertText")
|
||||
this.insert(range.start, delta.text)
|
||||
else if (delta.action == "removeLines")
|
||||
this.removeLines(range.start.row, range.end.row)
|
||||
this.removeLines(range.start.row, range.end.row - 1)
|
||||
else if (delta.action == "removeText")
|
||||
this.remove(range)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
this.revertDeltas = function(deltas) {
|
||||
for (var i=deltas.length-1; i>=0; i--) {
|
||||
var delta = deltas[i];
|
||||
var range = Range.fromPoints(delta.range.start, delta.range.end);
|
||||
|
||||
|
||||
if (delta.action == "insertLines")
|
||||
this.removeLines(range.start.row, range.end.row)
|
||||
this.removeLines(range.start.row, range.end.row - 1)
|
||||
else if (delta.action == "insertText")
|
||||
this.remove(range)
|
||||
else if (delta.action == "removeLines")
|
||||
this.insertLines(range.start.row, delta.lines)
|
||||
else if (delta.action == "removeText")
|
||||
this.insert(range.start, delta.text)
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}).call(Document.prototype);
|
||||
|
|
|
|||
|
|
@ -45,23 +45,23 @@ var TextMode = require("ace/mode/text").Mode;
|
|||
var Range = require("ace/range").Range;
|
||||
var Document = require("ace/document").Document;
|
||||
|
||||
var NO_CHANGE_DELTAS = {};
|
||||
|
||||
var EditSession = function(text, mode) {
|
||||
this.$modified = true;
|
||||
this.selection = new Selection(this);
|
||||
this.$breakpoints = [];
|
||||
|
||||
this.listeners = [];
|
||||
if (mode) {
|
||||
this.setMode(mode);
|
||||
}
|
||||
this.$frontMarkers = {};
|
||||
this.$backMarkers = {};
|
||||
this.$markerId = 1;
|
||||
this.$wrapData = [];
|
||||
|
||||
if (text instanceof Document) {
|
||||
this.setDocument(text);
|
||||
} else {
|
||||
this.setDocument(new Document(text));
|
||||
}
|
||||
|
||||
this.selection = new Selection(this);
|
||||
if (mode)
|
||||
this.setMode(mode);
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -88,12 +88,15 @@ var EditSession = function(text, mode) {
|
|||
this.$deltas.push(delta);
|
||||
this.$informUndoManager.schedule();
|
||||
}
|
||||
|
||||
this.$updateWrapDataOnChange(e);
|
||||
this._dispatchEvent("change", e);
|
||||
};
|
||||
|
||||
this.setValue = function(text) {
|
||||
this.doc.setValue(text);
|
||||
this.$deltas = [];
|
||||
this.doc.setValue(text);
|
||||
this.$deltas = [];
|
||||
this.$undoManager.reset();
|
||||
};
|
||||
|
||||
this.getValue =
|
||||
|
|
@ -128,7 +131,8 @@ var EditSession = function(text, mode) {
|
|||
|
||||
this.$defaultUndoManager = {
|
||||
undo: function() {},
|
||||
redo: function() {}
|
||||
redo: function() {},
|
||||
reset: function() {}
|
||||
};
|
||||
|
||||
this.getUndoManager = function() {
|
||||
|
|
@ -198,6 +202,79 @@ var EditSession = function(text, mode) {
|
|||
this._dispatchEvent("changeBreakpoint", {});
|
||||
};
|
||||
|
||||
this.getBreakpoints = function() {
|
||||
return this.$breakpoints;
|
||||
};
|
||||
|
||||
this.addMarker = function(range, clazz, type, inFront) {
|
||||
var id = this.$markerId++;
|
||||
|
||||
var marker = {
|
||||
range : range,
|
||||
type : type || "line",
|
||||
renderer: typeof type == "function" ? type : null,
|
||||
clazz : clazz,
|
||||
inFront: !!inFront
|
||||
}
|
||||
|
||||
if (inFront) {
|
||||
this.$frontMarkers[id] = marker;
|
||||
this._dispatchEvent("changeFrontMarker")
|
||||
} else {
|
||||
this.$backMarkers[id] = marker;
|
||||
this._dispatchEvent("changeBackMarker")
|
||||
}
|
||||
|
||||
return id;
|
||||
};
|
||||
|
||||
this.removeMarker = function(markerId) {
|
||||
var marker = this.$frontMarkers[markerId] || this.$backMarkers[markerId];
|
||||
if (!marker)
|
||||
return;
|
||||
|
||||
var markers = marker.inFront ? this.$frontMarkers : this.$backMarkers;
|
||||
if (marker) {
|
||||
delete (markers[markerId]);
|
||||
this._dispatchEvent(marker.inFront ? "changeFrontMarker" : "changeBackMarker");
|
||||
}
|
||||
};
|
||||
|
||||
this.getMarkers = function(inFront) {
|
||||
return inFront ? this.$frontMarkers : this.$backMarkers;
|
||||
};
|
||||
|
||||
/**
|
||||
* Error:
|
||||
* {
|
||||
* row: 12,
|
||||
* column: 2, //can be undefined
|
||||
* text: "Missing argument",
|
||||
* type: "error" // or "warning" or "info"
|
||||
* }
|
||||
*/
|
||||
this.setAnnotations = function(annotations) {
|
||||
this.$annotations = {};
|
||||
for (var i=0; i<annotations.length; i++) {
|
||||
var annotation = annotations[i];
|
||||
var row = annotation.row;
|
||||
if (this.$annotations[row])
|
||||
this.$annotations[row].push(annotation);
|
||||
else
|
||||
this.$annotations[row] = [annotation];
|
||||
}
|
||||
this._dispatchEvent("changeAnnotation", {});
|
||||
};
|
||||
|
||||
this.getAnnotations = function() {
|
||||
return this.$annotations;
|
||||
};
|
||||
|
||||
this.clearAnnotations = function() {
|
||||
this.$annotations = {};
|
||||
this._dispatchEvent("changeAnnotation", {});
|
||||
};
|
||||
|
||||
this.$detectNewLine = function(text) {
|
||||
var match = text.match(/^.*?(\r?\n)/m);
|
||||
if (match) {
|
||||
|
|
@ -208,7 +285,7 @@ var EditSession = function(text, mode) {
|
|||
};
|
||||
|
||||
this.tokenRe = /^[\w\d]+/g;
|
||||
this.nonTokenRe = /^[^\w\d]+/g;
|
||||
this.nonTokenRe = /^(?:[^\w\d]|[\u3040-\u309F]|[\u30A0-\u30FF]|[\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF])+/g;
|
||||
|
||||
this.getWordRange = function(row, column) {
|
||||
var line = this.getLine(row);
|
||||
|
|
@ -253,6 +330,14 @@ var EditSession = function(text, mode) {
|
|||
this.setMode = function(mode) {
|
||||
if (this.$mode === mode) return;
|
||||
|
||||
if (this.$worker)
|
||||
this.$worker.terminate();
|
||||
|
||||
if (window.Worker && !require.noWorker)
|
||||
this.$worker = mode.createWorker(this);
|
||||
else
|
||||
this.$worker = null;
|
||||
|
||||
this.$mode = mode;
|
||||
this._dispatchEvent("changeMode");
|
||||
};
|
||||
|
|
@ -286,8 +371,8 @@ var EditSession = function(text, mode) {
|
|||
return this.screenWidth;
|
||||
};
|
||||
|
||||
this.$computeWidth = function() {
|
||||
if (this.$modified) {
|
||||
this.$computeWidth = function(force) {
|
||||
if (this.$modified || force) {
|
||||
this.$modified = false;
|
||||
|
||||
var lines = this.doc.getAllLines();
|
||||
|
|
@ -306,7 +391,12 @@ var EditSession = function(text, mode) {
|
|||
longestScreenLine = Math.max(longestScreenLine, len);
|
||||
}
|
||||
this.width = longestLine;
|
||||
this.screenWidth = longestScreenLine;
|
||||
|
||||
if (this.$useWrapMode) {
|
||||
this.screenWidth = this.$wrapLimit;
|
||||
} else {
|
||||
this.screenWidth = longestScreenLine;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -433,52 +523,10 @@ var EditSession = function(text, mode) {
|
|||
return this.doc.insert(position, text);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param rows Array[Integer] sorted list of rows
|
||||
*/
|
||||
this.multiRowInsert = function(rows, column, text) {
|
||||
for (var i=rows.length-1; i>=0; i--) {
|
||||
var row = rows[i];
|
||||
if (row >= this.doc.getLength())
|
||||
continue;
|
||||
|
||||
var diff = column - this.doc.getLine(row).length;
|
||||
if ( diff > 0) {
|
||||
var padded = lang.stringRepeat(" ", diff) + text;
|
||||
var offset = -diff;
|
||||
}
|
||||
else {
|
||||
padded = text;
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
var end = this.insert({row: row, column: column+offset}, padded);
|
||||
}
|
||||
|
||||
return {
|
||||
rows: end ? end.row - rows[0] : 0,
|
||||
columns: end ? end.column - column : 0
|
||||
};
|
||||
};
|
||||
|
||||
this.remove = function(range) {
|
||||
return this.doc.remove(range);
|
||||
};
|
||||
|
||||
this.multiRowRemove = function(rows, range) {
|
||||
if (range.start.row !== rows[0])
|
||||
throw new TypeError("range must start in the first row!");
|
||||
|
||||
var height = range.end.row - rows[0];
|
||||
for (var i=rows.length-1; i>=0; i--) {
|
||||
var row = rows[i];
|
||||
if (row >= this.doc.getLength())
|
||||
continue;
|
||||
|
||||
var end = this.remove(new Range(row, range.start.column, row+height, range.end.column));
|
||||
}
|
||||
};
|
||||
|
||||
this.undoChanges = function(deltas) {
|
||||
if (!deltas.length)
|
||||
return;
|
||||
|
|
@ -487,15 +535,7 @@ var EditSession = function(text, mode) {
|
|||
this.doc.revertDeltas(deltas);
|
||||
this.$fromUndo = false;
|
||||
|
||||
// update the selection
|
||||
var firstDelta = deltas[0];
|
||||
var lastDelta = deltas[deltas.length-1];
|
||||
|
||||
this.selection.clearSelection();
|
||||
if (firstDelta.action == "insertText" || firstDelta.action == "insertLines")
|
||||
this.selection.moveCursorToPosition(firstDelta.range.start);
|
||||
if (firstDelta.action == "removeText" || firstDelta.action == "removeLines")
|
||||
this.selection.setSelectionRange(Range.fromPoints(firstDelta.range.start, lastDelta.range.end));
|
||||
this.$setUndoSelection(deltas, true);
|
||||
},
|
||||
|
||||
this.redoChanges = function(deltas) {
|
||||
|
|
@ -506,15 +546,53 @@ var EditSession = function(text, mode) {
|
|||
this.doc.applyDeltas(deltas);
|
||||
this.$fromUndo = false;
|
||||
|
||||
// update the selection
|
||||
var firstDelta = deltas[0];
|
||||
var lastDelta = deltas[deltas.length-1];
|
||||
this.$setUndoSelection(deltas, false);
|
||||
},
|
||||
|
||||
this.$setUndoSelection = function(deltas, isUndo) {
|
||||
// invert deltas is they are an undo
|
||||
if (isUndo)
|
||||
deltas = deltas.map(function(delta) {
|
||||
var d = {
|
||||
range: delta.range
|
||||
}
|
||||
if (delta.action == "insertText" || delta.action == "insertLines")
|
||||
d.action = "removeText"
|
||||
else
|
||||
d.action = "insertText"
|
||||
return d;
|
||||
}).reverse();
|
||||
|
||||
|
||||
var actions = [{}];
|
||||
|
||||
// collapse insert and remove operations
|
||||
for (var i=0; i<deltas.length; i++) {
|
||||
var delta = deltas[i];
|
||||
var isInsert = delta.action == "insertText" || delta.action == "insertLines";
|
||||
var action = actions[actions.length-1];
|
||||
if (action.isInsert !== isInsert) {
|
||||
actions.push({
|
||||
isInsert: isInsert,
|
||||
start: isInsert ? delta.range.start : delta.range.end,
|
||||
end: isInsert ? delta.range.end : delta.range.start
|
||||
})
|
||||
}
|
||||
else {
|
||||
if (isInsert)
|
||||
action.end = delta.range.end;
|
||||
else
|
||||
action.start = delta.range.start;
|
||||
}
|
||||
}
|
||||
|
||||
// update selection based on last operation
|
||||
this.selection.clearSelection();
|
||||
if (firstDelta.action == "insertText" ||firstDelta.action == "insertLines")
|
||||
this.selection.setSelectionRange(Range.fromPoints(firstDelta.range.start, lastDelta.range.end));
|
||||
if (firstDelta.action == "removeText" ||firstDelta.action == "removeLines")
|
||||
this.selection.moveCursorToPosition(firstDelta.range.start);
|
||||
var action = actions[actions.length-1];
|
||||
if (action.isInsert)
|
||||
this.selection.setSelectionRange(Range.fromPoints(action.start, action.end));
|
||||
else
|
||||
this.selection.moveCursorToPosition(action.end);
|
||||
},
|
||||
|
||||
this.replace = function(range, text) {
|
||||
|
|
@ -526,7 +604,6 @@ var EditSession = function(text, mode) {
|
|||
for (var row=startRow; row<=endRow; row++) {
|
||||
this.insert({row: row, column:0}, indentString);
|
||||
}
|
||||
return indentString.length;
|
||||
};
|
||||
|
||||
this.outdentRows = function (range) {
|
||||
|
|
@ -549,13 +626,8 @@ var EditSession = function(text, mode) {
|
|||
deleteRange.start.column = 0;
|
||||
deleteRange.end.column = j;
|
||||
}
|
||||
if (i == range.start.row)
|
||||
range.start.column -= deleteRange.end.column - deleteRange.start.column;
|
||||
if (i == range.end.row)
|
||||
range.end.column -= deleteRange.end.column - deleteRange.start.column;
|
||||
this.remove(deleteRange);
|
||||
}
|
||||
return range;
|
||||
};
|
||||
|
||||
this.moveLinesUp = function(firstRow, lastRow) {
|
||||
|
|
@ -589,53 +661,563 @@ var EditSession = function(text, mode) {
|
|||
return Math.max(0, Math.min(row, this.doc.getLength()-1));
|
||||
};
|
||||
|
||||
this.documentToScreenColumn = function(row, docColumn) {
|
||||
// WRAPMODE
|
||||
this.$wrapLimit = 80;
|
||||
this.$useWrapMode = false;
|
||||
this.$wrapLimitRange = {
|
||||
min : null,
|
||||
max : null
|
||||
};
|
||||
|
||||
this.setUseWrapMode = function(useWrapMode) {
|
||||
if (useWrapMode != this.$useWrapMode) {
|
||||
this.$useWrapMode = useWrapMode;
|
||||
this.$modified = true;
|
||||
|
||||
// If wrapMode is activaed, the wrapData array has to be initialized.
|
||||
if (useWrapMode) {
|
||||
var len = this.getLength();
|
||||
this.$wrapData = [];
|
||||
for (i = 0; i < len; i++) {
|
||||
this.$wrapData.push([]);
|
||||
}
|
||||
this.$updateWrapData(0, len - 1);
|
||||
}
|
||||
|
||||
this._dispatchEvent("changeWrapMode");
|
||||
}
|
||||
};
|
||||
|
||||
this.getUseWrapMode = function() {
|
||||
return this.$useWrapMode;
|
||||
};
|
||||
|
||||
// Allow the wrap limit to move freely between min and max. Either
|
||||
// parameter can be null to allow the wrap limit to be unconstrained
|
||||
// in that direction. Or set both parameters to the same number to pin
|
||||
// the limit to that value.
|
||||
this.setWrapLimitRange = function(min, max) {
|
||||
if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {
|
||||
this.$wrapLimitRange.min = min;
|
||||
this.$wrapLimitRange.max = max;
|
||||
this.$modified = true;
|
||||
// This will force a recalculation of the wrap limit
|
||||
this._dispatchEvent("changeWrapMode");
|
||||
}
|
||||
};
|
||||
|
||||
// This should generally only be called by the renderer when a resize
|
||||
// is detected.
|
||||
this.adjustWrapLimit = function(desiredLimit) {
|
||||
var wrapLimit = this.$constrainWrapLimit(desiredLimit);
|
||||
if (wrapLimit != this.$wrapLimit && wrapLimit > 0) {
|
||||
this.$wrapLimit = wrapLimit;
|
||||
this.$modified = true;
|
||||
if (this.$useWrapMode) {
|
||||
this.$updateWrapData(0, this.getLength() - 1);
|
||||
this._dispatchEvent("changeWrapLimit");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
this.$constrainWrapLimit = function(wrapLimit) {
|
||||
var min = this.$wrapLimitRange.min;
|
||||
if (min)
|
||||
wrapLimit = Math.max(min, wrapLimit);
|
||||
|
||||
var max = this.$wrapLimitRange.max;
|
||||
if (max)
|
||||
wrapLimit = Math.min(max, wrapLimit);
|
||||
|
||||
// What would a limit of 0 even mean?
|
||||
return Math.max(1, wrapLimit);
|
||||
};
|
||||
|
||||
this.getWrapLimit = function() {
|
||||
return this.$wrapLimit;
|
||||
};
|
||||
|
||||
this.getWrapLimitRange = function() {
|
||||
// Avoid unexpected mutation by returning a copy
|
||||
return {
|
||||
min : this.$wrapLimitRange.min,
|
||||
max : this.$wrapLimitRange.max
|
||||
};
|
||||
};
|
||||
|
||||
this.$updateWrapDataOnChange = function(e) {
|
||||
if (!this.$useWrapMode) {
|
||||
return;
|
||||
}
|
||||
|
||||
var len;
|
||||
var action = e.data.action;
|
||||
var firstRow = e.data.range.start.row,
|
||||
lastRow = e.data.range.end.row;
|
||||
|
||||
if (action.indexOf("Lines") != -1) {
|
||||
if (action == "insertLines") {
|
||||
lastRow = firstRow + (e.data.lines.length);
|
||||
} else {
|
||||
lastRow = firstRow;
|
||||
}
|
||||
len = e.data.lines.length;
|
||||
} else {
|
||||
len = lastRow - firstRow;
|
||||
}
|
||||
|
||||
if (len != 0) {
|
||||
if (action.indexOf("remove") != -1) {
|
||||
this.$wrapData.splice(firstRow, len);
|
||||
lastRow = firstRow;
|
||||
} else {
|
||||
var args = [firstRow, 0];
|
||||
for (var i = 0; i < len; i++) args.push([]);
|
||||
this.$wrapData.splice.apply(this.$wrapData, args);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.$wrapData.length != this.doc.$lines.length) {
|
||||
console.error("The length of doc.$lines and $wrapData have to be the same!");
|
||||
}
|
||||
|
||||
this.$updateWrapData(firstRow, lastRow);
|
||||
};
|
||||
|
||||
this.$updateWrapData = function(firstRow, lastRow) {
|
||||
var lines = this.doc.getAllLines();
|
||||
var tabSize = this.getTabSize();
|
||||
var wrapData = this.$wrapData;
|
||||
var wrapLimit = this.$wrapLimit;
|
||||
|
||||
for (var row = firstRow; row <= lastRow; row++) {
|
||||
wrapData[row] =
|
||||
this.$computeWrapSplits(lines[row], wrapLimit, tabSize);
|
||||
}
|
||||
};
|
||||
|
||||
// "Tokens"
|
||||
var CHAR = 1,
|
||||
CHAR_EXT = 2,
|
||||
SPACE = 3,
|
||||
TAB = 4,
|
||||
TAB_SPACE = 5;
|
||||
|
||||
this.$computeWrapSplits = function(textLine, wrapLimit, tabSize) {
|
||||
textLine = textLine.trimRight();
|
||||
if (textLine.length == 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
var tabSize = this.getTabSize();
|
||||
var splits = [];
|
||||
var tokens = this.$getDisplayTokens(textLine);
|
||||
var displayLength = tokens.length;
|
||||
var lastSplit = 0, lastDocSplit = 0;
|
||||
|
||||
function addSplit(screenPos) {
|
||||
var displayed = tokens.slice(lastSplit, screenPos);
|
||||
|
||||
// The document size is the current size - the extra width for tabs
|
||||
// and multipleWidth characters.
|
||||
var len = displayed.length;
|
||||
displayed.join("").
|
||||
// Get all the tabs.
|
||||
replace(/4/g, function(m) {
|
||||
len -= tabSize - 1;
|
||||
}).
|
||||
// Get all the multipleWidth characters.
|
||||
replace(/2/g, function(m) {
|
||||
len -= 1;
|
||||
});
|
||||
|
||||
lastDocSplit += len;
|
||||
splits.push(lastDocSplit);
|
||||
lastSplit = screenPos;
|
||||
}
|
||||
|
||||
while (displayLength - lastSplit > wrapLimit) {
|
||||
// This is, where the split should be.
|
||||
var split = lastSplit + wrapLimit;
|
||||
|
||||
// If there is a space or tab at this split position.
|
||||
if (tokens[split] >= SPACE) {
|
||||
// Include all following spaces + tabs in this split as well.
|
||||
while (tokens[split] >= SPACE) {
|
||||
split ++;
|
||||
}
|
||||
addSplit(split);
|
||||
} else {
|
||||
// Search for the first non space/tab token.
|
||||
for (split; split != lastSplit - 1; split--) {
|
||||
if (tokens[split] >= SPACE) {
|
||||
split++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If we found one, then add the split.
|
||||
if (split > lastSplit) {
|
||||
addSplit(split);
|
||||
}
|
||||
// No space or tab around? Well, force a split then.
|
||||
else {
|
||||
addSplit(lastSplit + wrapLimit);
|
||||
}
|
||||
}
|
||||
}
|
||||
return splits;
|
||||
}
|
||||
|
||||
this.$getDisplayTokens = function(str) {
|
||||
var arr = [];
|
||||
var tabSize = this.getTabSize();
|
||||
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
var c = str.charCodeAt(i);
|
||||
// Tab
|
||||
if (c == 9) {
|
||||
arr.push(TAB);
|
||||
for (var n = 1; n < tabSize; n++) {
|
||||
arr.push(TAB_SPACE);
|
||||
}
|
||||
}
|
||||
// Space
|
||||
else if(c == 32) {
|
||||
arr.push(SPACE);
|
||||
}
|
||||
// CJK characters
|
||||
else if (
|
||||
c >= 0x3040 && c <= 0x309F || // Hiragana
|
||||
c >= 0x30A0 && c <= 0x30FF || // Katakana
|
||||
c >= 0x4E00 && c <= 0x9FFF || // Single CJK ideographs
|
||||
c >= 0xF900 && c <= 0xFAFF ||
|
||||
c >= 0x3400 && c <= 0x4DBF
|
||||
) {
|
||||
arr.push(CHAR, CHAR_EXT);
|
||||
} else {
|
||||
arr.push(CHAR);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the width of the a string on the screen while assuming that
|
||||
* the string starts at the first column on the screen.
|
||||
*
|
||||
* @param string str String to calculate the screen width of
|
||||
* @return int number of columns for str on screen.
|
||||
*/
|
||||
this.$getStringScreenWidth = function(str) {
|
||||
var screenColumn = 0;
|
||||
var remaining = docColumn;
|
||||
|
||||
var line = this.getLine(row).split("\t");
|
||||
for (var i=0; i<line.length; i++) {
|
||||
var len = line[i].length;
|
||||
if (remaining > len) {
|
||||
remaining -= (len + 1);
|
||||
screenColumn += len + tabSize;
|
||||
}
|
||||
else {
|
||||
screenColumn += remaining;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return screenColumn;
|
||||
};
|
||||
|
||||
this.screenToDocumentColumn = function(row, screenColumn) {
|
||||
var tabSize = this.getTabSize();
|
||||
|
||||
var docColumn = 0;
|
||||
var remaining = screenColumn;
|
||||
for (var i=0; i<str.length; i++) {
|
||||
var c = str.charCodeAt(i);
|
||||
// tab
|
||||
if (c == 9) {
|
||||
screenColumn += tabSize;
|
||||
}
|
||||
// CJK characters
|
||||
else if (
|
||||
c >= 0x3040 && c <= 0x309F || // Hiragana
|
||||
c >= 0x30A0 && c <= 0x30FF || // Katakana
|
||||
c >= 0x4E00 && c <= 0x9FFF || // Single CJK ideographs
|
||||
c >= 0xF900 && c <= 0xFAFF ||
|
||||
c >= 0x3400 && c <= 0x4DBF
|
||||
) {
|
||||
screenColumn += 2;
|
||||
} else {
|
||||
screenColumn += 1;
|
||||
}
|
||||
}
|
||||
|
||||
var line = this.getLine(row).split("\t");
|
||||
for (var i=0; i<line.length; i++) {
|
||||
var len = line[i].length;
|
||||
if (remaining >= len + tabSize) {
|
||||
remaining -= (len + tabSize);
|
||||
docColumn += (len + 1);
|
||||
return screenColumn;
|
||||
}
|
||||
|
||||
this.getRowHeight = function(config, row) {
|
||||
var rows;
|
||||
if (!this.$useWrapMode || !this.$wrapData[row]) {
|
||||
rows = 1;
|
||||
} else {
|
||||
rows = this.$wrapData[row].length + 1;
|
||||
}
|
||||
|
||||
return rows * config.lineHeight;
|
||||
}
|
||||
|
||||
this.getScreenLastRowColumn = function(screenRow, returnDocPosition) {
|
||||
if (!this.$useWrapMode) {
|
||||
return this.$getStringScreenWidth(this.getLine(screenRow));
|
||||
}
|
||||
|
||||
var rowData = this.$screenToDocumentRow(screenRow);
|
||||
var docRow = rowData[0],
|
||||
row = rowData[1];
|
||||
|
||||
var start, end;
|
||||
if (this.$wrapData[docRow][row]) {
|
||||
start = (this.$wrapData[docRow][row - 1] || 0);
|
||||
end = this.$wrapData[docRow][row];
|
||||
returnDocPosition && end--;
|
||||
} else {
|
||||
end = this.getLine(docRow).length;
|
||||
start = (this.$wrapData[docRow][row - 1] || 0);
|
||||
}
|
||||
if (!returnDocPosition) {
|
||||
return this.$getStringScreenWidth(this.getLine(docRow).substring(start, end));
|
||||
} else {
|
||||
return end;
|
||||
}
|
||||
};
|
||||
|
||||
this.getDocumentLastRowColumn = function(docRow, docColumn) {
|
||||
if (!this.$useWrapMode) {
|
||||
return this.getLine(docRow).length;
|
||||
}
|
||||
|
||||
var screenRow = this.documentToScreenRow(docRow, docColumn);
|
||||
return this.getScreenLastRowColumn(screenRow, true);
|
||||
}
|
||||
|
||||
this.getScreenFirstRowColumn = function(screenRow) {
|
||||
if (!this.$useWrapMode) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
var rowData = this.$screenToDocumentRow(screenRow);
|
||||
var docRow = rowData[0],
|
||||
row = rowData[1];
|
||||
|
||||
return this.$wrapData[docRow][row - 1] || 0;
|
||||
};
|
||||
|
||||
this.getRowSplitData = function(row) {
|
||||
if (!this.$useWrapMode) {
|
||||
return undefined;
|
||||
} else {
|
||||
return this.$wrapData[row];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns array
|
||||
* - array[0]: The documentRow equivalent.
|
||||
* - array[1]: The screenRowOffset to the first documentRow on the screen.
|
||||
*/
|
||||
this.$screenToDocumentRow = function(row) {
|
||||
if (!this.$useWrapMode) {
|
||||
return [row, 0];
|
||||
}
|
||||
|
||||
var wrapData = this.$wrapData, linesCount = this.getLength();
|
||||
var docRow = 0;
|
||||
while (docRow < linesCount && row >= wrapData[docRow].length + 1) {
|
||||
row -= wrapData[docRow].length + 1;
|
||||
docRow ++;
|
||||
}
|
||||
|
||||
return [docRow, row];
|
||||
};
|
||||
|
||||
this.screenToDocumentRow = function(screenRow) {
|
||||
return this.$screenToDocumentRow(screenRow)[0];
|
||||
};
|
||||
|
||||
this.screenToDocumentColumn = function(screenRow, screenColumn) {
|
||||
return this.screenToDocumentPosition(screenRow, screenColumn).column;
|
||||
};
|
||||
|
||||
this.screenToDocumentPosition = function(row, column) {
|
||||
var line;
|
||||
var docRow;
|
||||
var docColumn;
|
||||
var remaining = column;
|
||||
var linesCount = this.getLength();
|
||||
if (!this.$useWrapMode) {
|
||||
docRow = row >= linesCount? linesCount-1 : (row < 0 ? 0 : row);
|
||||
row = 0;
|
||||
docColumn = 0;
|
||||
line = this.getLine(docRow);
|
||||
} else {
|
||||
var wrapData = this.$wrapData;
|
||||
|
||||
var docRow = 0;
|
||||
while (docRow < linesCount && row >= wrapData[docRow].length + 1) {
|
||||
row -= wrapData[docRow].length + 1;
|
||||
docRow ++;
|
||||
}
|
||||
|
||||
if (docRow >= linesCount) {
|
||||
docRow = linesCount-1
|
||||
row = wrapData[docRow].length;
|
||||
}
|
||||
else if (remaining > len){
|
||||
docColumn += len;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
docColumn += remaining;
|
||||
docColumn = wrapData[docRow][row - 1] || 0;
|
||||
line = this.getLine(docRow).substring(docColumn);
|
||||
}
|
||||
|
||||
var tabSize = this.getTabSize();
|
||||
for(var i = 0; i < line.length; i++) {
|
||||
var c = line.charCodeAt(i);
|
||||
|
||||
if (remaining > 0) {
|
||||
docColumn += 1;
|
||||
// tab
|
||||
if (c == 9) {
|
||||
if (remaining >= tabSize) {
|
||||
remaining -= tabSize;
|
||||
} else {
|
||||
remaining = 0;
|
||||
docColumn -= 1;
|
||||
}
|
||||
}
|
||||
// CJK characters
|
||||
else if (
|
||||
c >= 0x3040 && c <= 0x309F || // Hiragana
|
||||
c >= 0x30A0 && c <= 0x30FF || // Katakana
|
||||
c >= 0x4E00 && c <= 0x9FFF || // Single CJK ideographs
|
||||
c >= 0xF900 && c <= 0xFAFF ||
|
||||
c >= 0x3400 && c <= 0x4DBF
|
||||
) {
|
||||
if (remaining >= 2) {
|
||||
remaining -= 2;
|
||||
} else {
|
||||
remaining = 0;
|
||||
docColumn -= 1;
|
||||
}
|
||||
} else {
|
||||
remaining -= 1;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return docColumn;
|
||||
|
||||
// Clamp docColumn.
|
||||
if (this.$useWrapMode) {
|
||||
column = wrapData[docRow][row]
|
||||
if (docColumn >= column) {
|
||||
// We remove one character at the end such that the docColumn
|
||||
// position returned is not associated to the next row on the
|
||||
// screen.
|
||||
docColumn = column - 1;
|
||||
}
|
||||
} else if (line) {
|
||||
docColumn = Math.min(docColumn, line.length);
|
||||
}
|
||||
|
||||
return {
|
||||
row: docRow,
|
||||
column: docColumn
|
||||
};
|
||||
};
|
||||
|
||||
this.documentToScreenColumn = function(row, docColumn) {
|
||||
return this.documentToScreenPosition(row, docColumn).column;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @return array[2]
|
||||
* - array[0]: The number of the row on the screen (aka screenRow)
|
||||
* - array[1]: The number of rows from the first docRow on the screen
|
||||
* (aka screenRowOffset);
|
||||
*/
|
||||
this.$documentToScreenRow = function(docRow, docColumn) {
|
||||
if (!this.$useWrapMode) {
|
||||
return [docRow, 0];
|
||||
}
|
||||
|
||||
var wrapData = this.$wrapData;
|
||||
var screenRow = 0;
|
||||
|
||||
// Handle special case where the row is outside of the range of lines.
|
||||
if (docRow > wrapData.length - 1) {
|
||||
return [
|
||||
this.getScreenLength(),
|
||||
wrapData.length == 0 ? 0 : (wrapData[wrapData.length - 1].length - 1)
|
||||
];
|
||||
}
|
||||
|
||||
for (var i = 0; i < docRow; i++) {
|
||||
screenRow += wrapData[i].length + 1;
|
||||
}
|
||||
|
||||
var screenRowOffset = 0;
|
||||
while (docColumn >= wrapData[docRow][screenRowOffset]) {
|
||||
screenRow ++;
|
||||
screenRowOffset++;
|
||||
}
|
||||
|
||||
return [screenRow, screenRowOffset];
|
||||
}
|
||||
|
||||
this.documentToScreenRow = function(docRow, docColumn) {
|
||||
return this.$documentToScreenRow(docRow, docColumn)[0];
|
||||
}
|
||||
|
||||
this.documentToScreenPosition = function(pos, column) {
|
||||
var str;
|
||||
var tabSize = this.getTabSize();
|
||||
|
||||
// Normalize the passed in arguments.
|
||||
var row;
|
||||
if (column != null) {
|
||||
row = pos;
|
||||
} else {
|
||||
row = pos.row;
|
||||
column = pos.column;
|
||||
}
|
||||
|
||||
if (!this.$useWrapMode) {
|
||||
str = this.getLine(row).substring(0, column);
|
||||
column = this.$getStringScreenWidth(str);
|
||||
return {
|
||||
row: row,
|
||||
column: column
|
||||
};
|
||||
}
|
||||
|
||||
var rowData = this.$documentToScreenRow(row, column);
|
||||
var screenRow = rowData[0];
|
||||
|
||||
if (row >= this.getLength()) {
|
||||
return {
|
||||
row: screenRow,
|
||||
column: 0
|
||||
};
|
||||
}
|
||||
|
||||
var split;
|
||||
var wrapRowData = this.$wrapData[row];
|
||||
var screenColumn;
|
||||
var screenRowOffset = rowData[1];
|
||||
|
||||
str = this.getLine(row).substring(
|
||||
wrapRowData[screenRowOffset - 1] || 0, column);
|
||||
screenColumn = this.$getStringScreenWidth(str);
|
||||
|
||||
return {
|
||||
row: screenRow,
|
||||
column: screenColumn
|
||||
};
|
||||
};
|
||||
|
||||
this.getScreenLength = function() {
|
||||
if (!this.$useWrapMode) {
|
||||
return this.getLength();
|
||||
}
|
||||
|
||||
var screenRows = 0;
|
||||
for (var row = 0; row < this.$wrapData.length; row++) {
|
||||
screenRows += this.$wrapData[row].length + 1;
|
||||
}
|
||||
return screenRows;
|
||||
}
|
||||
|
||||
}).call(EditSession.prototype);
|
||||
|
||||
exports.EditSession = EditSession;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
/* vim:ts=4:sts=4:sw=4:
|
||||
* ***** 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
|
||||
|
|
@ -20,6 +21,8 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
|
@ -37,10 +40,15 @@
|
|||
|
||||
define(function(require, exports, module) {
|
||||
|
||||
require("pilot/fixoldbrowsers");
|
||||
|
||||
var oop = require("pilot/oop");
|
||||
var event = require("pilot/event");
|
||||
var lang = require("pilot/lang");
|
||||
var useragent = require("pilot/useragent");
|
||||
var TextInput = require("ace/keyboard/textinput").TextInput;
|
||||
var MouseHandler = require("ace/mouse_handler").MouseHandler;
|
||||
//var TouchHandler = require("ace/touch_handler").TouchHandler;
|
||||
var KeyBinding = require("ace/keyboard/keybinding").KeyBinding;
|
||||
var EditSession = require("ace/edit_session").EditSession;
|
||||
var Search = require("ace/search").Search;
|
||||
|
|
@ -53,33 +61,22 @@ var Editor =function(renderer, session) {
|
|||
this.container = container;
|
||||
this.renderer = renderer;
|
||||
|
||||
this.textInput = new TextInput(container, this);
|
||||
this.textInput = new TextInput(renderer.getTextAreaContainer(), this);
|
||||
this.keyBinding = new KeyBinding(this);
|
||||
var self = this;
|
||||
event.addListener(container, "mousedown", function(e) {
|
||||
setTimeout(function() {self.focus();});
|
||||
return event.preventDefault(e);
|
||||
});
|
||||
event.addListener(container, "selectstart", function(e) {
|
||||
return event.preventDefault(e);
|
||||
});
|
||||
|
||||
var mouseTarget = renderer.getMouseEventTarget();
|
||||
event.addListener(mouseTarget, "mousedown", this.onMouseDown.bind(this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 0, 2, 500, this.onMouseDoubleClick.bind(this));
|
||||
event.addMultiMouseDownListener(mouseTarget, 0, 3, 600, this.onMouseTripleClick.bind(this));
|
||||
event.addMouseWheelListener(mouseTarget, this.onMouseWheel.bind(this));
|
||||
|
||||
this.$selectionMarker = null;
|
||||
this.$highlightLineMarker = null;
|
||||
this.$blockScrolling = false;
|
||||
|
||||
// TODO detect touch event support
|
||||
if (useragent.isIPad) {
|
||||
//this.$mouseHandler = new TouchHandler(this);
|
||||
} else {
|
||||
this.$mouseHandler = new MouseHandler(this);
|
||||
}
|
||||
|
||||
this.$blockScrolling = 0;
|
||||
this.$search = new Search().set({
|
||||
wrap: true
|
||||
});
|
||||
|
||||
this.setSession(session || new EditSession(""));
|
||||
this.focus();
|
||||
};
|
||||
|
||||
(function(){
|
||||
|
|
@ -122,10 +119,16 @@ var Editor =function(renderer, session) {
|
|||
if (this.session == session) return;
|
||||
|
||||
if (this.session) {
|
||||
var oldSession = this.session;
|
||||
this.session.removeEventListener("change", this.$onDocumentChange);
|
||||
this.session.removeEventListener("changeMode", this.$onDocumentModeChange);
|
||||
this.session.removeEventListener("changeTabSize", this.$onDocumentChangeTabSize);
|
||||
this.session.removeEventListener("changeWrapLimit", this.$onDocumentChangeWrapLimit);
|
||||
this.session.removeEventListener("changeWrapMode", this.$onDocumentChangeWrapMode);
|
||||
this.session.removeEventListener("changeFrontMarker", this.$onChangeFrontMarker);
|
||||
this.session.removeEventListener("changeBackMarker", this.$onChangeBackMarker);
|
||||
this.session.removeEventListener("changeBreakpoint", this.$onDocumentChangeBreakpoint);
|
||||
this.session.removeEventListener("changeAnnotation", this.$onDocumentChangeAnnotation);
|
||||
|
||||
var selection = this.session.getSelection();
|
||||
selection.removeEventListener("changeCursor", this.$onCursorChange);
|
||||
|
|
@ -146,11 +149,25 @@ var Editor =function(renderer, session) {
|
|||
this.$onDocumentChangeTabSize = this.renderer.updateText.bind(this.renderer);
|
||||
session.addEventListener("changeTabSize", this.$onDocumentChangeTabSize);
|
||||
|
||||
this.$onDocumentChangeWrapLimit = this.onDocumentChangeWrapLimit.bind(this);
|
||||
session.addEventListener("changeWrapLimit", this.$onDocumentChangeWrapLimit);
|
||||
|
||||
this.$onDocumentChangeWrapMode = this.onDocumentChangeWrapMode.bind(this);
|
||||
session.addEventListener("changeWrapMode", this.$onDocumentChangeWrapMode);
|
||||
|
||||
this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this);
|
||||
this.session.addEventListener("changeFrontMarker", this.$onChangeFrontMarker);
|
||||
|
||||
this.$onChangeBackMarker = this.onChangeBackMarker.bind(this);
|
||||
this.session.addEventListener("changeBackMarker", this.$onChangeBackMarker);
|
||||
|
||||
this.$onDocumentChangeBreakpoint = this.onDocumentChangeBreakpoint.bind(this);
|
||||
this.session.addEventListener("changeBreakpoint", this.$onDocumentChangeBreakpoint);
|
||||
|
||||
this.$onDocumentChangeAnnotation = this.onDocumentChangeAnnotation.bind(this);
|
||||
this.session.addEventListener("changeAnnotation", this.$onDocumentChangeAnnotation);
|
||||
|
||||
this.selection = session.getSelection();
|
||||
this.$desiredColumn = 0;
|
||||
|
||||
this.$onCursorChange = this.onCursorChange.bind(this);
|
||||
this.selection.addEventListener("changeCursor", this.$onCursorChange);
|
||||
|
|
@ -164,9 +181,17 @@ var Editor =function(renderer, session) {
|
|||
|
||||
this.onCursorChange();
|
||||
this.onSelectionChange();
|
||||
this.onChangeFrontMarker();
|
||||
this.onChangeBackMarker();
|
||||
this.onDocumentChangeBreakpoint();
|
||||
this.onDocumentChangeAnnotation();
|
||||
this.renderer.scrollToRow(session.getScrollTopRow());
|
||||
this.renderer.updateFull();
|
||||
|
||||
this._dispatchEvent("changeSession", {
|
||||
session: session,
|
||||
oldSession: oldSession
|
||||
});
|
||||
};
|
||||
|
||||
this.getSession = function() {
|
||||
|
|
@ -185,10 +210,18 @@ var Editor =function(renderer, session) {
|
|||
this.renderer.setTheme(theme);
|
||||
};
|
||||
|
||||
this.setStyle = function(style) {
|
||||
this.renderer.setStyle(style)
|
||||
};
|
||||
|
||||
this.unsetStyle = function(style) {
|
||||
this.renderer.unsetStyle(style)
|
||||
}
|
||||
|
||||
this.$highlightBrackets = function() {
|
||||
if (this.$bracketHighlight) {
|
||||
this.renderer.removeMarker(this.$bracketHighlight);
|
||||
this.$bracketHighlight = null;
|
||||
if (this.session.$bracketHighlight) {
|
||||
this.session.removeMarker(this.session.$bracketHighlight);
|
||||
this.session.$bracketHighlight = null;
|
||||
}
|
||||
|
||||
if (this.$highlightPending) {
|
||||
|
|
@ -204,12 +237,19 @@ var Editor =function(renderer, session) {
|
|||
var pos = self.session.findMatchingBracket(self.getCursorPosition());
|
||||
if (pos) {
|
||||
var range = new Range(pos.row, pos.column, pos.row, pos.column+1);
|
||||
self.$bracketHighlight = self.renderer.addMarker(range, "ace_bracket");
|
||||
self.session.$bracketHighlight = self.session.addMarker(range, "ace_bracket");
|
||||
}
|
||||
}, 10);
|
||||
};
|
||||
|
||||
this.focus = function() {
|
||||
// Safari need the timeout
|
||||
// iOS and Firefox need it called immediately
|
||||
// to be on the save side we do both
|
||||
var _self = this;
|
||||
setTimeout(function() {
|
||||
_self.textInput.focus();
|
||||
});
|
||||
this.textInput.focus();
|
||||
};
|
||||
|
||||
|
|
@ -220,21 +260,23 @@ var Editor =function(renderer, session) {
|
|||
this.onFocus = function() {
|
||||
this.renderer.showCursor();
|
||||
this.renderer.visualizeFocus();
|
||||
this._dispatchEvent("focus");
|
||||
};
|
||||
|
||||
this.onBlur = function() {
|
||||
this.renderer.hideCursor();
|
||||
this.renderer.visualizeBlur();
|
||||
this._dispatchEvent("blur");
|
||||
};
|
||||
|
||||
this.onDocumentChange = function(e) {
|
||||
var delta = e.data;
|
||||
var range = delta.range;
|
||||
|
||||
|
||||
this.bgTokenizer.start(range.start.row);
|
||||
if (range.start.row == range.end.row)
|
||||
if (range.start.row == range.end.row && delta.action != "insertLines" && delta.action != "removeLines")
|
||||
var lastRow = range.end.row;
|
||||
else
|
||||
else
|
||||
lastRow = Infinity;
|
||||
this.renderer.updateLines(range.start.row, lastRow);
|
||||
|
||||
|
|
@ -248,47 +290,71 @@ var Editor =function(renderer, session) {
|
|||
};
|
||||
|
||||
this.onCursorChange = function(e) {
|
||||
this.$highlightBrackets();
|
||||
this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite);
|
||||
|
||||
if (!this.$blockScrolling && (!e || !e.blockScrolling)) {
|
||||
if (!this.$blockScrolling) {
|
||||
this.renderer.scrollCursorIntoView();
|
||||
}
|
||||
|
||||
// move text input over the cursor
|
||||
// this is required for iOS and IME
|
||||
this.renderer.moveTextAreaToCursor(this.textInput.getElement());
|
||||
|
||||
this.$highlightBrackets();
|
||||
this.$updateHighlightActiveLine();
|
||||
};
|
||||
|
||||
this.$updateHighlightActiveLine = function() {
|
||||
if (this.$highlightLineMarker) {
|
||||
this.renderer.removeMarker(this.$highlightLineMarker);
|
||||
var session = this.getSession();
|
||||
|
||||
if (session.$highlightLineMarker) {
|
||||
session.removeMarker(session.$highlightLineMarker);
|
||||
}
|
||||
this.$highlightLineMarker = null;
|
||||
session.$highlightLineMarker = null;
|
||||
|
||||
if (this.getHighlightActiveLine() && (this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) {
|
||||
var cursor = this.getCursorPosition();
|
||||
var range = new Range(cursor.row, 0, cursor.row+1, 0);
|
||||
this.$highlightLineMarker = this.renderer.addMarker(range, "ace_active_line", "line");
|
||||
session.$highlightLineMarker = session.addMarker(range, "ace_active_line", "line");
|
||||
}
|
||||
};
|
||||
|
||||
this.onSelectionChange = function(e) {
|
||||
if (this.$selectionMarker) {
|
||||
this.renderer.removeMarker(this.$selectionMarker);
|
||||
var session = this.getSession();
|
||||
|
||||
if (session.$selectionMarker) {
|
||||
session.removeMarker(session.$selectionMarker);
|
||||
}
|
||||
this.$selectionMarker = null;
|
||||
session.$selectionMarker = null;
|
||||
|
||||
if (!this.selection.isEmpty()) {
|
||||
var range = this.selection.getRange();
|
||||
var style = this.getSelectionStyle();
|
||||
this.$selectionMarker = this.renderer.addMarker(range, "ace_selection", style);
|
||||
session.$selectionMarker = session.addMarker(range, "ace_selection", style);
|
||||
}
|
||||
|
||||
this.onCursorChange(e);
|
||||
|
||||
if (this.$highlightSelectedWord)
|
||||
this.mode.highlightSelection(this);
|
||||
};
|
||||
|
||||
this.onChangeFrontMarker = function() {
|
||||
this.renderer.updateFrontMarkers();
|
||||
};
|
||||
|
||||
this.onChangeBackMarker = function() {
|
||||
this.renderer.updateBackMarkers();
|
||||
};
|
||||
|
||||
this.onDocumentChangeBreakpoint = function() {
|
||||
this.renderer.setBreakpoints(this.session.getBreakpoints());
|
||||
};
|
||||
|
||||
this.onDocumentChangeAnnotation = function() {
|
||||
this.renderer.setAnnotations(this.session.getAnnotations());
|
||||
};
|
||||
|
||||
this.onDocumentModeChange = function() {
|
||||
var mode = this.session.getMode();
|
||||
if (this.mode == mode)
|
||||
|
|
@ -308,94 +374,13 @@ var Editor =function(renderer, session) {
|
|||
this.renderer.setTokenizer(this.bgTokenizer);
|
||||
};
|
||||
|
||||
|
||||
this.onMouseDown = function(e) {
|
||||
var pageX = event.getDocumentX(e);
|
||||
var pageY = event.getDocumentY(e);
|
||||
|
||||
var pos = this.renderer.screenToTextCoordinates(pageX, pageY);
|
||||
pos.row = Math.max(0, Math.min(pos.row, this.session.getLength()-1));
|
||||
|
||||
if (event.getButton(e) != 0) {
|
||||
if (this.selection.isEmpty()) {
|
||||
this.moveCursorToPosition(pos);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.shiftKey)
|
||||
this.selection.selectToPosition(pos)
|
||||
else {
|
||||
this.moveCursorToPosition(pos);
|
||||
if (!this.$clickSelection)
|
||||
this.selection.clearSelection(pos.row, pos.column);
|
||||
}
|
||||
|
||||
this.renderer.scrollCursorIntoView();
|
||||
|
||||
var self = this;
|
||||
var mousePageX, mousePageY;
|
||||
|
||||
var onMouseSelection = function(e) {
|
||||
mousePageX = event.getDocumentX(e);
|
||||
mousePageY = event.getDocumentY(e);
|
||||
};
|
||||
|
||||
var onMouseSelectionEnd = function() {
|
||||
clearInterval(timerId);
|
||||
self.$clickSelection = null;
|
||||
};
|
||||
|
||||
var onSelectionInterval = function() {
|
||||
if (mousePageX === undefined || mousePageY === undefined)
|
||||
return;
|
||||
|
||||
var cursor = self.renderer.screenToTextCoordinates(mousePageX, mousePageY);
|
||||
cursor.row = Math.max(0, Math.min(cursor.row, self.session.getLength()-1));
|
||||
|
||||
if (self.$clickSelection) {
|
||||
if (self.$clickSelection.contains(cursor.row, cursor.column)) {
|
||||
self.selection.setSelectionRange(self.$clickSelection);
|
||||
} else {
|
||||
if (self.$clickSelection.compare(cursor.row, cursor.column) == -1) {
|
||||
var anchor = self.$clickSelection.end;
|
||||
} else {
|
||||
var anchor = self.$clickSelection.start;
|
||||
}
|
||||
self.selection.setSelectionAnchor(anchor.row, anchor.column);
|
||||
self.selection.selectToPosition(cursor);
|
||||
}
|
||||
}
|
||||
else {
|
||||
self.selection.selectToPosition(cursor);
|
||||
}
|
||||
|
||||
self.renderer.scrollCursorIntoView();
|
||||
};
|
||||
|
||||
event.capture(this.container, onMouseSelection, onMouseSelectionEnd);
|
||||
var timerId = setInterval(onSelectionInterval, 20);
|
||||
|
||||
return event.preventDefault(e);
|
||||
this.onDocumentChangeWrapLimit = function() {
|
||||
this.renderer.updateCursor(this.getCursorPosition(), this.$overwrite);
|
||||
this.renderer.updateFull();
|
||||
};
|
||||
|
||||
this.onMouseDoubleClick = function(e) {
|
||||
this.selection.selectWord();
|
||||
this.$clickSelection = this.getSelectionRange();
|
||||
this.$updateDesiredColumn();
|
||||
};
|
||||
|
||||
this.onMouseTripleClick = function(e) {
|
||||
this.selection.selectLine();
|
||||
this.$clickSelection = this.getSelectionRange();
|
||||
this.$updateDesiredColumn();
|
||||
};
|
||||
|
||||
this.onMouseWheel = function(e) {
|
||||
var speed = this.$scrollSpeed * 2;
|
||||
|
||||
this.renderer.scrollBy(e.wheelX * speed, e.wheelY * speed);
|
||||
return event.preventDefault(e);
|
||||
this.onDocumentChangeWrapMode = function() {
|
||||
this.renderer.onResize(true);
|
||||
};
|
||||
|
||||
this.getCopyText = function() {
|
||||
|
|
@ -412,7 +397,7 @@ var Editor =function(renderer, session) {
|
|||
return;
|
||||
|
||||
if (!this.selection.isEmpty()) {
|
||||
this.moveCursorToPosition(this.session.remove(this.getSelectionRange()));
|
||||
this.session.remove(this.getSelectionRange())
|
||||
this.clearSelection();
|
||||
}
|
||||
};
|
||||
|
|
@ -442,20 +427,18 @@ var Editor =function(renderer, session) {
|
|||
var lineIndent = this.mode.getNextLineIndent(lineState, line.slice(0, cursor.column), this.session.getTabString());
|
||||
var end = this.session.insert(cursor, text);
|
||||
|
||||
/* TODO: This shortcut is somehow broken
|
||||
if (!shouldOutdent && line != this.session.getLine(row) && text != "\n") {
|
||||
this.moveCursorToPosition(end);
|
||||
this.renderer.scrollCursorIntoView();
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
var lineState = this.bgTokenizer.getState(cursor.row);
|
||||
// multi line insert
|
||||
if (cursor.row !== end.row) {
|
||||
// TODO disabled multiline auto indent
|
||||
// possibly doing the indent before inserting the text
|
||||
// if (cursor.row !== end.row) {
|
||||
if (this.session.getDocument().isNewLine(text)) {
|
||||
this.moveCursorTo(cursor.row+1, 0);
|
||||
|
||||
var size = this.session.getTabSize(),
|
||||
minIndent = Number.MAX_VALUE;
|
||||
|
||||
|
||||
for (var row = cursor.row + 1; row <= end.row; ++row) {
|
||||
var indent = 0;
|
||||
|
||||
|
|
@ -480,17 +463,14 @@ var Editor =function(renderer, session) {
|
|||
outdent -= size;
|
||||
else if (line.charAt(i) == ' ')
|
||||
outdent -= 1;
|
||||
this.session.replace(new Range(row, 0, row, line.length), line.substr(i));
|
||||
this.session.remove(new Range(row, 0, row, i));
|
||||
}
|
||||
end.column += this.session.indentRows(cursor.row + 1, end.row, lineIndent);
|
||||
this.session.indentRows(cursor.row + 1, end.row, lineIndent);
|
||||
} else {
|
||||
if (shouldOutdent) {
|
||||
end.column += this.mode.autoOutdent(lineState, this.session, cursor.row);
|
||||
this.mode.autoOutdent(lineState, this.session, cursor.row);
|
||||
}
|
||||
}
|
||||
|
||||
this.moveCursorToPosition(end);
|
||||
this.renderer.scrollCursorIntoView();
|
||||
};
|
||||
}
|
||||
|
||||
this.onTextInput = function(text) {
|
||||
|
|
@ -507,9 +487,9 @@ var Editor =function(renderer, session) {
|
|||
|
||||
this.$overwrite = overwrite;
|
||||
|
||||
this.$blockScrolling = true;
|
||||
this.$blockScrolling += 1;
|
||||
this.onCursorChange();
|
||||
this.$blockScrolling = false;
|
||||
this.$blockScrolling -= 1;
|
||||
|
||||
this._dispatchEvent("changeOverwrite", {data: overwrite});
|
||||
};
|
||||
|
|
@ -522,15 +502,13 @@ var Editor =function(renderer, session) {
|
|||
this.setOverwrite(!this.$overwrite);
|
||||
};
|
||||
|
||||
|
||||
this.$scrollSpeed = 1;
|
||||
this.setScrollSpeed = function(speed) {
|
||||
this.$scrollSpeed = speed;
|
||||
}
|
||||
this.$mouseHandler.setScrollSpeed(speed);
|
||||
};
|
||||
|
||||
this.getScrollSpeed = function() {
|
||||
return this.$scrollSpeed;
|
||||
}
|
||||
return this.$mouseHandler.getScrollSpeed()
|
||||
};
|
||||
|
||||
this.$selectionStyle = "line";
|
||||
this.setSelectionStyle = function(style) {
|
||||
|
|
@ -541,7 +519,6 @@ var Editor =function(renderer, session) {
|
|||
this._dispatchEvent("changeSelectionStyle", {data: style});
|
||||
};
|
||||
|
||||
|
||||
this.getSelectionStyle = function() {
|
||||
return this.$selectionStyle;
|
||||
};
|
||||
|
|
@ -558,6 +535,22 @@ var Editor =function(renderer, session) {
|
|||
return this.$highlightActiveLine;
|
||||
};
|
||||
|
||||
this.$highlightSelectedWord = true;
|
||||
this.setHighlightSelectedWord = function(shouldHighlight) {
|
||||
if (this.$highlightSelectedWord == shouldHighlight)
|
||||
return;
|
||||
|
||||
this.$highlightSelectedWord = shouldHighlight;
|
||||
if (shouldHighlight)
|
||||
this.mode.highlightSelection(this);
|
||||
else
|
||||
this.mode.clearSelectionHighlight(this);
|
||||
};
|
||||
|
||||
this.getHighlightSelectedWord = function() {
|
||||
return this.$highlightSelectedWord;
|
||||
};
|
||||
|
||||
this.setShowInvisibles = function(showInvisibles) {
|
||||
if (this.getShowInvisibles() == showInvisibles)
|
||||
return;
|
||||
|
|
@ -601,7 +594,7 @@ var Editor =function(renderer, session) {
|
|||
if (this.selection.isEmpty()) {
|
||||
this.selection.selectRight();
|
||||
}
|
||||
this.moveCursorToPosition(this.session.remove(this.getSelectionRange()));
|
||||
this.session.remove(this.getSelectionRange())
|
||||
this.clearSelection();
|
||||
};
|
||||
|
||||
|
|
@ -612,10 +605,93 @@ var Editor =function(renderer, session) {
|
|||
if (this.selection.isEmpty())
|
||||
this.selection.selectLeft();
|
||||
|
||||
this.moveCursorToPosition(this.session.remove(this.getSelectionRange()));
|
||||
this.session.remove(this.getSelectionRange());
|
||||
this.clearSelection();
|
||||
};
|
||||
|
||||
this.removeWordRight = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (this.selection.isEmpty())
|
||||
this.selection.selectWordRight();
|
||||
|
||||
this.session.remove(this.getSelectionRange());
|
||||
this.clearSelection();
|
||||
};
|
||||
|
||||
this.removeWordLeft = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (this.selection.isEmpty())
|
||||
this.selection.selectWordLeft();
|
||||
|
||||
this.session.remove(this.getSelectionRange());
|
||||
this.clearSelection();
|
||||
};
|
||||
|
||||
this.removeToLineStart = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (this.selection.isEmpty())
|
||||
this.selection.selectLineStart();
|
||||
|
||||
this.session.remove(this.getSelectionRange());
|
||||
this.clearSelection();
|
||||
};
|
||||
|
||||
this.removeToLineEnd = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (this.selection.isEmpty())
|
||||
this.selection.selectLineEnd();
|
||||
|
||||
this.session.remove(this.getSelectionRange());
|
||||
this.clearSelection();
|
||||
};
|
||||
|
||||
this.splitLine = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (!this.selection.isEmpty()) {
|
||||
this.session.remove(this.getSelectionRange());
|
||||
this.clearSelection();
|
||||
}
|
||||
|
||||
var cursor = this.getCursorPosition();
|
||||
this.insert("\n");
|
||||
this.moveCursorToPosition(cursor);
|
||||
};
|
||||
|
||||
this.transposeLetters = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
||||
if (!this.selection.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var cursor = this.getCursorPosition();
|
||||
var column = cursor.column;
|
||||
if (column == 0)
|
||||
return;
|
||||
|
||||
var line = this.session.getLine(cursor.row);
|
||||
if (column < line.length) {
|
||||
var swap = line.charAt(column) + line.charAt(column-1);
|
||||
var range = new Range(cursor.row, column-1, cursor.row, column+1)
|
||||
}
|
||||
else {
|
||||
var swap = line.charAt(column-1) + line.charAt(column-2);
|
||||
var range = new Range(cursor.row, column-2, cursor.row, column)
|
||||
}
|
||||
this.session.replace(range, swap);
|
||||
};
|
||||
|
||||
this.indent = function() {
|
||||
if (this.$readOnly)
|
||||
return;
|
||||
|
|
@ -625,9 +701,7 @@ var Editor =function(renderer, session) {
|
|||
|
||||
if (range.start.row < range.end.row || range.start.column < range.end.column) {
|
||||
var rows = this.$getSelectedRows();
|
||||
var count = session.indentRows(rows.first, rows.last, "\t");
|
||||
|
||||
this.selection.shiftSelection(count);
|
||||
session.indentRows(rows.first, rows.last, "\t");
|
||||
} else {
|
||||
var indentString;
|
||||
|
||||
|
|
@ -649,10 +723,7 @@ var Editor =function(renderer, session) {
|
|||
return;
|
||||
|
||||
var selection = this.session.getSelection();
|
||||
var range = this.session.outdentRows(selection.getRange());
|
||||
|
||||
selection.setSelectionRange(range, selection.isBackwards());
|
||||
this.$updateDesiredColumn();
|
||||
this.session.outdentRows(selection.getRange());
|
||||
};
|
||||
|
||||
this.toggleCommentLines = function() {
|
||||
|
|
@ -661,8 +732,7 @@ var Editor =function(renderer, session) {
|
|||
|
||||
var state = this.bgTokenizer.getState(this.getCursorPosition().row);
|
||||
var rows = this.$getSelectedRows()
|
||||
var addedColumns = this.mode.toggleCommentLines(state, this.session, rows.first, rows.last);
|
||||
this.selection.shiftSelection(addedColumns);
|
||||
this.mode.toggleCommentLines(state, this.session, rows.first, rows.last);
|
||||
};
|
||||
|
||||
this.removeLines = function() {
|
||||
|
|
@ -670,10 +740,7 @@ var Editor =function(renderer, session) {
|
|||
return;
|
||||
|
||||
var rows = this.$getSelectedRows();
|
||||
this.selection.setSelectionAnchor(rows.last+1, 0);
|
||||
this.selection.selectTo(rows.first, 0);
|
||||
|
||||
this.session.remove(this.getSelectionRange());
|
||||
this.session.remove(new Range(rows.first, 0, rows.last+1, 0));
|
||||
this.clearSelection();
|
||||
};
|
||||
|
||||
|
|
@ -738,7 +805,6 @@ var Editor =function(renderer, session) {
|
|||
|
||||
this.onCompositionStart = function(text) {
|
||||
this.renderer.showComposition(this.getCursorPosition());
|
||||
//this.onTextInput(text);
|
||||
};
|
||||
|
||||
this.onCompositionUpdate = function(text) {
|
||||
|
|
@ -747,7 +813,6 @@ var Editor =function(renderer, session) {
|
|||
|
||||
this.onCompositionEnd = function() {
|
||||
this.renderer.hideComposition();
|
||||
//this.removeLeft();
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -763,142 +828,141 @@ var Editor =function(renderer, session) {
|
|||
return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());
|
||||
};
|
||||
|
||||
this.getVisibleRowCount = function() {
|
||||
return this.getLastVisibleRow() - this.getFirstVisibleRow() + 1;
|
||||
this.$getVisibleRowCount = function() {
|
||||
return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
|
||||
};
|
||||
|
||||
this.getPageDownRow = function() {
|
||||
return this.renderer.getLastVisibleRow() - 1;
|
||||
this.$getPageDownRow = function() {
|
||||
return this.renderer.getScrollBottomRow();
|
||||
};
|
||||
|
||||
this.getPageUpRow = function() {
|
||||
var firstRow = this.renderer.getFirstVisibleRow();
|
||||
var lastRow = this.renderer.getLastVisibleRow();
|
||||
this.$getPageUpRow = function() {
|
||||
var firstRow = this.renderer.getScrollTopRow();
|
||||
var lastRow = this.renderer.getScrollBottomRow();
|
||||
|
||||
return firstRow - (lastRow - firstRow) + 1;
|
||||
return firstRow - (lastRow - firstRow);
|
||||
};
|
||||
|
||||
this.selectPageDown = function() {
|
||||
var row = this.getPageDownRow() + Math.floor(this.getVisibleRowCount() / 2);
|
||||
var row = this.$getPageDownRow() + Math.floor(this.$getVisibleRowCount() / 2);
|
||||
|
||||
this.scrollPageDown();
|
||||
|
||||
var selection = this.getSelection();
|
||||
selection.$moveSelection(function() {
|
||||
selection.moveCursorTo(row, selection.getSelectionLead().column);
|
||||
});
|
||||
var leadScreenPos = this.session.documentToScreenPosition(selection.getSelectionLead());
|
||||
var dest = this.session.screenToDocumentPosition(row, leadScreenPos.column);
|
||||
selection.selectTo(dest.row, dest.column);
|
||||
};
|
||||
|
||||
this.selectPageUp = function() {
|
||||
var visibleRows = this.getLastVisibleRow() - this.getFirstVisibleRow();
|
||||
var row = this.getPageUpRow() + Math.round(visibleRows / 2);
|
||||
var visibleRows = this.renderer.getScrollTopRow() - this.renderer.getScrollBottomRow();
|
||||
var row = this.$getPageUpRow() + Math.round(visibleRows / 2);
|
||||
|
||||
this.scrollPageUp();
|
||||
|
||||
var selection = this.getSelection();
|
||||
selection.$moveSelection(function() {
|
||||
selection.moveCursorTo(row, selection.getSelectionLead().column);
|
||||
});
|
||||
var leadScreenPos = this.session.documentToScreenPosition(selection.getSelectionLead());
|
||||
var dest = this.session.screenToDocumentPosition(row, leadScreenPos.column);
|
||||
selection.selectTo(dest.row, dest.column);
|
||||
};
|
||||
|
||||
this.gotoPageDown = function() {
|
||||
var row = this.getPageDownRow(),
|
||||
column = Math.min(this.getCursorPosition().column,
|
||||
this.session.getLine(row).length);
|
||||
var row = this.$getPageDownRow();
|
||||
var column = this.getCursorPositionScreen().column;
|
||||
|
||||
this.scrollToRow(row);
|
||||
this.getSelection().moveCursorTo(row, column);
|
||||
this.getSelection().moveCursorToScreen(row, column);
|
||||
};
|
||||
|
||||
this.gotoPageUp = function() {
|
||||
var row = this.getPageUpRow(),
|
||||
column = Math.min(this.getCursorPosition().column,
|
||||
this.session.getLine(row).length);
|
||||
var row = this.$getPageUpRow();
|
||||
var column = this.getCursorPositionScreen().column;
|
||||
|
||||
this.scrollToRow(row);
|
||||
this.getSelection().moveCursorTo(row, column);
|
||||
this.getSelection().moveCursorToScreen(row, column);
|
||||
};
|
||||
|
||||
this.scrollPageDown = function() {
|
||||
this.scrollToRow(this.getPageDownRow());
|
||||
this.scrollToRow(this.$getPageDownRow());
|
||||
};
|
||||
|
||||
this.scrollPageUp = function() {
|
||||
this.renderer.scrollToRow(this.getPageUpRow());
|
||||
this.renderer.scrollToRow(this.$getPageUpRow());
|
||||
};
|
||||
|
||||
this.scrollToRow = function(row) {
|
||||
this.renderer.scrollToRow(row);
|
||||
};
|
||||
|
||||
this.scrollToLine = function(line, center) {
|
||||
this.renderer.scrollToLine(line, center);
|
||||
};
|
||||
|
||||
this.centerSelection = function() {
|
||||
var range = this.getSelectionRange();
|
||||
var line = Math.floor(range.start.row + (range.end.row - range.start.row) / 2);
|
||||
this.renderer.scrollToLine(line, true);
|
||||
};
|
||||
|
||||
this.getCursorPosition = function() {
|
||||
return this.selection.getCursor();
|
||||
};
|
||||
|
||||
this.getCursorPositionScreen = function() {
|
||||
return this.session.documentToScreenPosition(this.getCursorPosition());
|
||||
}
|
||||
|
||||
this.getSelectionRange = function() {
|
||||
return this.selection.getRange();
|
||||
};
|
||||
|
||||
|
||||
this.selectAll = function() {
|
||||
this.$blockScrolling += 1;
|
||||
this.selection.selectAll();
|
||||
this.$blockScrolling -= 1;
|
||||
};
|
||||
|
||||
this.clearSelection = function() {
|
||||
this.selection.clearSelection();
|
||||
this.$updateDesiredColumn();
|
||||
};
|
||||
|
||||
this.moveCursorTo = function(row, column) {
|
||||
this.selection.moveCursorTo(row, column);
|
||||
this.$updateDesiredColumn();
|
||||
};
|
||||
|
||||
this.moveCursorToPosition = function(pos) {
|
||||
this.selection.moveCursorToPosition(pos);
|
||||
this.$updateDesiredColumn();
|
||||
};
|
||||
|
||||
|
||||
this.gotoLine = function(lineNumber, row) {
|
||||
this.selection.clearSelection();
|
||||
|
||||
this.$blockScrolling = true;
|
||||
this.$blockScrolling += 1;
|
||||
this.moveCursorTo(lineNumber-1, row || 0);
|
||||
this.$blockScrolling = false;
|
||||
this.$blockScrolling -= 1;
|
||||
|
||||
if (!this.isRowVisible(this.getCursorPosition().row)) {
|
||||
this.scrollToRow(lineNumber - 1 - Math.floor(this.getVisibleRowCount() / 2));
|
||||
this.scrollToLine(lineNumber, true);
|
||||
}
|
||||
},
|
||||
|
||||
this.navigateTo = function(row, column) {
|
||||
this.clearSelection();
|
||||
this.moveCursorTo(row, column);
|
||||
this.$updateDesiredColumn(column);
|
||||
};
|
||||
|
||||
this.navigateUp = function(times) {
|
||||
this.selection.clearSelection();
|
||||
this.selection.moveCursorBy(-(times || 1), 0);
|
||||
|
||||
if (this.$desiredColumn) {
|
||||
var cursor = this.getCursorPosition();
|
||||
var column = this.session.screenToDocumentColumn(cursor.row, this.$desiredColumn);
|
||||
this.selection.moveCursorTo(cursor.row, column);
|
||||
}
|
||||
times = times || 1;
|
||||
this.selection.moveCursorBy(-times, 0);
|
||||
};
|
||||
|
||||
this.navigateDown = function(times) {
|
||||
this.selection.clearSelection();
|
||||
this.selection.moveCursorBy(times || 1, 0);
|
||||
|
||||
if (this.$desiredColumn) {
|
||||
var cursor = this.getCursorPosition();
|
||||
var column = this.session.screenToDocumentColumn(cursor.row, this.$desiredColumn);
|
||||
this.selection.moveCursorTo(cursor.row, column);
|
||||
}
|
||||
};
|
||||
|
||||
this.$updateDesiredColumn = function() {
|
||||
var cursor = this.getCursorPosition();
|
||||
this.$desiredColumn = this.session.documentToScreenColumn(cursor.row, cursor.column);
|
||||
times = times || 1;
|
||||
this.selection.moveCursorBy(times, 0);
|
||||
};
|
||||
|
||||
this.navigateLeft = function(times) {
|
||||
|
|
@ -967,7 +1031,6 @@ var Editor =function(renderer, session) {
|
|||
this.$tryReplace(range, replacement);
|
||||
if (range !== null)
|
||||
this.selection.setSelectionRange(range);
|
||||
this.$updateDesiredColumn();
|
||||
},
|
||||
|
||||
this.replaceAll = function(replacement, options) {
|
||||
|
|
@ -979,14 +1042,16 @@ var Editor =function(renderer, session) {
|
|||
if (!ranges.length)
|
||||
return;
|
||||
|
||||
var selection = this.getSelectionRange();
|
||||
this.clearSelection();
|
||||
this.selection.moveCursorTo(0, 0);
|
||||
|
||||
this.$blockScrolling += 1;
|
||||
for (var i = ranges.length - 1; i >= 0; --i)
|
||||
this.$tryReplace(ranges[i], replacement);
|
||||
if (ranges[0] !== null)
|
||||
this.selection.setSelectionRange(ranges[0]);
|
||||
this.$updateDesiredColumn();
|
||||
|
||||
this.selection.setSelectionRange(selection);
|
||||
this.$blockScrolling -= 1;
|
||||
},
|
||||
|
||||
this.$tryReplace = function(range, replacement) {
|
||||
|
|
@ -1039,7 +1104,6 @@ var Editor =function(renderer, session) {
|
|||
var range = this.$search.find(this.session);
|
||||
if (range) {
|
||||
this.gotoLine(range.end.row+1, range.end.column);
|
||||
this.$updateDesiredColumn();
|
||||
this.selection.setSelectionRange(range);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ exports.bindings = {
|
|||
"removeline": "Command-D",
|
||||
"gotoline": "Command-L",
|
||||
"togglecomment": "Command-7",
|
||||
"findnext": "Command-K",
|
||||
"findprevious": "Command-Shift-K",
|
||||
"findnext": "Command-G",
|
||||
"findprevious": "Command-Shift-G",
|
||||
"find": "Command-F",
|
||||
"replace": "Command-R",
|
||||
"undo": "Command-Z",
|
||||
|
|
@ -54,35 +54,44 @@ exports.bindings = {
|
|||
"selecttostart": "Command-Shift-Up",
|
||||
"gotostart": "Command-Home|Command-Up",
|
||||
"selectup": "Shift-Up",
|
||||
"golineup": "Up",
|
||||
"golineup": "Up|Ctrl-P",
|
||||
"copylinesdown": "Command-Option-Down",
|
||||
"movelinesdown": "Option-Down",
|
||||
"selecttoend": "Command-Shift-Down",
|
||||
"gotoend": "Command-End|Command-Down",
|
||||
"selectdown": "Shift-Down",
|
||||
"golinedown": "Down",
|
||||
"golinedown": "Down|Ctrl-N",
|
||||
"selectwordleft": "Option-Shift-Left",
|
||||
"gotowordleft": "Option-Left",
|
||||
"selecttolinestart": "Command-Shift-Left",
|
||||
"gotolinestart": "Command-Left|Home",
|
||||
"gotolinestart": "Command-Left|Home|Ctrl-A",
|
||||
"selectleft": "Shift-Left",
|
||||
"gotoleft": "Left",
|
||||
"gotoleft": "Left|Ctrl-B",
|
||||
"selectwordright": "Option-Shift-Right",
|
||||
"gotowordright": "Option-Right",
|
||||
"selecttolineend": "Command-Shift-Right",
|
||||
"gotolineend": "Command-Right|End",
|
||||
"gotolineend": "Command-Right|End|Ctrl-E",
|
||||
"selectright": "Shift-Right",
|
||||
"gotoright": "Right",
|
||||
"gotoright": "Right|Ctrl-F",
|
||||
"selectpagedown": "Shift-PageDown",
|
||||
"pagedown": "PageDown",
|
||||
"gotopagedown": "Option-PageDown|Ctrl-V",
|
||||
"selectpageup": "Shift-PageUp",
|
||||
"pageup": "PageUp",
|
||||
"gotopageup": "Option-PageUp",
|
||||
"selectlinestart": "Shift-Home",
|
||||
"selectlineend": "Shift-End",
|
||||
"del": "Delete",
|
||||
"backspace": "Ctrl-Backspace|Command-Backspace|Option-Backspace|Backspace",
|
||||
"del": "Delete|Ctrl-D",
|
||||
"backspace": "Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H",
|
||||
"removetolineend": "Ctrl-K",
|
||||
"removetolinestart": "Option-Backspace",
|
||||
"removewordleft": "Alt-Backspace|Ctrl-Alt-Backspace",
|
||||
"removewordright": "Alt-Delete",
|
||||
"outdent": "Shift-Tab",
|
||||
"indent": "Tab"
|
||||
"indent": "Tab",
|
||||
"transposeletters": "Ctrl-T",
|
||||
"splitline": "Ctrl-O",
|
||||
"centerselection": "Ctrl-L"
|
||||
};
|
||||
|
||||
});
|
||||
|
|
@ -74,13 +74,13 @@ exports.bindings = {
|
|||
"selectright": "Shift-Right",
|
||||
"gotoright": "Right",
|
||||
"selectpagedown": "Shift-PageDown",
|
||||
"pagedown": "PageDown",
|
||||
"gotopagedown": "PageDown",
|
||||
"selectpageup": "Shift-PageUp",
|
||||
"pageup": "PageUp",
|
||||
"gotopageup": "PageUp",
|
||||
"selectlinestart": "Shift-Home",
|
||||
"selectlineend": "Shift-End",
|
||||
"del": "Delete",
|
||||
"backspace": "Backspace",
|
||||
"backspace": "Ctrl-Backspace|Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
|
||||
"outdent": "Shift-Tab",
|
||||
"indent": "Tab"
|
||||
};
|
||||
|
|
|
|||
|
|
@ -80,13 +80,13 @@ StateHandler.prototype = {
|
|||
}
|
||||
|
||||
var keyArray = [];
|
||||
if (hashId & 1) keyArray.push("Ctrl");
|
||||
if (hashId & 8) keyArray.push("Command");
|
||||
if (hashId & 2) keyArray.push("Option");
|
||||
if (hashId & 4) keyArray.push("Shift");
|
||||
if (hashId & 1) keyArray.push("ctrl");
|
||||
if (hashId & 8) keyArray.push("command");
|
||||
if (hashId & 2) keyArray.push("option");
|
||||
if (hashId & 4) keyArray.push("shift");
|
||||
if (key) keyArray.push(key);
|
||||
|
||||
var symbolicName = keyArray.join("-").toLowerCase();
|
||||
var symbolicName = keyArray.join("-");
|
||||
var bufferToUse = data.buffer + symbolicName;
|
||||
|
||||
// Don't add the symbolic name to the key buffer if the alt_ key is
|
||||
|
|
@ -194,6 +194,13 @@ StateHandler.prototype = {
|
|||
* This function is called by keyBinding.
|
||||
*/
|
||||
handleKeyboard: function(data, hashId, key) {
|
||||
// If we pressed any command key but no other key, then ignore the input.
|
||||
// Otherwise "shift-" is added to the buffer, and later on "shift-g"
|
||||
// which results in "shift-shift-g" which doesn't make senese.
|
||||
if (hashId != 0 && (key == "" || String.fromCharCode(0))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Compute the current value of the keyboard input buffer.
|
||||
var r = this.$composeBuffer(data, hashId, key);
|
||||
var buffer = r.bufferToUse;
|
||||
|
|
|
|||
|
|
@ -38,14 +38,12 @@
|
|||
define(function(require, exports, module) {
|
||||
|
||||
var event = require("pilot/event");
|
||||
var useragent = require("pilot/useragent");
|
||||
|
||||
var TextInput = function(parentNode, host) {
|
||||
|
||||
var text = document.createElement("textarea");
|
||||
var style = text.style;
|
||||
style.position = "absolute";
|
||||
style.left = "-10000px";
|
||||
style.top = "-10000px";
|
||||
text.style.left = "-10000px";
|
||||
parentNode.appendChild(text);
|
||||
|
||||
var PLACEHOLDER = String.fromCharCode(0);
|
||||
|
|
@ -53,6 +51,7 @@ var TextInput = function(parentNode, host) {
|
|||
|
||||
var inCompostion = false;
|
||||
var copied = false;
|
||||
var tempStyle = '';
|
||||
|
||||
function sendText(valueToSend) {
|
||||
if (!copied) {
|
||||
|
|
@ -74,6 +73,7 @@ var TextInput = function(parentNode, host) {
|
|||
}
|
||||
|
||||
var onTextInput = function(e) {
|
||||
if (useragent.isIE && text.value.charCodeAt(0) > 128) return;
|
||||
setTimeout(function() {
|
||||
if (!inCompostion)
|
||||
sendText();
|
||||
|
|
@ -82,40 +82,67 @@ var TextInput = function(parentNode, host) {
|
|||
|
||||
var onCompositionStart = function(e) {
|
||||
inCompostion = true;
|
||||
sendText();
|
||||
text.value = "";
|
||||
if (!useragent.isIE) {
|
||||
sendText();
|
||||
text.value = "";
|
||||
};
|
||||
host.onCompositionStart();
|
||||
setTimeout(onCompositionUpdate, 0);
|
||||
if (!useragent.isGecko) setTimeout(onCompositionUpdate, 0);
|
||||
};
|
||||
|
||||
var onCompositionUpdate = function() {
|
||||
if (!inCompostion) return;
|
||||
host.onCompositionUpdate(text.value);
|
||||
};
|
||||
|
||||
var onCompositionEnd = function() {
|
||||
inCompostion = false;
|
||||
host.onCompositionEnd();
|
||||
onTextInput();
|
||||
setTimeout(function () {
|
||||
sendText();
|
||||
}, 0);
|
||||
};
|
||||
|
||||
var onCopy = function() {
|
||||
var onCopy = function(e) {
|
||||
copied = true;
|
||||
text.value = host.getCopyText();
|
||||
var copyText = host.getCopyText();
|
||||
if(copyText)
|
||||
text.value = copyText;
|
||||
else
|
||||
e.preventDefault();
|
||||
text.select();
|
||||
copied = true;
|
||||
setTimeout(sendText, 0);
|
||||
setTimeout(function () {
|
||||
sendText();
|
||||
}, 0);
|
||||
};
|
||||
|
||||
var onCut = function() {
|
||||
var onCut = function(e) {
|
||||
copied = true;
|
||||
text.value = host.getCopyText();
|
||||
host.onCut();
|
||||
var copyText = host.getCopyText();
|
||||
if(copyText) {
|
||||
text.value = copyText;
|
||||
host.onCut();
|
||||
} else
|
||||
e.preventDefault();
|
||||
text.select();
|
||||
setTimeout(sendText, 0);
|
||||
setTimeout(function () {
|
||||
sendText();
|
||||
}, 0);
|
||||
};
|
||||
|
||||
event.addCommandKeyListener(text, host.onCommandKey.bind(host));
|
||||
event.addListener(text, "keypress", onTextInput);
|
||||
if (useragent.isIE) {
|
||||
var keytable = { 13:1, 27:1 };
|
||||
event.addListener(text, "keyup", function (e) {
|
||||
if (inCompostion && (!text.value || keytable[e.keyCode]))
|
||||
setTimeout(onCompositionEnd, 0);
|
||||
if ((text.value.charCodeAt(0)|0) < 129) {
|
||||
return;
|
||||
};
|
||||
inCompostion ? onCompositionUpdate() : onCompositionStart();
|
||||
});
|
||||
};
|
||||
event.addListener(text, "textInput", onTextInput);
|
||||
event.addListener(text, "paste", function(e) {
|
||||
// Some browsers support the event.clipboardData API. Use this to get
|
||||
|
|
@ -130,13 +157,41 @@ var TextInput = function(parentNode, host) {
|
|||
onTextInput();
|
||||
}
|
||||
});
|
||||
event.addListener(text, "propertychange", onTextInput);
|
||||
if (!useragent.isIE) {
|
||||
event.addListener(text, "propertychange", onTextInput);
|
||||
};
|
||||
|
||||
event.addListener(text, "copy", onCopy);
|
||||
event.addListener(text, "cut", onCut);
|
||||
if (useragent.isIE) {
|
||||
event.addListener(text, "beforecopy", function(e) {
|
||||
var copyText = host.getCopyText();
|
||||
if(copyText)
|
||||
clipboardData.setData("Text", copyText);
|
||||
else
|
||||
e.preventDefault();
|
||||
});
|
||||
event.addListener(parentNode, "keydown", function(e) {
|
||||
if (e.ctrlKey && e.keyCode == 88) {
|
||||
var copyText = host.getCopyText();
|
||||
if (copyText) {
|
||||
clipboardData.setData("Text", copyText);
|
||||
host.onCut();
|
||||
}
|
||||
event.preventDefault(e)
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
event.addListener(text, "copy", onCopy);
|
||||
event.addListener(text, "cut", onCut);
|
||||
}
|
||||
|
||||
event.addListener(text, "compositionstart", onCompositionStart);
|
||||
event.addListener(text, "compositionupdate", onCompositionUpdate);
|
||||
if (useragent.isGecko) {
|
||||
event.addListener(text, "text", onCompositionUpdate);
|
||||
};
|
||||
if (useragent.isWebKit) {
|
||||
event.addListener(text, "keyup", onCompositionUpdate);
|
||||
};
|
||||
event.addListener(text, "compositionend", onCompositionEnd);
|
||||
|
||||
event.addListener(text, "blur", function() {
|
||||
|
|
@ -157,6 +212,32 @@ var TextInput = function(parentNode, host) {
|
|||
this.blur = function() {
|
||||
text.blur();
|
||||
};
|
||||
|
||||
this.getElement = function() {
|
||||
return text;
|
||||
};
|
||||
|
||||
this.onContextMenu = function(mousePos, isEmpty){
|
||||
if (mousePos) {
|
||||
if(!tempStyle)
|
||||
tempStyle = text.style.cssText;
|
||||
text.style.cssText = 'position:fixed; z-index:1000;' +
|
||||
'left:' + (mousePos.x - 2) + 'px; top:' + (mousePos.y - 2) + 'px;'
|
||||
|
||||
}
|
||||
if (isEmpty)
|
||||
text.value='';
|
||||
}
|
||||
|
||||
this.onContextMenuClose = function(){
|
||||
setTimeout(function () {
|
||||
if (tempStyle) {
|
||||
text.style.cssText = tempStyle;
|
||||
tempStyle = '';
|
||||
}
|
||||
sendText();
|
||||
}, 0);
|
||||
}
|
||||
};
|
||||
|
||||
exports.TextInput = TextInput;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
|
@ -57,15 +58,8 @@ var Cursor = function(parentEl) {
|
|||
};
|
||||
|
||||
this.setCursor = function(position, overwrite) {
|
||||
this.position = {
|
||||
row : position.row,
|
||||
column : this.session.documentToScreenColumn(position.row, position.column)
|
||||
};
|
||||
if (overwrite) {
|
||||
dom.addCssClass(this.cursor, "ace_overwrite");
|
||||
} else {
|
||||
dom.removeCssClass(this.cursor, "ace_overwrite");
|
||||
}
|
||||
this.position = position;
|
||||
this.overwrite = overwrite;
|
||||
};
|
||||
|
||||
this.hideCursor = function() {
|
||||
|
|
@ -100,7 +94,7 @@ var Cursor = function(parentEl) {
|
|||
}, 1000);
|
||||
};
|
||||
|
||||
this.getPixelPosition = function() {
|
||||
this.getPixelPosition = function(onScreen) {
|
||||
if (!this.config || !this.position) {
|
||||
return {
|
||||
left : 0,
|
||||
|
|
@ -108,10 +102,12 @@ var Cursor = function(parentEl) {
|
|||
};
|
||||
}
|
||||
|
||||
var cursorLeft = Math.round(this.position.column * this.config.characterWidth);
|
||||
var cursorTop = this.position.row * this.config.lineHeight;
|
||||
var pos = this.session.documentToScreenPosition(this.position);
|
||||
var cursorLeft = Math.round(pos.column * this.config.characterWidth);
|
||||
var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) *
|
||||
this.config.lineHeight;
|
||||
|
||||
return {
|
||||
return {
|
||||
left : cursorLeft,
|
||||
top : cursorTop
|
||||
};
|
||||
|
|
@ -123,23 +119,23 @@ var Cursor = function(parentEl) {
|
|||
|
||||
this.config = config;
|
||||
|
||||
var cursorLeft = Math.round(this.position.column * config.characterWidth);
|
||||
var cursorTop = this.position.row * config.lineHeight;
|
||||
this.pixelPos = this.getPixelPosition(true);
|
||||
|
||||
this.pixelPos = {
|
||||
left : cursorLeft,
|
||||
top : cursorTop
|
||||
};
|
||||
|
||||
this.cursor.style.left = cursorLeft + "px";
|
||||
this.cursor.style.top = (cursorTop - (config.firstRow * config.lineHeight))
|
||||
+ "px";
|
||||
this.cursor.style.left = this.pixelPos.left + "px";
|
||||
this.cursor.style.top = this.pixelPos.top + "px";
|
||||
this.cursor.style.width = config.characterWidth + "px";
|
||||
this.cursor.style.height = config.lineHeight + "px";
|
||||
|
||||
if (this.isVisible) {
|
||||
this.element.appendChild(this.cursor);
|
||||
}
|
||||
|
||||
if (this.overwrite) {
|
||||
dom.addCssClass(this.cursor, "ace_overwrite");
|
||||
} else {
|
||||
dom.removeCssClass(this.cursor, "ace_overwrite");
|
||||
}
|
||||
|
||||
this.restartTimer();
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
*
|
||||
* Contributor(s):
|
||||
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||
* Julian Viereck <julian.viereck@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
|
@ -45,35 +46,70 @@ var Gutter = function(parentEl) {
|
|||
parentEl.appendChild(this.element);
|
||||
|
||||
this.$breakpoints = [];
|
||||
this.$annotations = [];
|
||||
this.$decorations = [];
|
||||
};
|
||||
|
||||
(function() {
|
||||
|
||||
this.setSession = function(session) {
|
||||
this.session = session;
|
||||
};
|
||||
|
||||
this.addGutterDecoration = function(row, className){
|
||||
if (!this.$decorations[row])
|
||||
if (!this.$decorations[row])
|
||||
this.$decorations[row] = "";
|
||||
this.$decorations[row] += " ace_" + className;
|
||||
}
|
||||
|
||||
|
||||
this.removeGutterDecoration = function(row, className){
|
||||
this.$decorations[row] =
|
||||
this.$decorations[row].replace(" ace_" + className, "");
|
||||
}
|
||||
this.$decorations[row] = this.$decorations[row].replace(" ace_" + className, "");
|
||||
};
|
||||
|
||||
this.setBreakpoints = function(rows) {
|
||||
this.$breakpoints = rows.concat();
|
||||
};
|
||||
|
||||
this.setAnnotations = function(annotations) {
|
||||
// iterate over sparse array
|
||||
this.$annotations = [];
|
||||
for (var row in annotations) if (annotations.hasOwnProperty(row)) {
|
||||
var rowAnnotations = annotations[row];
|
||||
if (!rowAnnotations)
|
||||
continue;
|
||||
|
||||
var rowInfo = this.$annotations[row] = {
|
||||
text: []
|
||||
};
|
||||
for (var i=0; i<rowAnnotations.length; i++) {
|
||||
var annotation = rowAnnotations[i];
|
||||
rowInfo.text.push(annotation.text.replace(/"/g, """).replace(/'/g, "’").replace(/</, "<"));
|
||||
var type = annotation.type;
|
||||
if (type == "error")
|
||||
rowInfo.className = "ace_error";
|
||||
else if (type == "warning" && rowInfo.className != "ace_error")
|
||||
rowInfo.className = "ace_warning";
|
||||
else if (type == "info" && (!rowInfo.className))
|
||||
rowInfo.className = "ace_info";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.update = function(config) {
|
||||
this.$config = config;
|
||||
|
||||
var html = [];
|
||||
for ( var i = config.firstRow; i <= config.lastRow; i++) {
|
||||
var annotation = this.$annotations[i] || {
|
||||
className: "",
|
||||
text: []
|
||||
};
|
||||
html.push("<div class='ace_gutter-cell",
|
||||
this.$decorations[i] || "",
|
||||
this.$breakpoints[i] ? " ace_breakpoint" : "",
|
||||
"' style='height:", config.lineHeight, "px;'>", (i+1), "</div>");
|
||||
this.$breakpoints[i] ? " ace_breakpoint " : " ",
|
||||
annotation.className,
|
||||
"' title='", annotation.text.join("\n"),
|
||||
"' style='height:", this.session.getRowHeight(config, i), "px;'>", (i+1), "</div>");
|
||||
html.push("</div>");
|
||||
}
|
||||
this.element = dom.setInnerHtml(this.element, html.join(""));
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue