Fix link-inserter event value when dialog opens

When the insert-link dialog is opened, a change event is manually
fired in order to get the system in sync. This is not optimum,
but until we refactor jquery.wikiEditor.dialogs.config.js it's
a simple way to do it.

The issue was that this manual event was being given an empty string
as the title value, but it should've been the actual current field
value. The reason it's not the same is that when the dialog is
closed with the cancel button, the state of all the fields is not
reset (this is a long-standing design feature of the dialog).

Bug: T293167
Change-Id: I8e2a0a5169b5d2a6d706623dc0c879469acd9afa
This commit is contained in:
Sam Wilson 2021-12-08 10:00:48 +08:00
parent 1072dcc27c
commit b8a4fcc998

View file

@ -279,7 +279,7 @@
insertLinkTitleInputField.getField().focus();
// Trigger the change event, so the link status indicator is up to date.
// It may be triggered again for the selection, below.
insertLinkTitleInputField.getField().emit( 'change', '' );
insertLinkTitleInputField.getField().emit( 'change', insertLinkTitleInputField.getField().getValue() );
$( '#wikieditor-toolbar-link-dialog' ).data( 'whitespace', [ '', '' ] );
if ( selection !== '' ) {