Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tagger feature for copy/paste order #367 #369

Closed
wants to merge 2 commits into from

Conversation

7r0u8l3
Copy link
Collaborator

@7r0u8l3 7r0u8l3 commented Jan 16, 2024

This script now includes a global array selectedOrder to track the order of selected tags. The toggleTag function has been modified to update this array when a tag is selected or deselected. The displaySelected function uses this array to display the tags in the order they were selected, ensuring that the selection order is consistent regardless of their DOM order.

The toggleTag function now considers both the title and the category of a tag when toggling its selection. The displaySelected function uses the updated selectedOrder array, which contains objects with title and category properties, to display the selected tags. The clear button event listener in the init function now resets the selectedOrder array when clearing the selection. This should ensure that tags with duplicate names in different categories are handled correctly, and their selection order is maintained as expected.

Instead of using querySelector with :contains, it iterates over all categories and checks their h2 text content to find the matching category. Once the correct category is found, it searches for the tag with the matching title within that category. This approach should resolve the error and correctly handle the selection and display of tags, even when they have duplicate names in different categories.

Each tag is identified by both its title and its category, allowing for proper handling of duplicate tag names in different categories. The selectedOrder array now stores objects with title and category properties. The displaySelected function has been updated to use this additional information when displaying selected tags. This approach should resolve the issue with duplicate tag names and ensure that tags are correctly identified and displayed based on both their title and category.

#367

Issue
Fixes #367

Description
Test URLs
Before (Changes from main): https://main--merative2--hlxsites.hlx.page/tools/tagger/index.html

After (Changes from this PR): https://tagger---feature-for-copy/paste-order-%23367--merative2--hlxsites.hlx.page/tools/tagger/index.html

Before (Changes from main): https://main--merative2--hlxsites.hlx.page/

After (Changes from this PR): https://tagger---feature-for-copy/paste-order-%23367--merative2--hlxsites.hlx.page/

…or proper handling of duplicate tag names in different categories.

The selectedOrder array now stores objects with title and category properties.
The displaySelected function has been updated to use this additional information when displaying selected tags.
Instead of using querySelector with :contains, it iterates over all categories and checks their h2 text content to find the matching category.
Once the correct category is found, it searches for the tag with the matching title within that category.
Copy link

aem-code-sync bot commented Jan 16, 2024

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch and validate page speed.
In case there are problems, just click a checkbox below to rerun the respective action.

  • Re-run PSI checks
  • Re-sync branch
Commits

@7r0u8l3 7r0u8l3 closed this Jan 16, 2024
@7r0u8l3
Copy link
Collaborator Author

7r0u8l3 commented Jan 16, 2024

Duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[tagger] Feature for copy/paste order
1 participant