Skip to content
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

Merged
merged 7 commits into from May 1, 2017
Merged

Image pages #2132

merged 7 commits into from May 1, 2017

Conversation

kareila
Copy link
Member

@kareila kareila commented Apr 20, 2017

Various fixes for the image upload/management pages.

Fixes #1985. Fixes #2033. Fixes #2036.

@@ -209,10 +213,13 @@ $(function() {
$.extend( image, data );
$field.data( "image-attributes", image );

var escape_titletext = image.title.replace( /</g, '&lt;' ).replace( /'/g, "&apos;" );
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

@kareila
Copy link
Member Author

kareila commented Apr 30, 2017

@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.

@alierak
Copy link
Member

alierak commented Apr 30, 2017

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.

@alierak
Copy link
Member

alierak commented Apr 30, 2017

Scratch the comment about that function having a purpose, though, since I don't believe it's called anywhere.

@kareila
Copy link
Member Author

kareila commented May 1, 2017

Thanks for confirming that this is a hard problem to solve. I'll file it next to cache invalidation and naming things.

@kareila kareila merged commit 9895bff into dreamwidth:develop May 1, 2017
@kareila kareila deleted the image-pages branch May 1, 2017 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants