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

674 commits

Author SHA1 Message Date
Alexander Gratzl
819960f777 Revert "updated package name so I can use it for my project until PR is merged"
This reverts commit 878a1a702a.
2024-12-02 13:13:29 +01:00
Alexander Gratzl
878a1a702a updated package name so I can use it for my project until PR is merged
(cherry picked from commit 63e40ef299)
2024-12-02 13:11:57 +01:00
Alexander Gratzl
5b74cbec2c Revert "updated package name so I can use it for my project until PR is merged"
This reverts commit 63e40ef299.
2024-12-02 12:01:22 +01:00
Alexander Gratzl
63e40ef299 updated package name so I can use it for my project until PR is merged 2024-12-02 12:00:00 +01:00
Alexander Gratzl
cfd5b8460c ran eslint fix and prettier 2024-11-29 14:51:04 +01:00
Alexander Gratzl
2293b4a12b #472 fixed contenteditable=false elements being merged when they shouldn't, fixed compilation error caused by missing nullcheck 2024-11-29 14:49:13 +01:00
Alexander Gratzl
bb795b04bb #472 when inserting an element, correctly place range position AFTER contenteditable=false element instead of inside 2024-11-29 12:34:39 +01:00
Alexander Gratzl
0388bcb640 #472 fixed contenteditable inline element being split when pressing enter 2024-11-29 12:13:34 +01:00
Neil Jenkins
cbd8881e78 Release v2.3.2 2024-08-16 16:02:44 +10:00
Neil Jenkins
671319d316 Always fire pathChange event on selection change
This lets you reliably hook into the pathChange event to know when
to recalculate button state for bold, italic, etc.

Resolves #465
2024-08-16 15:59:43 +10:00
Neil Jenkins
aa29157969 Fix backspace at beginning of quote deletes block
Fixes #468
2024-08-16 15:52:29 +10:00
Neil Jenkins
34952705f2 Release v2.3.1 2024-07-23 14:17:32 +10:00
Neil Jenkins
3c8f0cd89b Fix crash extracting contents of range
endContainer can be null here.
2024-07-23 14:16:36 +10:00
Neil Jenkins
af26ba85d2 Release v2.3.0 2024-07-18 13:08:36 +10:00
Neil Jenkins
4d0836c670 Add the html to the willPaste event details
The fragment is still the important thing, but this lets the willPaste
handler look at the original HTML as part of its processing too.
2024-07-18 13:05:47 +10:00
Neil Jenkins
e00a62e6fa Add comment to HTML on copy
This lets us detect on paste if the copy (probably) came from Squire.
2024-07-18 13:05:11 +10:00
Neil Jenkins
3def29e081 Fix merging text nodes after delete
startContainer is not necessarily a sibling to endContainer at this
point. endContainer is definitely at the right level of the hierarchy
so instead just get the previous sibling from this and merge with that
if it's also a text node.
2024-07-18 13:04:35 +10:00
Neil Jenkins
196f325fc0 Release v2.2.9 2024-07-17 16:21:35 +10:00
Neil Jenkins
ac5972b7e3 Fix code formatting in tests 2024-07-17 16:18:59 +10:00
Neil Jenkins
4156fb11d6 Reformat code to new prettier style 2024-07-17 15:26:08 +10:00
Neil Jenkins
4e697df3c7 Update npm packages 2024-07-17 15:25:09 +10:00
Neil Jenkins
4cecb3c366 Expose editor global variable in Demo.html
For easier experimentation.
2024-07-17 15:19:49 +10:00
Neil Jenkins
077d29e778 Move range down tree for font info
This means if the selection is equivalent to just being inside a text
node, you'll get back the font info.

Resolves #462
2024-07-17 15:19:31 +10:00
Neil Jenkins
333d5fbd09 Remove ZWS and parent empty inlines on blur
Resolves #461
2024-07-17 15:18:27 +10:00
Neil Jenkins
72bfb9232f Release v2.2.8 2024-03-04 11:24:34 +11:00
Neil Jenkins
d2e211796b Fix undo shortcut sometimes not working
Same deal - does the Shift modifier also modify the character? Just
allow both.

Fixes #457.
2024-03-04 11:22:10 +11:00
Neil Jenkins
46bc36861e Fix Shift-number shortcuts don't work on windows
The perennial issue of should keyboard shortcuts be about the character
or the key!
2024-03-04 10:52:07 +11:00
Chasen Stark
43799dc57d Editor.ts: Revert fix for Grammarly bug
The fix for Grammarly bug prevents pasting text directly from the keyboard on Android if the text to be
inserted contains \n, as pasting from the keyboard does not fire a true paste event. The Grammarly bug seems to have been
fixed in Samsung keyboard as of v5.6.10.4.
2024-02-22 13:28:17 -05:00
Neil Jenkins
38754f17f9 Release v2.2.7 2024-02-21 11:57:57 +11:00
Neil Jenkins
d23363e153 Update dependencies 2024-02-21 11:55:31 +11:00
Illia Kyselov
4d2c80de92 fix(Editor): make willPaste custom event to be cancelable 2024-02-21 11:51:05 +11:00
Neil Jenkins
73e9d083dd Fix handling of Japanese IME input
With the modern keyboard events, the Backspace/Enter handlers were being
triggered even when they were part of an IME composition, which broke
the native IME handling. We now ignore all keyboard events that are part
of composition to avoid this issue.
2024-02-01 21:24:11 +11:00
Neil Jenkins
b415665d01 Release v2.2.6 2024-02-01 11:51:02 +11:00
Neil Jenkins
6cfd85bd8e Add undo point for automatic list creation
If you do `*` then space or `1. ` then space at the beginning of a line,
we automatically create a list. Now you can use undo to undo just the
automatic list creation, reverting to the plain text you typed.
2023-12-20 14:17:34 +11:00
Neil Jenkins
3804ea50ba Use modern keyboard event properties
The keyboard event handling code was written over a decade ago and we
have better APIs now! More importantly, the old APIs are deprecated, so
we should stop using them.

Fixes #450
2023-12-20 14:17:34 +11:00
Neil Jenkins
752a42d917 Fix Firefox cursor position bug after paste
We merge a faux block with contents from after a split point when
inserting HTML. The merge function presumes this block has already had
fixCursor run on it to ensure we add the <br>s some browsers need to
support correct cursor focusing.

Fixes #451
2023-12-20 14:17:34 +11:00
Neil Jenkins
c0479f3fdf Fix missing assignment in fixCursor
The parent variable was introduced in the Typescript refactor to make
the type checker happy, however we missed assigning the result back to
the `node` variable at the end.

Fixes #449
2023-12-20 10:45:19 +11:00
Chasen Stark
949b5b227e Editor.ts: Update insertText comment to address keyboard 'paste' bug 2023-11-30 13:09:40 -05:00
Neil Jenkins
8bee51683b Release v2.2.5 2023-11-08 09:45:59 +01:00
Neil Jenkins
efdff6c71b Focus editor after undo/redo
This matches the behaviour of all the other commands, and means if you
add toolbar buttons for undo/redo they work as expected.

Fixes #445.
2023-11-08 09:44:16 +01:00
Neil Jenkins
942486e452 Release v2.2.4 2023-10-24 12:47:02 +11:00
Ioan Moldovan
ff7babcdd3 fix: invalid setKeyHandler key parameter type 2023-10-24 12:45:07 +11:00
Neil Jenkins
69e03f4cf5 Release v2.2.3 2023-10-09 11:53:59 +11:00
Neil Jenkins
1ed32e3db7 Squire: Fix crash removing formatting
The fixer node may get removed when merging adjacent inlines, so move
the cleanup to before this. For safety, also properly check for non-null
nodes so we don't crash if it's still elided for some reason.
2023-10-09 11:52:58 +11:00
Neil Jenkins
311b8ee39e Release v2.2.2 2023-10-04 12:29:58 +11:00
Neil Jenkins
57f2d37c1d Work around Chrome bug not rendering text
There seems to be a bug in Chrome where it will sometimes not render
some of the text in the DOM when there are multiple zero-width spaces
around the beginning and ends of inline tags (not sure on the exact
details).

Steps to reproduce (prior to this commit):

1. Turn on bold and underlined text
2. Type something in bold and underlined text
3. Turn off bold and underline
4. Try to type something — it will not show up! That is, until you press
   the enter key and we remove the zero-width spaces.
2023-10-04 12:28:38 +11:00
Neil Jenkins
9cef52d963 Release v2.2.1 2023-10-03 11:14:27 +11:00
Neil Jenkins
cc32c7dd7e Fix empty string on clipboard if plainTextOnly
If extractRangeToClipboard was called with a toPlainText fn and
plainTextOnly=true, and there was a selection that was not just inside
a single text node, it was not actually getting the text to add to the
clipboard.
2023-10-03 11:13:02 +11:00
Neil Jenkins
9f3e2610a6 Release v2.2.0 2023-10-02 13:46:50 +11:00
Neil Jenkins
950e122c5c Improve default plain text cut/copy
Instead of using innerText, this now uses the getTextContentsOfRange
helper fn to work out the white space, so is consistent with the
editor's getSelectedText method and should be higher fidelity.

Note, you can still override the behaviour by supplying a toPlainText
fn in the editor config (such as the one you can find at
https://github.com/fastmail/overture/blob/master/source/html/toPlainText.js)
2023-10-02 13:27:19 +11:00