New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Image pages #2132
Image pages #2132
Conversation
htdocs/js/jquery.fileupload.js
Outdated
@@ -209,10 +213,13 @@ $(function() { | |||
$.extend( image, data ); | |||
$field.data( "image-attributes", image ); | |||
|
|||
var escape_titletext = image.title.replace( /</g, '<' ).replace( /'/g, "'" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It boggles my mind that there isn't a function for this, but I did peek around and didn't see one... just a bunch of people on the Internet saying 'do it yourself'. And I guess we don't have such a function already anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't know jQuery well, but this does work. I'm open to a more elegant solution if anyone has one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've got an idea, but I don't know if it's elegant. Instead of manipulating text, for which the functions don't already exist, you'd have to manipulate the DOM so that the page actually contains the img you're trying to build up, non-displayed. Then ask jQuery for the html source of that img.
@alierak and I couldn't figure out a better way to do this in the given context. I have tweaked my initial approach to fix a couple of issues, but we agree this is probably the best way to do it in this instance. |
I did eventually find an "existing function", though. In js/6alib/core.js, they define String.encodeHTML for this purpose. However, it may contain a bug in that it does not replace single quotes. |
Scratch the comment about that function having a purpose, though, since I don't believe it's called anywhere. |
Thanks for confirming that this is a hard problem to solve. I'll file it next to cache invalidation and naming things. |
Various fixes for the image upload/management pages.
Fixes #1985. Fixes #2033. Fixes #2036.