From d34dcb0b271dde92802c7b19e92718d72c773e04 Mon Sep 17 00:00:00 2001 From: Per Ploug Date: Thu, 29 Sep 2016 13:26:25 +0200 Subject: [PATCH] Load template editor correct without massive ace deps --- .../directives/components/umbaceeditor.directive.js | 9 ++++++++- .../src/views/templates/edit.controller.js | 5 +++++ src/Umbraco.Web/Editors/TemplateQueryController.cs | 4 ++-- src/Umbraco.Web/UI/JavaScript/JsInitialize.js | 1 - 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbaceeditor.directive.js b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbaceeditor.directive.js index 331354491a..6e66e75dd6 100644 --- a/src/Umbraco.Web.UI.Client/src/common/directives/components/umbaceeditor.directive.js +++ b/src/Umbraco.Web.UI.Client/src/common/directives/components/umbaceeditor.directive.js @@ -1,7 +1,7 @@ (function() { 'use strict'; - function AceEditorDirective(umbAceEditorConfig) { + function AceEditorDirective(umbAceEditorConfig, assetsService) { if (angular.isUndefined(window.ace)) { throw new Error('ui-ace need ace to work... (o rly?)'); @@ -32,12 +32,14 @@ var config = window.ace.require('ace/config'); config.set('workerPath', opts.workerPath); } + // ace requires loading if (angular.isDefined(opts.require)) { opts.require.forEach(function(n) { window.ace.require(n); }); } + // Boolean options if (angular.isDefined(opts.showGutter)) { acee.renderer.setShowGutter(opts.showGutter); @@ -126,6 +128,7 @@ function link(scope, el, attr, ngModel) { + /** * Corresponds the umbAceEditorConfig ACE configuration. * @type object @@ -138,11 +141,15 @@ */ var opts = angular.extend({}, options, scope.$eval(attr.umbAceEditor)); + + //load ace libraries here... + /** * ACE editor * @type object */ var acee = window.ace.edit(el[0]); + acee.$blockScrolling = Infinity; /** * ACE editor session. diff --git a/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js index c60b456a4e..195fc87b91 100644 --- a/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/templates/edit.controller.js @@ -81,6 +81,11 @@ vm.aceOption = { mode: "razor", theme: "chrome", + showPrintMargin: false, + + advanced: { + fontSize: '16px' + }, onLoad: function(_editor) { vm.editor = _editor; diff --git a/src/Umbraco.Web/Editors/TemplateQueryController.cs b/src/Umbraco.Web/Editors/TemplateQueryController.cs index 2eaf63f159..a68c3bb9e0 100644 --- a/src/Umbraco.Web/Editors/TemplateQueryController.cs +++ b/src/Umbraco.Web/Editors/TemplateQueryController.cs @@ -65,7 +65,7 @@ namespace Umbraco.Web.Editors var sb = new StringBuilder(); - sb.Append("CurrentPage.Site()"); + sb.Append("Model.Content.Site()"); var timer = new Stopwatch(); @@ -217,7 +217,7 @@ namespace Umbraco.Web.Editors }); - return queryResult; + return queryResult; } private object GetConstraintValue(QueryCondition condition) diff --git a/src/Umbraco.Web/UI/JavaScript/JsInitialize.js b/src/Umbraco.Web/UI/JavaScript/JsInitialize.js index 899c313a7d..44a1ae75c7 100644 --- a/src/Umbraco.Web/UI/JavaScript/JsInitialize.js +++ b/src/Umbraco.Web/UI/JavaScript/JsInitialize.js @@ -17,7 +17,6 @@ 'lib/angular-local-storage/angular-local-storage.min.js', "lib/ace-builds/src-min-noconflict/ace.js", - "lib/ace-builds/src-min-noconflict/mode-razor.js", 'lib/bootstrap/js/bootstrap.2.3.2.min.js', 'lib/bootstrap-tabdrop/bootstrap-tabdrop.js',