-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Media: Implement WIP advanced image settings dialog #2085
Conversation
EditorMediaAdvanced.defaultProps = { | ||
visible: false, | ||
toggleVisible: () => {} | ||
}; |
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 put these here when we are already using destructuring in the function declaration?
function EditorMediaAdvanced( { visible = false, toggleVisible = noop } ) {
…
}
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 put these here when we are already using destructuring in the function declaration?
You know, that's an interesting question. One has to wonder why defaultProps
was one of the two properties that the React team chose to support for stateless functional components. Perhaps there's some semantics of defaultProps
that wouldn't be reflected with the destructured default values? I couldn't find much discussion on the topic, though this commenter appears to prefer default arguments from a function purity perspective. On the flip-side, it does make the function declaration line a bit longer.
Do you have a strong preference either way? I'm inclined to keep it as is, mostly for aesthetics to this last point and for proximity to the propTypes
declaration for quick scanning. Additionally, it may be that this is easier for static analysis if we choose to pursue some automated documentation of components.
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.
Do you have a strong preference either way?
not at all 😄
👍
👍 |
e35c6dd
to
493e88b
Compare
Media: Implement WIP advanced image settings dialog
Related: #307
This pull request seeks to implement a minimal set of behavior related to advanced image settings editing. Specifically, the changes included add a new TinyMCE toolbar button to be shown in the inline toolbar for images which, when clicked, toggles the display of a
<Dialog />
component, currently rendered with dummy content.Implementation notes:
I fully expect the structure of the Redux state and
<EditorMediaAdvanced />
component to need extensive revisions as this functionality is built, thus the lack of proper documentation and testing. That said, feel free to comment on the proposed structure as-is.Testing instructions:
Confirm that the included behavior is only shown in development environments by temporarily setting
post-editor/media-advanced
tofalse
inconfig/development.json
and restartingmake run
.post-editor/media-advanced
istrue
, an "Edit" icon is shown in the inline toolbarpost-editor/media-advanced
isfalse
, an "Edit" icon is not shown in the inline toolbar and there are no errors in the developer tools console