-
-
Notifications
You must be signed in to change notification settings - Fork 295
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
fix: resolve caption state handling and CSS issues #278
base: master
Are you sure you want to change the base?
Conversation
src/index.ts
Outdated
|
||
// reset caption on toggle | ||
if (tuneName === 'caption' && !this._data[tuneName]) { | ||
if (tuneName === 'caption' && !this.ui.isTuneActive(tuneName)) { |
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.
why we depend on style instead of actual data state?
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.
The reason why I considered style because the way caption
in features needs to be interpreted as boolean
while its a string, leading to the inconsistency in maintaining the tune
state (On successive enable/disable while resetting the caption). This doesn't feel like a a permanent fix.
So I took a step back and thought of introducing a withCaption
field which is of type boolean
like other tune values which are very consistent with tune state.
I also tried to turn the field caption
into an object:
{
state: boolean,
value: string,
}
But introducing a complex structure compared to a straight forward boolean
seems unnecessary.
@@ -135,6 +135,7 @@ This Tool returns `data` with following format | |||
| -------------- | --------- | ------------------------------- | | |||
| file | `object` | Uploaded file data. Any data got from backend uploader. Always contain the `url` property | | |||
| caption | `string` | image's caption | | |||
| withCaption | `boolean` | add caption to image | |
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 it's redundant property since we already have "caption" field that can be empty.
Developer can disable caption for all image blocks using tool config. It should not affect output data
Problem
caption
feature in the Image Tool wasn't properly reflecting the correct state when preloaded data contained a caption.select an image
button was hidden inuploading
state causing a bad UX if user doesn't select any file.Solution
this._data
values.display
property, relying onvisibility
fixed the problem.display: none
duringuploading
state.