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

76 commits

Author SHA1 Message Date
Neil Jenkins
a069e8305e Add accurate check for whether <br> breaks line.
When cleaning up <br> elements, we need to accurately determine whether there's
text before and after it in the block to know whether it will introduce a
visible line break.
2013-02-26 10:19:00 +11:00
Neil Jenkins
327b48b9db Save undo step on delete.
* But only if it's deleting whitespace or destroying a block or deleting a
  selection. This makes it undo deletion word-by-word rather than
  character-by-character.
2013-02-25 13:52:22 +11:00
Neil Jenkins
e3ad6c6b18 Fix allowed block regexp.
* Was not correctly matching full string only.
2013-02-25 11:05:26 +11:00
Neil Jenkins
0ba91e627d Rewrite all <br>s in cleanupBRs fn.
Previously, we were just removing <br>s that didn't have siblings on both sides. A better test is whether the containing block has any non-whitespace text content. If it does, the <br> is a line break and we can just split the block. If it doesn't though, we need to leave the <br> as a placeholder, to ensure the block doesn't collapse to 0 height.
2013-02-25 10:39:27 +11:00
Neil Jenkins
ac14985583 Remove empty inline nodes on paste. 2013-02-22 15:06:56 +11:00
Neil Jenkins
7162777a0f Only remove whitespace nodes if between blocks.
* When cleaning the tree we want to remove useless whitespace between block
  nodes, but we were being a bit too aggressive and removing all whitespace
  nodes. Now checks the context first.
2013-02-21 11:37:20 +11:00
Neil Jenkins
0bb3c142eb Rewrite <font> tags when cleaning tree.
* Converts to <span>.
2013-02-21 11:35:23 +11:00
Neil Jenkins
52e517b376 Catch all errors to allow logging.
* All errors will be caught and passed to the editor.didError fn. This can be
  overridden to do something useful, like logging them to the server.
2013-01-24 11:54:44 +11:00
Neil Jenkins
45711a38a4 Markup links on 'enter' too.
* Check for links in the current text node, and add <a> tags if found, when the
  enter key is pressed, not just when the spacebar is pressed.
2013-01-24 11:51:51 +11:00
Neil Jenkins
f49d1c190e Automatically markup <a> links on spacebar press.
* When spacebar is pressed, any URL-like text in the current text node will be
  wrapped in an <a> tag with the URL as the href.
2013-01-15 10:34:37 +11:00
Neil Jenkins
8b2090c94e Add <a> for ftp:// links on paste. 2013-01-15 10:34:03 +11:00
Neil Jenkins
bce3e8d208 Ensure IE not in compat-mode on demo page. 2013-01-15 10:32:21 +11:00
Neil Jenkins
8ccc9fad06 Add argument to getHTML to include bookmark.
* Selection is then automatically restored when HTML containing a bookmark is
  set.
2012-11-21 12:35:50 +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
1d83790a57 Fix Webkit scrolls to top on paste bug. 2012-11-12 11:51:46 +11:00
Neil Jenkins
388740c7f8 Fix bug in cut in Safari
* Safari 6 modifies the selection when bookmarking it. Ensure it is restored
  before the cut takes place.
2012-11-01 18:14:10 +11:00
Neil Jenkins
92645f1c0f Add extra check to loop. 2012-08-22 13:14:08 +02:00
Neil Jenkins
691058e071 Fix blur() function loses IE browser window focus. 2012-08-09 16:08:21 +10:00
Neil Jenkins
f9974ed7d9 Fix IE returns null for getSelection if never focussed. 2012-08-09 15:08:04 +10:00
Neil Jenkins
52a10d463c Tidy. Make backspace/delete aware of non-editable blocks 2012-08-08 16:20:28 +10:00
Neil Jenkins
f2090b05d0 Tidy. Ensure trailing new line in all source files 2012-08-07 13:36:05 +10:00
Neil Jenkins
50b7ad1e4e Treat pasted image as a drag-dropped image file. 2012-08-07 12:20:55 +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
0412ece8ec Fix blur method.
Have to blur the body, not the window.
2012-07-25 17:35:03 +10:00
Neil Jenkins
b87a9c26fe Add setTextDirection method.
Allows setting RTL or LTR text direction on a block level basis.
2012-07-24 15:59:36 +10:00
Neil Jenkins
c964a6a564 Fix bug in removing empty inlines on delete. 2012-07-02 16:44:10 +10:00
Neil Jenkins
e4b5ea6ee8 If all text in inline tag deleted, remove tag. 2012-07-02 14:04:06 +10:00
Neil Jenkins
819ddb296e Always restore range to textnodes.
When restoring a range from a bookmark, always call range.moveBoundariesDownTree
to anchor it to the nearest text node. If you call setSelection with a range not
anchored inside a textnode, Opera may incorrectly set the selection.
2012-06-19 14:43:10 +10:00
Neil Jenkins
c5abcde210 API rename (inc|dec)reaseQuoteLevel
Use full words in API method name for consistency with the rest of the API.
2012-04-12 11:42:07 +10:00
Neil Jenkins
98ebe661b2 Allow custom cleaning on paste.
A willPaste event is now fired just before pasted content is inserted into the
document, allowing custom, arbitrary modification of the pasted content, or
prevention of the paste event altogether.
2012-04-12 11:38:22 +10:00
Neil Jenkins
b6c659e295 Remove unused variables. 2012-04-12 09:22:58 +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
63a97d9b99 Fix IE8 grabs focus on load of editor. 2012-04-04 17:01:28 +10:00
Neil Jenkins
5c9420c7fa Fix bug in updating path correctly. 2012-04-03 20:35:07 +10:00
Neil Jenkins
9b5512bf98 Tidy up a few bits of code. 2012-04-02 17:38:19 +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
89eb88ce15 Fix repeating keys don't fire handlers.
Holding down a key will trigger it repeatedly; we need to capture all of these
events to override backspace/enter etc.
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
cfb08691c2 Don't focus body in non-Gecko.
Opera loses selection. Only Gecko seems to need it.
2012-03-29 17:55:15 +11:00
Neil Jenkins
f8273e7d15 Make email addresses into links on paste. 2012-03-08 15:13:32 +11:00
Neil Jenkins
64b8f9affa Fix focus method not working in Firefox. 2012-02-08 23:23:55 +11:00
Neil Jenkins
e3ee4dad12 Whitespace cleanup. 2012-01-25 11:47:26 +11:00
Neil Jenkins
78e8955be1 Work around iOS bug when setting selection. 2012-01-25 11:37:38 +11:00
Neil Jenkins
d413b1bb85 Automatically wrap URLs in <a> when pasting text. 2012-01-25 11:36:51 +11:00
Neil Jenkins
aa8527fc2c Fix bug in removing format. 2011-12-09 14:27:37 +11:00
Neil Jenkins
ceed1cfa81 Don't continue link over block break. 2011-12-09 13:53:09 +11:00
Neil Jenkins
14ee0d0ad5 Scroll cursor into view on enter. 2011-12-09 13:15:15 +11:00
Neil Jenkins
43634a3ba4 Add styles via separate API method.
<style></style> must not be included text supplied to setHTML call.
2011-11-17 18:37:49 +11:00
Neil Jenkins
a8e6e5b391 Merge adjacent containers on delete/backspace.
If you delete the line separating two containers (e.g. a blockquote), the
containers are merged.
2011-11-17 18:36:58 +11:00