0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-23 07:43:52 -05:00
Commit graph

32 commits

Author SHA1 Message Date
Neil Jenkins
ca5c08e4d0 Cleanup nbsp-only text nodes. 2014-05-20 17:47:02 +10:00
Neil Jenkins
f9cb71a666 Remove Firefox's native table controls. 2014-05-20 13:55:11 +10:00
Neil Jenkins
85c458b2d2 Drop all formatting when breaking block quote.
We don't want the same formatting as the quote in the unquoted section.
2014-05-20 13:49:55 +10:00
Neil Jenkins
76b482b41f Fix off-by-one error trimming white space. 2014-04-30 15:15:54 +10:00
Neil Jenkins
996a0dd672 Trim meaningless white space from text nodes in cleanTree fn.
If a text node at the beinning of a block began with white-space, it would mean
some situations where we should be doing all the transformations for
enter/delete/backspace were being left to the browser.
2014-04-26 11:58:58 +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
712104cd99 Add kb shortcuts for making lists and +/- quote level. 2014-04-07 14:44:44 +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
a875d20f12 Rewrite <s> to <strike> in cleanTree fn. 2014-02-03 17:58:11 +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
08cc8172a8 Stop treating a non-breaking space as white-space.
Its effect is that of a normal character in HTML, that just happens to render
as a space.
2013-11-04 18:21:57 +11:00
Neil Jenkins
0b3df54b6e IE11 Compatibility 2013-10-08 16:44:08 +11:00
Neil Jenkins
5d30a85aa8 Fix broken this reference in afterCut handler. 2013-07-18 15:49:21 +10:00
Neil Jenkins
f918a0106b Fix method call names in _onCut handler. 2013-07-17 17:13:04 +10:00
Neil Jenkins
731a1da910 Fix wrong method name & invalid this. 2013-07-17 16:13:29 +10:00
Neil Jenkins
02a647c574 Fix reference to old range method.
Now a function instead.
2013-07-17 11:35:34 +10:00
Neil Jenkins
d2e9d2214b Fix broken references to this.
The clean functions used a `this` reference to call createElement, but are
called as functions not methods so `this` is undefined. Instead, we'll get the
ownerDocument off the nodes passed in, then call the createElement function
directly.
2013-07-17 11:13:49 +10: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
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
dbda1fa4ed On paste, ignore image if text/html present.
If you copy a portion of text from word, it includes an image version of the text as well as an HTML version. On paste, we now ignore the image
representation on the clipboard if an HTML representation is present, so that
the text pastes as expected, rather than as an image.
2013-06-03 15:34:51 +10:00
Neil Jenkins
946afc9a17 Support add/removing listeners whilst firing event
If you removed an event listener whilst it was being fired, this would alter the
list of handlers, which would cause the fireEvent function to read past the end
of the array (and to skip the next listener). Now, we clone the array of
listeners before firing, so adding/removing listeners has no effect on an
already firing event.
2013-05-24 14:02:12 +10:00
Neil Jenkins
87c0f3fbe1 Fix Cmd-left/right bug in Firefox on Mac OS X.
Firefox incorrectly goes back/forward in history instead of moving the cursor to
the beginning/end of the line when you press cmd-left/right on a mac. We now
override this to do the right thing.
2013-05-20 16:14:28 +10:00
Neil Jenkins
03818bd3e8 Log error if addEventListener called with null fn 2013-05-20 11:43:08 +10:00
Neil Jenkins
1fbc166226 Ignore IMGs when stripping empty inlines.
When cleaning up pasted content, we remove any empty inline tags. However, we
should not be stripping <img> tags (which are of course both inline and empty).
2013-05-17 17:24:00 +10:00
Neil Jenkins
4c5b157d09 Fix KB bold/italic etc. shortcuts in Webkit.
Webkit needs a special placeholder text node as it can't focus empty text nodes.
This was being cleaned up too early, before the user had a chance to enter any
text.
2013-04-18 13:59:08 +02:00
Neil Jenkins
20f92c9785 Always return nodeAfterSplit from split fn 2013-04-10 13:43:31 +10:00
Neil Jenkins
77b0b6c716 Check for null start block in backspace handler. 2013-04-10 11:08:40 +10:00
Neil Jenkins
dd7034501f Return same node passed in to fixCursor function. 2013-04-10 10:47:42 +10:00
Neil Jenkins
e1bae30a16 Make editor.insertElement support block elements. 2013-04-08 13:48:06 +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