产品-公式编辑器

This commit is contained in:
黎永顺 2023-04-28 16:13:03 +08:00
parent 6f0c1044ad
commit 5c56b8ced4
1 changed files with 4 additions and 6 deletions

View File

@ -11,8 +11,8 @@ CodeMirror.extendMode("css", {
});
CodeMirror.extendMode("javascript", {
commentStart: "/*",
commentEnd: "*/",
commentStart: "",
commentEnd: "",
// FIXME semicolons inside of for
newlineAfterToken: function (type, content, textAfter, state) {
if (this.jsonMode) {
@ -37,10 +37,8 @@ CodeMirror.defineExtension("commentRange", function (isComment, from, to) {
var cm = this, curMode = CodeMirror.innerMode(cm.getMode(), cm.getTokenAt(from).state).mode;
cm.operation(function () {
if (isComment) { // Comment range
cm.replaceRange("", to);
// cm.replaceRange(curMode.commentEnd, to);
cm.replaceRange("", from);
// cm.replaceRange(curMode.commentStart, from);
cm.replaceRange(curMode.commentEnd, to);
cm.replaceRange(curMode.commentStart, from);
if (from.line == to.line && from.ch == to.ch) // An empty comment inserted - put cursor inside
cm.setCursor(from.line, from.ch + curMode.commentStart.length);
} else { // Uncomment range