Cleanup of console.log, remove unused code and name button better than 'Warrens button'

This commit is contained in:
Warren Buckley
2018-10-12 14:00:15 +01:00
parent 6a4e9f5368
commit 9dcabd24d2
5 changed files with 15 additions and 30 deletions

View File

@@ -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 <a id="anchor"></a>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 = [];

View File

@@ -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);

View File

@@ -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();
},

View File

@@ -2,8 +2,7 @@
<tinymceConfig>
<commands>
<command alias="code" name="Source code editor" mode="Insert" />
<command alias="codemirror" name="Advanced source code editor" mode="Insert" />
<command alias="ace" name="WARREN code editor" mode="Insert" />
<command alias="ace" name="Advanced source code editor" mode="Insert" />
<command alias="removeformat" name="Remove format" mode="Selection"/>
<command alias="undo" name="Undo" mode="Insert" />
<command alias="redo" name="Redo" mode="Insert" />

View File

@@ -2,8 +2,7 @@
<tinymceConfig>
<commands>
<command alias="code" name="Source code editor" mode="Insert" />
<command alias="codemirror" name="Advanced source code editor" mode="Insert" />
<command alias="ace" name="WARREN code editor" mode="Insert" />
<command alias="ace" name="Advanced source code editor" mode="Insert" />
<command alias="removeformat" name="Remove format" mode="Selection"/>
<command alias="undo" name="Undo" mode="Insert" />
<command alias="redo" name="Redo" mode="Insert" />