Browse Source

用到codemirrior的editor可配置行高

es6
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; margin: 0;
white-space: pre; white-space: pre;
word-wrap: normal; word-wrap: normal;
line-height: inherit;
color: inherit; color: inherit;
z-index: 2; z-index: 2;
position: relative; position: relative;
overflow: visible; overflow: visible;
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent;
} }
.codemirror-high-line-height {
line-height: 2;
}
.codemirror-low-line-height {
line-height: 1.4;
}
.CodeMirror-wrap pre { .CodeMirror-wrap pre {
word-wrap: break-word; word-wrap: break-word;
white-space: pre-wrap; white-space: pre-wrap;

8
bi/base.js

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

7
docs/base.css

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

8
docs/base.js

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

4
src/base/formula/formulaeditor.js

@ -10,7 +10,8 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
watermark: '', watermark: '',
value: '', value: '',
fieldTextValueMap: {}, fieldTextValueMap: {},
showHint: true showHint: true,
lineHeight: 2
}); });
}, },
_init: function () { _init: function () {
@ -22,6 +23,7 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
lineNumbers: false, lineNumbers: false,
mode: 'formula' 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) { this.editor.on("change", function (cm, change) {
self._checkWaterMark(); self._checkWaterMark();
if (o.showHint) { 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(), { return $.extend(BI.CodeEditor.superclass._defaultConfig.apply(), {
baseCls: 'bi-code-editor bi-card', baseCls: 'bi-code-editor bi-card',
value: '', value: '',
watermark: "" watermark: "",
lineHeight: 2
}); });
}, },
_init: function () { _init: function () {
@ -20,6 +21,7 @@ BI.CodeEditor = BI.inherit(BI.Single, {
lineWrapping: true, lineWrapping: true,
lineNumbers: false 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) { this.editor.on("change", function (cm, change) {
BI.nextTick(function () { BI.nextTick(function () {
self.fireEvent(BI.CodeEditor.EVENT_CHANGE) self.fireEvent(BI.CodeEditor.EVENT_CHANGE)

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

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

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

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

Loading…
Cancel
Save