Neil Jenkins
c78bd4aac9
If text == html, only copy as plain text
...
It must be plain text if they're the same, and this helps avoid a Safari bug
(when we can) where when you copy HTML and then paste it in Pages/Numbers, it
gets the charset wrong and mangles non-ASCII characters.
2020-07-27 11:16:47 +10:00
Neil Jenkins
e46b2e4881
Only cleanupBrs on copy if using innerText
...
This is a fix for Firefox's inner text handling, so if we're not using that
don't bother.
2020-07-20 10:56:23 +10:00
Neil Jenkins
a91c3f3042
Always run html through willCutCopy fn
...
The plain text may be calculated from the HTML, so we should convert the
HTML first, then convert it to text.
2020-07-14 19:59:03 +10:00
Neil Jenkins
d5b320bd7d
Fix plain text only copying when using toPlainText
...
We need to get the HTML to convert.
2020-07-14 19:57:32 +10:00
Nicholas Wylie
b952894d10
Export onCopy function
2020-07-14 13:33:48 +10:00
Neil Jenkins
15f9b46728
Handle clipboard on iOS again
...
The WebKit bug (https://bugs.webkit.org/show_bug.cgi?id=143776 ) was fixed back
in iOS 11.4.
This reverts 3be9a7dea8
.
2019-11-17 10:21:33 +08:00
Neil Jenkins
6b85bda364
Handle pasting text/uri-list
2019-03-25 15:40:41 -04:00
Neil Jenkins
43b2c6b0e1
Insert table rather than image on paste from Excel
2019-02-21 16:31:06 +11:00
Neil Jenkins
2059c5a4ae
Fix pasting image copied from browser
2019-01-10 15:18:24 +11:00
Neil Jenkins
e3e7c17315
Add config.willCutCopy option
...
Is an optional function that transforms the HTML being cut/copied before
placing it on the clipboard.
2018-07-12 15:40:01 +10:00
Neil Jenkins
db005b379b
Make createRange method public
2018-05-09 17:43:11 +10:00
Neil Jenkins
070f2e52a3
Support pasting images in Edge
2017-12-13 16:43:43 +11:00
Neil Jenkins
45fee4c858
Fix potential infinite loop on cut
...
Common ancestor of range may change while range is manipulated for deletion.
2017-01-19 17:08:39 +11:00
Neil Jenkins
9596f4ecf8
Ensure moving boundaries up tree never passes root
2017-01-13 15:15:59 +11:00
Neil Jenkins
79ffc02557
Unify cut and copy implementations
...
* Data added to clipboard should now always be the same for cut as for copy
* Fixes bug when cutting across blocks, where not all parents would be included
in the data added to the clipboard
2017-01-13 10:24:01 +11:00
Neil Jenkins
6f83f23881
Fix delete behaviour
...
1. Fixes cursor position when deleting starting with a selection at beginning
of block.
2. Fixes block disappears when whole inline contents is deleted.
2017-01-10 10:06:28 +11:00
Neil Jenkins
066bdd2cde
Ignore "cut" if no selection
2017-01-10 10:05:56 +11:00
Neil Jenkins
e645489f5f
Fix empty lines missing when copying plain text
2017-01-10 10:05:35 +11:00
Neil Jenkins
3d8cd62edb
Improve copying of plain text on windows
2016-12-11 12:32:25 +11:00
Neil Jenkins
2c7f7b907c
Fix copying when not inside valid doc structure
2016-12-09 10:42:18 +11:00
Neil Jenkins
801388222d
Fix pasting plain text when not first item
2016-11-21 10:59:44 +11:00
Neil Jenkins
c656be7e65
Fix copying plain text in Firefox
...
Resolves #244
2016-11-02 15:32:06 +11:00
Neil Jenkins
e1d30b7082
Fix error when copying inline text-only.
2016-09-10 09:24:14 -04:00
Neil Jenkins
26b71dee8e
Fix copying inline styles when selection not on boundary.
...
Resolves #219 properly this time.
2016-09-09 12:14:57 -04:00
Neil Jenkins
9aacad6e3c
Make Shift-Ctrl-V paste as plain text.
...
Fixes #230 .
2016-09-04 20:58:49 -04:00
Neil Jenkins
cbde7a9198
Always preserve inline formatting on copy
...
Fixes #219 .
2016-09-04 20:44:36 -04:00
Neil Jenkins
aae328e226
Ensure valid DOM tree is added to clipboard on copy
...
Fixes #204 .
2016-08-10 16:24:13 +10:00
Neil Jenkins
8b580ed988
Add undo checkpoint on drop.
...
Resolves #188 .
2016-05-26 13:54:26 +10:00
Neil Jenkins
e3d0576a38
Workaround Facebook iOS URL copying bug
2016-04-11 16:58:13 +10:00
Neil Jenkins
3be9a7dea8
Workaround iOS clipboardData bug
2016-03-24 09:44:35 +11:00
Neil Jenkins
6a348e084b
Make Squire work without an iframe(!)
2016-03-23 17:41:09 +11:00
Neil Jenkins
349f391075
Fix typo in cut/copy handlers
2016-03-14 15:21:48 +11:00
Neil Jenkins
c895d6b307
Set a plain text version too on cut/copy
2016-03-12 17:18:21 +11:00
Neil Jenkins
62616ef4ec
Add saveUndoState method to public API
...
For #174
2016-03-11 15:58:32 +11:00
Neil Jenkins
6413034884
Improve copy/paste
...
* In browsers that support it, we now tell it to copy exactly what was selected
in the DOM, and not to add extra gunk which browsers do to preserve exact
styling if pasted into another document.
* Don't use the clipboard APIs with MS Edge, since it only supports plain text.
If we let it fallback to the browser implementation it will insert HTML.
2016-03-11 15:22:49 +11:00
Neil Jenkins
6ed3b93900
Workaround Firefox clipboard ignores RTF data
2016-03-07 18:38:07 +11:00
Neil Jenkins
715166b95d
Let browser handle paste of images in FF/Safari.
2015-07-16 10:47:56 -07:00
Neil Jenkins
fdcef5fc8e
Workaround clipboard having blank text/html version.
2015-07-14 12:59:27 -07:00
Neil Jenkins
579cad7ff9
Fix pasting plain text in Safari.
2015-07-11 19:22:46 +07:00
Neil Jenkins
def56193d4
Fix dummy paste area should be removed after paste completes
2015-06-22 09:32:47 +07:00
Neil Jenkins
680c0fbbb7
Don't use old clipboard API.
...
Safari very rarely has a text/html version (even if you copy from within
Safari!) so you end up always pasting plain text. Better to use the fallback
method to grab the data.
2015-06-19 14:19:37 +07:00
Neil Jenkins
bc523f83e8
Better paste handling
...
Get paste data directly from browser when supported. Funnel all pastes through
the insertHTML method for consistent results.
2015-06-19 14:19:21 +07:00
Neil Jenkins
395a5825e9
Split cleaning fns and clipboard handlers into separate file.
2015-06-19 14:18:32 +07:00