Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Make dialog-filename strings breakable #3446

Merged
merged 3 commits into from
Apr 17, 2013
Merged

Make dialog-filename strings breakable #3446

merged 3 commits into from
Apr 17, 2013

Conversation

redmunds
Copy link
Contributor

This is for #3382. I found several other cases that need the same fix.

@TomMalbran
Copy link
Contributor

It seems like it would be really useful to have a util function that first escapes the url and then breaks it, since there are lots of stacked calls using those functions. An alternative, if possible, would be that breakableUrl, escapes the url before breaking it (maybe adding a new boolean parameter if there are cases where it shouldn't do it).

@redmunds
Copy link
Contributor Author

@TomMalbran I thought about that, but didn't do anything, so thanks for inspiring me :) I took another look at the code and noticed that htmlEscape() is called every time breakableUrl() is called, so I changed the code to do that automatically.

@TomMalbran
Copy link
Contributor

I checked that too, and it does make sense to always escape the url before breaking it, since when you call breakableUrl() you want to put the string in a template, so htmlEscape() is always needed.

@redmunds
Copy link
Contributor Author

@TomMalbran Since you've already looked at this one, do you want to officially review it?

var errMsg = StringUtils.format(Strings.ERROR_CREATING_FILE,
StringUtils.htmlEscape(data.rslt.name),
errString);
var errMsg = StringUtils.format(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might look better to just replace the errMsg in the Dialog, with these lines and not use the variable, since that is how it does everywhere else. If removing the errString variable too, is good, then we can combine it all without additional variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. I got rid of errMsg, but left errString.

@TomMalbran
Copy link
Contributor

Sure. I added a few comments there. I found that the Find In Files Label for scoped searches (FindInFiles.js:104) and the Close all documents (DocumentCommandHandlers.js:666) needs a break too. It does look nice in the dialogs and search results.

@ghost ghost assigned TomMalbran Apr 17, 2013
@redmunds
Copy link
Contributor Author

Changes pushed.

Good catch on DocumentCommandsHandlers.js:666 -- I only searched the strings.js file for 'dialog-filename'. I also fixed FindInFiles.js104.

@TomMalbran
Copy link
Contributor

Thanks. I did a search for htmlEscape and checked the ones that where urls to find if there were more missing.

This looks great. Merging

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants