From c6a3ef0db21ffb87262a7776aa3b71b0c2411985 Mon Sep 17 00:00:00 2001 From: Benjamin Franzke <bfr@qbus.de> Date: Fri, 10 Dec 2021 20:03:20 +0100 Subject: [PATCH] [TASK] Re-enable jquery.autocomplete in grunt copy action Add a patch file for jquery.autocomplete that contains the custom TYPO3 patches added in #79938 and #70988. Enable the grunt copy action to ensure that mass package-upgrades like #92419 do not miss to update our local fork. A non-applying patch will produce an error during upgrade, while a local fork is silently ignored. Also, pin devbridge-autocomplete to the version that is actually used (updated last time in #70988): yarn add devbridge-autocomplete@~1.3.0 The patch file has been generated via: cp typo3/sysext/core/Resources/Public/JavaScript/Contrib/jquery.autocomplete.js \ Build/node_modules/devbridge-autocomplete/dist/jquery.autocomplete.js patch-package devbridge-autocomplete Note: The version line change is removed and the indentation (tabs vs spaces) is fixed, as it rather limits updatability, therefore the resulting javascript file format is slightly changed. No functional change. Resolves: #96334 Related: #92419 Related: #79938 Related: #70988 Related: #96323 Releases: main Change-Id: Ib8f9a79c3df1875e8a1606122f30e7d15bce06a9 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72626 Tested-by: core-ci <typo3@b13.com> Tested-by: Benni Mack <benni@typo3.org> Tested-by: Oliver Hader <oliver.hader@typo3.org> Reviewed-by: Benni Mack <benni@typo3.org> Reviewed-by: Oliver Hader <oliver.hader@typo3.org> --- Build/Gruntfile.js | 4 +--- Build/package.json | 2 +- .../devbridge-autocomplete+1.3.0.patch | 24 +++++++++++++++++++ Build/yarn.lock | 14 ++++------- .../JavaScript/Contrib/jquery.autocomplete.js | 16 ++++++------- 5 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 Build/patches/devbridge-autocomplete+1.3.0.patch diff --git a/Build/Gruntfile.js b/Build/Gruntfile.js index 23d8ea7c8040..575879a45d85 100644 --- a/Build/Gruntfile.js +++ b/Build/Gruntfile.js @@ -522,9 +522,7 @@ module.exports = function (grunt) { 'flatpickr/locales.js': 'flatpickr/dist/l10n/index.js', 'jquery.minicolors.js': '../node_modules/@claviska/jquery-minicolors/jquery.minicolors.min.js', '../../../../../backend/Resources/Public/Images/colorpicker/jquery.minicolors.png': '../node_modules/@claviska/jquery-minicolors/jquery.minicolors.png', - /* disabled until autocomplete formatGroup is fixed to pass on the index too - 'jquery.autocomplete.js': '../node_modules/devbridge-autocomplete/dist/jquery.autocomplete.min.js', - */ + 'jquery.autocomplete.js': '../node_modules/devbridge-autocomplete/dist/jquery.autocomplete.js', 'd3-dispatch.js': 'd3-dispatch/dist/d3-dispatch.min.js', 'd3-drag.js': 'd3-drag/dist/d3-drag.min.js', 'd3-selection.js': 'd3-selection/dist/d3-selection.min.js', diff --git a/Build/package.json b/Build/package.json index 0b1c3ce8b630..1baa5ac96f63 100644 --- a/Build/package.json +++ b/Build/package.json @@ -95,7 +95,7 @@ "d3-dispatch": "^2.0.0", "d3-drag": "^2.0.0", "d3-selection": "^2.0.0", - "devbridge-autocomplete": "^1.4.11", + "devbridge-autocomplete": "~1.3.0", "flatpickr": "^4.6.3", "font-awesome": "^4.7.0", "imagesloaded": "^4.1.4", diff --git a/Build/patches/devbridge-autocomplete+1.3.0.patch b/Build/patches/devbridge-autocomplete+1.3.0.patch new file mode 100644 index 000000000000..dcc30b9b9ce0 --- /dev/null +++ b/Build/patches/devbridge-autocomplete+1.3.0.patch @@ -0,0 +1,24 @@ +diff --git a/node_modules/devbridge-autocomplete/dist/jquery.autocomplete.js b/node_modules/devbridge-autocomplete/dist/jquery.autocomplete.js +index 74121fa..50d1494 100644 +--- a/node_modules/devbridge-autocomplete/dist/jquery.autocomplete.js ++++ b/node_modules/devbridge-autocomplete/dist/jquery.autocomplete.js +@@ -667,7 +667,8 @@ + beforeRender = options.beforeRender, + html = '', + category, +- formatGroup = function (suggestion, index) { ++ // modified for TYPO3, added index parameter ++ formatGroup = function (suggestion, value, index) { + var currentCategory = suggestion.data[groupBy]; + + if (category === currentCategory){ +@@ -676,7 +677,8 @@ + + category = currentCategory; + +- return options.formatGroup(suggestion, category); ++ // modified for TYPO3, added index parameter ++ return options.formatGroup(suggestion, category, index); + }; + + if (options.triggerSelectOnValidInput && that.isExactMatch(value)) { diff --git a/Build/yarn.lock b/Build/yarn.lock index 6f66203c915d..458db7240f1c 100644 --- a/Build/yarn.lock +++ b/Build/yarn.lock @@ -739,11 +739,6 @@ resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-2.0.47.tgz#9665a157519dd48d259f94ac670d332a56561c00" integrity sha512-5bidBzyNZ5euxwRjN0UsGsnmCXb6yuNAQkJceJ00Qq7uVLAZ442gJ2I0h56wGfRpIcZyY2wPV103Zq9IMnkjkg== -"@types/jquery@^2.0.32": - version "2.0.55" - resolved "https://registry.yarnpkg.com/@types/jquery/-/jquery-2.0.55.tgz#5a2984988952789faaffdd4baee11141d6bc999c" - integrity sha512-uYRE5OytoDlKznee3WPoXeyv3uMTYWHlAQMgn9esgFB5pC2uCyWe35wZYyCM51Cc3SeslXS9iilBqGwc/3QsDQ== - "@types/jqueryui@^1.12.13": version "1.12.13" resolved "https://registry.yarnpkg.com/@types/jqueryui/-/jqueryui-1.12.13.tgz#1aa0507b4d1a75b03592d2126fbd6d2ea8e8c284" @@ -2555,12 +2550,11 @@ detect-file@^1.0.0: resolved "https://registry.yarnpkg.com/detect-file/-/detect-file-1.0.0.tgz#f0d66d03672a825cb1b73bdb3fe62310c8e552b7" integrity sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc= -devbridge-autocomplete@^1.4.11: - version "1.4.11" - resolved "https://registry.yarnpkg.com/devbridge-autocomplete/-/devbridge-autocomplete-1.4.11.tgz#05424a675711a9c3ad118c98de0a22180944b00f" - integrity sha512-lRU1y9IKyPm45NKDMcujszJoftw+wqxKbtcNJoMx+LywJQJdDwjg/s4lwLYR4vyQQ6VTcUaIeveLMkZTqorBIA== +devbridge-autocomplete@~1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/devbridge-autocomplete/-/devbridge-autocomplete-1.3.0.tgz#9894a3d36e9b7406461c0ba8f21e648fbcffe16b" + integrity sha1-mJSj026bdAZGHAuo8h5kj7z/4Ws= dependencies: - "@types/jquery" "^2.0.32" jquery ">=1.7" dezalgo@^1.0.0: diff --git a/typo3/sysext/core/Resources/Public/JavaScript/Contrib/jquery.autocomplete.js b/typo3/sysext/core/Resources/Public/JavaScript/Contrib/jquery.autocomplete.js index 50d1494ee4a9..668075edff4d 100644 --- a/typo3/sysext/core/Resources/Public/JavaScript/Contrib/jquery.autocomplete.js +++ b/typo3/sysext/core/Resources/Public/JavaScript/Contrib/jquery.autocomplete.js @@ -1,5 +1,5 @@ /** -* Ajax Autocomplete for jQuery, version %version% +* Ajax Autocomplete for jQuery, version 1.3.0 * (c) 2017 Tomas Kirda * * Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license. @@ -132,7 +132,7 @@ if (!currentValue) { return suggestion.value; } - + var pattern = '(' + utils.escapeRegExChars(currentValue) + ')'; return suggestion.value @@ -230,7 +230,7 @@ onBlur: function () { this.enableKillerFn(); }, - + abortAjax: function () { var that = this; if (that.currentRequest) { @@ -359,8 +359,8 @@ that.stopKillSuggestions(); that.intervalId = window.setInterval(function () { if (that.visible) { - // No need to restore value when - // preserveInput === true, + // No need to restore value when + // preserveInput === true, // because we did not change it if (!that.options.preserveInput) { that.el.val(that.currentValue); @@ -368,7 +368,7 @@ that.hide(); } - + that.stopKillSuggestions(); }, 50); }, @@ -667,7 +667,7 @@ beforeRender = options.beforeRender, html = '', category, - // modified for TYPO3, added index parameter + // modified for TYPO3, added index parameter formatGroup = function (suggestion, value, index) { var currentCategory = suggestion.data[groupBy]; @@ -677,7 +677,7 @@ category = currentCategory; - // modified for TYPO3, added index parameter + // modified for TYPO3, added index parameter return options.formatGroup(suggestion, category, index); }; -- GitLab