From 9dcabd24d243bee52bb5d2f266aea56f09e938bc Mon Sep 17 00:00:00 2001 From: Warren Buckley Date: Fri, 12 Oct 2018 14:00:15 +0100 Subject: [PATCH] Cleanup of console.log, remove unused code and name button better than 'Warrens button' --- .../src/common/services/tinymce.service.js | 26 +++++++++---------- .../rte/codeeditor.controller.js | 11 +------- .../propertyeditors/rte/rte.controller.js | 2 -- .../config/tinyMceConfig.Release.config | 3 +-- .../config/tinyMceConfig.config | 3 +-- 5 files changed, 15 insertions(+), 30 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js index 79623de215..f80f80ebf7 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/tinymce.service.js @@ -2,7 +2,7 @@ * @ngdoc service * @name umbraco.services.tinyMceService * - * + * * @description * A service containing all logic for all of the Umbraco TinyMCE plugins */ @@ -160,7 +160,7 @@ function tinyMceService($log, $q, imageHelper, $locale, $http, $timeout, stylesh /** * Returns a promise of the configuration object to initialize the TinyMCE editor * @param {} args - * @returns {} + * @returns {} */ getTinyMceEditorConfig: function (args) { @@ -252,7 +252,7 @@ function tinyMceService($log, $q, imageHelper, $locale, $http, $timeout, stylesh return $q.when(config); }); - + }, /** @@ -300,7 +300,7 @@ function tinyMceService($log, $q, imageHelper, $locale, $http, $timeout, stylesh * @description * Creates the umbrco insert embedded media tinymce plugin * - * @param {Object} editor the TinyMCE editor instance + * @param {Object} editor the TinyMCE editor instance * @param {Object} $scope the current controller scope */ createInsertEmbeddedMedia: function (editor, $scope, callback) { @@ -326,9 +326,7 @@ function tinyMceService($log, $q, imageHelper, $locale, $http, $timeout, stylesh editor.addButton("ace", { icon: "code", - text: "Code WARREN", - title: "Code WARREN", - tooltip: "Code WARREN", + tooltip: "View Source Code", onclick: function(){ callback(); } @@ -344,7 +342,7 @@ function tinyMceService($log, $q, imageHelper, $locale, $http, $timeout, stylesh * @description * Creates the umbrco insert media tinymce plugin * - * @param {Object} editor the TinyMCE editor instance + * @param {Object} editor the TinyMCE editor instance * @param {Object} $scope the current controller scope */ createMediaPicker: function (editor, $scope, callback) { @@ -436,7 +434,7 @@ function tinyMceService($log, $q, imageHelper, $locale, $http, $timeout, stylesh * @description * Creates the insert umbrco macro tinymce plugin * - * @param {Object} editor the TinyMCE editor instance + * @param {Object} editor the TinyMCE editor instance * @param {Object} $scope the current controller scope */ createInsertMacro: function (editor, $scope, callback) { @@ -460,7 +458,7 @@ function tinyMceService($log, $q, imageHelper, $locale, $http, $timeout, stylesh }); /** - * Because the macro gets wrapped in a P tag because of the way 'enter' works, this + * Because the macro gets wrapped in a P tag because of the way 'enter' works, this * method will return the macro element if not wrapped in a p, or the p if the macro * element is the only one inside of it even if we are deep inside an element inside the macro */ @@ -468,7 +466,7 @@ function tinyMceService($log, $q, imageHelper, $locale, $http, $timeout, stylesh var e = $(element).closest(".umb-macro-holder"); if (e.length > 0) { if (e.get(0).parentNode.nodeName === "P") { - //now check if we're the only element + //now check if we're the only element if (element.parentNode.childNodes.length === 1) { return e.get(0).parentNode; } @@ -502,7 +500,7 @@ function tinyMceService($log, $q, imageHelper, $locale, $http, $timeout, stylesh //if the end selection is a macro then move the cursor //NOTE: we don't have to handle when the selection comes from a previous parent because - // that is automatically taken care of with the normal onNodeChanged logic since the + // that is automatically taken care of with the normal onNodeChanged logic since the // evt.element will be the macro once it becomes part of the selection. var $testForMacro = $(endSelection).closest(".umb-macro-holder"); if ($testForMacro.length > 0) { @@ -622,7 +620,7 @@ function tinyMceService($log, $q, imageHelper, $locale, $http, $timeout, stylesh //set onNodeChanged event listener editor.on('NodeChange', onNodeChanged); - /** + /** * Listen for the keydown in the editor, we'll check if we are currently on a macro element, if so * we'll check if the key down is a supported key which requires an action, otherwise we ignore the request * so the macro cannot be edited. @@ -1035,7 +1033,7 @@ function tinyMceService($log, $q, imageHelper, $locale, $http, $timeout, stylesh * From the given string, generates a string array where each item is the id attribute value from a named anchor * 'some string with a named anchor' returns ['anchor'] * - * @param {string} input the string to parse + * @param {string} input the string to parse */ getAnchorNames: function (input) { var anchors = []; diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/codeeditor.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/codeeditor.controller.js index f799dce03a..97f00023bb 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/codeeditor.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/codeeditor.controller.js @@ -4,8 +4,6 @@ function CodeEditorController($scope, localizationService) { var vm = this; - vm.loading = false; - vm.submit = submit; vm.close = close; @@ -15,7 +13,7 @@ theme: "chrome", showPrintMargin: false, advanced: { - fontSize: '14px', + fontSize: "14px", enableSnippets: false, //The Razor mode snippets are awful (Need a way to override these) enableBasicAutocompletion: true, enableLiveAutocompletion: false @@ -32,8 +30,6 @@ function onInit() { - vm.loading = true; - // set default title if(!$scope.model.title) { // TODO change to a new key to get 'source code' or similar @@ -41,10 +37,6 @@ $scope.model.title = value; }); } - - //GO - - } function submit(model) { @@ -64,7 +56,6 @@ } onInit(); - } angular.module("umbraco").controller("Umbraco.PropertyEditors.RTECodeEditorController", CodeEditorController); diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js index 66df2a787b..758f138d4a 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/rte/rte.controller.js @@ -204,8 +204,6 @@ angular.module("umbraco") view: 'views/propertyeditors/rte/codeeditor.html', size: 'small', submit: function (model) { - console.log('HTML update', model.content); - console.log(tinyMceEditor); tinyMceEditor.setContent(model.content); editorService.close(); }, diff --git a/src/Umbraco.Web.UI/config/tinyMceConfig.Release.config b/src/Umbraco.Web.UI/config/tinyMceConfig.Release.config index 8243ddfcc0..dafbbe8bb5 100644 --- a/src/Umbraco.Web.UI/config/tinyMceConfig.Release.config +++ b/src/Umbraco.Web.UI/config/tinyMceConfig.Release.config @@ -2,8 +2,7 @@ - - + diff --git a/src/Umbraco.Web.UI/config/tinyMceConfig.config b/src/Umbraco.Web.UI/config/tinyMceConfig.config index 8243ddfcc0..dafbbe8bb5 100644 --- a/src/Umbraco.Web.UI/config/tinyMceConfig.config +++ b/src/Umbraco.Web.UI/config/tinyMceConfig.config @@ -2,8 +2,7 @@ - - +