Merge remote-tracking branch 'refs/remotes/ckcz123/v2.0' into v2.0-editor-docs-20180313
This commit is contained in:
commit
4842dd3c8f
63
_server/CodeMirror/javascript-lint.js
Normal file
63
_server/CodeMirror/javascript-lint.js
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||||
|
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||||
|
|
||||||
|
(function(mod) {
|
||||||
|
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||||
|
mod(require("../../lib/codemirror"));
|
||||||
|
else if (typeof define == "function" && define.amd) // AMD
|
||||||
|
define(["../../lib/codemirror"], mod);
|
||||||
|
else // Plain browser env
|
||||||
|
mod(CodeMirror);
|
||||||
|
})(function(CodeMirror) {
|
||||||
|
"use strict";
|
||||||
|
// declare global: JSHINT
|
||||||
|
|
||||||
|
function validator(text, options) {
|
||||||
|
if (!window.JSHINT) {
|
||||||
|
if (window.console) {
|
||||||
|
window.console.error("Error: window.JSHINT not defined, CodeMirror JavaScript linting cannot run.");
|
||||||
|
}
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
if (!options.indent) // JSHint error.character actually is a column index, this fixes underlining on lines using tabs for indentation
|
||||||
|
options.indent = 1; // JSHint default value is 4
|
||||||
|
JSHINT(text, options, options.globals);
|
||||||
|
var errors = JSHINT.data().errors, result = [];
|
||||||
|
if (errors) parseErrors(errors, result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
CodeMirror.registerHelper("lint", "javascript", validator);
|
||||||
|
|
||||||
|
function parseErrors(errors, output) {
|
||||||
|
for ( var i = 0; i < errors.length; i++) {
|
||||||
|
var error = errors[i];
|
||||||
|
if (error) {
|
||||||
|
if (error.line <= 0) {
|
||||||
|
if (window.console) {
|
||||||
|
window.console.warn("Cannot display JSHint error (invalid line " + error.line + ")", error);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var start = error.character - 1, end = start + 1;
|
||||||
|
if (error.evidence) {
|
||||||
|
var index = error.evidence.substring(start).search(/.\b/);
|
||||||
|
if (index > -1) {
|
||||||
|
end += index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Convert to format expected by validation service
|
||||||
|
var hint = {
|
||||||
|
message: error.reason,
|
||||||
|
severity: error.code ? (error.code.startsWith('W') ? "warning" : "error") : "error",
|
||||||
|
from: CodeMirror.Pos(error.line - 1, start),
|
||||||
|
to: CodeMirror.Pos(error.line - 1, end)
|
||||||
|
};
|
||||||
|
|
||||||
|
output.push(hint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
1
_server/CodeMirror/jshint.min.js
vendored
Normal file
1
_server/CodeMirror/jshint.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
73
_server/CodeMirror/lint.css
Normal file
73
_server/CodeMirror/lint.css
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
/* The lint marker gutter */
|
||||||
|
.CodeMirror-lint-markers {
|
||||||
|
width: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-lint-tooltip {
|
||||||
|
background-color: #ffd;
|
||||||
|
border: 1px solid black;
|
||||||
|
border-radius: 4px 4px 4px 4px;
|
||||||
|
color: black;
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: 10pt;
|
||||||
|
overflow: hidden;
|
||||||
|
padding: 2px 5px;
|
||||||
|
position: fixed;
|
||||||
|
white-space: pre;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
z-index: 330;
|
||||||
|
max-width: 600px;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity .4s;
|
||||||
|
-moz-transition: opacity .4s;
|
||||||
|
-webkit-transition: opacity .4s;
|
||||||
|
-o-transition: opacity .4s;
|
||||||
|
-ms-transition: opacity .4s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-lint-mark-error, .CodeMirror-lint-mark-warning {
|
||||||
|
background-position: left bottom;
|
||||||
|
background-repeat: repeat-x;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-lint-mark-error {
|
||||||
|
background-image:
|
||||||
|
url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==")
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-lint-mark-warning {
|
||||||
|
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=");
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-lint-marker-error, .CodeMirror-lint-marker-warning {
|
||||||
|
background-position: center center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
cursor: pointer;
|
||||||
|
display: inline-block;
|
||||||
|
height: 16px;
|
||||||
|
width: 16px;
|
||||||
|
vertical-align: middle;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-lint-message-error, .CodeMirror-lint-message-warning {
|
||||||
|
padding-left: 18px;
|
||||||
|
background-position: top left;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-lint-marker-error, .CodeMirror-lint-message-error {
|
||||||
|
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII=");
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-lint-marker-warning, .CodeMirror-lint-message-warning {
|
||||||
|
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII=");
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-lint-marker-multiple {
|
||||||
|
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-position: right bottom;
|
||||||
|
width: 100%; height: 100%;
|
||||||
|
}
|
||||||
252
_server/CodeMirror/lint.js
Normal file
252
_server/CodeMirror/lint.js
Normal file
@ -0,0 +1,252 @@
|
|||||||
|
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
||||||
|
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
||||||
|
|
||||||
|
(function(mod) {
|
||||||
|
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
||||||
|
mod(require("../../lib/codemirror"));
|
||||||
|
else if (typeof define == "function" && define.amd) // AMD
|
||||||
|
define(["../../lib/codemirror"], mod);
|
||||||
|
else // Plain browser env
|
||||||
|
mod(CodeMirror);
|
||||||
|
})(function(CodeMirror) {
|
||||||
|
"use strict";
|
||||||
|
var GUTTER_ID = "CodeMirror-lint-markers";
|
||||||
|
|
||||||
|
function showTooltip(e, content) {
|
||||||
|
var tt = document.createElement("div");
|
||||||
|
tt.className = "CodeMirror-lint-tooltip";
|
||||||
|
tt.appendChild(content.cloneNode(true));
|
||||||
|
document.body.appendChild(tt);
|
||||||
|
|
||||||
|
function position(e) {
|
||||||
|
if (!tt.parentNode) return CodeMirror.off(document, "mousemove", position);
|
||||||
|
tt.style.top = Math.max(0, e.clientY - tt.offsetHeight - 5) + "px";
|
||||||
|
tt.style.left = (e.clientX + 5) + "px";
|
||||||
|
}
|
||||||
|
CodeMirror.on(document, "mousemove", position);
|
||||||
|
position(e);
|
||||||
|
if (tt.style.opacity != null) tt.style.opacity = 1;
|
||||||
|
return tt;
|
||||||
|
}
|
||||||
|
function rm(elt) {
|
||||||
|
if (elt.parentNode) elt.parentNode.removeChild(elt);
|
||||||
|
}
|
||||||
|
function hideTooltip(tt) {
|
||||||
|
if (!tt.parentNode) return;
|
||||||
|
if (tt.style.opacity == null) rm(tt);
|
||||||
|
tt.style.opacity = 0;
|
||||||
|
setTimeout(function() { rm(tt); }, 600);
|
||||||
|
}
|
||||||
|
|
||||||
|
function showTooltipFor(e, content, node) {
|
||||||
|
var tooltip = showTooltip(e, content);
|
||||||
|
function hide() {
|
||||||
|
CodeMirror.off(node, "mouseout", hide);
|
||||||
|
if (tooltip) { hideTooltip(tooltip); tooltip = null; }
|
||||||
|
}
|
||||||
|
var poll = setInterval(function() {
|
||||||
|
if (tooltip) for (var n = node;; n = n.parentNode) {
|
||||||
|
if (n && n.nodeType == 11) n = n.host;
|
||||||
|
if (n == document.body) return;
|
||||||
|
if (!n) { hide(); break; }
|
||||||
|
}
|
||||||
|
if (!tooltip) return clearInterval(poll);
|
||||||
|
}, 400);
|
||||||
|
CodeMirror.on(node, "mouseout", hide);
|
||||||
|
}
|
||||||
|
|
||||||
|
function LintState(cm, options, hasGutter) {
|
||||||
|
this.marked = [];
|
||||||
|
this.options = options;
|
||||||
|
this.timeout = null;
|
||||||
|
this.hasGutter = hasGutter;
|
||||||
|
this.onMouseOver = function(e) { onMouseOver(cm, e); };
|
||||||
|
this.waitingFor = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseOptions(_cm, options) {
|
||||||
|
if (options instanceof Function) return {getAnnotations: options};
|
||||||
|
if (!options || options === true) options = {};
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
function clearMarks(cm) {
|
||||||
|
var state = cm.state.lint;
|
||||||
|
if (state.hasGutter) cm.clearGutter(GUTTER_ID);
|
||||||
|
for (var i = 0; i < state.marked.length; ++i)
|
||||||
|
state.marked[i].clear();
|
||||||
|
state.marked.length = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
function makeMarker(labels, severity, multiple, tooltips) {
|
||||||
|
var marker = document.createElement("div"), inner = marker;
|
||||||
|
marker.className = "CodeMirror-lint-marker-" + severity;
|
||||||
|
if (multiple) {
|
||||||
|
inner = marker.appendChild(document.createElement("div"));
|
||||||
|
inner.className = "CodeMirror-lint-marker-multiple";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tooltips != false) CodeMirror.on(inner, "mouseover", function(e) {
|
||||||
|
showTooltipFor(e, labels, inner);
|
||||||
|
});
|
||||||
|
|
||||||
|
return marker;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getMaxSeverity(a, b) {
|
||||||
|
if (a == "error") return a;
|
||||||
|
else return b;
|
||||||
|
}
|
||||||
|
|
||||||
|
function groupByLine(annotations) {
|
||||||
|
var lines = [];
|
||||||
|
for (var i = 0; i < annotations.length; ++i) {
|
||||||
|
var ann = annotations[i], line = ann.from.line;
|
||||||
|
(lines[line] || (lines[line] = [])).push(ann);
|
||||||
|
}
|
||||||
|
return lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
function annotationTooltip(ann) {
|
||||||
|
var severity = ann.severity;
|
||||||
|
if (!severity) severity = "error";
|
||||||
|
var tip = document.createElement("div");
|
||||||
|
tip.className = "CodeMirror-lint-message-" + severity;
|
||||||
|
if (typeof ann.messageHTML != 'undefined') {
|
||||||
|
tip.innerHTML = ann.messageHTML;
|
||||||
|
} else {
|
||||||
|
tip.appendChild(document.createTextNode(ann.message));
|
||||||
|
}
|
||||||
|
return tip;
|
||||||
|
}
|
||||||
|
|
||||||
|
function lintAsync(cm, getAnnotations, passOptions) {
|
||||||
|
var state = cm.state.lint
|
||||||
|
var id = ++state.waitingFor
|
||||||
|
function abort() {
|
||||||
|
id = -1
|
||||||
|
cm.off("change", abort)
|
||||||
|
}
|
||||||
|
cm.on("change", abort)
|
||||||
|
getAnnotations(cm.getValue(), function(annotations, arg2) {
|
||||||
|
cm.off("change", abort)
|
||||||
|
if (state.waitingFor != id) return
|
||||||
|
if (arg2 && annotations instanceof CodeMirror) annotations = arg2
|
||||||
|
cm.operation(function() {updateLinting(cm, annotations)})
|
||||||
|
}, passOptions, cm);
|
||||||
|
}
|
||||||
|
|
||||||
|
function startLinting(cm) {
|
||||||
|
var state = cm.state.lint, options = state.options;
|
||||||
|
/*
|
||||||
|
* Passing rules in `options` property prevents JSHint (and other linters) from complaining
|
||||||
|
* about unrecognized rules like `onUpdateLinting`, `delay`, `lintOnChange`, etc.
|
||||||
|
*/
|
||||||
|
var passOptions = options.options || options;
|
||||||
|
var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint");
|
||||||
|
if (!getAnnotations) return;
|
||||||
|
if (options.async || getAnnotations.async) {
|
||||||
|
lintAsync(cm, getAnnotations, passOptions)
|
||||||
|
} else {
|
||||||
|
var annotations = getAnnotations(cm.getValue(), passOptions, cm);
|
||||||
|
if (!annotations) return;
|
||||||
|
if (annotations.then) annotations.then(function(issues) {
|
||||||
|
cm.operation(function() {updateLinting(cm, issues)})
|
||||||
|
});
|
||||||
|
else cm.operation(function() {updateLinting(cm, annotations)})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateLinting(cm, annotationsNotSorted) {
|
||||||
|
clearMarks(cm);
|
||||||
|
var state = cm.state.lint, options = state.options;
|
||||||
|
|
||||||
|
var annotations = groupByLine(annotationsNotSorted);
|
||||||
|
|
||||||
|
for (var line = 0; line < annotations.length; ++line) {
|
||||||
|
var anns = annotations[line];
|
||||||
|
if (!anns) continue;
|
||||||
|
|
||||||
|
var maxSeverity = null;
|
||||||
|
var tipLabel = state.hasGutter && document.createDocumentFragment();
|
||||||
|
|
||||||
|
for (var i = 0; i < anns.length; ++i) {
|
||||||
|
var ann = anns[i];
|
||||||
|
var severity = ann.severity;
|
||||||
|
if (!severity) severity = "error";
|
||||||
|
maxSeverity = getMaxSeverity(maxSeverity, severity);
|
||||||
|
|
||||||
|
if (options.formatAnnotation) ann = options.formatAnnotation(ann);
|
||||||
|
if (state.hasGutter) tipLabel.appendChild(annotationTooltip(ann));
|
||||||
|
|
||||||
|
if (ann.to) state.marked.push(cm.markText(ann.from, ann.to, {
|
||||||
|
className: "CodeMirror-lint-mark-" + severity,
|
||||||
|
__annotation: ann
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state.hasGutter)
|
||||||
|
cm.setGutterMarker(line, GUTTER_ID, makeMarker(tipLabel, maxSeverity, anns.length > 1,
|
||||||
|
state.options.tooltips));
|
||||||
|
}
|
||||||
|
if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, annotations, cm);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onChange(cm) {
|
||||||
|
var state = cm.state.lint;
|
||||||
|
if (!state) return;
|
||||||
|
clearTimeout(state.timeout);
|
||||||
|
state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
function popupTooltips(annotations, e) {
|
||||||
|
var target = e.target || e.srcElement;
|
||||||
|
var tooltip = document.createDocumentFragment();
|
||||||
|
for (var i = 0; i < annotations.length; i++) {
|
||||||
|
var ann = annotations[i];
|
||||||
|
tooltip.appendChild(annotationTooltip(ann));
|
||||||
|
}
|
||||||
|
showTooltipFor(e, tooltip, target);
|
||||||
|
}
|
||||||
|
|
||||||
|
function onMouseOver(cm, e) {
|
||||||
|
var target = e.target || e.srcElement;
|
||||||
|
if (!/\bCodeMirror-lint-mark-/.test(target.className)) return;
|
||||||
|
var box = target.getBoundingClientRect(), x = (box.left + box.right) / 2, y = (box.top + box.bottom) / 2;
|
||||||
|
var spans = cm.findMarksAt(cm.coordsChar({left: x, top: y}, "client"));
|
||||||
|
|
||||||
|
var annotations = [];
|
||||||
|
for (var i = 0; i < spans.length; ++i) {
|
||||||
|
var ann = spans[i].__annotation;
|
||||||
|
if (ann) annotations.push(ann);
|
||||||
|
}
|
||||||
|
if (annotations.length) popupTooltips(annotations, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
CodeMirror.defineOption("lint", false, function(cm, val, old) {
|
||||||
|
if (old && old != CodeMirror.Init) {
|
||||||
|
clearMarks(cm);
|
||||||
|
if (cm.state.lint.options.lintOnChange !== false)
|
||||||
|
cm.off("change", onChange);
|
||||||
|
CodeMirror.off(cm.getWrapperElement(), "mouseover", cm.state.lint.onMouseOver);
|
||||||
|
clearTimeout(cm.state.lint.timeout);
|
||||||
|
delete cm.state.lint;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (val) {
|
||||||
|
var gutters = cm.getOption("gutters"), hasLintGutter = false;
|
||||||
|
for (var i = 0; i < gutters.length; ++i) if (gutters[i] == GUTTER_ID) hasLintGutter = true;
|
||||||
|
var state = cm.state.lint = new LintState(cm, parseOptions(cm, val), hasLintGutter);
|
||||||
|
if (state.options.lintOnChange !== false)
|
||||||
|
cm.on("change", onChange);
|
||||||
|
if (state.options.tooltips != false && state.options.tooltips != "gutter")
|
||||||
|
CodeMirror.on(cm.getWrapperElement(), "mouseover", state.onMouseOver);
|
||||||
|
|
||||||
|
startLinting(cm);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
CodeMirror.defineExtension("performLint", function() {
|
||||||
|
if (this.state.lint) startLinting(this);
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -19,6 +19,16 @@
|
|||||||
width: 435px;
|
width: 435px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.leftTab .leftTabHeader {
|
||||||
|
position: fixed;
|
||||||
|
top: 15px;
|
||||||
|
left: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leftTab .leftTabContent {
|
||||||
|
padding-top: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
#appendPicSelection span {
|
#appendPicSelection span {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
font-size:11px;
|
font-size:11px;
|
||||||
@ -28,19 +38,19 @@
|
|||||||
|
|
||||||
#left6 {
|
#left6 {
|
||||||
left: 5px;
|
left: 5px;
|
||||||
/* top: 1930px; */
|
|
||||||
top: 5px;
|
top: 5px;
|
||||||
z-index: 200;
|
z-index: 200;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
background-color: rgb(245, 245, 245);
|
background-color: rgb(245, 245, 245);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
#left6 #blocklyArea {
|
#left6 #blocklyArea {
|
||||||
float: left;
|
float: left;
|
||||||
width: 60%;
|
width: 60%;
|
||||||
height: 100%;
|
height: 95%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#left6 #blocklyDiv {
|
#left6 #blocklyDiv {
|
||||||
@ -50,7 +60,7 @@
|
|||||||
#left6 .CodeMirror {
|
#left6 .CodeMirror {
|
||||||
border: 1px solid #eee;
|
border: 1px solid #eee;
|
||||||
float: left;
|
float: left;
|
||||||
height: 100%;
|
height: 95%;
|
||||||
width: 35%;
|
width: 35%;
|
||||||
}
|
}
|
||||||
#left6 #codeArea {width: 99.5%; height: 15.4em;overflow:y;/* resize:none; */}
|
#left6 #codeArea {width: 99.5%; height: 15.4em;overflow:y;/* resize:none; */}
|
||||||
|
|||||||
@ -126,6 +126,32 @@ initscript=String.raw`
|
|||||||
],
|
],
|
||||||
"false": []
|
"false": []
|
||||||
}),
|
}),
|
||||||
|
'<label text="商店购买属性/钥匙"></label>',
|
||||||
|
MotaActionFunctions.actionParser.parse([
|
||||||
|
{"type": "choices", "text": "\t[老人,man]少年,你需要钥匙吗?\n我这里有大把的!",
|
||||||
|
"choices": [
|
||||||
|
{"text": "黄钥匙(\${9+flag:shop_times}金币)", "action": [
|
||||||
|
{"type": "if", "condition": "status:money>=9+flag:shop_times",
|
||||||
|
"true": [
|
||||||
|
{"type": "setValue", "name": "status:money", "value": "status:money-(9+flag:shop_times)"},
|
||||||
|
{"type": "setValue", "name": "item:yellowKey", "value": "item:yellowKey+1"},
|
||||||
|
],
|
||||||
|
"false": [
|
||||||
|
"\t[老人,man]你的金钱不足!",
|
||||||
|
{"type": "revisit"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]},
|
||||||
|
{"text": "蓝钥匙(\${18+2*flag:shop_times}金币)", "action": [
|
||||||
|
]},
|
||||||
|
{"text": "离开", "action": [
|
||||||
|
{"type": "exit"}
|
||||||
|
]}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{"type": "setValue", "name": "flag:shop_times", "value": "flag:shop_times+1"},
|
||||||
|
{"type": "revisit"}
|
||||||
|
], 'event'),
|
||||||
'<label text="战前剧情"></label>',
|
'<label text="战前剧情"></label>',
|
||||||
MotaActionFunctions.actionParser.parse({
|
MotaActionFunctions.actionParser.parse({
|
||||||
"trigger": "action",
|
"trigger": "action",
|
||||||
|
|||||||
@ -5,9 +5,15 @@ var editor_multi = {};
|
|||||||
var codeEditor = CodeMirror.fromTextArea(document.getElementById("multiLineCode"), {
|
var codeEditor = CodeMirror.fromTextArea(document.getElementById("multiLineCode"), {
|
||||||
lineNumbers: true,
|
lineNumbers: true,
|
||||||
matchBrackets: true,
|
matchBrackets: true,
|
||||||
|
indentUnit: 4,
|
||||||
|
tabSize: 4,
|
||||||
|
indentWithTabs: true,
|
||||||
|
smartIndent: true,
|
||||||
mode: {name: "javascript", json: true, globalVars: true},
|
mode: {name: "javascript", json: true, globalVars: true},
|
||||||
lineWrapping: true,
|
lineWrapping: true,
|
||||||
continueComments: "Enter",
|
continueComments: "Enter",
|
||||||
|
gutters: ["CodeMirror-lint-markers"],
|
||||||
|
lint: true,
|
||||||
extraKeys: {"Ctrl-Q": "toggleComment"},
|
extraKeys: {"Ctrl-Q": "toggleComment"},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
36
editor.html
36
editor.html
@ -5,6 +5,7 @@
|
|||||||
<link href="_server/css/editor.css" rel="stylesheet">
|
<link href="_server/css/editor.css" rel="stylesheet">
|
||||||
<link href="_server/CodeMirror/codemirror.css" rel="stylesheet">
|
<link href="_server/CodeMirror/codemirror.css" rel="stylesheet">
|
||||||
<link href="_server/CodeMirror/show-hint.css" rel="stylesheet">
|
<link href="_server/CodeMirror/show-hint.css" rel="stylesheet">
|
||||||
|
<link href="_server/CodeMirror/lint.css" rel="stylesheet">
|
||||||
<link href="_server/css/editor_mode.css" rel="stylesheet">
|
<link href="_server/css/editor_mode.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -36,8 +37,9 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div id="left1" class='leftTab' style="z-index:-1;opacity: 0;"><div ><!-- appendpic -->
|
<div id="left1" class='leftTab' style="z-index:-1;opacity: 0;"><!-- appendpic -->
|
||||||
<h3>追加素材</h3>
|
<h3 class="leftTabHeader">追加素材</h3>
|
||||||
|
<div class="leftTabContent">
|
||||||
<p>
|
<p>
|
||||||
<input id="selectFileBtn" type="button" value="导入文件到画板"/>
|
<input id="selectFileBtn" type="button" value="导入文件到画板"/>
|
||||||
<select id="selectAppend"></select><!-- ["terrains", "animates", "enemys", "enemy48", "items", "npcs", "npc48"] -->
|
<select id="selectAppend"></select><!-- ["terrains", "animates", "enemys", "enemy48", "items", "npcs", "npc48"] -->
|
||||||
@ -56,9 +58,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div></div>
|
</div></div>
|
||||||
<div id="left2" class='leftTab' style="z-index:-1;opacity: 0;"><div><!-- loc -->
|
<div id="left2" class='leftTab' style="z-index:-1;opacity: 0;"><!-- loc -->
|
||||||
<h3>地图选点 <button onclick="editor.mode.onmode('save')">save</button></h3>
|
<h3 class="leftTabHeader">地图选点 <button onclick="editor.mode.onmode('save')">save</button></h3>
|
||||||
<p id='pos_a6771a78_a099_417c_828f_0a24851ebfce'>0,0</p>
|
<div class="leftTabContent">
|
||||||
|
<p id='pos_a6771a78_a099_417c_828f_0a24851ebfce' style="margin-left: 15px">0,0</p>
|
||||||
<div class='etable'>
|
<div class='etable'>
|
||||||
<table>
|
<table>
|
||||||
<tbody id='table_3d846fc4_7644_44d1_aa04_433d266a73df'>
|
<tbody id='table_3d846fc4_7644_44d1_aa04_433d266a73df'>
|
||||||
@ -67,8 +70,9 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div></div>
|
</div></div>
|
||||||
<div id="left3" class='leftTab' style="z-index:-1;opacity: 0;"><div><!-- emenyitem -->
|
<div id="left3" class='leftTab' style="z-index:-1;opacity: 0;"><!-- emenyitem -->
|
||||||
<h3>图块属性 <button onclick="editor.mode.onmode('save')">save</button></h3>
|
<h3 class="leftTabHeader">图块属性 <button onclick="editor.mode.onmode('save')">save</button></h3>
|
||||||
|
<div class="leftTabContent">
|
||||||
<div id='newIdIdnum'><!-- id and idnum -->
|
<div id='newIdIdnum'><!-- id and idnum -->
|
||||||
<input placeholder="输入新id"/>
|
<input placeholder="输入新id"/>
|
||||||
<input placeholder="输入新idnum"/>
|
<input placeholder="输入新idnum"/>
|
||||||
@ -84,8 +88,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div></div>
|
</div></div>
|
||||||
<div id="left4" class='leftTab' style="z-index:-1;opacity: 0;"><div><!-- floor -->
|
<div id="left4" class='leftTab' style="z-index:-1;opacity: 0;"><!-- floor -->
|
||||||
<h3>楼层属性 <button onclick="editor.mode.onmode('save')">save</button></h3>
|
<h3 class="leftTabHeader">楼层属性 <button onclick="editor.mode.onmode('save')">save</button></h3>
|
||||||
|
<div class="leftTabContent">
|
||||||
<div class='etable'>
|
<div class='etable'>
|
||||||
<table>
|
<table>
|
||||||
<tbody id='table_4a3b1b09_b2fb_4bdf_b9ab_9f4cdac14c74'>
|
<tbody id='table_4a3b1b09_b2fb_4bdf_b9ab_9f4cdac14c74'>
|
||||||
@ -94,8 +99,9 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div></div>
|
</div></div>
|
||||||
<div id="left5" class='leftTab' style="z-index:-1;opacity: 0;"><div><!-- tower -->
|
<div id="left5" class='leftTab' style="z-index:-1;opacity: 0;"><!-- tower -->
|
||||||
<h3>全塔属性 <button onclick="editor.mode.onmode('save')">save</button></h3>
|
<h3 class="leftTabHeader">全塔属性 <button onclick="editor.mode.onmode('save')">save</button></h3>
|
||||||
|
<div class="leftTabContent">
|
||||||
<div class='etable'>
|
<div class='etable'>
|
||||||
<table>
|
<table>
|
||||||
<tbody id='table_b6a03e4c_5968_4633_ac40_0dfdd2c9cde5'>
|
<tbody id='table_b6a03e4c_5968_4633_ac40_0dfdd2c9cde5'>
|
||||||
@ -138,8 +144,9 @@
|
|||||||
<button onclick="editor_multi.cancel()">cancel</button>
|
<button onclick="editor_multi.cancel()">cancel</button>
|
||||||
<textarea id="multiLineCode" name="multiLineCode"></textarea>
|
<textarea id="multiLineCode" name="multiLineCode"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<div id="left8" class='leftTab' style="z-index:-1;opacity: 0;"><div><!-- functions -->
|
<div id="left8" class='leftTab' style="z-index:-1;opacity: 0;"><!-- functions -->
|
||||||
<h3>脚本编辑 <button onclick="editor.mode.onmode('save')">save</button></h3>
|
<h3 class="leftTabHeader">脚本编辑 <button onclick="editor.mode.onmode('save')">save</button></h3>
|
||||||
|
<div class="leftTabContent">
|
||||||
<div class='etable'>
|
<div class='etable'>
|
||||||
<table>
|
<table>
|
||||||
<tbody id='table_e260a2be_5690_476a_b04e_dacddede78b3'>
|
<tbody id='table_e260a2be_5690_476a_b04e_dacddede78b3'>
|
||||||
@ -390,6 +397,9 @@ main.init('editor', function() {
|
|||||||
<script src="_server/CodeMirror/codeMirror.bundle.min.js"></script>
|
<script src="_server/CodeMirror/codeMirror.bundle.min.js"></script>
|
||||||
<script src="_server/CodeMirror/show-hint.js"></script>
|
<script src="_server/CodeMirror/show-hint.js"></script>
|
||||||
<script src="_server/CodeMirror/javascript-hint.js"></script>
|
<script src="_server/CodeMirror/javascript-hint.js"></script>
|
||||||
|
<script src="_server/CodeMirror/jshint.min.js"></script>
|
||||||
|
<script src="_server/CodeMirror/lint.js"></script>
|
||||||
|
<script src="_server/CodeMirror/javascript-lint.js"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -34,11 +34,11 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|||||||
},
|
},
|
||||||
"enemys_template" : {'name': '新敌人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0},
|
"enemys_template" : {'name': '新敌人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0},
|
||||||
"maps" : {
|
"maps" : {
|
||||||
"id" : "$range(false)$end",
|
"id" : "图块ID \n$range(false)$end",
|
||||||
"idnum" : "$range(false)$end",
|
"idnum" : "图块数字 \n$range(false)$end",
|
||||||
"cls" : "$range(false)$end",
|
"cls" : "图块类别 \n$range(false)$end",
|
||||||
"trigger" : "$select({\"values\":[null,\"openDoor\",\"passNet\",\"changeLight\",\"ski\",\"pushBox\"]})$end",
|
"trigger" : "图块的默认触发器 \n$select({\"values\":[null,\"openDoor\",\"passNet\",\"changeLight\",\"ski\",\"pushBox\"]})$end",
|
||||||
"noPass" : "$select({\"values\":[null,true,false]})$end"
|
"noPass" : "图块默认可通行状态 \n$select({\"values\":[null,true,false]})$end"
|
||||||
},
|
},
|
||||||
"floors" : {
|
"floors" : {
|
||||||
'floor' : {
|
'floor' : {
|
||||||
|
|||||||
@ -126,18 +126,18 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
|
|||||||
"bluePotion": " 蓝血瓶加血数值 ",
|
"bluePotion": " 蓝血瓶加血数值 ",
|
||||||
"yellowPotion": " 黄血瓶加血数值 ",
|
"yellowPotion": " 黄血瓶加血数值 ",
|
||||||
"greenPotion": " 绿血瓶加血数值 ",
|
"greenPotion": " 绿血瓶加血数值 ",
|
||||||
"sword0": " 默认装备折断的剑的攻击力 ",
|
"sword0": " 默认装备折断的剑的攻击力 \n$leaf(true)$end",
|
||||||
"shield0": " 默认装备残破的盾的防御力 ",
|
"shield0": " 默认装备残破的盾的防御力 \n$leaf(true)$end",
|
||||||
"sword1": " 铁剑加攻数值 ",
|
"sword1": " 铁剑加攻数值 \n$leaf(true)$end",
|
||||||
"shield1": " 铁盾加防数值 ",
|
"shield1": " 铁盾加防数值 \n$leaf(true)$end",
|
||||||
"sword2": " 银剑加攻数值 ",
|
"sword2": " 银剑加攻数值 \n$leaf(true)$end",
|
||||||
"shield2": " 银盾加防数值 ",
|
"shield2": " 银盾加防数值 \n$leaf(true)$end",
|
||||||
"sword3": " 骑士剑加攻数值 ",
|
"sword3": " 骑士剑加攻数值 \n$leaf(true)$end",
|
||||||
"shield3": " 骑士盾加防数值 ",
|
"shield3": " 骑士盾加防数值 \n$leaf(true)$end",
|
||||||
"sword4": " 圣剑加攻数值 ",
|
"sword4": " 圣剑加攻数值 \n$leaf(true)$end",
|
||||||
"shield4": " 圣盾加防数值 ",
|
"shield4": " 圣盾加防数值 \n$leaf(true)$end",
|
||||||
"sword5": " 神圣剑加攻数值 ",
|
"sword5": " 神圣剑加攻数值 \n$leaf(true)$end",
|
||||||
"shield5": " 神圣盾加防数值 ",
|
"shield5": " 神圣盾加防数值 \n$leaf(true)$end",
|
||||||
"moneyPocket": " 金钱袋加金币的数值 ",
|
"moneyPocket": " 金钱袋加金币的数值 ",
|
||||||
"breakArmor": " /****** 怪物相关 ******/ \n 破甲的比例(战斗前,怪物附加角色防御的x%作为伤害) ",
|
"breakArmor": " /****** 怪物相关 ******/ \n 破甲的比例(战斗前,怪物附加角色防御的x%作为伤害) ",
|
||||||
"counterAttack": " 反击的比例(战斗时,怪物每回合附加角色攻击的x%作为伤害,无视角色防御) ",
|
"counterAttack": " 反击的比例(战斗时,怪物每回合附加角色攻击的x%作为伤害,无视角色防御) ",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user