shepherd icon indicating copy to clipboard operation
shepherd copied to clipboard

feature: add support for multiple elements highlight

Open IArny opened this issue 3 years ago • 15 comments

I would propose feature to support multiple elements highlight. All elements selected with attachTo.element will be highlighted if attachTo.multiple is true. I added multiple flag to attachTo field to keep old behavior. I'd appreciate your feedback for this PR.

Also this PR can resolve https://github.com/shipshapecode/shepherd/issues/525 issue

IArny avatar Sep 30 '22 06:09 IArny

This will be a life-saver for me! Thanks

Krumil avatar Oct 04 '22 10:10 Krumil

@IArny would you be able to rebase and fix conflicts please? Thanks!

RobbieTheWagner avatar Oct 22 '22 00:10 RobbieTheWagner

@IArny I'm so sorry, but it looks like we have conflicts again. Could you rebase one more time please?

RobbieTheWagner avatar Nov 04 '22 13:11 RobbieTheWagner

@rwwagner90 I've fixed conflicts and tests, could you check it agait, please

IArny avatar Jan 11 '23 09:01 IArny

@rwwagner90 Could you review my PR, please

IArny avatar Jan 30 '23 04:01 IArny

Hey, is anyone here? Would appreciate this to be merged to master @rwwagner90

IArny avatar Feb 10 '23 05:02 IArny

@IArny apologies, I have not had a chance to review this yet.

RobbieTheWagner avatar Feb 24 '23 19:02 RobbieTheWagner

@IArny I finally got a chance to take a look at this. I think it might make more sense to have attachTo be an array of objects with {element, on} like it currently is, just would accept an array instead of just a single element. If we wanted to keep the old API as well, we could use something like isArray to check if the option passed is an array, etc. What do you think?

RobbieTheWagner avatar Feb 26 '23 00:02 RobbieTheWagner

@RobbieTheWagner thanks for review, I think that attachTo as an array would be useful feature, but we can leave current implementation as an option too. Maybe you can merge current PR and I will make attachTo as an array in next PR? A bit difficult to support this PR as it contains some linting updates.

IArny avatar Feb 26 '23 04:02 IArny

@IArny I don't think we should merge this PR, unfortunately. I think basically we should do:

if(Array.isArray(attachTo) {
  // loop through the attachTo options and do all the attachTo things
} else {
// Just do what we already do when it's a single element
}

I do not like that your implementation requires a root element selector and selects all elements under it when you pass multiple. I would rather be explicit about all the elements you want highlighted.

RobbieTheWagner avatar Feb 28 '23 21:02 RobbieTheWagner

This will be much a nice feature ! I guess the Array approach enables the option to place the Pop-up relative to an element but also hightlight another one:

attachTo: [ {element: '.main-highlight', on: 'left'}, {element: '.secondary-highlight'}, ]

juanitoddd avatar Aug 23 '23 11:08 juanitoddd

So it looks like this is almost ready for release? Is that the case?

500Foods avatar Nov 13 '23 20:11 500Foods

Are we gonna see this change on release any soon?

davidperezvw avatar Jan 31 '24 14:01 davidperezvw

Lots of repo activity! Is this in the works now?

500Foods avatar Mar 28 '24 07:03 500Foods

@IArny I don't think we should merge this PR, unfortunately. I think basically we should do:

if(Array.isArray(attachTo) {
  // loop through the attachTo options and do all the attachTo things
} else {
// Just do what we already do when it's a single element
}

I do not like that your implementation requires a root element selector and selects all elements under it when you pass multiple. I would rather be explicit about all the elements you want highlighted.

This was the last place we left off. This is not planned currently, but if someone wanted to spike it out, we would definitely accept PRs!

RobbieTheWagner avatar Mar 29 '24 11:03 RobbieTheWagner