MDL-72963 core: fix inplace editable in draggable elements

This commit is contained in:
Ferran Recio 2021-11-02 10:54:46 +01:00
parent b16fc54103
commit da0296a948
3 changed files with 18 additions and 2 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -135,9 +135,19 @@ define(
el.removeAttr('data-oldcontent');
el.removeClass('inplaceeditingon');
el.find('[data-inplaceeditablelink]').focus();
// Re-enable any parent draggable attribute.
el.parents(`[data-inplace-in-draggable="true"]`)
.attr('draggable', true)
.attr('data-inplace-in-draggable', false);
};
var turnEditingOffEverywhere = function() {
// Re-enable any disabled draggable attribute.
$(`[data-inplace-in-draggable="true"]`)
.attr('draggable', true)
.attr('data-inplace-in-draggable', false);
$('span.inplaceeditable.inplaceeditingon').each(function() {
turnEditingOff($(this));
});
@ -324,6 +334,12 @@ define(
var type = el.attr('data-type');
var options = el.attr('data-options');
// Input text inside draggable elements disable text selection in some browsers.
// To prevent this we temporally disable any parent draggables.
el.parents('[draggable="true"]')
.attr('data-inplace-in-draggable', true)
.attr('draggable', false);
if (type === 'toggle') {
turnEditingOnToggle(el, options);
} else if (type === 'select') {