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

T/77 Image captions in the view are hidden instead of being removed #81

Merged
merged 9 commits into from
Mar 30, 2017

Conversation

szymonkups
Copy link
Contributor

@szymonkups szymonkups commented Mar 23, 2017

Suggested merge commit message (convention)

Fix: Image captions in the view are hidden instead of being removed. Closes ckeditor/ckeditor5#5080 .


Additional information

Please close #74 before.

}
// Hide last selected caption if have no child elements.
if ( this._lastSelectedCaption && !this._lastSelectedCaption.childCount ) {
this._lastSelectedCaption.addClass( 'ck-editable_hidden' );
Copy link
Member

Choose a reason for hiding this comment

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

We have .ck-hidden class for this kind of things.

@@ -246,20 +169,16 @@ function captionModelToView( elementCreator ) {
elementCreator.clone( true ) :
elementCreator();

// Hide if empty.
if ( !captionElement.childCount ) {
viewCaption.addClass( 'ck-editable_hidden' );
Copy link
Member

Choose a reason for hiding this comment

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

We have .ck-hidden class for this kind of things.

@Reinmar Reinmar requested a review from scofalik March 28, 2017 14:15
@Reinmar
Copy link
Member

Reinmar commented Mar 28, 2017

I asked @scofalik to check this PR.

if ( isImage( captionElement.parent ) && ( captionElement.childCount > 0 ) ) {
// Return if element shouldn't be present when empty.
if ( !captionElement.childCount && !hide ) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better if this part of code is in if ( isImage( ... ) ) { ... } so it won't ever affect other converters if we have different type of captions.

Copy link
Contributor

Choose a reason for hiding this comment

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

On the other hand it won't affect other converters because it does not consume anything, but I was also thinking whether the caption should not be consumed in this case 🤔 . Since we are not consuming, the code could stay here.

@scofalik
Copy link
Contributor

I'd like to see one improvement introduced here (unless there is already ticket for this and you plan to work on it). Right now, when content is inserted into the caption, the caption does not show. The content could come from OT, for example.

@scofalik scofalik merged commit aae2957 into master Mar 30, 2017
@scofalik scofalik deleted the t/77 branch March 30, 2017 07:02
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.

Yet another caption+undo bug: mapping empty caption.
4 participants