Commit a5051118 authored by Romain Courteaud's avatar Romain Courteaud

Add ace editor gadget.

parent 45681dfb
......@@ -85,6 +85,14 @@ module.exports = function (grunt) {
strictMath: true,
strictUnits: true,
syncImport: true
},
files: {
"<%= global_config.dest %>/editor_ace/aceeditor.css":
"<%= global_config.src %>/editor_ace/aceeditor.less",
"<%= global_config.dest %>/erp5/erp5.css":
"<%= global_config.src %>/erp5/erp5.less",
"<%= global_config.dest %>/twin_erp5/superindex.css":
"<%= global_config.src %>/twin_erp5/superindex.less"
}
}
},
......@@ -175,6 +183,11 @@ module.exports = function (grunt) {
},
curl: {
ace: {
src: 'https://github.com/ajaxorg/ace-builds/archive/3bfda31096cf3f42b77aac64eb788584ea796822.zip',
relative_url: "lib/ace-builds-3bfda31096cf3f42b77aac64eb788584ea796822/src-min/ace.js",
dest: '<%= global_config.tmp %>/ace.zip'
},
jqueryte: {
src: 'http://jqueryte.com/jqte/<%= curl.jqueryte.directory %>.zip',
version: "1.4.0",
......@@ -215,6 +228,10 @@ module.exports = function (grunt) {
},
unzip: {
ace: {
src: '<%= curl.ace.dest %>',
dest: '<%= global_config.dest %>/lib/'
},
jqueryte: {
src: '<%= curl.jqueryte.dest %>',
dest: '<%= global_config.dest %>/lib/'
......
/*global ace, rJS */
/*jslint nomen: true*/
(function (window, rJS) {
"use strict";
var gk = rJS(window);
gk.declareMethod('setContent', function (value) {
this.editor.getSession().setValue(value);
})
.declareMethod('getContent', function () {
return this.editor.getSession().getValue();
});
gk.ready(function (g) {
g.editor = ace.edit(g.__element.getElementsByTagName('div')[0]);
g.editor.setTheme("ace/theme/monokai");
});
}(window, rJS, ace));
#editor {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Ace Editor</title>
<script src="../<%= curl.ace.relative_url %>" type="text/javascript" charset="utf-8"></script>
<script src="../<%= copy.rsvp.relative_dest %>" type="text/javascript"></script>
<script src="../<%= copy.renderjs.relative_dest %>" type="text/javascript"></script>
<script src="aceeditor.js" type="text/javascript"></script>
<!--script src="./ace/theme-monokai.js" type="text/javascript"></script>
<script src="./ace/mode-javascript.js" type="text/javascript"></script>
<script src="./ace/worker-javascript.js" type="text/javascript"></script-->
<link rel="stylesheet" href="aceeditor.css" media="screen" ></link>
</head>
<body>
<div id="editor"></div>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment