Cannot reproduce Editor miss-handles safari detection with copy & paste

Xon

Well-known member
Affected version
2.2.6
I've had reports from users since updating to XF2.2.6 that the editor on copy & paste unexpectedly consuming newlines.

I can replicate this if using Chrome/Edge and selecting a Safari-using device.

Using this as a source; https://docs.google.com/document/d/1NIFe3wDMUgouCWY0VzTvG33pgSHMyx-WXwHmpuh13Sg/edit

It can be from Chrome or Safari, but pasting it into Safari or Chrome-emulating-Safari and the new line between the two sentences is stripped. While it is preserved for Chrome/Edge=>Chrome/Edge
 
Last edited:
According to safari dev tools; the copy & paste has the mime types; text/html;text/plain;
unknown.png

Digging into the minified js;
Code:
/text/html/.test(c) && !b.browser.safari ? v = a.clipboardData.getData("text/html") : /text/rtf/.test(c) && b.browser.safari ? v = q : /public.rtf/.test(c) && b.browser.safari && (v = a.clipboardData.getData("text/rtf"))

For safari this will skip text/html copy & paste :(
 
Adding this appears to mitigate the copy&paste behaviour not working as expected;
Code:
$(document).on('editor:init', function(event, ed, xfEditor) {
    ed.browser.safari = 0;
});
 
This seems to work fine these days without any particular patches. Let me know if this isn't the case.
 
Top Bottom