HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

delete img src="null" when pressing cancel in image prompt Button Bar

jackmaessenjackmaessen ✭✭✭
edited November 2014 in Feedback

I noticed that the embedded plugin Button Bar in 2.1 prompts with clicking on image button and url button.
There is only one thing i find disturbing, that when you press Cancel in the prompt, he returns null in the textarea

img src="null"

So i put an if statement in the case to disable this text:

The original case:


           case 'image':
           var urlOpts = {};
           var thisOpts = $.extend(htmlOpts, {
              closetype: 'short'
           });

           var PromptText = gdn.definition('ButtonBarImageUrl', 'ButtonBar.ImageUrlText');
           NewURL = prompt(PromptText);
           urlOpts.src = NewURL;         

           $(TextArea).insertRoundTag('img',thisOpts,urlOpts);
           break;

Customized case:


           case 'image':
           var urlOpts = {};
           var thisOpts = $.extend(htmlOpts, {
              closetype: 'short'
           });

           var PromptText = gdn.definition('ButtonBarImageUrl', 'ButtonBar.ImageUrlText');
           NewURL = prompt(PromptText);
           if(NewURL != null){ // condition added
           urlOpts.src = NewURL;


           $(TextArea).insertRoundTag('img',thisOpts,urlOpts);
            } // end if
           break;

Maybe helpfull for other people who wants to disable the

img src="null"

in the textarea when pressing Cancel

Tagged:

Comments

Sign In or Register to comment.