-
-
Notifications
You must be signed in to change notification settings - Fork 176
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
Optionally provide innerHtml and textContent on StimulusReflex::Element #517
Optionally provide innerHtml and textContent on StimulusReflex::Element #517
Conversation
20c84a5
to
d916662
Compare
This is really exciting! 🦖 |
a93880e
to
91055bc
Compare
This is so useful @julianrubisch ! The note-taking feature I'm working on has |
8539540
to
8fe3cbb
Compare
We'll have to hold this back a bit, I might have found a bug around checkbox list values not being pulled correctly from attrs |
c595fe5
to
09b9c98
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if you call a succession of selector/nothing Reflexes, using the same instance of an SR controller, and the dataset/selectors change between invocations?
hmmm so all I can say is this mimicks behavior as it was before. I was seeing errors because I was pulling attrs of In other words: the state of Now we're back to "as before" |
That's a great answer, thank-you. With that insight in mind, I amend my review to LGTM. Each |
Exactly! |
This looks great. I propose that we make the data attributes more explicit to match the stimulate args. Even though it's annoyingly verbose.
|
* GitBook: [master] 18 pages modified * GitBook: [master] 18 pages modified * Update Changelog * GitBook: [master] one page modified * GitBook: [master] one page modified * refactor stream_name (stimulusreflex#519) * Add localization example to ApplicationReflex template (stimulusreflex#521) * connection_identifier needs to return a non-empty value * Update Changelog * Fix two minor typos (stimulusreflex#526) * chore: add sideEffects false to make Webpack happy (stimulusreflex#523) * Update Changelog * Schema object with getters (stimulusreflex#505) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Erlingur Þorsteinsson <erlingur@erlingur.is> Co-authored-by: Julian Rubisch <julian@julianrubisch.at> Co-authored-by: Konnor Rogers <konnor5456@gmail.com>
Enhancement
Description
This PR allows to optionally transmit the
reflexElement
'sinnerHTML
and/ortextContent
when calling a reflex.This can be done:
includeInnerHTML: true
orincludeTextContent: true
as an option tothis.stimulate
OR
data-reflex-include-html
ordata-reflex-include-text
on the reflex HTML elementThis PR also includes a refactoring of client-side reflexData handling into its own class, analog to the Ruby side, along with tests.
Why should this be added
This PR is inspired by working with contenteditable divs (i.e., a "Notion"-like interface).
Prior to this, you would have to put the innerHTML into a data attribute manually like this:
and I figured this should be taken care of at the framework level.
Checklist
Please note that the best way to suggest changes or updates to the documentation is to join Discord and leave a note in the #docs channel. Any documentation updates posted as PRs cannot be accepted at this time. ❤️