ScienceCommons / api

API for interacting with Curate Science model
http://curatescience.org
MIT License
2 stars 4 forks source link

formatting issues when copy-and-pasting text into specific text boxes #206

Closed eplebel closed 9 years ago

eplebel commented 9 years ago

STEPS:

  1. copy-and-paste any text from a website into any text boxes (i.e., DOI, Publication Year, Article title, Journal name, or Abstract) on the "Add article" screen (https://www.curatescience.org/beta/#/articles/new) or edit mode on an article page.

Notice that the formatting from the website is displayed in these textboxes, instead of being stripped away (as is the case for the main search box or comment text boxes). This is happening on both staging and production. NOTE: Once an article is added or saved, the formatting is stripped away and it displays correctly.

A closely related issue is that copy-and-pasting into the abstract text box (either on add article screen or edit mode) on STAGING results in the text being duplicated (once with formatting stripped away and another time with the original formatting). This does NOT occur on production, and is probably related to @manzhikov last changes (see https://github.com/ScienceCommons/www/commit/2cd3da25049ab53efd2ffa30b573b1cc7070962b ) in relation to issue #175

alexkyllo commented 9 years ago

This is the browser working as designed. In order to fix this I would need to use javascript to detect a paste event, intercept the clipboard contents, strip HTML tags from it, and paste the plain text. But what if the user wants to paste text with line breaks or URL links in it?

eplebel commented 9 years ago

Great points! Hence, leave the formatting issues as is for now, and just try to address the duplicate text issue. Thanks!

alexkyllo commented 9 years ago

Wow, this one was a pain in the ass, but I finally fixed it in both Chrome and Firefox! No promises about IE, Safari or Opera though!

Deployed to staging and PR opened: https://github.com/ScienceCommons/www/pull/47

eplebel commented 9 years ago

Wow, you're a work horse!! That's awesome. I guess now we now why that freelancer gave up on that job!

Thanks so much!