fixes how the grid rte resizes when a tab changes to use the proper event handler

This commit is contained in:
Shannon
2018-11-20 14:10:20 +11:00
parent 80070e7332
commit 9ae4d1cdf5
2 changed files with 12 additions and 15 deletions

View File

@@ -363,11 +363,18 @@ angular.module("umbraco.directives")
//};
var tabShownListener = eventsService.on("valTab.tabShown", function (e, args) {
//the tab has been shown, trigger the mceAutoResize (as it could have timed out before the tab was shown)
if (tinyMceEditor !== undefined && tinyMceEditor != null) {
tinyMceEditor.execCommand('mceAutoResize', false, null, null);
var tabShownListener = eventsService.on("app.tabChange", function (e, args) {
var tabId = args.id;
var myTabId = element.closest(".umb-tab-pane").attr("rel");
if (String(tabId) === myTabId) {
//the tab has been shown, trigger the mceAutoResize (as it could have timed out before the tab was shown)
if (tinyMceEditor !== undefined && tinyMceEditor != null) {
tinyMceEditor.execCommand('mceAutoResize', false, null, null);
}
}
});
//listen for formSubmitting event (the result is callback used to remove the event subscription)

View File

@@ -6,7 +6,7 @@
* @description Used to show validation warnings for a tab to indicate that the tab content has validations errors in its data.
* In order for this directive to work, the valFormManager directive must be placed on the containing form.
**/
function valTab(eventsService) {
function valTab() {
return {
require: ['^form', '^valFormManager'],
restrict: "A",
@@ -31,16 +31,6 @@ function valTab(eventsService) {
scope.tabHasError = false;
}
});
var tabShownFunc = function (e) {
var tabContent = element.closest(".umb-panel").find("#" + tabId);
eventsService.emit('valTab.tabShown', { originalEvent: e, tab: scope.tab, content: tabContent });
};
var anchorElement = element.find("a[data-toggle='tab']");
anchorElement.on('shown.bs.tab', tabShownFunc);
scope.$on('$destroy', function () {
anchorElement.off('shown.bs.tab', tabShownFunc);
});
}
};
}