From 3af0f029d236f64b6c4a323e8ec1a031cac802c7 Mon Sep 17 00:00:00 2001
From: rajputanuj31 <115709571+rajputanuj31@users.noreply.github.com>
Date: Wed, 8 Feb 2023 23:11:33 +0530
Subject: [PATCH 01/21] multiselect
---
.../components/browser/items/item.es6.js | 20 +++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js b/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
index 4f5d12e0ebea7..6d83e90ee09b3 100644
--- a/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
+++ b/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
@@ -148,13 +148,25 @@ export default {
}
// Handle clicks when the item was not selected
+ const startindex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.$store.state.selectedItems[0]);
+ const endindex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.item);
if (!this.isSelected()) {
- // Unselect all other selected items,
- // if the shift key was not pressed during the click event
- if (!(event.shiftKey || event.keyCode === 13)) {
+ if ((event.shiftKey || event.keyCode === 13)) {
+ if (startindex < endindex) {
+ for (let i = startindex; i <= endindex; i += 1) {
+ this.$store.commit(types.SELECT_BROWSER_ITEM, this.$store.getters.getSelectedDirectoryContents[i]);
+ }
+ } else {
+ for (let i = startindex; i >= endindex; i -= 1) {
+ this.$store.commit(types.SELECT_BROWSER_ITEM, this.$store.getters.getSelectedDirectoryContents[i]);
+ }
+ }
+ } else if ((event.ctrlKey || event.keyCode === 17)) {
+ this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
+ } else {
this.$store.commit(types.UNSELECT_ALL_BROWSER_ITEMS);
+ this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
}
- this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
return;
}
this.$store.dispatch('toggleBrowserItemSelect', this.item);
From 96f16ac35755b856a91105d5d46e7cdf80678f26 Mon Sep 17 00:00:00 2001
From: rajputanuj31 <115709571+rajputanuj31@users.noreply.github.com>
Date: Wed, 8 Feb 2023 23:48:22 +0530
Subject: [PATCH 02/21] Revert "Improving the consistency of the HTML models
(#39715)"
This reverts commit a8aa3efe1e965ab78cf17fd7a1567bd0e4d82cf4.
---
modules/mod_login/tmpl/default.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/mod_login/tmpl/default.php b/modules/mod_login/tmpl/default.php
index f84dc9c2cef6f..81e894bbcbbe0 100644
--- a/modules/mod_login/tmpl/default.php
+++ b/modules/mod_login/tmpl/default.php
@@ -67,8 +67,8 @@
-
-
From 981522f3daaf656bff769d7f9c642d35d6f40b68 Mon Sep 17 00:00:00 2001
From: rajputanuj31 <115709571+rajputanuj31@users.noreply.github.com>
Date: Thu, 9 Feb 2023 00:06:04 +0530
Subject: [PATCH 03/21] updates
---
.../components/com_media/src/Controller/ApiController.php | 2 +-
administrator/components/com_menus/src/Model/MenusModel.php | 2 +-
libraries/src/Cache/CacheStorage.php | 2 +-
libraries/src/Filesystem/File.php | 2 +-
libraries/src/Form/Field/ModuleorderField.php | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/administrator/components/com_media/src/Controller/ApiController.php b/administrator/components/com_media/src/Controller/ApiController.php
index 13a46436459ba..46497ab5a4266 100644
--- a/administrator/components/com_media/src/Controller/ApiController.php
+++ b/administrator/components/com_media/src/Controller/ApiController.php
@@ -202,7 +202,7 @@ public function postFiles()
// A file needs to be created
$name = $this->getModel()->createFile($adapter, $name, $path, $mediaContent, $override);
} else {
- // A folder needs to be created
+ // A file needs to be created
$name = $this->getModel()->createFolder($adapter, $name, $path, $override);
}
diff --git a/administrator/components/com_menus/src/Model/MenusModel.php b/administrator/components/com_menus/src/Model/MenusModel.php
index 89c01cc618d34..fff53351d3517 100644
--- a/administrator/components/com_menus/src/Model/MenusModel.php
+++ b/administrator/components/com_menus/src/Model/MenusModel.php
@@ -268,7 +268,7 @@ public function &getModules()
*
* @return array
*
- * @since 4.2.0
+ * @since _DEPLOY_VERSION__
*/
public function getMissingModuleLanguages(): array
{
diff --git a/libraries/src/Cache/CacheStorage.php b/libraries/src/Cache/CacheStorage.php
index 32e5647634c86..581f714c8115b 100644
--- a/libraries/src/Cache/CacheStorage.php
+++ b/libraries/src/Cache/CacheStorage.php
@@ -100,7 +100,7 @@ public function __construct($options = [])
{
$app = Factory::getApplication();
- $this->_hash = md5($app->get('secret', ''));
+ $this->_hash = md5($app->get('secret'));
$this->_application = $options['application'] ?? md5(JPATH_CONFIGURATION);
$this->_language = $options['language'] ?? 'en-GB';
$this->_locking = $options['locking'] ?? true;
diff --git a/libraries/src/Filesystem/File.php b/libraries/src/Filesystem/File.php
index c9aa02ec07ca9..f861021ab03d8 100644
--- a/libraries/src/Filesystem/File.php
+++ b/libraries/src/Filesystem/File.php
@@ -122,7 +122,7 @@ public static function copy($src, $dest, $path = null, $useStreams = false)
// Check src path
if (!is_readable($src)) {
- Log::add(Text::sprintf('JLIB_FILESYSTEM_ERROR_FILE_FIND_COPY', __METHOD__, $src), Log::WARNING, 'jerror');
+ Log::add(Text::sprintf('LIB_FILESYSTEM_ERROR_JFILE_FIND_COPY', __METHOD__, $src), Log::WARNING, 'jerror');
return false;
}
diff --git a/libraries/src/Form/Field/ModuleorderField.php b/libraries/src/Form/Field/ModuleorderField.php
index 4b12ec6c2a989..bb5aebc0b594a 100644
--- a/libraries/src/Form/Field/ModuleorderField.php
+++ b/libraries/src/Form/Field/ModuleorderField.php
@@ -43,7 +43,7 @@ class ModuleorderField extends FormField
* The linked property
*
* @var string
- * @since 4.2.7
+ * @since __DEPLOY_VERSION_
*/
protected $linked;
From 869b1683f92d9e8a867fef29fe97e60c5d4a5bf6 Mon Sep 17 00:00:00 2001
From: rajputanuj31 <115709571+rajputanuj31@users.noreply.github.com>
Date: Thu, 9 Feb 2023 00:30:47 +0530
Subject: [PATCH 04/21] updates
---
.../scripts/components/browser/table/row.vue | 20 +++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/administrator/components/com_media/resources/scripts/components/browser/table/row.vue b/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
index d5cc15c1df5d1..052de559840ec 100644
--- a/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
+++ b/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
@@ -125,13 +125,25 @@ export default {
}
// Handle clicks when the item was not selected
+ const startindex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.$store.state.selectedItems[0]);
+ const endindex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.item);
if (!this.isSelected()) {
- // Unselect all other selected items,
- // if the shift key was not pressed during the click event
- if (!(event.shiftKey || event.keyCode === 13)) {
+ if ((event.shiftKey || event.keyCode === 13)) {
+ if (startindex < endindex) {
+ for (let i = startindex; i <= endindex; i += 1) {
+ this.$store.commit(types.SELECT_BROWSER_ITEM, this.$store.getters.getSelectedDirectoryContents[i]);
+ }
+ } else {
+ for (let i = startindex; i >= endindex; i -= 1) {
+ this.$store.commit(types.SELECT_BROWSER_ITEM, this.$store.getters.getSelectedDirectoryContents[i]);
+ }
+ }
+ } else if ((event.ctrlKey || event.keyCode === 17)) {
+ this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
+ } else {
this.$store.commit(types.UNSELECT_ALL_BROWSER_ITEMS);
+ this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
}
- this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
return;
}
From a9012143379ef6fcd3c32e9467411c320a665aad Mon Sep 17 00:00:00 2001
From: rajputanuj31 <115709571+rajputanuj31@users.noreply.github.com>
Date: Thu, 9 Feb 2023 17:51:28 +0530
Subject: [PATCH 05/21] updates
---
.../scripts/components/browser/items/item.es6.js | 16 +++++++---------
.../scripts/components/browser/table/row.vue | 16 +++++++---------
2 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js b/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
index 6d83e90ee09b3..e91f7cd8f3a2e 100644
--- a/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
+++ b/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
@@ -148,18 +148,16 @@ export default {
}
// Handle clicks when the item was not selected
- const startindex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.$store.state.selectedItems[0]);
- const endindex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.item);
if (!this.isSelected()) {
if ((event.shiftKey || event.keyCode === 13)) {
- if (startindex < endindex) {
- for (let i = startindex; i <= endindex; i += 1) {
- this.$store.commit(types.SELECT_BROWSER_ITEM, this.$store.getters.getSelectedDirectoryContents[i]);
- }
+ const currentIndex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.$store.state.selectedItems[0]);
+ const endindex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.item);
+ if (currentIndex < endindex) {
+ this.$store.getters.getSelectedDirectoryContents.slice(currentIndex, endindex + 1)
+ .forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
} else {
- for (let i = startindex; i >= endindex; i -= 1) {
- this.$store.commit(types.SELECT_BROWSER_ITEM, this.$store.getters.getSelectedDirectoryContents[i]);
- }
+ this.$store.getters.getSelectedDirectoryContents.slice(endindex, currentIndex)
+ .forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
}
} else if ((event.ctrlKey || event.keyCode === 17)) {
this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
diff --git a/administrator/components/com_media/resources/scripts/components/browser/table/row.vue b/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
index 052de559840ec..2fd377d4ae748 100644
--- a/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
+++ b/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
@@ -125,18 +125,16 @@ export default {
}
// Handle clicks when the item was not selected
- const startindex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.$store.state.selectedItems[0]);
- const endindex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.item);
if (!this.isSelected()) {
if ((event.shiftKey || event.keyCode === 13)) {
- if (startindex < endindex) {
- for (let i = startindex; i <= endindex; i += 1) {
- this.$store.commit(types.SELECT_BROWSER_ITEM, this.$store.getters.getSelectedDirectoryContents[i]);
- }
+ const currentIndex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.$store.state.selectedItems[0]);
+ const endindex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.item);
+ if (currentIndex < endindex) {
+ this.$store.getters.getSelectedDirectoryContents.slice(currentIndex, endindex + 1)
+ .forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
} else {
- for (let i = startindex; i >= endindex; i -= 1) {
- this.$store.commit(types.SELECT_BROWSER_ITEM, this.$store.getters.getSelectedDirectoryContents[i]);
- }
+ this.$store.getters.getSelectedDirectoryContents.slice(endindex, currentIndex)
+ .forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
}
} else if ((event.ctrlKey || event.keyCode === 17)) {
this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
From 52e7d7dad942e7c7ea2ca57f5f09b7ac148cd331 Mon Sep 17 00:00:00 2001
From: rajputanuj31 <115709571+rajputanuj31@users.noreply.github.com>
Date: Thu, 9 Feb 2023 18:40:37 +0530
Subject: [PATCH 06/21] updates
---
.../resources/scripts/components/browser/items/item.es6.js | 2 +-
.../resources/scripts/components/browser/table/row.vue | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js b/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
index e91f7cd8f3a2e..4ee77441b1e9f 100644
--- a/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
+++ b/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
@@ -159,7 +159,7 @@ export default {
this.$store.getters.getSelectedDirectoryContents.slice(endindex, currentIndex)
.forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
}
- } else if ((event.ctrlKey || event.keyCode === 17)) {
+ } else if ((event[/Mac|Mac OS|MacIntel/gi.test(window.navigator.userAgent) ? 'metaKey ' : 'ctrlKey'] || event.keyCode === 17)) {
this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
} else {
this.$store.commit(types.UNSELECT_ALL_BROWSER_ITEMS);
diff --git a/administrator/components/com_media/resources/scripts/components/browser/table/row.vue b/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
index 2fd377d4ae748..093b07d4b5229 100644
--- a/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
+++ b/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
@@ -136,7 +136,7 @@ export default {
this.$store.getters.getSelectedDirectoryContents.slice(endindex, currentIndex)
.forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
}
- } else if ((event.ctrlKey || event.keyCode === 17)) {
+ } else if ((event[/Mac|Mac OS|MacIntel/gi.test(window.navigator.userAgent) ? 'metaKey ' : 'ctrlKey'] || event.keyCode === 17)) {
this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
} else {
this.$store.commit(types.UNSELECT_ALL_BROWSER_ITEMS);
From cabe3ccee60e199ad3777d04c35f3cdf8705ffd7 Mon Sep 17 00:00:00 2001
From: rajputanuj31 <115709571+rajputanuj31@users.noreply.github.com>
Date: Fri, 10 Feb 2023 14:07:34 +0530
Subject: [PATCH 07/21] comments updated
---
.../scripts/components/browser/items/item.es6.js | 8 ++++++--
.../resources/scripts/components/browser/table/row.vue | 8 ++++++--
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js b/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
index 4ee77441b1e9f..4b112681d7b65 100644
--- a/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
+++ b/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
@@ -149,17 +149,21 @@ export default {
// Handle clicks when the item was not selected
if (!this.isSelected()) {
- if ((event.shiftKey || event.keyCode === 13)) {
+ // Handle clicks when shift key was pressed
+ if (event.shiftKey || event.keyCode === 13) {
const currentIndex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.$store.state.selectedItems[0]);
const endindex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.item);
+ // Handle selections from up to down
if (currentIndex < endindex) {
this.$store.getters.getSelectedDirectoryContents.slice(currentIndex, endindex + 1)
.forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
+ // Handle selections from down to up
} else {
this.$store.getters.getSelectedDirectoryContents.slice(endindex, currentIndex)
.forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
}
- } else if ((event[/Mac|Mac OS|MacIntel/gi.test(window.navigator.userAgent) ? 'metaKey ' : 'ctrlKey'] || event.keyCode === 17)) {
+ // Handle clicks when shift key was pressed
+ } else if (event[/Mac|Mac OS|MacIntel/gi.test(window.navigator.userAgent) ? 'metaKey ' : 'ctrlKey'] || event.keyCode === 17) {
this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
} else {
this.$store.commit(types.UNSELECT_ALL_BROWSER_ITEMS);
diff --git a/administrator/components/com_media/resources/scripts/components/browser/table/row.vue b/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
index 093b07d4b5229..09a4e757a9cc9 100644
--- a/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
+++ b/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
@@ -126,17 +126,21 @@ export default {
// Handle clicks when the item was not selected
if (!this.isSelected()) {
- if ((event.shiftKey || event.keyCode === 13)) {
+ // Handle clicks when shift key was pressed
+ if (event.shiftKey || event.keyCode === 13) {
const currentIndex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.$store.state.selectedItems[0]);
const endindex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.item);
+ // Handle selections from up to down
if (currentIndex < endindex) {
this.$store.getters.getSelectedDirectoryContents.slice(currentIndex, endindex + 1)
.forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
+ // Handle selections from down to up
} else {
this.$store.getters.getSelectedDirectoryContents.slice(endindex, currentIndex)
.forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
}
- } else if ((event[/Mac|Mac OS|MacIntel/gi.test(window.navigator.userAgent) ? 'metaKey ' : 'ctrlKey'] || event.keyCode === 17)) {
+ // Handle clicks when shift key was pressed
+ } else if (event[/Mac|Mac OS|MacIntel/gi.test(window.navigator.userAgent) ? 'metaKey ' : 'ctrlKey'] || event.keyCode === 17) {
this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
} else {
this.$store.commit(types.UNSELECT_ALL_BROWSER_ITEMS);
From e4a509f253671a49499ceecae74e735a38ba641c Mon Sep 17 00:00:00 2001
From: rajputanuj31 <115709571+rajputanuj31@users.noreply.github.com>
Date: Fri, 10 Feb 2023 14:47:36 +0530
Subject: [PATCH 08/21] fixed a typo in comments
---
.../resources/scripts/components/browser/items/item.es6.js | 2 +-
.../resources/scripts/components/browser/table/row.vue | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js b/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
index 4b112681d7b65..08c842d806a75 100644
--- a/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
+++ b/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
@@ -162,7 +162,7 @@ export default {
this.$store.getters.getSelectedDirectoryContents.slice(endindex, currentIndex)
.forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
}
- // Handle clicks when shift key was pressed
+ // Handle clicks when ctrl key was pressed
} else if (event[/Mac|Mac OS|MacIntel/gi.test(window.navigator.userAgent) ? 'metaKey ' : 'ctrlKey'] || event.keyCode === 17) {
this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
} else {
diff --git a/administrator/components/com_media/resources/scripts/components/browser/table/row.vue b/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
index 09a4e757a9cc9..d178d3a3a98d6 100644
--- a/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
+++ b/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
@@ -139,7 +139,7 @@ export default {
this.$store.getters.getSelectedDirectoryContents.slice(endindex, currentIndex)
.forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
}
- // Handle clicks when shift key was pressed
+ // Handle clicks when ctrl key was pressed
} else if (event[/Mac|Mac OS|MacIntel/gi.test(window.navigator.userAgent) ? 'metaKey ' : 'ctrlKey'] || event.keyCode === 17) {
this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
} else {
From 005b0d66c22d32be522081167351a9fe190f717e Mon Sep 17 00:00:00 2001
From: rajputanuj31 <115709571+rajputanuj31@users.noreply.github.com>
Date: Fri, 10 Feb 2023 18:52:04 +0530
Subject: [PATCH 09/21] updates
---
.../resources/scripts/components/browser/browser.vue | 1 +
.../scripts/components/browser/items/item.es6.js | 12 ++++++++----
.../scripts/components/browser/table/row.vue | 12 ++++++++----
.../scripts/components/browser/table/table.vue | 1 +
4 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/administrator/components/com_media/resources/scripts/components/browser/browser.vue b/administrator/components/com_media/resources/scripts/components/browser/browser.vue
index b8bd44e5b9c91..0a04abb226886 100644
--- a/administrator/components/com_media/resources/scripts/components/browser/browser.vue
+++ b/administrator/components/com_media/resources/scripts/components/browser/browser.vue
@@ -45,6 +45,7 @@
v-for="item in localItems"
:key="item.path"
:item="item"
+ :localItems="localItems"
/>
diff --git a/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js b/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
index 08c842d806a75..492f4d48931fc 100644
--- a/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
+++ b/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
@@ -14,6 +14,10 @@ export default {
type: Object,
default: () => {},
},
+ localItems: {
+ type: Array,
+ default: () => [],
+ },
},
data() {
return {
@@ -151,15 +155,15 @@ export default {
if (!this.isSelected()) {
// Handle clicks when shift key was pressed
if (event.shiftKey || event.keyCode === 13) {
- const currentIndex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.$store.state.selectedItems[0]);
- const endindex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.item);
+ const currentIndex = this.localItems.indexOf(this.$store.state.selectedItems[0]);
+ const endindex = this.localItems.indexOf(this.item);
// Handle selections from up to down
if (currentIndex < endindex) {
- this.$store.getters.getSelectedDirectoryContents.slice(currentIndex, endindex + 1)
+ this.localItems.slice(currentIndex, endindex + 1)
.forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
// Handle selections from down to up
} else {
- this.$store.getters.getSelectedDirectoryContents.slice(endindex, currentIndex)
+ this.localItems.slice(endindex, currentIndex)
.forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
}
// Handle clicks when ctrl key was pressed
diff --git a/administrator/components/com_media/resources/scripts/components/browser/table/row.vue b/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
index d178d3a3a98d6..593e547daa0f8 100644
--- a/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
+++ b/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
@@ -42,6 +42,10 @@ export default {
type: Object,
default: () => {},
},
+ localItems: {
+ type: Array,
+ default: () => [],
+ },
},
computed: {
/* The dimension of a file */
@@ -128,15 +132,15 @@ export default {
if (!this.isSelected()) {
// Handle clicks when shift key was pressed
if (event.shiftKey || event.keyCode === 13) {
- const currentIndex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.$store.state.selectedItems[0]);
- const endindex = this.$store.getters.getSelectedDirectoryContents.indexOf(this.item);
+ const currentIndex = this.localItems.indexOf(this.$store.state.selectedItems[0]);
+ const endindex = this.localItems.indexOf(this.item);
// Handle selections from up to down
if (currentIndex < endindex) {
- this.$store.getters.getSelectedDirectoryContents.slice(currentIndex, endindex + 1)
+ this.localItems.slice(currentIndex, endindex + 1)
.forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
// Handle selections from down to up
} else {
- this.$store.getters.getSelectedDirectoryContents.slice(endindex, currentIndex)
+ this.localItems.slice(endindex, currentIndex)
.forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
}
// Handle clicks when ctrl key was pressed
diff --git a/administrator/components/com_media/resources/scripts/components/browser/table/table.vue b/administrator/components/com_media/resources/scripts/components/browser/table/table.vue
index 1b194f637a013..457014518ac22 100644
--- a/administrator/components/com_media/resources/scripts/components/browser/table/table.vue
+++ b/administrator/components/com_media/resources/scripts/components/browser/table/table.vue
@@ -116,6 +116,7 @@
v-for="item in localItems"
:key="item.path"
:item="item"
+ :local-items="localItems"
/>
From 831630af01585000898c8cc1c4f21d756619e191 Mon Sep 17 00:00:00 2001
From: rajputanuj31 <115709571+rajputanuj31@users.noreply.github.com>
Date: Fri, 10 Feb 2023 19:34:56 +0530
Subject: [PATCH 10/21] updates
---
.../components/browser/items/item.es6.js | 70 +----------------
.../scripts/components/browser/table/row.vue | 61 +--------------
.../components/browser/utils/utils.es6.js | 75 +++++++++++++++++++
3 files changed, 81 insertions(+), 125 deletions(-)
create mode 100644 administrator/components/com_media/resources/scripts/components/browser/utils/utils.es6.js
diff --git a/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js b/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
index 492f4d48931fc..6a041ca1eaf59 100644
--- a/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
+++ b/administrator/components/com_media/resources/scripts/components/browser/items/item.es6.js
@@ -7,6 +7,7 @@ import Audio from './audio.vue';
import Doc from './document.vue';
import * as types from '../../../store/mutation-types.es6';
import api from '../../../app/Api.es6';
+import { onItemClick } from '../utils/utils.es6.js';
export default {
props: {
@@ -123,73 +124,8 @@ export default {
* Handle the click event
* @param event
*/
- handleClick(event) {
- if (this.item.path && this.item.type === 'file') {
- window.parent.document.dispatchEvent(
- new CustomEvent('onMediaFileSelected', {
- bubbles: true,
- cancelable: false,
- detail: {
- path: this.item.path,
- thumb: this.item.thumb,
- fileType: this.item.mime_type ? this.item.mime_type : false,
- extension: this.item.extension ? this.item.extension : false,
- width: this.item.width ? this.item.width : 0,
- height: this.item.height ? this.item.height : 0,
- },
- }),
- );
- }
-
- if (this.item.type === 'dir') {
- window.parent.document.dispatchEvent(
- new CustomEvent('onMediaFileSelected', {
- bubbles: true,
- cancelable: false,
- detail: {},
- }),
- );
- }
-
- // Handle clicks when the item was not selected
- if (!this.isSelected()) {
- // Handle clicks when shift key was pressed
- if (event.shiftKey || event.keyCode === 13) {
- const currentIndex = this.localItems.indexOf(this.$store.state.selectedItems[0]);
- const endindex = this.localItems.indexOf(this.item);
- // Handle selections from up to down
- if (currentIndex < endindex) {
- this.localItems.slice(currentIndex, endindex + 1)
- .forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
- // Handle selections from down to up
- } else {
- this.localItems.slice(endindex, currentIndex)
- .forEach((element) => this.$store.commit(types.SELECT_BROWSER_ITEM, element));
- }
- // Handle clicks when ctrl key was pressed
- } else if (event[/Mac|Mac OS|MacIntel/gi.test(window.navigator.userAgent) ? 'metaKey ' : 'ctrlKey'] || event.keyCode === 17) {
- this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
- } else {
- this.$store.commit(types.UNSELECT_ALL_BROWSER_ITEMS);
- this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
- }
- return;
- }
- this.$store.dispatch('toggleBrowserItemSelect', this.item);
- window.parent.document.dispatchEvent(
- new CustomEvent('onMediaFileSelected', {
- bubbles: true,
- cancelable: false,
- detail: {},
- }),
- );
-
- // If more than one item was selected and the user clicks again on the selected item,
- // he most probably wants to unselect all other items.
- if (this.$store.state.selectedItems.length > 1) {
- this.$store.commit(types.UNSELECT_ALL_BROWSER_ITEMS);
- this.$store.commit(types.SELECT_BROWSER_ITEM, this.item);
- }
+ handleClick(event, item) {
+ return onItemClick(event, item);
},
/**
diff --git a/administrator/components/com_media/resources/scripts/components/browser/table/row.vue b/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
index 593e547daa0f8..3c4f30ae6250b 100644
--- a/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
+++ b/administrator/components/com_media/resources/scripts/components/browser/table/row.vue
@@ -33,6 +33,7 @@