diff --git a/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js b/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js index 229849413e..448ba1bb40 100644 --- a/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js +++ b/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js @@ -10,7 +10,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls.CodeEditor"); var _controlId = controlId; if (!_isSimpleEditor && typeof(codeEditor) == "undefined") { - throw "CodeMirror editor not found!"; + throw "CodeMirror editor not found!"; } //create the inner object @@ -28,7 +28,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls.CodeEditor"); } else { //this is a wrapper for CodeMirror - return this._editor.getCode(); + return this._editor.getValue(); } }, SetCode: function(code) { @@ -37,7 +37,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls.CodeEditor"); } else { //this is a wrapper for CodeMirror - this._editor.setCode(code); + this._editor.setValue(code); } }, Insert: function(open, end, txtEl, arg3) { @@ -59,14 +59,15 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls.CodeEditor"); } } else { - this._editor.win.document.body.focus(); //need to restore the focus to the editor body + this._editor.focus(); //need to restore the focus to the editor body //if the saved selection (IE only) is not null, then if (this._cmSave != null) { this._editor.selectLines(this._cmSave.start.line, this._cmSave.start.character, this._cmSave.end.line, this._cmSave.end.character); } - var selection = this._editor.selection(); + var selection = this._editor.getSelection(); + var replace = (arg3) ? open + arg3 : open; //concat open and arg3, if arg3 specified if (end != "") { replace = replace + selection + end; diff --git a/src/Umbraco.Web.UI/umbraco_client/CodeArea/javascript.js b/src/Umbraco.Web.UI/umbraco_client/CodeArea/javascript.js index 2d7f547015..9b5c0e4402 100644 --- a/src/Umbraco.Web.UI/umbraco_client/CodeArea/javascript.js +++ b/src/Umbraco.Web.UI/umbraco_client/CodeArea/javascript.js @@ -3,11 +3,26 @@ function resizeTextArea(textEditor, offsetX, offsetY) { var clientWidth = getViewportWidth(); if (textEditor != null) { - textEditor.style.width = (clientWidth - offsetX) + "px"; + // textEditor.style.width = (clientWidth - offsetX) + "px"; textEditor.style.height = (clientHeight - getY(textEditor) - offsetY) + "px"; } } +var currentHandle = null, currentLine; +function updateLineInfo(cm) { + var line = cm.getCursor().line, handle = cm.getLineHandle(line); + if (handle == currentHandle && line == currentLine) return; + + if (currentHandle) { + cm.setLineClass(currentHandle, null, null); + cm.clearMarker(currentHandle); + } + currentHandle = handle; currentLine = line; + cm.setLineClass(currentHandle, null, "activeline"); + cm.setMarker(currentHandle, String(line + 1)); +} + + function UmbracoCodeSnippet() { this.BeginTag = ""; this.EndTag = ""; diff --git a/src/Umbraco.Web.UI/umbraco_client/CodeArea/styles.css b/src/Umbraco.Web.UI/umbraco_client/CodeArea/styles.css index d5ffca6478..3b03afe0aa 100644 --- a/src/Umbraco.Web.UI/umbraco_client/CodeArea/styles.css +++ b/src/Umbraco.Web.UI/umbraco_client/CodeArea/styles.css @@ -1,14 +1,8 @@ -.CodeMirror-line-numbers -{ - color:black; - background-color:#fff; - font-family:monospace; - font-size:10pt; - padding:6px 6px 0px 0px; - line-height:16px; - text-align:right; - border-right: 1px solid #efefef; -} - -div.codepress{border: none !Important; background: #fff;} -div.codepress iframe{border: none !Important; background: #fff;} \ No newline at end of file + .CodeMirror { + border: none !Important; + font-size: 14px !Important; + } + + .CodeMirror-gutter{background: none !Important; border: none; padding-rigth: 5px;} + + span.cm-at{background: yellow !Important;} \ No newline at end of file