@@ -369,7 +369,7 @@ export class RichText extends React.Component<IRichTextProps, IRichTextState> {
369
369
} } />
370
370
371
371
< TextField label = { strings . TextToDisplayLabel }
372
- value = { this . state . insertUrlText || this . state . insertUrl }
372
+ value = { this . state . insertUrlText }
373
373
onChanged = { ( newValue ?: string ) => {
374
374
if ( newValue !== this . state . insertUrl ) {
375
375
this . setState ( {
@@ -385,7 +385,7 @@ export class RichText extends React.Component<IRichTextProps, IRichTextState> {
385
385
< Link className = { `${ styles . action } ${ styles . unlinkButton } ` } onClick = { this . handleRemoveLink } > { strings . RemoveLinkLabel } </ Link >
386
386
)
387
387
}
388
- < PrimaryButton className = { styles . action } onClick = { this . handleCreateLink } text = { strings . SaveButtonLabel } />
388
+ < PrimaryButton className = { styles . action } onClick = { this . handleCreateLink } text = { strings . SaveButtonLabel } disabled = { this . checkLinkUrl ( ) } />
389
389
< DefaultButton className = { styles . action } onClick = { this . closeDialog } text = { strings . CancelButtonLabel } />
390
390
</ div >
391
391
</ DialogFooter >
@@ -569,7 +569,7 @@ id="DropDownStyles"
569
569
< ReactQuill ref = { this . linkQuill }
570
570
placeholder = { placeholder }
571
571
modules = { modules }
572
- value = { text || '' }
572
+ defaultValue = { text || '' } //property value causes issues, defaultValue does not
573
573
onChange = { this . handleChange }
574
574
onChangeSelection = { this . handleChangeSelection }
575
575
onFocus = { this . handleOnFocus } />
@@ -690,7 +690,7 @@ id="DropDownStyles"
690
690
}
691
691
692
692
if ( cursorPosition > - 1 ) {
693
- const textToInsert : string = this . state . insertUrlText !== undefined ? this . state . insertUrlText : this . state . insertUrl ;
693
+ const textToInsert : string = ( this . state . insertUrlText !== undefined && this . state . insertUrlText !== "" ) ? this . state . insertUrlText : this . state . insertUrl ;
694
694
const urlToInsert : string = this . state . insertUrl ;
695
695
quill . insertText ( cursorPosition , textToInsert ) ;
696
696
quill . setSelection ( cursorPosition , textToInsert . length ) ;
@@ -704,6 +704,17 @@ id="DropDownStyles"
704
704
} ) ;
705
705
}
706
706
707
+ /**
708
+ * Disable Save-button if hyperlink is undefined or empty
709
+ * This prevents the user of adding an empty hyperlink
710
+ */
711
+ private checkLinkUrl = ( ) => {
712
+ if ( this . state . insertUrl !== undefined && this . state . insertUrl != "" ) {
713
+ return false ;
714
+ }
715
+ return true ;
716
+ }
717
+
707
718
/**
708
719
* Applies a format to the selection
709
720
* @param name format name
0 commit comments