[IMP] update ace editor to v1.3.1
Note that we do not do a custom build anymore, since we lazyload the files anyway. A custom build will save a few kb, but will not do any meaningful change to the user experience. However, it dies impact negatively our ease of maintenance, so standard build it is.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,187 +1,265 @@
|
|||||||
(function() {var define = ace.define, require = ace.require;
|
define("ace/mode/python_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) {
|
||||||
define("ace/mode/python_highlight_rules", ["require", "exports", "module", "ace/lib/oop", "ace/mode/text_highlight_rules"], function(e, t, n) {
|
"use strict";
|
||||||
"use strict";
|
|
||||||
var r = e("../lib/oop"),
|
var oop = require("../lib/oop");
|
||||||
i = e("./text_highlight_rules").TextHighlightRules,
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
s = function() {
|
|
||||||
var e = "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",
|
var PythonHighlightRules = function() {
|
||||||
t = "True|False|None|NotImplemented|Ellipsis|__debug__",
|
|
||||||
n = "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",
|
var keywords = (
|
||||||
r = this.createKeywordMapper({
|
"and|as|assert|break|class|continue|def|del|elif|else|except|exec|" +
|
||||||
"invalid.deprecated": "debugger",
|
"finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|" +
|
||||||
"support.function": n,
|
"raise|return|try|while|with|yield|async|await"
|
||||||
"constant.language": t,
|
);
|
||||||
keyword: e
|
|
||||||
}, "identifier"),
|
var builtinConstants = (
|
||||||
i = "(?:r|u|ur|R|U|UR|Ur|uR)?",
|
"True|False|None|NotImplemented|Ellipsis|__debug__"
|
||||||
s = "(?:(?:[1-9]\\d*)|(?:0))",
|
);
|
||||||
o = "(?:0[oO]?[0-7]+)",
|
|
||||||
u = "(?:0[xX][\\dA-Fa-f]+)",
|
var builtinFunctions = (
|
||||||
a = "(?:0[bB][01]+)",
|
"abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|" +
|
||||||
f = "(?:" + s + "|" + o + "|" + u + "|" + a + ")",
|
"eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|" +
|
||||||
l = "(?:[eE][+-]?\\d+)",
|
"binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|" +
|
||||||
c = "(?:\\.\\d+)",
|
"float|list|raw_input|unichr|callable|format|locals|reduce|unicode|" +
|
||||||
h = "(?:\\d+)",
|
"chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|" +
|
||||||
p = "(?:(?:" + h + "?" + c + ")|(?:" + h + "\\.))",
|
"cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|" +
|
||||||
d = "(?:(?:" + p + "|" + h + ")" + l + ")",
|
"__import__|complex|hash|min|set|apply|delattr|help|next|setattr|" +
|
||||||
v = "(?:" + d + "|" + p + ")",
|
"buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern"
|
||||||
m = "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})";
|
);
|
||||||
this.$rules = {
|
var keywordMapper = this.createKeywordMapper({
|
||||||
start: [{
|
"invalid.deprecated": "debugger",
|
||||||
token: "comment",
|
"support.function": builtinFunctions,
|
||||||
regex: "#.*$"
|
"constant.language": builtinConstants,
|
||||||
}, {
|
"keyword": keywords
|
||||||
token: "string",
|
}, "identifier");
|
||||||
regex: i + '"{3}',
|
|
||||||
next: "qqstring3"
|
var strPre = "(?:r|u|ur|R|U|UR|Ur|uR)?";
|
||||||
}, {
|
|
||||||
token: "string",
|
var decimalInteger = "(?:(?:[1-9]\\d*)|(?:0))";
|
||||||
regex: i + '"(?=.)',
|
var octInteger = "(?:0[oO]?[0-7]+)";
|
||||||
next: "qqstring"
|
var hexInteger = "(?:0[xX][\\dA-Fa-f]+)";
|
||||||
}, {
|
var binInteger = "(?:0[bB][01]+)";
|
||||||
token: "string",
|
var integer = "(?:" + decimalInteger + "|" + octInteger + "|" + hexInteger + "|" + binInteger + ")";
|
||||||
regex: i + "'{3}",
|
|
||||||
next: "qstring3"
|
var exponent = "(?:[eE][+-]?\\d+)";
|
||||||
}, {
|
var fraction = "(?:\\.\\d+)";
|
||||||
token: "string",
|
var intPart = "(?:\\d+)";
|
||||||
regex: i + "'(?=.)",
|
var pointFloat = "(?:(?:" + intPart + "?" + fraction + ")|(?:" + intPart + "\\.))";
|
||||||
next: "qstring"
|
var exponentFloat = "(?:(?:" + pointFloat + "|" + intPart + ")" + exponent + ")";
|
||||||
}, {
|
var floatNumber = "(?:" + exponentFloat + "|" + pointFloat + ")";
|
||||||
token: "constant.numeric",
|
|
||||||
regex: "(?:" + v + "|\\d+)[jJ]\\b"
|
var stringEscape = "\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\abfnrtv'\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})";
|
||||||
}, {
|
|
||||||
token: "constant.numeric",
|
this.$rules = {
|
||||||
regex: v
|
"start" : [ {
|
||||||
}, {
|
token : "comment",
|
||||||
token: "constant.numeric",
|
regex : "#.*$"
|
||||||
regex: f + "[lL]\\b"
|
}, {
|
||||||
}, {
|
token : "string", // multi line """ string start
|
||||||
token: "constant.numeric",
|
regex : strPre + '"{3}',
|
||||||
regex: f + "\\b"
|
next : "qqstring3"
|
||||||
}, {
|
}, {
|
||||||
token: r,
|
token : "string", // " string
|
||||||
regex: "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
regex : strPre + '"(?=.)',
|
||||||
}, {
|
next : "qqstring"
|
||||||
token: "keyword.operator",
|
}, {
|
||||||
regex: "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
|
token : "string", // multi line ''' string start
|
||||||
}, {
|
regex : strPre + "'{3}",
|
||||||
token: "paren.lparen",
|
next : "qstring3"
|
||||||
regex: "[\\[\\(\\{]"
|
}, {
|
||||||
}, {
|
token : "string", // ' string
|
||||||
token: "paren.rparen",
|
regex : strPre + "'(?=.)",
|
||||||
regex: "[\\]\\)\\}]"
|
next : "qstring"
|
||||||
}, {
|
}, {
|
||||||
token: "text",
|
token : "constant.numeric", // imaginary
|
||||||
regex: "\\s+"
|
regex : "(?:" + floatNumber + "|\\d+)[jJ]\\b"
|
||||||
}],
|
}, {
|
||||||
qqstring3: [{
|
token : "constant.numeric", // float
|
||||||
token: "constant.language.escape",
|
regex : floatNumber
|
||||||
regex: m
|
}, {
|
||||||
}, {
|
token : "constant.numeric", // long integer
|
||||||
token: "string",
|
regex : integer + "[lL]\\b"
|
||||||
regex: '"{3}',
|
}, {
|
||||||
next: "start"
|
token : "constant.numeric", // integer
|
||||||
}, {
|
regex : integer + "\\b"
|
||||||
defaultToken: "string"
|
}, {
|
||||||
}],
|
token : keywordMapper,
|
||||||
qstring3: [{
|
regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b"
|
||||||
token: "constant.language.escape",
|
}, {
|
||||||
regex: m
|
token : "keyword.operator",
|
||||||
}, {
|
regex : "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
|
||||||
token: "string",
|
}, {
|
||||||
regex: "'{3}",
|
token : "paren.lparen",
|
||||||
next: "start"
|
regex : "[\\[\\(\\{]"
|
||||||
}, {
|
}, {
|
||||||
defaultToken: "string"
|
token : "paren.rparen",
|
||||||
}],
|
regex : "[\\]\\)\\}]"
|
||||||
qqstring: [{
|
}, {
|
||||||
token: "constant.language.escape",
|
token : "text",
|
||||||
regex: m
|
regex : "\\s+"
|
||||||
}, {
|
} ],
|
||||||
token: "string",
|
"qqstring3" : [ {
|
||||||
regex: "\\\\$",
|
token : "constant.language.escape",
|
||||||
next: "qqstring"
|
regex : stringEscape
|
||||||
}, {
|
}, {
|
||||||
token: "string",
|
token : "string", // multi line """ string end
|
||||||
regex: '"|$',
|
regex : '"{3}',
|
||||||
next: "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
defaultToken: "string"
|
defaultToken : "string"
|
||||||
}],
|
} ],
|
||||||
qstring: [{
|
"qstring3" : [ {
|
||||||
token: "constant.language.escape",
|
token : "constant.language.escape",
|
||||||
regex: m
|
regex : stringEscape
|
||||||
}, {
|
}, {
|
||||||
token: "string",
|
token : "string", // multi line ''' string end
|
||||||
regex: "\\\\$",
|
regex : "'{3}",
|
||||||
next: "qstring"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
token: "string",
|
defaultToken : "string"
|
||||||
regex: "'|$",
|
} ],
|
||||||
next: "start"
|
"qqstring" : [{
|
||||||
}, {
|
token : "constant.language.escape",
|
||||||
defaultToken: "string"
|
regex : stringEscape
|
||||||
}]
|
}, {
|
||||||
}
|
token : "string",
|
||||||
};
|
regex : "\\\\$",
|
||||||
r.inherits(s, i), t.PythonHighlightRules = s
|
next : "qqstring"
|
||||||
}), define("ace/mode/folding/pythonic", ["require", "exports", "module", "ace/lib/oop", "ace/mode/folding/fold_mode"], function(e, t, n) {
|
}, {
|
||||||
"use strict";
|
token : "string",
|
||||||
var r = e("../../lib/oop"),
|
regex : '"|$',
|
||||||
i = e("./fold_mode").FoldMode,
|
next : "start"
|
||||||
s = t.FoldMode = function(e) {
|
}, {
|
||||||
this.foldingStartMarker = new RegExp("([\\[{])(?:\\s*)$|(" + e + ")(?:\\s*)(?:#.*)?$")
|
defaultToken: "string"
|
||||||
};
|
}],
|
||||||
r.inherits(s, i),
|
"qstring" : [{
|
||||||
function() {
|
token : "constant.language.escape",
|
||||||
this.getFoldWidgetRange = function(e, t, n) {
|
regex : stringEscape
|
||||||
var r = e.getLine(n),
|
}, {
|
||||||
i = r.match(this.foldingStartMarker);
|
token : "string",
|
||||||
if (i) return i[1] ? this.openingBracketBlock(e, i[1], n, i.index) : i[2] ? this.indentationBlock(e, n, i.index + i[2].length) : this.indentationBlock(e, n)
|
regex : "\\\\$",
|
||||||
}
|
next : "qstring"
|
||||||
}.call(s.prototype)
|
}, {
|
||||||
}), define("ace/mode/python", ["require", "exports", "module", "ace/lib/oop", "ace/mode/text", "ace/mode/python_highlight_rules", "ace/mode/folding/pythonic", "ace/range"], function(e, t, n) {
|
token : "string",
|
||||||
"use strict";
|
regex : "'|$",
|
||||||
var r = e("../lib/oop"),
|
next : "start"
|
||||||
i = e("./text").Mode,
|
}, {
|
||||||
s = e("./python_highlight_rules").PythonHighlightRules,
|
defaultToken: "string"
|
||||||
o = e("./folding/pythonic").FoldMode,
|
}]
|
||||||
u = e("../range").Range,
|
};
|
||||||
a = function() {
|
};
|
||||||
this.HighlightRules = s, this.foldingRules = new o("\\:")
|
|
||||||
};
|
oop.inherits(PythonHighlightRules, TextHighlightRules);
|
||||||
r.inherits(a, i),
|
|
||||||
function() {
|
exports.PythonHighlightRules = PythonHighlightRules;
|
||||||
this.lineCommentStart = "#", this.getNextLineIndent = function(e, t, n) {
|
});
|
||||||
var r = this.$getIndent(t),
|
|
||||||
i = this.getTokenizer().getLineTokens(t, e),
|
define("ace/mode/folding/pythonic",["require","exports","module","ace/lib/oop","ace/mode/folding/fold_mode"], function(require, exports, module) {
|
||||||
s = i.tokens;
|
"use strict";
|
||||||
if (s.length && s[s.length - 1].type == "comment") return r;
|
|
||||||
if (e == "start") {
|
var oop = require("../../lib/oop");
|
||||||
var o = t.match(/^.*[\{\(\[\:]\s*$/);
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
o && (r += n)
|
|
||||||
}
|
var FoldMode = exports.FoldMode = function(markers) {
|
||||||
return r
|
this.foldingStartMarker = new RegExp("([\\[{])(?:\\s*)$|(" + markers + ")(?:\\s*)(?:#.*)?$");
|
||||||
};
|
};
|
||||||
var e = {
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
pass: 1,
|
|
||||||
"return": 1,
|
(function() {
|
||||||
raise: 1,
|
|
||||||
"break": 1,
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
"continue": 1
|
var line = session.getLine(row);
|
||||||
};
|
var match = line.match(this.foldingStartMarker);
|
||||||
this.checkOutdent = function(t, n, r) {
|
if (match) {
|
||||||
if (r !== "\r\n" && r !== "\r" && r !== "\n") return !1;
|
if (match[1])
|
||||||
var i = this.getTokenizer().getLineTokens(n.trim(), t).tokens;
|
return this.openingBracketBlock(session, match[1], row, match.index);
|
||||||
if (!i) return !1;
|
if (match[2])
|
||||||
do var s = i.pop(); while (s && (s.type == "comment" || s.type == "text" && s.value.match(/^\s+$/)));
|
return this.indentationBlock(session, row, match.index + match[2].length);
|
||||||
return s ? s.type == "keyword" && e[s.value] : !1
|
return this.indentationBlock(session, row);
|
||||||
}, this.autoOutdent = function(e, t, n) {
|
}
|
||||||
n += 1;
|
};
|
||||||
var r = this.$getIndent(t.getLine(n)),
|
|
||||||
i = t.getTabString();
|
}).call(FoldMode.prototype);
|
||||||
r.slice(-i.length) == i && t.remove(new u(n, r.length - i.length, n, r.length))
|
|
||||||
}, this.$id = "ace/mode/python"
|
});
|
||||||
}.call(a.prototype), t.Mode = a
|
|
||||||
|
define("ace/mode/python",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/python_highlight_rules","ace/mode/folding/pythonic","ace/range"], function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var PythonHighlightRules = require("./python_highlight_rules").PythonHighlightRules;
|
||||||
|
var PythonFoldMode = require("./folding/pythonic").FoldMode;
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.HighlightRules = PythonHighlightRules;
|
||||||
|
this.foldingRules = new PythonFoldMode("\\:");
|
||||||
|
this.$behaviour = this.$defaultBehaviour;
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.lineCommentStart = "#";
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
|
||||||
|
var tokens = tokenizedLine.tokens;
|
||||||
|
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state == "start") {
|
||||||
|
var match = line.match(/^.*[\{\(\[:]\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
var outdents = {
|
||||||
|
"pass": 1,
|
||||||
|
"return": 1,
|
||||||
|
"raise": 1,
|
||||||
|
"break": 1,
|
||||||
|
"continue": 1
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
if (input !== "\r\n" && input !== "\r" && input !== "\n")
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var tokens = this.getTokenizer().getLineTokens(line.trim(), state).tokens;
|
||||||
|
|
||||||
|
if (!tokens)
|
||||||
|
return false;
|
||||||
|
do {
|
||||||
|
var last = tokens.pop();
|
||||||
|
} while (last && (last.type == "comment" || (last.type == "text" && last.value.match(/^\s+$/))));
|
||||||
|
|
||||||
|
if (!last)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return (last.type == "keyword" && outdents[last.value]);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
|
||||||
|
row += 1;
|
||||||
|
var indent = this.$getIndent(doc.getLine(row));
|
||||||
|
var tab = doc.getTabString();
|
||||||
|
if (indent.slice(-tab.length) == tab)
|
||||||
|
doc.remove(new Range(row, indent.length-tab.length, row, indent.length));
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$id = "ace/mode/python";
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
});
|
});
|
||||||
})();
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+1406
-1408
File diff suppressed because it is too large
Load Diff
@@ -2452,7 +2452,7 @@ var FieldDomain = AbstractField.extend({
|
|||||||
var AceEditor = DebouncedField.extend({
|
var AceEditor = DebouncedField.extend({
|
||||||
template: "AceEditor",
|
template: "AceEditor",
|
||||||
jsLibs: [
|
jsLibs: [
|
||||||
'/web/static/lib/ace/ace.odoo-custom.js',
|
'/web/static/lib/ace/ace.js',
|
||||||
[
|
[
|
||||||
'/web/static/lib/ace/mode-python.js',
|
'/web/static/lib/ace/mode-python.js',
|
||||||
'/web/static/lib/ace/mode-xml.js'
|
'/web/static/lib/ace/mode-xml.js'
|
||||||
|
|||||||
@@ -424,7 +424,7 @@
|
|||||||
<script type="text/javascript" src="/web/static/lib/nvd3/d3.v3.js"></script>
|
<script type="text/javascript" src="/web/static/lib/nvd3/d3.v3.js"></script>
|
||||||
<script type="text/javascript" src="/web/static/lib/nvd3/nv.d3.js"></script>
|
<script type="text/javascript" src="/web/static/lib/nvd3/nv.d3.js"></script>
|
||||||
<script type="text/javascript" src="/web/static/src/js/libs/nvd3.js"></script>
|
<script type="text/javascript" src="/web/static/src/js/libs/nvd3.js"></script>
|
||||||
<script type="text/javascript" src="/web/static/lib/ace/ace.odoo-custom.js"></script>
|
<script type="text/javascript" src="/web/static/lib/ace/ace.js"></script>
|
||||||
<script type="text/javascript" src="/web/static/lib/ace/mode-python.js"></script>
|
<script type="text/javascript" src="/web/static/lib/ace/mode-python.js"></script>
|
||||||
<script type="text/javascript" src="/web/static/lib/ace/mode-xml.js"></script>
|
<script type="text/javascript" src="/web/static/lib/ace/mode-xml.js"></script>
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ var ViewEditor = Widget.extend({
|
|||||||
template: 'web_editor.ace_view_editor',
|
template: 'web_editor.ace_view_editor',
|
||||||
xmlDependencies: ['/web_editor/static/src/xml/ace.xml'],
|
xmlDependencies: ['/web_editor/static/src/xml/ace.xml'],
|
||||||
jsLibs: [
|
jsLibs: [
|
||||||
'/web/static/lib/ace/ace.odoo-custom.js',
|
'/web/static/lib/ace/ace.js',
|
||||||
[
|
[
|
||||||
'/web/static/lib/ace/mode-xml.js',
|
'/web/static/lib/ace/mode-xml.js',
|
||||||
'/web/static/lib/ace/mode-less.js',
|
'/web/static/lib/ace/mode-less.js',
|
||||||
|
|||||||
Reference in New Issue
Block a user