Add check for placholder node in sub-ref create flow

Make it a bit more explicit when we want to remove that node and
be a bit more verbose with comments.

Bug: T375156
Change-Id: Ibb5efefa03037b99b50284071d06231e518530a6
This commit is contained in:
WMDE-Fisch 2024-10-10 13:24:54 +02:00
parent 863565ec3a
commit ff1790755a

View file

@ -241,10 +241,14 @@ ve.ui.MWReferenceDialog.prototype.getSetupProcess = function ( data ) {
this.reuseSearch.setInternalList( this.getFragment().getDocument().getInternalList() );
this.openReusePanel();
} else if ( data.createSubRef ) {
if ( this.selectedNode instanceof ve.dm.MWReferenceNode ) {
if ( this.selectedNode instanceof ve.dm.MWReferenceNode &&
this.selectedNode.getAttribute( 'placeholder' ) ) {
// remove the placeholder node from Citoid
this.getFragment().removeContent();
this.selectedNode = null;
}
// we never want to edit an existing node here
this.selectedNode = null;
this.onReuseSearchResultsExtends( data.createSubRef );
} else {
this.panels.setItem( this.editPanel );