BirkbeckCTP / janeway

A web-based platform for publishing journals, preprints, conference proceedings, and books
https://janeway.systems/
GNU Affero General Public License v3.0
166 stars 65 forks source link

More options when copy-pasting formatted text #4017

Open joemull opened 4 months ago

joemull commented 4 months ago

Is your feature request related to a problem? Please describe. With #3983 we introduced the TinyMCE text editor and added a modal that lets you clear all formatting when pasting from another app, like Word. This is usually better than keeping all the formatting.

But many users want something in the middle. They want to keep very basic formatting like italics, bolding, and hyperlinks. See https://github.com/BirkbeckCTP/janeway/issues/2282#issuecomment-1286758594 and https://github.com/BirkbeckCTP/janeway/issues/1481#issuecomment-1185419521.

Describe the solution you'd like The option to keep some formatting. This could be achieved by using something like sanitize-html as @ajrbyers suggested in #3983.

ajrbyers commented 1 month ago

More investigation to discover what a middle ground option here would be.

joemull commented 1 month ago

Possible solution:

Split JanewayBleachField into a few subclasses per downstream constraints. Fields that will be used in metadata streams like title and abstract could use JATSJanewayBleachField, which would only allow options for the copy-paste UI that conform to the JATS for content markup.

Meanwhile fields like the CMS page and news item where people are likely to want more formatting could implement the above solution, using something like ContentJanewayBleachField, which specifies a third middle paste option "Keep bold, italics, and links".

joemull commented 1 month ago

Another clarification: we are not proposing removing the existing two options with this feature. Users would still have the options Clear all formatting and Keep all formatting (so long as that formatting is permitted downstream), to handle exceptional cases, whatever other option(s) we add.