Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Added read-only mode to the ImageTextAlternative. #124

Closed
wants to merge 4 commits into from
Closed

Conversation

oskarwrobel
Copy link
Contributor

@oskarwrobel oskarwrobel commented Jul 6, 2017

Suggested merge commit message (convention)

Feature: Added read-only mode to the ImageTextAlternative. Closes ckeditor/ckeditor5#5108.


Requires ckeditor/ckeditor5-ui#267.

@oskarwrobel oskarwrobel requested a review from oleq July 6, 2017 12:49

const panel = new ImageBalloonPanel( editor );
const form = new TextAlternativeFormView( editor.locale );

form.labeledInput.inputView.bind( 'isReadOnly' ).to( command, 'isEnabled', value => !value );
form.saveButtonView.bind( 'isEnabled' ).to( command );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it rather be form.bind( 'isEnabled' ).to( command ); and then, inside TextAlternativeFormView, isEnabled should be propagated among the inputs and buttons?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way the form will be re–usable with all its features. In your implementation, if you want to re–use the form, you got to repeat the code from the lines above each time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the form had 15 controls, this would become a DRY madness.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was my first thought too. I'll change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember why I didn't do it. Because LinkFormView is bind to two commands LinkCommand and UnlinkCommand. But image alt use only one command so can have a common TextAlternativeFormView#isEnabled state.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about it. TextAlternativeFormView is not a reusable view.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should create some generic FormView? This view might know its children and easily disable and enable it.

@oskarwrobel
Copy link
Contributor Author

I agree with https://github.com/ckeditor/ckeditor5-image/issues/123#issuecomment-313639614. Text alternative is not something that needs to be available in read-only mode. I'm for closing this PR.

@oleq oleq closed this Jul 12, 2017
@oleq oleq deleted the t/123 branch July 18, 2017 15:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Text alternative balloon should be displayed as read-only when command is disabled
2 participants