pf2e icon indicating copy to clipboard operation
pf2e copied to clipboard

(redeux) Generate Check Prompt Macro: Added button to copy to clipboard. Closes #13090

Open racehd opened this issue 10 months ago • 4 comments

  • Closes #13090

  • split into separate PR ~~(redeux) Generate Check Prompt Macro: Added default level to level-based DC's, based on average party level. #11664~~

    • ~~I did not like the idea of extra clicks to prefill the default value, so I went with the most common occurrence to use the party level as the default value automatically rather than have to push an extra button to do so. I believe this will be a better user experience than a separate level button.~~
    • ~~I think this can close the request, but that depends if you see value in the request for the option to have a button(s) for levels of creatures and hazards on the scene. Practically speaking I am not sure why you would be using a level based DC from Creature's/Hazards rather than the party level.~~

This is my first system contribution outside of data entry. Thanks!

racehd avatar Apr 17 '24 01:04 racehd

In my original PR i hadn't realized the <p> tags in the Post-to-chat functionality were wrapped around each occurrence of the check. I have returned the original formatting for posting-to-chat, and then for the clipboard functionality I have stripped the <p> tags for optimal copying/pasting.

racehd avatar Apr 17 '24 02:04 racehd

Thanks for making a PR.

Can you separate the default level bit into its own PR? I'm thinking we can merge that portion without any fuss, but the copy might need thinking.

Currently what comes to mind for the copy with regards to implementation is that perhaps instead of passing the action to the function, the private method could return the result and the event handlers can post the message / copy to clipboard. If this occurs, the private function might be #getPromptData() instead.

There's a thought I had regarding UX, but that can be saved for the future.

CarlosFdez avatar Apr 17 '24 04:04 CarlosFdez

Thanks for the feedback. I have done the following:

  • Split the default level into separate PR
  • Refactored the generatePrompt function into a getPromptData function, which then returns the flavor and content to the event handlers, and the event handlers handle the posting to chat or copying to clipboard. Thanks for this feedback, I had originally tried this but was initially unsure how to implement it since my javascript is quite rusty.

For the UX I did see that there is a clipboard icon used for the rule elements UI. I wasn't 100% sure how to implement that here, but if you think that would be better I could try that instead of localizing "Copy" button. Or did you have other UX feedback?

racehd avatar Apr 17 '24 11:04 racehd

Yay! Redeux did the thing! Thank you.

yorkshirelandscape avatar Jun 28 '24 01:06 yorkshirelandscape