diff --git a/Build/Sources/TypeScript/backend/tooltip.ts b/Build/Sources/TypeScript/backend/tooltip.ts deleted file mode 100644 index 91ba0167e067..000000000000 --- a/Build/Sources/TypeScript/backend/tooltip.ts +++ /dev/null @@ -1,111 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ - -import { Tooltip as BootstrapTooltip } from 'bootstrap'; -import DocumentService from '@typo3/core/document-service'; - -/** - * The main tooltip object - * - * Hint: Due to the current usage of tooltips, this class can't be static right now - * - * @deprecated bootstrap tooltip has been deprecated since TYPO3 v12 and will be removed with v13. - */ -class Tooltip { - constructor() { - DocumentService.ready().then((): void => { - console.warn('Tooltip has been deprecated since TYPO3 v12 and will be removed with v13. Rely on browser title instead.'); - this.initialize('[data-bs-toggle="tooltip"]'); - }); - } - - private static applyAttributes(attributes: Record, node: HTMLElement): void { - for (const [attribute, value] of Object.entries(attributes)) { - node.setAttribute(attribute, value); - } - } - - public initialize(selector: string, options: Partial = {}): void { - if (Object.entries(options).length === 0) { - options = { - container: 'body', - trigger: 'hover', - delay: { - show: 500, - hide: 100 - } - }; - } - const elements = document.querySelectorAll(selector); - for (const element of elements) { - // Ensure elements are not initialized multiple times. - BootstrapTooltip.getOrCreateInstance(element, options); - } - } - - /** - * Show tooltip on element(s) - * - * @param {NodeListOf|HTMLElement} elements - * @param {String} title - */ - public show(elements: NodeListOf | HTMLElement, title: string): void { - const attributes = { - 'data-bs-placement': 'auto', - title: title - }; - - if (elements instanceof NodeList) { - for (const node of elements) { - Tooltip.applyAttributes(attributes, node); - BootstrapTooltip.getInstance(node).show(); - } - return; - } - - if (elements instanceof HTMLElement) { - Tooltip.applyAttributes(attributes, elements); - BootstrapTooltip.getInstance(elements).show(); - return; - } - } - - /** - * Hide tooltip on element(s) - * - * @param {NodeListOf|HTMLElement} elements - */ - public hide(elements: NodeListOf | HTMLElement): void { - if (elements instanceof NodeList) { - for (const node of elements) { - const instance = BootstrapTooltip.getInstance(node); - if (instance !== null) { - instance.hide(); - } - } - return; - } - - if (elements instanceof HTMLElement) { - BootstrapTooltip.getInstance(elements).hide(); - return; - } - } -} - -const tooltipObject = new Tooltip(); - -// expose as global object -TYPO3.Tooltip = tooltipObject; - -export default tooltipObject; diff --git a/Build/types/TYPO3/index.d.ts b/Build/types/TYPO3/index.d.ts index 8b611cdef064..45f10a6125a3 100644 --- a/Build/types/TYPO3/index.d.ts +++ b/Build/types/TYPO3/index.d.ts @@ -20,7 +20,6 @@ declare namespace TYPO3 { export let Severity: any; export let ShortcutMenu: any; export let Storage: any; - export let Tooltip: any; export let WindowManager: any; export let Wizard: any; export let WorkspacesMenu: any; diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/tooltip.js b/typo3/sysext/backend/Resources/Public/JavaScript/tooltip.js deleted file mode 100644 index 190995419291..000000000000 --- a/typo3/sysext/backend/Resources/Public/JavaScript/tooltip.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * This file is part of the TYPO3 CMS project. - * - * It is free software; you can redistribute it and/or modify it under - * the terms of the GNU General Public License, either version 2 - * of the License, or any later version. - * - * For the full copyright and license information, please read the - * LICENSE.txt file that was distributed with this source code. - * - * The TYPO3 project - inspiring people to share! - */ -import{Tooltip as BootstrapTooltip}from"bootstrap";import DocumentService from"@typo3/core/document-service.js";class Tooltip{constructor(){DocumentService.ready().then((()=>{console.warn("Tooltip has been deprecated since TYPO3 v12 and will be removed with v13. Rely on browser title instead."),this.initialize('[data-bs-toggle="tooltip"]')}))}static applyAttributes(t,o){for(const[e,i]of Object.entries(t))o.setAttribute(e,i)}initialize(t,o={}){0===Object.entries(o).length&&(o={container:"body",trigger:"hover",delay:{show:500,hide:100}});const e=document.querySelectorAll(t);for(const t of e)BootstrapTooltip.getOrCreateInstance(t,o)}show(t,o){const e={"data-bs-placement":"auto",title:o};if(t instanceof NodeList)for(const o of t)Tooltip.applyAttributes(e,o),BootstrapTooltip.getInstance(o).show();else if(t instanceof HTMLElement)return Tooltip.applyAttributes(e,t),void BootstrapTooltip.getInstance(t).show()}hide(t){if(t instanceof NodeList)for(const o of t){const t=BootstrapTooltip.getInstance(o);null!==t&&t.hide()}else t instanceof HTMLElement&&BootstrapTooltip.getInstance(t).hide()}}const tooltipObject=new Tooltip;TYPO3.Tooltip=tooltipObject;export default tooltipObject; \ No newline at end of file diff --git a/typo3/sysext/core/Documentation/Changelog/13.0/Breaking-100963-DeprecatedFunctionalityRemoved.rst b/typo3/sysext/core/Documentation/Changelog/13.0/Breaking-100963-DeprecatedFunctionalityRemoved.rst index 0d83da4e0d25..c91e8b8b3efc 100644 --- a/typo3/sysext/core/Documentation/Changelog/13.0/Breaking-100963-DeprecatedFunctionalityRemoved.rst +++ b/typo3/sysext/core/Documentation/Changelog/13.0/Breaking-100963-DeprecatedFunctionalityRemoved.rst @@ -294,7 +294,7 @@ The following Backend route identifiers have been removed: The following global JavaScript variables have been removed: -- :js:`Global_JavaScript_Variable_Name` +- :js:`TYPO3.Tooltip` The following global JavaScript functions have been removed: @@ -302,7 +302,7 @@ The following global JavaScript functions have been removed: The following JavaScript modules have been removed: -- :js:`module.name` +- :js:`tooltip` The following JavaScript methods behaviour has changed: