diff --git a/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-view.html b/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-view.html index a10ff503b9..f99603afa4 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-view.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/editor/umb-editor-view.html @@ -1,4 +1,4 @@ -
- +
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/grid/grid.listviewlayout.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/grid/grid.listviewlayout.controller.js index a6de5f3016..e1754dd89d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/grid/grid.listviewlayout.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/layouts/grid/grid.listviewlayout.controller.js @@ -16,7 +16,7 @@ vm.nodeId = $scope.contentId; //vm.acceptedFileTypes = mediaHelper.formatFileTypes(Umbraco.Sys.ServerVariables.umbracoSettings.imageFileTypes); //instead of passing in a whitelist, we pass in a blacklist by adding ! to the ext - vm.acceptedFileTypes = mediaHelper.formatFileTypes(Umbraco.Sys.ServerVariables.umbracoSettings.disallowedUploadFiles).replace(/./g, "!."); + vm.acceptedFileTypes = mediaHelper.formatFileTypes(Umbraco.Sys.ServerVariables.umbracoSettings.disallowedUploadFiles).replace(/\./g, "!."); vm.maxFileSize = Umbraco.Sys.ServerVariables.umbracoSettings.maxFileSize + "KB"; vm.activeDrag = false; diff --git a/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js b/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js index 8f0faf2a28..96ef28f53c 100644 --- a/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js +++ b/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js @@ -35,9 +35,18 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls.CodeEditor"); this._control.val(code); } else { - //this is a wrapper for CodeMirror + //this is a wrapper for CodeMirror this._editor.focus(); + + var codeChanged = this._editor.getValue() != code; + var cursor = this._editor.doc.getCursor(); + this._editor.setValue(code); + + // Restore cursor position if the server saved code matches. + if (!codeChanged) + this._editor.setCursor(cursor); + this._editor.focus(); } }, diff --git a/src/Umbraco.Web.UI/umbraco_client/Editors/EditView.js b/src/Umbraco.Web.UI/umbraco_client/Editors/EditView.js index 96ea4d14a6..87b180ce2d 100644 --- a/src/Umbraco.Web.UI/umbraco_client/Editors/EditView.js +++ b/src/Umbraco.Web.UI/umbraco_client/Editors/EditView.js @@ -174,6 +174,9 @@ } if (args.contents) { UmbEditor.SetCode(args.contents); + } else if (!this.IsSimpleEditor) { + // Restore focuse to text region. SetCode also does this. + UmbEditor._editor.focus(); } UmbClientMgr.mainTree().setActiveTreeType(this._opts.currentTreeType);