产品-公式编辑器
This commit is contained in:
parent
6f0c1044ad
commit
5c56b8ced4
|
|
@ -11,8 +11,8 @@ CodeMirror.extendMode("css", {
|
||||||
});
|
});
|
||||||
|
|
||||||
CodeMirror.extendMode("javascript", {
|
CodeMirror.extendMode("javascript", {
|
||||||
commentStart: "/*",
|
commentStart: "",
|
||||||
commentEnd: "*/",
|
commentEnd: "",
|
||||||
// FIXME semicolons inside of for
|
// FIXME semicolons inside of for
|
||||||
newlineAfterToken: function (type, content, textAfter, state) {
|
newlineAfterToken: function (type, content, textAfter, state) {
|
||||||
if (this.jsonMode) {
|
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;
|
var cm = this, curMode = CodeMirror.innerMode(cm.getMode(), cm.getTokenAt(from).state).mode;
|
||||||
cm.operation(function () {
|
cm.operation(function () {
|
||||||
if (isComment) { // Comment range
|
if (isComment) { // Comment range
|
||||||
cm.replaceRange("", to);
|
cm.replaceRange(curMode.commentEnd, to);
|
||||||
// cm.replaceRange(curMode.commentEnd, to);
|
cm.replaceRange(curMode.commentStart, from);
|
||||||
cm.replaceRange("", from);
|
|
||||||
// cm.replaceRange(curMode.commentStart, from);
|
|
||||||
if (from.line == to.line && from.ch == to.ch) // An empty comment inserted - put cursor inside
|
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);
|
cm.setCursor(from.line, from.ch + curMode.commentStart.length);
|
||||||
} else { // Uncomment range
|
} else { // Uncomment range
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue