Skip to content

Commit

Permalink
Merge pull request #15049 from craftcms/bugfix/15040-inline-editing-s…
Browse files Browse the repository at this point in the history
…tyles

Bugfix/15040 inline editing styles
  • Loading branch information
brandonkelly authored May 22, 2024
2 parents 6343cda + 7aa85e8 commit d56b167
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- Fixed a “User not authorized to create this element.” error that could occur when creating a new entry within a Matrix field, if the field had Max Entries set. ([#15015](https://github.com/craftcms/cms/issues/15015))
- Fixed a bug where nested entries weren’t showing up within Matrix fields set to the element index view mode, when viewing entry revisions. ([#15038](https://github.com/craftcms/cms/pull/15038))
- Fixed the styling of element chips displayed within an element card. ([#15044](https://github.com/craftcms/cms/issues/15044))
- Fixed styling issues with inline-editing within element indexes. ([#15040](https://github.com/craftcms/cms/issues/15040), [#15049](https://github.com/craftcms/cms/pull/15049))

## 5.1.4 - 2024-05-17

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.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

26 changes: 26 additions & 0 deletions src/web/assets/cp/src/css/_main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3577,6 +3577,32 @@ table {
.source-path {
margin: -22px calc(var(--padding) * -1 + 2px) 24px;
}

.inline-editing {
textarea,
input[type='email'],
input[type='text'].fullwidth,
input[type='url'] {
min-width: 10rem;
}

.money-container input[type='text'].fullwidth,
input[type='text'][inputmode].fullwidth {
min-width: 5rem;
}

.lightswitch-outer-container .lightswitch-inner-container span {
overflow: initial;
}

.selectize.select:not(.fullwidth) {
width: 10rem;
}

.flex:has(input[type='text'][inputmode].fullwidth) {
flex-wrap: nowrap;
}
}
}

.elementselectormodal & {
Expand Down
12 changes: 9 additions & 3 deletions src/web/assets/cp/src/js/TableElementIndexView.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ Craft.TableElementIndexView = Craft.BaseElementIndexView.extend({

Craft.cp.displaySuccess(Craft.t('app', 'Changes saved.'));
this.elementIndex.inlineEditing = false;
this.elementIndex.updateElements(true, false);
this.elementIndex.updateElements(true, false).then(() => {
this.elementIndex.$elements.removeClass('inline-editing');
});
})
.catch(() => {
this.elementIndex.setIndexAvailable();
Expand All @@ -186,7 +188,9 @@ Craft.TableElementIndexView = Craft.BaseElementIndexView.extend({
this.addListener(this.$cancelBtn, 'activate', () => {
this.$cancelBtn.addClass('loading');
this.elementIndex.inlineEditing = false;
this.elementIndex.updateElements(true, false);
this.elementIndex.updateElements(true, false).then(() => {
this.elementIndex.$elements.removeClass('inline-editing');
});
});

this.addListener(this.$elementContainer, 'keydown', (event) => {
Expand Down Expand Up @@ -214,7 +218,9 @@ Craft.TableElementIndexView = Craft.BaseElementIndexView.extend({
this.addListener(this.$editBtn, 'activate', () => {
this.$editBtn.addClass('loading');
this.elementIndex.inlineEditing = true;
this.elementIndex.updateElements(true, false);
this.elementIndex.updateElements(true, false).then(() => {
this.elementIndex.$elements.addClass('inline-editing');
});
});
}
},
Expand Down
3 changes: 3 additions & 0 deletions src/web/assets/cp/src/js/TagSelectInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ Craft.TagSelectInput = Craft.BaseElementSelectInput.extend(
},

getElementSortAxis: function () {
if (this.$container.parents('.inline-editing').length == 1) {
return 'y';
}
return 'x';
},

Expand Down

0 comments on commit d56b167

Please sign in to comment.