update validation to work with block list editor inline mode

This commit is contained in:
Mads Rasmussen
2021-07-08 15:25:14 +02:00
parent d6c247e047
commit 0032eb0936
2 changed files with 13 additions and 4 deletions

View File

@@ -13,14 +13,17 @@ function valTab($timeout) {
link: function (scope, element, attr, ctrs) {
var form = ctrs[0];
var tabAlias = scope.tab.alias;
var tabAlias = scope.tab.alias;
let closestEditor = element.closest(".blockelement-inlineblock-editor");
closestEditor = closestEditor.length === 0 ? element.closest(".umb-editor-sub-view") : closestEditor;
closestEditor = closestEditor.length === 0 ? element.closest(".umb-editor") : closestEditor;
scope.tabHasError = false;
function setValidity (form) {
if (!form.$valid) {
var subView = element.closest(".umb-editor-sub-view");
var editor = subView.length > 0 ? subView : element.closest(".umb-editor");
var tabContent = editor.find("[data-element='tab-content-" + tabAlias + "']");
var tabContent = closestEditor.find("[data-element='tab-content-" + tabAlias + "']");
//check if the validation messages are contained inside of this tabs
if (tabContent.find(".ng-invalid").length > 0) {

View File

@@ -10,6 +10,12 @@
border-color: @gray-8;
}
.umb-editor-tab-bar {
margin: 0;
position: static;
padding: 0;
}
> button {
width: 100%;
min-height: 48px;