Set focus to RTE when clicking property label (#6609)

This commit is contained in:
Steve Megson
2019-10-29 18:15:22 +00:00
committed by Sebastiaan Janssen
parent 990d14e791
commit 3a111eceb3
3 changed files with 13 additions and 3 deletions

View File

@@ -735,7 +735,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
//get all macro divs and load their content
$(editor.dom.select(".umb-macro-holder.mceNonEditable")).each(function () {
self.loadMacroContent($(this), null);
self.loadMacroContent($(this), null, editor);
});
});
@@ -850,14 +850,15 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
}
var $macroDiv = $(editor.dom.select("div.umb-macro-holder." + uniqueId));
editor.setDirty(true);
//async load the macro content
this.loadMacroContent($macroDiv, macroObject);
this.loadMacroContent($macroDiv, macroObject, editor);
},
/** loads in the macro content async from the server */
loadMacroContent: function ($macroDiv, macroData) {
loadMacroContent: function ($macroDiv, macroData, editor) {
//if we don't have the macroData, then we'll need to parse it from the macro div
if (!macroData) {
@@ -893,7 +894,11 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
$macroDiv.removeClass("loading");
htmlResult = htmlResult.trim();
if (htmlResult !== "") {
var wasDirty = editor.isDirty();
$ins.html(htmlResult);
if (!wasDirty) {
editor.undoManager.clear();
}
}
});
});

View File

@@ -101,6 +101,10 @@ angular.module("umbraco")
}
});
$scope.focus = function () {
tinyMceEditor.focus();
}
//when the element is disposed we need to unsubscribe!
// NOTE: this is very important otherwise if this is part of a modal, the listener still exists because the dom
// element might still be there even after the modal has been hidden.

View File

@@ -2,6 +2,7 @@
<umb-load-indicator ng-if="isLoading"></umb-load-indicator>
<div class="umb-rte-editor-con">
<input type="text" id="{{model.alias}}" ng-focus="focus()" style="position:absolute;top:0;width:0;height:0;" />
<div id="{{textAreaHtmlId}}" class="umb-rte-editor" ng-style="{ width: containerWidth, height: containerHeight, overflow: containerOverflow}"></div>
</div>
</div>