Skip to content
Permalink
Browse files

Image2 link dialog integration will now hide display text field if ne…

…cessary.
  • Loading branch information...
mlewand committed Aug 25, 2016
1 parent 4ba96ff commit f94651ab1ab5f80635ea094f24148e6c65a272fe
Showing with 39 additions and 3 deletions.
  1. +11 −3 plugins/image2/plugin.js
  2. +7 −0 tests/plugins/image2/manual/link.html
  3. +21 −0 tests/plugins/image2/manual/link.md
@@ -1428,14 +1428,22 @@
onOk = def.onOk;

def.onShow = function() {
var widget = getFocusedWidget( editor );
var widget = getFocusedWidget( editor ),
displayTextField = this.getContentElement( 'info', 'linkDisplayText' ).getElement();

// Widget cannot be enclosed in a link, i.e.
// <a>foo<inline widget/>bar</a>
if ( widget && ( widget.inline ? !widget.wrapper.getAscendant( 'a' ) : 1 ) )
if ( widget && ( widget.inline ? !widget.wrapper.getAscendant( 'a' ) : 1 ) ) {
this.setupContent( widget.data.link || {} );
else

// Hide the display text in case of linking image2 widget.
displayTextField.hide();
} else {
// Make sure that display text is visible, as it might be hidden by image2 integration
// before.
displayTextField.show();
onShow.apply( this, arguments );
}
};

// Set widget data if linking the widget using
@@ -0,0 +1,7 @@
<div id="editor1" contenteditable="true">
<p>An example image: <img alt="alt" src="%BASE_PATH%/_assets/logo.png" />.</p>
</div>

<script>
CKEDITOR.replace( 'editor1' );
</script>
@@ -0,0 +1,21 @@
@bender-tags: 4.5.11, tc, 7154
@bender-ui: collapsed
@bender-ckeditor-plugins: wysiwygarea, sourcearea, toolbar, image2, link

## Link dialog integration

1. Click on image to focus it.
1. Use Link button.
* Make sure Display Text field is **hidden**.
1. Put `foo` into URL.
1. Click OK button.

**Expected:** Following source `<p>An example image: <a href="http://foo"><img alt="alt" src="/tests//_assets/logo.png" /></a>.</p>`

## Restoring Display Text

1. Perform the above "Link dialog integration" TC.
1. Put selection on `example` word.
1. Use Link button.

**Expected:** Display Text field is visible.

0 comments on commit f94651a

Please sign in to comment.
You can’t perform that action at this time.