From 798e17f9c313c559a987bbe569fe147e074de748 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 21 Jun 2017 15:36:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E5=88=B0codemirrior=E7=9A=84editor?= =?UTF-8?q?=E5=8F=AF=E9=85=8D=E7=BD=AE=E8=A1=8C=E9=AB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bi/base.css | 7 ++++++- bi/base.js | 8 ++++++-- docs/base.css | 7 ++++++- docs/base.js | 8 ++++++-- src/base/formula/formulaeditor.js | 4 +++- src/base/single/editor/editor.code.js | 4 +++- src/css/base/formula/codemirror.css | 7 ++++++- src/less/base/formula/codemirror.less | 10 +++++++++- 8 files changed, 45 insertions(+), 10 deletions(-) diff --git a/bi/base.css b/bi/base.css index 369a7c7f3..e30476362 100644 --- a/bi/base.css +++ b/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; diff --git a/bi/base.js b/bi/base.js index a97de0bb8..c64eebd0b 100644 --- a/bi/base.js +++ b/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) diff --git a/docs/base.css b/docs/base.css index 369a7c7f3..e30476362 100644 --- a/docs/base.css +++ b/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; diff --git a/docs/base.js b/docs/base.js index a97de0bb8..c64eebd0b 100644 --- a/docs/base.js +++ b/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) diff --git a/src/base/formula/formulaeditor.js b/src/base/formula/formulaeditor.js index 9d721e420..74da71433 100644 --- a/src/base/formula/formulaeditor.js +++ b/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) { diff --git a/src/base/single/editor/editor.code.js b/src/base/single/editor/editor.code.js index 997d57252..f97564f62 100644 --- a/src/base/single/editor/editor.code.js +++ b/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) diff --git a/src/css/base/formula/codemirror.css b/src/css/base/formula/codemirror.css index 16c4dff52..c6d2a97d5 100644 --- a/src/css/base/formula/codemirror.css +++ b/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; diff --git a/src/less/base/formula/codemirror.less b/src/less/base/formula/codemirror.less index 551883a9a..a7d8476f6 100644 --- a/src/less/base/formula/codemirror.less +++ b/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;