Skip to content

Commit

Permalink
Merge branch '4.x' of https://github.com/craftcms/cms into 5.x
Browse files Browse the repository at this point in the history
[ci skip]
  • Loading branch information
brandonkelly committed Dec 7, 2024
2 parents ad99138 + f4611e0 commit 74ead67
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Fixed a bug where some blank user group and entry type values weren’t getting omitted from project config data. ([#16272](https://github.com/craftcms/cms/pull/16272), [#16273](https://github.com/craftcms/cms/pull/16273))
- Fixed a bug where pressing <kbd>Return</kbd> when a color text input within an editable table was focused was submitting the form rather than moving focus to the next row.
- Fixed a bug where custom fields would stay visible within Field Layout Designer field libraries when they didn’t match the search criteria, if they had previously been dragged. ([#16277](https://github.com/craftcms/cms/issues/16277))

## 5.5.5 - 2024-12-03
Expand Down
2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/web/assets/cp/dist/cp.js.map

Large diffs are not rendered by default.

51 changes: 25 additions & 26 deletions src/web/assets/cp/src/js/EditableTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ Craft.EditableTable.Row = Garnish.Base.extend(

this.$textareas = $();
this.niceTexts = [];
var textareasByColId = {};
var textInputsByColId = {};

var i = 0;
var colId, col, td, $checkbox;
Expand All @@ -731,42 +731,41 @@ Craft.EditableTable.Row = Garnish.Base.extend(

if (Craft.inArray(col.type, Craft.EditableTable.textualColTypes)) {
$('.editable-table-preview', td).remove();
const $textarea = $('textarea', td);
this.$textareas = this.$textareas.add($textarea);
let $input;
if (col.type === 'color') {
$input = $('input.color-input', td);
} else {
$input = $('textarea', td);
this.$textareas = this.$textareas.add($input);
this.niceTexts.push(
new Garnish.NiceText($input, {
onHeightChange: this.onTextareaHeightChange.bind(this),
})
);
}

this.addListener($textarea, 'focus', 'onTextareaFocus');
this.addListener($textarea, 'mousedown', 'ignoreNextTextareaFocus');

this.niceTexts.push(
new Garnish.NiceText($textarea, {
onHeightChange: this.onTextareaHeightChange.bind(this),
})
);
this.addListener($input, 'focus', 'onTextareaFocus');
this.addListener($input, 'mousedown', 'ignoreNextTextareaFocus');

this.addListener(
$textarea,
$input,
'keypress',
{tdIndex: i, type: col.type},
'handleKeypress'
);
this.addListener(
$textarea,
'input',
{type: col.type},
'validateValue'
);
$textarea.trigger('input');
this.addListener($input, 'input', {type: col.type}, 'validateValue');
$input.trigger('input');

if (col.type !== 'multiline') {
this.addListener(
$textarea,
$input,
'paste',
{tdIndex: i, type: col.type},
'handlePaste'
);
}

textareasByColId[colId] = $textarea;
textInputsByColId[colId] = $input;
} else if (col.type === 'checkbox') {
$checkbox = $('input[type="checkbox"]', td);

Expand Down Expand Up @@ -825,13 +824,13 @@ Craft.EditableTable.Row = Garnish.Base.extend(

if (
col.autopopulate &&
typeof textareasByColId[col.autopopulate] !== 'undefined' &&
!textareasByColId[colId].val() &&
!textareasByColId[col.autopopulate].val()
typeof textInputsByColId[col.autopopulate] !== 'undefined' &&
!textInputsByColId[colId].val() &&
!textInputsByColId[col.autopopulate].val()
) {
new Craft.HandleGenerator(
textareasByColId[colId],
textareasByColId[col.autopopulate],
textInputsByColId[colId],
textInputsByColId[col.autopopulate],
{
allowNonAlphaStart: true,
}
Expand Down

0 comments on commit 74ead67

Please sign in to comment.