Commit 6d742dc3 authored by Oliver Bartsch's avatar Oliver Bartsch Committed by Christian Kuhn

[BUGFIX] Fix edit page title input group

The correct height of the input group is restored by
removing unnecessary wrappers around the buttons.

See: https://getbootstrap.com/docs/5.0/forms/input-group/#button-addons

Resolves: #93262
Releases: master
Change-Id: I3e8276f66efbb593480371d3ee26d0ec08ba35d8
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/67399Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Jochen's avatarJochen <rothjochen@gmail.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Jochen's avatarJochen <rothjochen@gmail.com>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 9eada3ad
......@@ -135,12 +135,8 @@ class PageActions {
'<div class="form-group">' +
'<div class="input-group input-group-lg">' +
'<input class="form-control t3js-title-edit-input">' +
'<span class="input-group-btn">' +
'<button class="btn btn-default" type="button" data-action="submit"><span class="t3-icon fa fa-floppy-o"></span></button> ' +
'</span>' +
'<span class="input-group-btn">' +
'<button class="btn btn-default" type="button" data-action="cancel"><span class="t3-icon fa fa-times"></span></button> ' +
'</span>' +
'</div>' +
'</div>' +
'</form>',
......
......@@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};define(["require","exports","./Enum/KeyTypes","jquery","./Storage/Persistent","./Wizard/NewContentElement"],(function(t,e,i,a,n,s){"use strict";var l;a=__importDefault(a),function(t){t.pageTitle=".t3js-title-inlineedit",t.hiddenElements=".t3js-hidden-record",t.newButton=".t3js-toggle-new-content-element-wizard"}(l||(l={}));return new class{constructor(){this.pageId=0,this.pageOverlayId=0,this.$pageTitle=null,this.$showHiddenElementsCheckbox=null,a.default(()=>{this.initializeElements(),this.initializeEvents(),this.initializeNewContentElementWizard(),this.initializePageTitleRenaming()})}setPageId(t){this.pageId=t}setLanguageOverlayId(t){this.pageOverlayId=t}initializePageTitleRenaming(){if(!a.default.isReady)return void a.default(()=>{this.initializePageTitleRenaming()});if(this.pageId<=0)return;const t=a.default('<button type="button" class="btn btn-link" aria-label="'+TYPO3.lang.editPageTitle+'" data-action="edit"><span class="t3-icon fa fa-pencil"></span></button>');t.on("click",()=>{this.editPageTitle()}),this.$pageTitle.on("dblclick",()=>{this.editPageTitle()}).append(t)}initializeElements(){this.$pageTitle=a.default(l.pageTitle+":first"),this.$showHiddenElementsCheckbox=a.default("#checkTt_content_showHidden")}initializeEvents(){this.$showHiddenElementsCheckbox.on("change",this.toggleContentElementVisibility)}toggleContentElementVisibility(t){const e=a.default(t.currentTarget),i=a.default(l.hiddenElements),s=a.default("<span />",{class:"checkbox-spinner fa fa-circle-o-notch fa-spin"});e.hide().after(s),e.prop("checked")?i.slideDown():i.slideUp(),n.set("moduleData.web_layout.tt_content_showHidden",e.prop("checked")?"1":"0").done(()=>{s.remove(),e.show()})}editPageTitle(){const t=a.default('<form><div class="form-group"><div class="input-group input-group-lg"><input class="form-control t3js-title-edit-input"><span class="input-group-btn"><button class="btn btn-default" type="button" data-action="submit"><span class="t3-icon fa fa-floppy-o"></span></button> </span><span class="input-group-btn"><button class="btn btn-default" type="button" data-action="cancel"><span class="t3-icon fa fa-times"></span></button> </span></div></div></form>'),e=t.find("input");t.find('[data-action="cancel"]').on("click",()=>{t.replaceWith(this.$pageTitle),this.initializePageTitleRenaming()}),t.find('[data-action="submit"]').on("click",()=>{const i=e.val().trim();""!==i&&this.$pageTitle.text()!==i?this.saveChanges(e):t.find('[data-action="cancel"]').trigger("click")}),e.parents("form").on("submit",t=>(t.preventDefault(),!1));const n=this.$pageTitle;n.children().last().remove(),n.replaceWith(t),e.val(n.text()).focus(),e.on("keydown",e=>{switch(e.which){case i.KeyTypesEnum.ENTER:t.find('[data-action="submit"]').trigger("click");break;case i.KeyTypesEnum.ESCAPE:t.find('[data-action="cancel"]').trigger("click")}})}saveChanges(e){const i=e.parents("form");i.find("button").addClass("disabled"),e.attr("disabled","disabled");let a,n={};a=this.pageOverlayId>0?this.pageOverlayId:this.pageId,n.data={},n.data.pages={},n.data.pages[a]={title:e.val()},t(["TYPO3/CMS/Backend/AjaxDataHandler"],t=>{t.process(n).then(()=>{i.find("[data-action=cancel]").trigger("click"),this.$pageTitle.text(e.val()),this.initializePageTitleRenaming(),top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree()}).catch(()=>{i.find("[data-action=cancel]").trigger("click")})})}initializeNewContentElementWizard(){Array.from(document.querySelectorAll(l.newButton)).forEach(t=>{t.classList.remove("disabled")}),a.default(l.newButton).on("click",t=>{t.preventDefault();const e=a.default(t.currentTarget);s.wizard(e.attr("href"),e.data("title"))})}}}));
\ No newline at end of file
var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};define(["require","exports","./Enum/KeyTypes","jquery","./Storage/Persistent","./Wizard/NewContentElement"],(function(t,e,i,a,n,l){"use strict";var s;a=__importDefault(a),function(t){t.pageTitle=".t3js-title-inlineedit",t.hiddenElements=".t3js-hidden-record",t.newButton=".t3js-toggle-new-content-element-wizard"}(s||(s={}));return new class{constructor(){this.pageId=0,this.pageOverlayId=0,this.$pageTitle=null,this.$showHiddenElementsCheckbox=null,a.default(()=>{this.initializeElements(),this.initializeEvents(),this.initializeNewContentElementWizard(),this.initializePageTitleRenaming()})}setPageId(t){this.pageId=t}setLanguageOverlayId(t){this.pageOverlayId=t}initializePageTitleRenaming(){if(!a.default.isReady)return void a.default(()=>{this.initializePageTitleRenaming()});if(this.pageId<=0)return;const t=a.default('<button type="button" class="btn btn-link" aria-label="'+TYPO3.lang.editPageTitle+'" data-action="edit"><span class="t3-icon fa fa-pencil"></span></button>');t.on("click",()=>{this.editPageTitle()}),this.$pageTitle.on("dblclick",()=>{this.editPageTitle()}).append(t)}initializeElements(){this.$pageTitle=a.default(s.pageTitle+":first"),this.$showHiddenElementsCheckbox=a.default("#checkTt_content_showHidden")}initializeEvents(){this.$showHiddenElementsCheckbox.on("change",this.toggleContentElementVisibility)}toggleContentElementVisibility(t){const e=a.default(t.currentTarget),i=a.default(s.hiddenElements),l=a.default("<span />",{class:"checkbox-spinner fa fa-circle-o-notch fa-spin"});e.hide().after(l),e.prop("checked")?i.slideDown():i.slideUp(),n.set("moduleData.web_layout.tt_content_showHidden",e.prop("checked")?"1":"0").done(()=>{l.remove(),e.show()})}editPageTitle(){const t=a.default('<form><div class="form-group"><div class="input-group input-group-lg"><input class="form-control t3js-title-edit-input"><button class="btn btn-default" type="button" data-action="submit"><span class="t3-icon fa fa-floppy-o"></span></button> <button class="btn btn-default" type="button" data-action="cancel"><span class="t3-icon fa fa-times"></span></button> </div></div></form>'),e=t.find("input");t.find('[data-action="cancel"]').on("click",()=>{t.replaceWith(this.$pageTitle),this.initializePageTitleRenaming()}),t.find('[data-action="submit"]').on("click",()=>{const i=e.val().trim();""!==i&&this.$pageTitle.text()!==i?this.saveChanges(e):t.find('[data-action="cancel"]').trigger("click")}),e.parents("form").on("submit",t=>(t.preventDefault(),!1));const n=this.$pageTitle;n.children().last().remove(),n.replaceWith(t),e.val(n.text()).focus(),e.on("keydown",e=>{switch(e.which){case i.KeyTypesEnum.ENTER:t.find('[data-action="submit"]').trigger("click");break;case i.KeyTypesEnum.ESCAPE:t.find('[data-action="cancel"]').trigger("click")}})}saveChanges(e){const i=e.parents("form");i.find("button").addClass("disabled"),e.attr("disabled","disabled");let a,n={};a=this.pageOverlayId>0?this.pageOverlayId:this.pageId,n.data={},n.data.pages={},n.data.pages[a]={title:e.val()},t(["TYPO3/CMS/Backend/AjaxDataHandler"],t=>{t.process(n).then(()=>{i.find("[data-action=cancel]").trigger("click"),this.$pageTitle.text(e.val()),this.initializePageTitleRenaming(),top.TYPO3.Backend.NavigationContainer.PageTree.refreshTree()}).catch(()=>{i.find("[data-action=cancel]").trigger("click")})})}initializeNewContentElementWizard(){Array.from(document.querySelectorAll(s.newButton)).forEach(t=>{t.classList.remove("disabled")}),a.default(s.newButton).on("click",t=>{t.preventDefault();const e=a.default(t.currentTarget);l.wizard(e.attr("href"),e.data("title"))})}}}));
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment