Browse Source

用到codemirrior的editor可配置行高

master
windy 8 years ago
parent
commit
798e17f9c3
  1. 7
      bi/base.css
  2. 8
      bi/base.js
  3. 7
      docs/base.css
  4. 8
      docs/base.js
  5. 4
      src/base/formula/formulaeditor.js
  6. 4
      src/base/single/editor/editor.code.js
  7. 7
      src/css/base/formula/codemirror.css
  8. 10
      src/less/base/formula/codemirror.less

7
bi/base.css

@ -424,13 +424,18 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {
margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
z-index: 2;
position: relative;
overflow: visible;
-webkit-tap-highlight-color: transparent;
}
.codemirror-high-line-height {
line-height: 2;
}
.codemirror-low-line-height {
line-height: 1.4;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;

8
bi/base.js

@ -14260,7 +14260,8 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
watermark: '',
value: '',
fieldTextValueMap: {},
showHint: true
showHint: true,
lineHeight: 2
});
},
_init: function () {
@ -14272,6 +14273,7 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
lineNumbers: false,
mode: 'formula'
});
o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height");
this.editor.on("change", function (cm, change) {
self._checkWaterMark();
if (o.showHint) {
@ -17712,7 +17714,8 @@ BI.CodeEditor = BI.inherit(BI.Single, {
return $.extend(BI.CodeEditor.superclass._defaultConfig.apply(), {
baseCls: 'bi-code-editor bi-card',
value: '',
watermark: ""
watermark: "",
lineHeight: 2
});
},
_init: function () {
@ -17723,6 +17726,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
lineWrapping: true,
lineNumbers: false
});
o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height");
this.editor.on("change", function (cm, change) {
BI.nextTick(function () {
self.fireEvent(BI.CodeEditor.EVENT_CHANGE)

7
docs/base.css

@ -424,13 +424,18 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {
margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
z-index: 2;
position: relative;
overflow: visible;
-webkit-tap-highlight-color: transparent;
}
.codemirror-high-line-height {
line-height: 2;
}
.codemirror-low-line-height {
line-height: 1.4;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;

8
docs/base.js

@ -14260,7 +14260,8 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
watermark: '',
value: '',
fieldTextValueMap: {},
showHint: true
showHint: true,
lineHeight: 2
});
},
_init: function () {
@ -14272,6 +14273,7 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
lineNumbers: false,
mode: 'formula'
});
o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height");
this.editor.on("change", function (cm, change) {
self._checkWaterMark();
if (o.showHint) {
@ -17712,7 +17714,8 @@ BI.CodeEditor = BI.inherit(BI.Single, {
return $.extend(BI.CodeEditor.superclass._defaultConfig.apply(), {
baseCls: 'bi-code-editor bi-card',
value: '',
watermark: ""
watermark: "",
lineHeight: 2
});
},
_init: function () {
@ -17723,6 +17726,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
lineWrapping: true,
lineNumbers: false
});
o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height");
this.editor.on("change", function (cm, change) {
BI.nextTick(function () {
self.fireEvent(BI.CodeEditor.EVENT_CHANGE)

4
src/base/formula/formulaeditor.js

@ -10,7 +10,8 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
watermark: '',
value: '',
fieldTextValueMap: {},
showHint: true
showHint: true,
lineHeight: 2
});
},
_init: function () {
@ -22,6 +23,7 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
lineNumbers: false,
mode: 'formula'
});
o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height");
this.editor.on("change", function (cm, change) {
self._checkWaterMark();
if (o.showHint) {

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

@ -9,7 +9,8 @@ BI.CodeEditor = BI.inherit(BI.Single, {
return $.extend(BI.CodeEditor.superclass._defaultConfig.apply(), {
baseCls: 'bi-code-editor bi-card',
value: '',
watermark: ""
watermark: "",
lineHeight: 2
});
},
_init: function () {
@ -20,6 +21,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
lineWrapping: true,
lineNumbers: false
});
o.lineHeight === 1 ? this.element.addClass("codemirror-low-line-height") : this.element.addClass("codemirror-high-line-height");
this.editor.on("change", function (cm, change) {
BI.nextTick(function () {
self.fireEvent(BI.CodeEditor.EVENT_CHANGE)

7
src/css/base/formula/codemirror.css

@ -331,13 +331,18 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {
margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
z-index: 2;
position: relative;
overflow: visible;
-webkit-tap-highlight-color: transparent;
}
.codemirror-high-line-height {
line-height: 2;
}
.codemirror-low-line-height {
line-height: 1.4;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;

10
src/less/base/formula/codemirror.less

@ -409,7 +409,6 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {
margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
z-index: 2;
position: relative;
@ -417,6 +416,15 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {
-webkit-tap-highlight-color: transparent;
}
.codemirror-high-line-height {
line-height: 2;
}
.codemirror-low-line-height {
line-height: 1.4;
}
.CodeMirror-wrap pre {
word-wrap: break-word;
white-space: pre-wrap;

Loading…
Cancel
Save