Browse Source

Merge pull request #195 in ~GUY/fineui from ~WINDY/fineui:master to master

* commit '416c9c16781e60ea62eb3fda0eccfa63fd044375':
  code.editor的问题
master
windy 7 years ago
parent
commit
eb96ab83bc
  1. 5
      bi/base.js
  2. 5
      dist/base.js
  3. 5
      dist/bundle.js
  4. 40
      dist/bundle.min.js
  5. 5
      src/base/single/editor/editor.code.js

5
bi/base.js

@ -19045,6 +19045,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
lineWrapping: true, lineWrapping: true,
lineNumbers: false, lineNumbers: false,
readOnly: o.readOnly, readOnly: o.readOnly,
//解决插入字段由括号或其他特殊字符包围时分裂的bug
specialChars: /[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/ specialChars: /[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/
}); });
o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height"); o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height");
@ -19130,6 +19131,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
var value = param; var value = param;
param = this.options.paramFormatter(param); param = this.options.paramFormatter(param);
var from = this.editor.getCursor(); var from = this.editor.getCursor();
//解决插入字段由括号或其他特殊字符包围时分裂的bug,在两端以不可见字符包裹一下
this.editor.replaceSelection('\u200b' + param + '\u200b'); this.editor.replaceSelection('\u200b' + param + '\u200b');
var to = this.editor.getCursor(); var to = this.editor.getCursor();
var options = {className: 'param', atomic: true}; var options = {className: 'param', atomic: true};
@ -19150,7 +19152,8 @@ BI.CodeEditor = BI.inherit(BI.Single, {
return this.editor.getValue("\n", function (line) { return this.editor.getValue("\n", function (line) {
var rawText = line.text, value = line.text, num = 0; var rawText = line.text, value = line.text, num = 0;
value.text = rawText; value.text = rawText;
_.forEach(line.markedSpans, function (i, ms) { //根据插入位置不同,line.markedSpan可能是乱序的
_.forEach(_.sortBy(line.markedSpans, "from"), function (i, ms) {
switch (i.marker.className) { switch (i.marker.className) {
case "param": case "param":
case "error-param": case "error-param":

5
dist/base.js vendored

@ -19045,6 +19045,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
lineWrapping: true, lineWrapping: true,
lineNumbers: false, lineNumbers: false,
readOnly: o.readOnly, readOnly: o.readOnly,
//解决插入字段由括号或其他特殊字符包围时分裂的bug
specialChars: /[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/ specialChars: /[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/
}); });
o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height"); o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height");
@ -19130,6 +19131,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
var value = param; var value = param;
param = this.options.paramFormatter(param); param = this.options.paramFormatter(param);
var from = this.editor.getCursor(); var from = this.editor.getCursor();
//解决插入字段由括号或其他特殊字符包围时分裂的bug,在两端以不可见字符包裹一下
this.editor.replaceSelection('\u200b' + param + '\u200b'); this.editor.replaceSelection('\u200b' + param + '\u200b');
var to = this.editor.getCursor(); var to = this.editor.getCursor();
var options = {className: 'param', atomic: true}; var options = {className: 'param', atomic: true};
@ -19150,7 +19152,8 @@ BI.CodeEditor = BI.inherit(BI.Single, {
return this.editor.getValue("\n", function (line) { return this.editor.getValue("\n", function (line) {
var rawText = line.text, value = line.text, num = 0; var rawText = line.text, value = line.text, num = 0;
value.text = rawText; value.text = rawText;
_.forEach(line.markedSpans, function (i, ms) { //根据插入位置不同,line.markedSpan可能是乱序的
_.forEach(_.sortBy(line.markedSpans, "from"), function (i, ms) {
switch (i.marker.className) { switch (i.marker.className) {
case "param": case "param":
case "error-param": case "error-param":

5
dist/bundle.js vendored

@ -48074,6 +48074,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
lineWrapping: true, lineWrapping: true,
lineNumbers: false, lineNumbers: false,
readOnly: o.readOnly, readOnly: o.readOnly,
//解决插入字段由括号或其他特殊字符包围时分裂的bug
specialChars: /[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/ specialChars: /[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/
}); });
o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height"); o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height");
@ -48159,6 +48160,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
var value = param; var value = param;
param = this.options.paramFormatter(param); param = this.options.paramFormatter(param);
var from = this.editor.getCursor(); var from = this.editor.getCursor();
//解决插入字段由括号或其他特殊字符包围时分裂的bug,在两端以不可见字符包裹一下
this.editor.replaceSelection('\u200b' + param + '\u200b'); this.editor.replaceSelection('\u200b' + param + '\u200b');
var to = this.editor.getCursor(); var to = this.editor.getCursor();
var options = {className: 'param', atomic: true}; var options = {className: 'param', atomic: true};
@ -48179,7 +48181,8 @@ BI.CodeEditor = BI.inherit(BI.Single, {
return this.editor.getValue("\n", function (line) { return this.editor.getValue("\n", function (line) {
var rawText = line.text, value = line.text, num = 0; var rawText = line.text, value = line.text, num = 0;
value.text = rawText; value.text = rawText;
_.forEach(line.markedSpans, function (i, ms) { //根据插入位置不同,line.markedSpan可能是乱序的
_.forEach(_.sortBy(line.markedSpans, "from"), function (i, ms) {
switch (i.marker.className) { switch (i.marker.className) {
case "param": case "param":
case "error-param": case "error-param":

40
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

5
src/base/single/editor/editor.code.js

@ -26,6 +26,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
lineWrapping: true, lineWrapping: true,
lineNumbers: false, lineNumbers: false,
readOnly: o.readOnly, readOnly: o.readOnly,
//解决插入字段由括号或其他特殊字符包围时分裂的bug
specialChars: /[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/ specialChars: /[\u0000-\u001f\u007f\u00ad\u200c-\u200f\u2028\u2029\ufeff]/
}); });
o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height"); o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height");
@ -111,6 +112,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
var value = param; var value = param;
param = this.options.paramFormatter(param); param = this.options.paramFormatter(param);
var from = this.editor.getCursor(); var from = this.editor.getCursor();
//解决插入字段由括号或其他特殊字符包围时分裂的bug,在两端以不可见字符包裹一下
this.editor.replaceSelection('\u200b' + param + '\u200b'); this.editor.replaceSelection('\u200b' + param + '\u200b');
var to = this.editor.getCursor(); var to = this.editor.getCursor();
var options = {className: 'param', atomic: true}; var options = {className: 'param', atomic: true};
@ -131,7 +133,8 @@ BI.CodeEditor = BI.inherit(BI.Single, {
return this.editor.getValue("\n", function (line) { return this.editor.getValue("\n", function (line) {
var rawText = line.text, value = line.text, num = 0; var rawText = line.text, value = line.text, num = 0;
value.text = rawText; value.text = rawText;
_.forEach(line.markedSpans, function (i, ms) { //根据插入位置不同,line.markedSpan可能是乱序的
_.forEach(_.sortBy(line.markedSpans, "from"), function (i, ms) {
switch (i.marker.className) { switch (i.marker.className) {
case "param": case "param":
case "error-param": case "error-param":

Loading…
Cancel
Save