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

54 commits

Author SHA1 Message Date
Neil Jenkins
0f361d69c6 Add IFRAME to list of inline nodes.
Resolves #180.
2016-05-01 16:36:43 +10:00
Neil Jenkins
6a28aafd2f Add HR as a leaf node name. 2016-05-01 16:33:47 +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
3ff9a46ea9 Check for null parent in getPath 2016-03-26 11:32:59 +11:00
Neil Jenkins
3dca852630 Log errors from fixCursor to track down bug 2016-03-24 22:04:42 +11:00
Neil Jenkins
6a348e084b Make Squire work without an iframe(!) 2016-03-23 17:41:09 +11:00
Neil Jenkins
2a8fb93cd9 Fix erroneous white-space removal when pasting inline fragment. 2015-06-23 09:46:15 +07:00
Neil Jenkins
a1ff33da9f Squire#removeAllFormatting fixes.
* Update the path after making the changes, so UI buttons can update correctly.
* Focus the editor on completion, to match the behaviour of other commands.
* Merge all the gathered text nodes if they're adjacent, so we have a normalised
  result.
2015-06-17 19:07:29 +07:00
Neil Jenkins
a2ca4a3864 Allow setting default attributes for ul/ol/li/blockquote.
Merges #83, with fixes, tidying and squashing.
2015-05-09 17:22:54 +07:00
Neil Jenkins
4c63ad696e Only maintain LI numbering when splitting OL if in BLOCKQUOTE.
Fixes #53
2015-03-29 18:39:50 +11:00
Neil Jenkins
3c8eaa1fcc Use default block settings when fixCursor called on body 2015-03-29 18:36:58 +11:00
Neil Jenkins
5865eb032a Maintain li numbering when splitting OL 2015-02-06 14:19:06 +07:00
Neil Jenkins
90623a51a2 Clean up empty inlines when deleting selection.
Fixes #6
2014-12-25 15:09:46 +07:00
Neil Jenkins
b944eb3b3b Fix ZWS removal when Squire script not in iframe. 2014-10-02 16:36:39 +07:00
Neil Jenkins
e7cef49818 Rename isOpera -> isPresto.
Opera now uses WebKit, but these tweaks are only for the Presto version.
2014-10-02 16:23:30 +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
d5e8ef1381 Preserve inline styles on enter in WebKit. 2014-08-28 08:17:07 +07:00
Neil Jenkins
aa9afdfaf6 Code format tidying.
* Use upper-case for all tag names.
* Tidy document reference.
2014-06-02 10:17:54 +10:00
Neil Jenkins
aca8fd4fab Better fix up of mixed inline/block content. 2014-05-27 11:31:06 +10:00
Neil Jenkins
46706db889 Wrap LI contents when merging. 2014-05-23 15:33:00 +10:00
Neil Jenkins
0d5398868f Better, simpler cleanup of zero-width space placeholders.
Fixes issue applying multiple inline formats at the same time with a collapsed
selection in WebKit. Much more robust than previous method.
2014-04-16 18:07:46 +10:00
Neil Jenkins
6b754d423c Add support mult-level lists.
* Hit tab to increase list depth, or call increaseListLevel method.
* Hit enter on a blank item to decrease list depth, or call decreaseListLevel method.
2014-04-07 13:05:44 +10:00
Neil Jenkins
bee49bef40 Use <S> to markup strike through, not <STRIKE>.
The <strike> tab has been obsoleted in HTML5.
2014-02-03 18:20:03 +11:00
Neil Jenkins
88ced455f9 Add subscript/superscript/strikethrough helper methods.
* And keyboard shortcuts. (Ctrl-Shift-5/6/7 respectively).
2014-01-13 14:32:24 +11:00
Neil Jenkins
fefa32b744 Fix reference to setPlaceholderTextNode
This is now an instance method, whereas before it was global. Annoyingly, we
need to access this from from within fixCursor which has no reference to the
RTE instance itself (and it would be a pain to pass one down). For now, just
referring to the global `editor` variable if it exists (i.e. if the script
loaded in an iframe). Need a better solution longer term though.
2013-07-16 20:36:24 +10:00
Neil Jenkins
6b4dda816e Make into a JS class for multiple instantiation.
* If you load the squire.js script into a top-level page rather than an iframe,
  it will add a Squire constructor to the global scope.
* The Squire constructor can be used to instantiate multiple instances on the
  same page without having to load/parse/execute the full code every time.
* For each instance, create a new iframe, then call `new Squire( document )`,
  with the document node for each iframe.
2013-06-20 23:15:18 +10:00
Neil Jenkins
20f92c9785 Always return nodeAfterSplit from split fn 2013-04-10 13:43:31 +10:00
Neil Jenkins
dd7034501f Return same node passed in to fixCursor function. 2013-04-10 10:47:42 +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
775b72ec88 Make Element#getPath more robust.
Won't throw an error if called on a node that is not part of a document, but
will now instead return the path from whatever the root element is down to the
node.
2013-01-30 11:28:36 +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
e4b5ea6ee8 If all text in inline tag deleted, remove tag. 2012-07-02 14:04:06 +10:00
Neil Jenkins
bf8598e060 Fix zero-width space character bug.
If the node containing the zero-width space character was merged by a call to
Range#mergeInlines, the character was not being removed, making for odd cursor
movement.
2012-04-10 15:42:47 +10:00
Neil Jenkins
543abca022 Workaround WebKit/IE can't focus empty text nodes. 2012-04-02 17:38:01 +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
70078355b7 Whitespace fix. 2012-03-08 15:19:43 +11:00
Neil Jenkins
e3ee4dad12 Whitespace cleanup. 2012-01-25 11:47:26 +11:00
Neil Jenkins
cfe9bea8b3 Opera collapses blocks with just spaces for data 2011-12-09 13:30:58 +11:00
Neil Jenkins
f1a714a179 <br>s should be added to every block in Webkit/Gecko 2011-11-16 19:24:43 +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
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
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
953ee3bfc7 Fix bug in FF on enter. 2011-11-02 18:46:45 +11:00
Neil Jenkins
ae09554883 Don't try to merge <br>s or <img>s etc. 2011-11-02 16:43:42 +11:00
Neil Jenkins
9dcbf45f4a Fix Range#get(Start|End)Block. 2011-11-02 16:31:46 +11:00