0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00
Commit graph

43 commits

Author SHA1 Message Date
Neil Jenkins
7ecf75f246 Fix determining if at start of block when at end of doc
Fixes #190
2016-05-26 11:42:53 +10:00
Andy Kauffman
4e7e290fbc Fix block boundary issue
If the node is at the end of the document, this method can fail with
'TypeError: Cannot read property 'previousSibling' of null'
2016-05-19 10:28:46 +10:00
Neil Jenkins
44a2b5c7a8 Add guard for null nodes in insertTreeFragmentIntoRange 2016-04-08 17:42:47 +10:00
Neil Jenkins
66c0b20702 Squire: Fix possible error when deleting range 2016-04-07 13:08:45 +10:00
Neil Jenkins
6a348e084b Make Squire work without an iframe(!) 2016-03-23 17:41:09 +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
9461368a5c Fix whitespace errors.
Thanks to @gertsonderby who pointed these out in #138.
2015-09-28 15:48:23 +02:00
Neil Jenkins
c190fab9fd Fix deletion of range when start or end is at edge of block.
If the selection starts and ends in the middle of blocks, we need to merge
these after extracting the range. But we need to be careful not to merge if
the selection ends at a block, as we end up merging into a block that wasn't
selected.
2015-07-25 18:03:51 -07:00
Neil Jenkins
e90f18dba9 Fix inserting partial inlines in insertTreeFragmentIntoRange
Needs to account for browser "<br>"s inside blocks.
2015-06-19 14:18:07 +07:00
Neil Jenkins
c25bfe8a9f Fix error thrown inserting tree fragment at start/end of document. 2015-06-17 15:43:50 +07:00
Neil Jenkins
e59e6418af Improve merging edges of inserted tree fragment.
Fixes #87.
2015-06-12 17:48:06 +07:00
Neil Jenkins
73ca65edb5 Fix pasting multiple lines into a blockquote.
Pasting is hard to get right in the general case, not least because the
browsers give so little control over the process, leaving you to resort to
crappy hacks. But we can special case the pasting to a blockquote case fairly
easily, and I can't see any particular regression it should cause.

Fixes #59.
2015-04-09 20:16:04 +07:00
Neil Jenkins
1c0fa1a50f Rewrite getSelectedText method.
Fixes #57.

* Fixes bug where it could return text outside selection
* Inserts new line between blocks.
2015-04-08 17:13:21 +07:00
Allen Heavey
eced74244d fix typo: ndoes -> nodes 2015-03-19 14:55:45 +08:00
Neil Jenkins
ed0ebdae49 Merge adjacent text nodes after extracting range. 2015-03-04 14:50:44 +08:00
Neil Jenkins
5b8e348232 Fix invalid caching of selection nodes in paste handler.
Fixes error thrown when pasting text twice in succession (or more generally,
when pasting it into non-normalised text nodes).
2015-02-06 14:18:38 +07:00
Neil Jenkins
dfed911833 Add .jshintrc file so JSHint checks it correctly.
Resolves #25.
2015-01-08 12:25:54 +07:00
Neil Jenkins
54b428aaa6 Fix deleting selection across block boundary. 2014-12-26 14:48:13 +07:00
Neil Jenkins
b944eb3b3b Fix ZWS removal when Squire script not in iframe. 2014-10-02 16:36:39 +07:00
Neil Jenkins
597024eecb Remove FILTER_(ACCEPT|SKIP) constants.
Just return a boolean for the TreeWalker filter fn. This diverges from the spec,
but since the goal of this implementation is not to fully implement the spec
and we're never going to use a native implementation, this doesn't matter and
the code is easier to read when the function is just returning a boolean like
any normal filter function.
2014-09-04 17:24:31 +07:00
Neil Jenkins
a280cb4946 Improve detection of range at begin/end of block. 2014-09-03 11:17:14 +07:00
Neil Jenkins
7812b8db23 Turn Range prototype extensions into functions.
A step towards being able to share code between multiple concurrent instances of
the editor. Also reduces minified size slightly.
2013-06-20 21:03:01 +10:00
Neil Jenkins
af1720282c Replace Node prototype extensions with normal fns.
* Firefox was sometimes not finding the extensions on elements.
* This minifies to a smaller target.
2013-04-08 13:27:06 +10:00
Neil Jenkins
b35b7d4b35 Fix bug in Range#insertTreeFragment
Merging containers could remove the nodeAfterSplit from the tree, which then
caused an error to be thrown if it had no content, as the code would try to
remove it again.
2013-01-30 11:30:11 +11:00
Neil Jenkins
fe6ffb0ed5 Add IE10 compatibility.
* All UA detection moved into a separate file.
2012-11-12 18:30:40 +11:00
Neil Jenkins
f2090b05d0 Tidy. Ensure trailing new line in all source files 2012-08-07 13:36:05 +10:00
Neil Jenkins
a9a0ac6411 Fix bug where image may be duplicated on enter.
* Do not move range boundaries inside images; these should always be treated as
  leaf nodes.
* Workaround FF bug where it may return range as being inside of image node.
2012-08-01 11:53:37 +10:00
Neil Jenkins
c595fb0bb8 Fix cursor location after Range::_deleteContents
Should always collapse to start.
2012-04-04 15:11:27 +10:00
Neil Jenkins
6480739143 Update copyright year. 2012-04-02 15:55:33 +10:00
Neil Jenkins
f0ba6216cc Add support for IE8. 2012-04-02 15:55:33 +10:00
Neil Jenkins
e3ee4dad12 Whitespace cleanup. 2012-01-25 11:47:26 +11:00
Neil Jenkins
143eea15cb Fix cursor when deleting range contents 2011-11-15 21:46:11 +11:00
Neil Jenkins
feca3e4d8f Make forEachBlock method public.
And tidy a few bits and pieces.
2011-11-14 17:55:40 +11:00
Neil Jenkins
a2ef14e218 Add make/remove link sugar.
Also:
Add getSelectedText method.
Fix bug in setting HTML after undo/redo in Opera.
2011-11-10 18:31:07 +11:00
Neil Jenkins
3b09cbf703 Improve cleaning of inserted content. 2011-11-04 16:53:12 +11:00
Neil Jenkins
28c9ab10a9 Fix FF deleting everything on cut. 2011-11-03 17:05:18 +11:00
Neil Jenkins
0f750d2a0e Fix Range#get(Start|End)Block.
Was still returning the wrong result in certain situations (for example when the
start boundary was just before the end of a block).
2011-11-03 12:10:16 +11:00
Neil Jenkins
e8a917f321 Fix Range#containsNode.
Not sufficient for node to be adjacent to range; must actually contain range.
2011-11-02 19:12:31 +11:00
Neil Jenkins
a91df2db4c Ensure range is valid after Range#_deleteContents. 2011-11-02 18:46:18 +11:00
Neil Jenkins
9dcbf45f4a Fix Range#get(Start|End)Block. 2011-11-02 16:31:46 +11:00
Neil Jenkins
1d5b841860 Fix bug in deleting all. 2011-11-02 11:54:58 +11:00
Neil Jenkins
f245cc0dba Fix Range#get(Start|End)Block methods. 2011-10-31 13:08:51 +11:00
Neil Jenkins
72141fd670 Initial commit for public release. 2011-10-29 14:15:21 +11:00