fixes: U4-7903 Using shortcut for "add property" removes "add property"-field for other tabs in document type editor && U4-7904 Add property using shortcut - submit button text is missing
This commit is contained in:
@@ -15,45 +15,55 @@ angular.module("umbraco.directives")
|
||||
keyCombo = scope.$eval(attrs["hotkey"]);
|
||||
}
|
||||
|
||||
// disable shortcuts in input fields if keycombo is 1 character
|
||||
if (keyCombo) {
|
||||
function activate() {
|
||||
|
||||
if (keyCombo.length === 1) {
|
||||
options = {
|
||||
inputDisabled: true
|
||||
};
|
||||
}
|
||||
if (keyCombo) {
|
||||
|
||||
keyboardService.bind(keyCombo, function() {
|
||||
|
||||
var element = $(el);
|
||||
var activeElementType = document.activeElement.tagName;
|
||||
var clickableElements = ["A", "BUTTON"];
|
||||
|
||||
if (element.is("a,div,button,input[type='button'],input[type='submit'],input[type='checkbox']") && !element.is(':disabled')) {
|
||||
|
||||
if (element.is(':visible') || attrs.hotkeyWhenHidden) {
|
||||
|
||||
// when keycombo is enter and a link or button has focus - click the link or button instead of using the hotkey
|
||||
if (keyCombo === "enter" && clickableElements.indexOf(activeElementType) === 0) {
|
||||
document.activeElement.click();
|
||||
} else {
|
||||
element.click();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
element.focus();
|
||||
// disable shortcuts in input fields if keycombo is 1 character
|
||||
if (keyCombo.length === 1) {
|
||||
options = {
|
||||
inputDisabled: true
|
||||
};
|
||||
}
|
||||
|
||||
}, options);
|
||||
keyboardService.bind(keyCombo, function() {
|
||||
|
||||
el.on('$destroy', function() {
|
||||
keyboardService.unbind(keyCombo);
|
||||
});
|
||||
var element = $(el);
|
||||
var activeElementType = document.activeElement.tagName;
|
||||
var clickableElements = ["A", "BUTTON"];
|
||||
|
||||
if (element.is("a,div,button,input[type='button'],input[type='submit'],input[type='checkbox']") && !element.is(':disabled')) {
|
||||
|
||||
if (element.is(':visible') || attrs.hotkeyWhenHidden) {
|
||||
|
||||
if (attrs.hotkeyWhen && attrs.hotkeyWhen === "false") {
|
||||
return;
|
||||
}
|
||||
|
||||
// when keycombo is enter and a link or button has focus - click the link or button instead of using the hotkey
|
||||
if (keyCombo === "enter" && clickableElements.indexOf(activeElementType) === 0) {
|
||||
document.activeElement.click();
|
||||
} else {
|
||||
element.click();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
element.focus();
|
||||
}
|
||||
|
||||
}, options);
|
||||
|
||||
el.on('$destroy', function() {
|
||||
keyboardService.unbind(keyCombo);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
activate();
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
// add init tab
|
||||
addInitGroup(scope.model.groups);
|
||||
|
||||
activateFirstGroup(scope.model.groups);
|
||||
|
||||
// localize texts
|
||||
localizationService.localize("validation_validation").then(function(value) {
|
||||
validationTranslated = value;
|
||||
@@ -153,14 +155,14 @@
|
||||
|
||||
return resourceLookup(scope.model.id, selectedContentTypeAliases, propAliasesExisting).then(function (filteredAvailableCompositeTypes) {
|
||||
_.each(scope.compositionsDialogModel.availableCompositeContentTypes, function (current) {
|
||||
//reset first
|
||||
//reset first
|
||||
current.allowed = true;
|
||||
//see if this list item is found in the response (allowed) list
|
||||
var found = _.find(filteredAvailableCompositeTypes, function (f) {
|
||||
return current.contentType.alias === f.contentType.alias;
|
||||
});
|
||||
|
||||
//allow if the item was found in the response (allowed) list -
|
||||
//allow if the item was found in the response (allowed) list -
|
||||
// and ensure its set to allowed if it is currently checked,
|
||||
// DO not allow if it's a locked content type.
|
||||
current.allowed = scope.model.lockedCompositeContentTypes.indexOf(current.contentType.alias) === -1 &&
|
||||
@@ -181,7 +183,7 @@
|
||||
}
|
||||
|
||||
function setupAvailableContentTypesModel(result) {
|
||||
scope.compositionsDialogModel.availableCompositeContentTypes = result;
|
||||
scope.compositionsDialogModel.availableCompositeContentTypes = result;
|
||||
//iterate each one and set it up
|
||||
_.each(scope.compositionsDialogModel.availableCompositeContentTypes, function (c) {
|
||||
//enable it if it's part of the selected model
|
||||
@@ -276,7 +278,7 @@
|
||||
// submit overlay if no compositions has been removed
|
||||
// or the action has been confirmed
|
||||
} else {
|
||||
|
||||
|
||||
// make sure that all tabs has an init property
|
||||
if (scope.model.groups.length !== 0) {
|
||||
angular.forEach(scope.model.groups, function(group) {
|
||||
@@ -454,6 +456,15 @@
|
||||
return groups;
|
||||
}
|
||||
|
||||
function activateFirstGroup(groups) {
|
||||
if (groups && groups.length > 0) {
|
||||
var firstGroup = groups[0];
|
||||
if(!firstGroup.tabState || firstGroup.tabState === "inActive") {
|
||||
firstGroup.tabState = "active";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- PROPERTIES ---------- */
|
||||
|
||||
scope.addProperty = function(property, group) {
|
||||
|
||||
@@ -3,5 +3,5 @@
|
||||
<p>Are you sure you want to navigate away from this page? - you have unsaved changes</p>
|
||||
|
||||
<button class="btn btn-warning" ng-click="discard(notification)">Discard changes</button>
|
||||
<button class="btn" ng-click="stay(notification)">Stay</button>
|
||||
</div>
|
||||
<button class="btn" ng-click="stay(notification)" umb-auto-focus>Stay</button>
|
||||
</div>
|
||||
|
||||
@@ -75,6 +75,7 @@
|
||||
ng-disabled="tab.inherited"
|
||||
umb-auto-focus
|
||||
umb-auto-resize
|
||||
on-focus="activateGroup(tab)"
|
||||
required
|
||||
val-server-field="{{'Groups[' + $index + '].Name'}}" />
|
||||
|
||||
@@ -109,7 +110,15 @@
|
||||
<li ng-class="{'umb-group-builder__property-sortable': sortingMode && !property.inherited && !property.locked}" ng-repeat="property in tab.properties">
|
||||
|
||||
<!-- Init property / Property placeholder / add new property -->
|
||||
<a href="" class="umb-group-builder__property -placeholder" ng-if="property.propertyState=='init' && !sortingMode" ng-class="{'-placeholder': property.propertyState=='init'}" hotkey="alt+shift+p" ng-click="addProperty(property, tab)" focus-when="{{property.focus}}">
|
||||
<a href=""
|
||||
class="umb-group-builder__property -placeholder"
|
||||
ng-if="property.propertyState=='init' && !sortingMode"
|
||||
ng-class="{'-placeholder': property.propertyState=='init'}"
|
||||
hotkey="alt+shift+p"
|
||||
hotkey-when="{{tab.tabState === 'active' && property.propertyState=='init'}}"
|
||||
ng-click="addProperty(property, tab)"
|
||||
on-focus="activateGroup(tab)"
|
||||
focus-when="{{property.focus}}">
|
||||
|
||||
<div class="umb-group-builder__property-meta">
|
||||
<div class="umb-group-builder__placeholder-box -input-small"></div>
|
||||
|
||||
Reference in New Issue
Block a user