diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ContextHelp.ts b/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ContextHelp.ts index ce8efb6bc69807a0956e3a82129caf50ce9a1217..fd10961e7e876667021f391798b1ffb9eca18fc8 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ContextHelp.ts +++ b/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/ContextHelp.ts @@ -163,12 +163,7 @@ class ContextHelp { content: content, }; Popover.setOptions($trigger, options); - $trigger - .attr('data-loaded', 'true') - .one('hidden.bs.popover', (): void => { - Popover.show($trigger); - }); - Popover.hide($trigger); + $trigger.attr('data-loaded', 'true'); }); } } diff --git a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Popover.ts b/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Popover.ts index 970f97775a49b0fbaf097edae3501b7cdc188e65..c57df8073398c7c054905463e9103302d7ba002e 100644 --- a/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Popover.ts +++ b/Build/Sources/TypeScript/backend/Resources/Public/TypeScript/Popover.ts @@ -88,6 +88,7 @@ class Popover { public setOption($element: JQuery, key: string, value: string): void { if (key === 'content') { $element.attr('data-bs-content', value); + $element.data('typo3.bs.popover').setContent(value); } else { $element.each((i, el) => { const popover = $(el).data('typo3.bs.popover'); diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js b/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js index f98786dfd5f9702e1ee02cd61e49ed8c22a3acaf..7c4abcaef8fa76d695d481311113b4760f8151c7 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js @@ -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","jquery","TYPO3/CMS/Core/Ajax/AjaxRequest","./Popover","bootstrap"],(function(t,e,a,o,l){"use strict";a=__importDefault(a);class s{constructor(){this.ajaxUrl=TYPO3.settings.ajaxUrls.context_help,this.trigger="click",this.placement="auto",this.selector=".help-link",this.initialize()}static resolveBackend(){return void 0!==window.opener&&null!==window.opener?window.opener.top:top}initialize(){const t=s.resolveBackend();void 0!==t.TYPO3.settings.ContextHelp&&(this.helpModuleUrl=t.TYPO3.settings.ContextHelp.moduleUrl),void 0===TYPO3.ShortcutMenu&&void 0===t.TYPO3.ShortcutMenu&&a.default(".icon-actions-system-shortcut-new").closest(".btn").hide();let e=" ";void 0!==t.TYPO3.lang&&(e=t.TYPO3.lang.csh_tooltip_loading);const o=a.default(this.selector);o.attr("data-loaded","false").attr("data-bs-html","true").attr("data-bs-original-title",e).attr("data-bs-placement",this.placement).attr("data-bs-trigger",this.trigger),l.popover(o),a.default(document).on("show.bs.popover",this.selector,t=>{const e=a.default(t.currentTarget),o=e.data("description");if(void 0!==o&&""!==o){const t={title:e.data("title")||"",content:o};l.setOptions(e,t)}else"false"===e.attr("data-loaded")&&e.data("table")&&this.loadHelp(e);e.closest(".t3js-module-docheader").length&&l.setOption(e,"placement","bottom")}).on("click",".help-has-link",t=>{a.default(".popover").each((e,o)=>{const l=a.default(o);l.has(t.target).length&&this.showHelpPopup(a.default('[aria-describedby="'+l.attr("id")+'"]'))})}).on("click","body",t=>{a.default(this.selector).each((e,o)=>{const s=a.default(o);s.is(t.target)||0!==s.has(t.target).length||0!==a.default(".popover").has(t.target).length||l.hide(s)})})}showHelpPopup(t){try{const e=window.open(this.helpModuleUrl+"&table="+t.data("table")+"&field="+t.data("field")+"&action=detail","ContextHelpWindow","height=400,width=600,status=0,menubar=0,scrollbars=1");return e.focus(),l.hide(t),e}catch(t){}}loadHelp(t){const e=t.data("table"),a=t.data("field");e&&new o(this.ajaxUrl).withQueryArguments({params:{action:"getContextHelp",table:e,field:a}}).get().then(async e=>{const a=await e.resolve(),o={title:a.title||"",content:a.content||"<p></p>"};l.setOptions(t,o),t.attr("data-loaded","true").one("hidden.bs.popover",()=>{l.show(t)}),l.hide(t)})}}return new s})); \ No newline at end of file +var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};define(["require","exports","jquery","TYPO3/CMS/Core/Ajax/AjaxRequest","./Popover","bootstrap"],(function(t,e,a,o,l){"use strict";a=__importDefault(a);class s{constructor(){this.ajaxUrl=TYPO3.settings.ajaxUrls.context_help,this.trigger="click",this.placement="auto",this.selector=".help-link",this.initialize()}static resolveBackend(){return void 0!==window.opener&&null!==window.opener?window.opener.top:top}initialize(){const t=s.resolveBackend();void 0!==t.TYPO3.settings.ContextHelp&&(this.helpModuleUrl=t.TYPO3.settings.ContextHelp.moduleUrl),void 0===TYPO3.ShortcutMenu&&void 0===t.TYPO3.ShortcutMenu&&a.default(".icon-actions-system-shortcut-new").closest(".btn").hide();let e=" ";void 0!==t.TYPO3.lang&&(e=t.TYPO3.lang.csh_tooltip_loading);const o=a.default(this.selector);o.attr("data-loaded","false").attr("data-bs-html","true").attr("data-bs-original-title",e).attr("data-bs-placement",this.placement).attr("data-bs-trigger",this.trigger),l.popover(o),a.default(document).on("show.bs.popover",this.selector,t=>{const e=a.default(t.currentTarget),o=e.data("description");if(void 0!==o&&""!==o){const t={title:e.data("title")||"",content:o};l.setOptions(e,t)}else"false"===e.attr("data-loaded")&&e.data("table")&&this.loadHelp(e);e.closest(".t3js-module-docheader").length&&l.setOption(e,"placement","bottom")}).on("click",".help-has-link",t=>{a.default(".popover").each((e,o)=>{const l=a.default(o);l.has(t.target).length&&this.showHelpPopup(a.default('[aria-describedby="'+l.attr("id")+'"]'))})}).on("click","body",t=>{a.default(this.selector).each((e,o)=>{const s=a.default(o);s.is(t.target)||0!==s.has(t.target).length||0!==a.default(".popover").has(t.target).length||l.hide(s)})})}showHelpPopup(t){try{const e=window.open(this.helpModuleUrl+"&table="+t.data("table")+"&field="+t.data("field")+"&action=detail","ContextHelpWindow","height=400,width=600,status=0,menubar=0,scrollbars=1");return e.focus(),l.hide(t),e}catch(t){}}loadHelp(t){const e=t.data("table"),a=t.data("field");e&&new o(this.ajaxUrl).withQueryArguments({params:{action:"getContextHelp",table:e,field:a}}).get().then(async e=>{const a=await e.resolve(),o={title:a.title||"",content:a.content||"<p></p>"};l.setOptions(t,o),t.attr("data-loaded","true")})}}return new s})); \ No newline at end of file diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/Popover.js b/typo3/sysext/backend/Resources/Public/JavaScript/Popover.js index 58d63144823b5ccf936783d89720e9f2bfa860c6..e364faf9c9d64362623e4a7a4d772132fe1d1611 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/Popover.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/Popover.js @@ -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","jquery","bootstrap"],(function(t,e,o,a){"use strict";o=__importDefault(o);return new class{constructor(){this.DEFAULT_SELECTOR='[data-bs-toggle="popover"]',this.initialize()}initialize(t){t=t||this.DEFAULT_SELECTOR,o.default(t).each((t,e)=>{const s=new a.Popover(e);o.default(e).data("typo3.bs.popover",s)})}popover(t){t.each((t,e)=>{const s=new a.Popover(e);o.default(e).data("typo3.bs.popover",s)})}setOptions(t,e){const a=(e=e||{}).title||t.data("title")||"",s=e.content||t.data("bs-content")||"";t.attr("data-bs-original-title",a).attr("data-bs-content",s).attr("data-bs-placement","auto"),o.default.each(e,(e,o)=>{this.setOption(t,e,o)})}setOption(t,e,a){"content"===e?t.attr("data-bs-content",a):t.each((t,s)=>{const n=o.default(s).data("typo3.bs.popover");n&&(n.config[e]=a)})}show(t){t.each((t,e)=>{const a=o.default(e).data("typo3.bs.popover");a&&a.show()})}hide(t){t.each((t,e)=>{const a=o.default(e).data("typo3.bs.popover");a&&a.hide()})}destroy(t){t.each((t,e)=>{const a=o.default(e).data("typo3.bs.popover");a&&a.dispose()})}toggle(t){t.each((t,e)=>{const a=o.default(e).data("typo3.bs.popover");a&&a.toggle()})}}})); \ No newline at end of file +var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};define(["require","exports","jquery","bootstrap"],(function(t,e,o,a){"use strict";o=__importDefault(o);return new class{constructor(){this.DEFAULT_SELECTOR='[data-bs-toggle="popover"]',this.initialize()}initialize(t){t=t||this.DEFAULT_SELECTOR,o.default(t).each((t,e)=>{const s=new a.Popover(e);o.default(e).data("typo3.bs.popover",s)})}popover(t){t.each((t,e)=>{const s=new a.Popover(e);o.default(e).data("typo3.bs.popover",s)})}setOptions(t,e){const a=(e=e||{}).title||t.data("title")||"",s=e.content||t.data("bs-content")||"";t.attr("data-bs-original-title",a).attr("data-bs-content",s).attr("data-bs-placement","auto"),o.default.each(e,(e,o)=>{this.setOption(t,e,o)})}setOption(t,e,a){"content"===e?(t.attr("data-bs-content",a),t.data("typo3.bs.popover").setContent(a)):t.each((t,s)=>{const p=o.default(s).data("typo3.bs.popover");p&&(p.config[e]=a)})}show(t){t.each((t,e)=>{const a=o.default(e).data("typo3.bs.popover");a&&a.show()})}hide(t){t.each((t,e)=>{const a=o.default(e).data("typo3.bs.popover");a&&a.hide()})}destroy(t){t.each((t,e)=>{const a=o.default(e).data("typo3.bs.popover");a&&a.dispose()})}toggle(t){t.each((t,e)=>{const a=o.default(e).data("typo3.bs.popover");a&&a.toggle()})}}})); \ No newline at end of file