0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2025-01-03 13:16:31 -05:00
Commit graph

44 commits

Author SHA1 Message Date
Neil Jenkins
73f18523a2 Remove unused variables 2020-07-14 12:12:45 +10:00
Nicholas Wylie
a3de6add71 Update shortcuts to toggle lists
Previously ctrl+shift+{7,8} would make an (un)ordered list but
hitting the shortcut again would have no effect. This change
causes the list to be removed when triggering the shortcut while
inside the list.
2020-06-25 16:00:06 +10:00
Nicholas Wylie
bb3cd05c64 Move cursor outside of <a> when inserting HTML
When links are pasted into the editor the cursor ends up at the
end of the text node inside the parent <a> element. Any text
entered is then appended to the end of the link text. Chrome
automatically moves the cursor after the end of <a> elements when
additional text is inserted, so this change enforces the same
behaviour in other browsers.

Resolves LP 55607264
https://app.liquidplanner.com/space/14822/projects/show/55607264
2020-06-04 15:02:03 +10:00
Nicholas Wylie
85e39333dc Map Cmd-[] to change list level when in list
These shortcuts alter the indentation level of blockquotes. When inside a list this is probably not the behaviour the user would expect. This change alters the functionality to increase/decrease the list indentation level instead of wrapping the list item in a blockquote when inside a list.

Co-authored-by: Neil Jenkins <neil@nmjenkins.com>
2020-05-19 14:45:05 +10:00
Neil Jenkins
6b3ce94406 Fix backspace sometimes not handled on mobile
With soft keyboards, e.g. on an iPhone, the shift key is automatically activated
when the cursor is at the beginning of the paragraph. However, this meant that
when you hit backspace, we were not handling the event and the browser was doing
it for us, resulting in broken styling.
2020-05-11 11:16:11 +10:00
Neil Jenkins
e1e8ec78cb Remove uneditable container entirely on delete/backspace
If you backspace/delete to remove an uneditable block, we should be checking if
it's part of a larger uneditable container and if so removing the whole thing.
2020-03-29 13:42:15 +11:00
Neil Jenkins
58321e5504 Remove support for pre-Chromium Opera 2020-03-11 14:47:14 +11:00
Limon Monte
1850e2cdae Add config.addLinks 2019-12-30 13:14:33 +11:00
Neil Jenkins
9218c9ba14 Fix iOS auto-capitalisation on enter 2019-11-20 22:52:36 +08:00
Neil Jenkins
dcd121a65a Ignore shift key on enter on iOS 2019-11-20 22:10:05 +08:00
Neil Jenkins
5b998f5b6f Fix Kana-Kanji input on Mac Safari
Resolves #332
2018-10-15 08:40:10 +11:00
Neil Jenkins
b14ae45b38 Escape <a> on space even if in nested tags
Fixes #326
2018-10-05 16:25:28 +10:00
Neil Jenkins
625d10139e Add support for <pre>/<code> formatting 2018-07-27 10:47:38 +10:00
Neil Jenkins
e07150192f Make shift-enter always just add <br> 2018-07-27 09:23:26 +10:00
Neil Jenkins
db005b379b Make createRange method public 2018-05-09 17:43:11 +10:00
Neil Jenkins
389daab664 If ctrl/meta held down, key is not inserting text 2018-03-26 10:06:01 +01:00
Neil Jenkins
b0ac7d32d0 Handle all cases of overwriting content
Modern browsers tell you which character will be inserted with event.key, so
we can make sure we handle content deletion ourselves in these cases too.
2018-03-18 10:40:03 +00:00
Neil Jenkins
9dda7cc845 Fix FF does not leave <a> on space 2018-03-18 10:34:12 +00:00
Neil Jenkins
833d7dfdbd New (increase|decrease)ListLevel algorithms
Fixes #287
2017-08-15 11:11:48 +10:00
Neil Jenkins
48fabd491a Improved algorithm for inserting tree into range
Fixes #283
2017-07-19 14:29:16 +02:00
Neil Jenkins
bb593e879a Don't insert <br> inside end of <a> on enter
Fixes #271
2017-03-21 17:06:44 +11:00
Neil Jenkins
9596f4ecf8 Ensure moving boundaries up tree never passes root 2017-01-13 15:15:59 +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
Islam Sharabash
6a9582c7e7 Allowing arbitrary nesting for bullets
This allows any level of indentation for bullets. It does this by introducing
invalid HTML. In particular, you can make bullets like:

<ul>
  <ul>
    <li>foo</li>
  </ul>
</ul>
2016-09-27 05:50:59 +04:00
Neil Jenkins
d4abc182c8 If selection, delete contents before letting brower insert space
Fixes #213
2016-07-14 11:31:11 +10:00
Neil Jenkins
f593d8ac04 Enforce sane focus/blur events.
Because focus/blur events are fired synchonously, browsers can get confused if
UI code starts focusing other elements while inside a focus/blur handler, and
end up firing events in the wrong order which can cause infinite loops.

This change ensures we only get a focus/blur event when they really are
happening, and you always get one then the other.
2016-06-10 11:02:24 +10:00
Neil Jenkins
6c4f8e1aaf Add support for default <a> attributes
Resolves #186.
2016-05-05 11:50:36 +10:00
Neil Jenkins
923a0efd1a Fix delete/backspace removing content outside editor 2016-03-26 11:20:28 +11:00
Neil Jenkins
6a348e084b Make Squire work without an iframe(!) 2016-03-23 17:41:09 +11:00
Neil Jenkins
62616ef4ec Add saveUndoState method to public API
For #174
2016-03-11 15:58:32 +11:00
Neil Jenkins
6bafa1d140 Run fixContainers before merging blocks.
In case paste or something has got the document into a weird state with inline
content not inside a block.
2016-02-26 14:28:53 +11:00
Neil Jenkins
7330324d92 Fix Firefox throws error if initialised with display:none
Fixes #168.
2016-01-06 14:38:53 +11:00
Neil Jenkins
93f7867214 Fix Meta-Left/Right handling in Firefox.
Fixes #167.
2015-12-29 11:15:01 +11:00
Neil Jenkins
9ccf765ba8 Scroll cursor into view after setting selection.
Fixes #162 and fixes #165.
2015-12-09 15:12:47 +11:00
Neil Jenkins
bf8f796ea4 Add shift-tab keyboard shortcut.
If at beginning of list item, shift-tab decreases indent (to mirror tab to indent).
2015-11-17 16:50:55 +11:00
Neil Jenkins
162ec9049e Make scroll on enter logic independent of CSS.
Fixes #149.
2015-10-23 17:05:32 +01:00
Trey Cordova
85c9002ce5 Add tab nesting capability to list items with text in them;
- This requires your cursor to be at the beginning of the list item.
- This implementation mimics Google Docs.
2015-10-23 14:22:04 +02:00
Neil Jenkins
0ec3c43791 Don't prevent default on tab unless doing something.
Fixes #131.
2015-09-04 18:33:11 +01:00
Neil Jenkins
8d764f6638 Fix Chrome may replace <div> with <br> if you delete all content.
Fixes #108.
2015-07-13 06:39:07 -07:00
Neil Jenkins
a8fcd55cf4 Make event.preventDefault() cancel default key actions.
Fixes #107
2015-07-13 09:25:44 +07:00
Neil Jenkins
4f010a5de0 Override page up/down to match expected platform behaviour. 2015-06-25 11:02:56 +07:00
Neil Jenkins
395a5825e9 Split cleaning fns and clipboard handlers into separate file. 2015-06-19 14:18:32 +07:00
Neil Jenkins
09167c73e4 Make it possible to delete an <img> with display other than inline
Based on pull request #85 from dryoma.
2015-06-17 17:18:34 +07:00
Neil Jenkins
223060ecf9 Add method to set key handlers.
Resolves #70
2015-04-29 11:16:11 +07:00