Skip to content

Commit

Permalink
Link dialog - getMediaRadioGroup method #6028
Browse files Browse the repository at this point in the history
  • Loading branch information
reisfmb committed Mar 15, 2023
1 parent 2303bce commit 079aa4d
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -722,8 +722,7 @@ export class LinkModalDialog
}

private resetMediaRadioValue(): void {
const mediaRadio: RadioGroup = <RadioGroup>this.getFieldById('contentMediaRadio');
mediaRadio.setValue(MediaContentRadioAction.OPEN);
this.getMediaRadioGroup().setValue(MediaContentRadioAction.OPEN);
}

private createParamKeyFormItem(initialKey: string): [FormItem, string] {
Expand Down Expand Up @@ -782,6 +781,10 @@ export class LinkModalDialog
return button;
}

private getMediaRadioGroup(): RadioGroup {
return <RadioGroup>this.getFieldById('contentMediaRadio');
}

protected getMainFormItems(): FormItem [] {
const getLinkText: Function = () => {
return <string>this.ckeOriginalDialog.getValueOf('info', 'linkDisplayText');
Expand Down Expand Up @@ -879,7 +882,7 @@ export class LinkModalDialog
return formItem;
}

private handleSelectorValueChanged(selectedContent: ContentSummary, formItem: FormItem): void {
private handleSelectorValueChanged(selectedContent: ContentSummary, formItem: FormItem): void {
if (!selectedContent) {
formItem.setValidator(Validators.required);
this.resetMediaRadioValue();
Expand All @@ -891,12 +894,10 @@ export class LinkModalDialog
}

if (selectedContent.getType().isDescendantOfMedia()) {
const mediaRadio: RadioGroup = <RadioGroup>this.getFieldById('contentMediaRadio');

this.mediaOptionRadioFormItem.show();
this.anchorFormItem.hide();
this.paramsFormItem.hide();
if (mediaRadio.doGetValue() === MediaContentRadioAction.LINK) {
if (this.getMediaRadioGroup().doGetValue() === MediaContentRadioAction.LINK) {
this.contentTargetCheckBoxFormItem.show();
}
} else {
Expand Down Expand Up @@ -934,11 +935,9 @@ export class LinkModalDialog
});

mediaUploader.onFileUploaded((event: UploadedEvent<Content>) => {
const mediaRadio: RadioGroup = <RadioGroup>this.getFieldById('contentMediaRadio');

this.mediaOptionRadioFormItem.show();

if (mediaRadio.doGetValue() === MediaContentRadioAction.LINK) {
if (this.getMediaRadioGroup().doGetValue() === MediaContentRadioAction.LINK) {
this.contentTargetCheckBoxFormItem.show();
}

Expand Down Expand Up @@ -1057,7 +1056,7 @@ export class LinkModalDialog
}

private generateUrlParamsForMedia(): ContentLinkParams {
const mediaContentRadioSelectedOption: string = (<RadioGroup>this.getFieldById('contentMediaRadio')).doGetValue();
const mediaContentRadioSelectedOption: string = this.getMediaRadioGroup().doGetValue();
const contentSelectorValue: string = this.getContentSelectorValue();

if (mediaContentRadioSelectedOption === MediaContentRadioAction.OPEN) {
Expand Down

0 comments on commit 079aa4d

Please sign in to comment.