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
#351 Inline editable enchancements #366
Conversation
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.
I think the changes to the change
event data and the addition of the value/enterValueText options warrant this being a 'minor' instead of a 'patch'.
It does fix several bugs but it's mainly enhancements
@@ -63,7 +63,7 @@ class InlineMorphSection extends MorphSection | |||
morphSection.detector = undefined | |||
morphSection.hide() | |||
@on 'hide', 'hx.morph-section', (data) -> | |||
exitEditMode.call(morphSection, data.toggle, data.content) | |||
exitEditMode?.call(morphSection, data.toggle, data.content) |
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.
So you don't have to pass it through as an empty function if you don't have an exit edit mode function
} | ||
|
||
.hx-inline-editable-no-value { | ||
font-style: italic; |
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.
Making it italic when no value has been entered is probably enough of a visual cue (along with the Enter Value
text) that the user should do something
|
||
value: (value) -> | ||
if value isnt undefined | ||
@textSelection.text(value) | ||
@emit('change', {api: false, value: value}) | ||
@emit('change', { cause: 'api', value: value }) |
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.
This was broken anyway (api was always passed as false) so I updated to the cause/value mentality.
Description
enterValueText
option to display when no value is entered (see screenshots)value
option (defaults toselection.text()
as previous)change
event - it was passing{api: false, value:<value>}
regardless of whether the value was set with the api or by the user (now uses standardchange/value
data)enter
to set the valueMotivation and Context
The initial scope of this was to resolve #351 but in the process of resolving it and adding tests I noticed a few other bugs
How Has This Been Tested?
Added tests for full coverage of the module, tested on the demo page example
Screenshots (if appropriate):
Checklist: