Commit Graph

2256 Commits

Author SHA1 Message Date
Wilson Zhong
b45fb70fa8
fix(extension-table): update insertion position of new tables fix #5143
Typically when inserting a new table we want to select within the first cell of the newly inserted
table. This change should ensure that occurs even if original selection's head precedes the anchor.

fix #5143
2024-06-07 16:30:06 +02:00
Nick the Sick
e542330170
chore: upgrade y-prosemirror 2024-06-07 15:11:48 +02:00
Nick Perez
f635d7b4f5
fix: revert font-family escaping introduced by #4545 (#5164)
Using `CSS.escape` is the wrong tool for the job here:
 - it is meant for CSS selectors and does not handle CSS variables properly.
 - you can't use `var(--title)` as a font-family because it was getting escaped to `var\(--title\)`
2024-06-04 09:37:43 +02:00
Nick Perez
74bfdc5bef
feat: error handling of invalid content for a schema (#5178)
This change introduces two new top-level options to the editor: `enableContentCheck` & `onContentError` for dealing with content supplied that does not match the prose-mirror schema generated by the set of tiptap extensions.

`enableContentCheck` allows the app developer to opt into the behavior to check for invalid schemas (this change is otherwise backwards compatible).
When true, this will try to parse the document, and any content that does not match the schema will emit a `contentError` which can be listened to via the `onContentError` callback.
2024-06-04 09:32:54 +02:00
Stanislav Volar
8d1af5fbe5
fix: parse only available configured text-align values (#5169)
---------

Co-authored-by: volar <stanislav.volar@petitpress.sk>
Co-authored-by: Nick Perez <nicholas.perez@tiptap.dev>
2024-05-30 17:09:44 +02:00
LoneRifle
326c993628
build(deps): bump prosemirror-trailing-node to 2.0.8 (#4949) 2024-05-27 14:48:33 +02:00
Benjamin Kroeger
ef635db6c0
revert: remove 'whenNotEditable' as option for openOnClick" (#5040)
This reverts commit 0f41e389b3.

Co-authored-by: Nick Perez <nicholas.perez@tiptap.dev>
2024-05-24 16:58:58 +02:00
Nantris
e95140c889
fix: validate pasted links (#5061) 2024-05-24 14:02:37 +02:00
Aaron HS
ae14557906
fix: whitespace being stripped from generateJSON (#5158) 2024-05-24 13:55:45 +02:00
Liao Jinyuan
daa5e52ba2
fix(extension-code-block): #3604 paste code from vscode (#3606)
* fix(extension-code-block): paste code from vscode

* fix: remove unused import

* fix: put cursor inside the created code block

---------

Co-authored-by: Nick the Sick <nicholas.perez@tiptap.dev>
2024-05-17 07:50:14 +02:00
Steven DeMartini
f55171fb43
fix: types for Suggestion command, allowing generic overrides (#4136)
* Fix typing for Suggestion `command` with new MentionAttrs generic

As of
7cae9673f0,
new generics were added for Suggestion options and props. However,
there is a subtle bug in the current typing: the object selected with
the suggestion `command` need not have the same types as the `items` in
the suggestion options. For instance, in Tiptap's official demo
https://tiptap.dev/api/nodes/mention, the suggestion `items` are all
`string`s, but the selected Mention is of type `{id: string}` (which are
the attributes of the Mention node, as the Mention extension requires):

```ts
  const selectItem = index => {
    const item = props.items[index]

    if (item) {
      props.command({ id: item })
    }
  }
```

i.e., there should be no restriction that when you select something with
the suggestion `command`, it must use the identical structure as the
suggested items. When using the suggestion plugin with the Mention
extension, for instance, the value passed to the SuggestionProps
`props.command()` function must be a `Record<string, any>`, as it's
directly/exclusively used to set the `attrs` of a `Node` via
`insertContentAt` (and you need not use that shape for suggestion
options, as in the Tiptap example above):
44996d60be/packages/extension-mention/src/mention.ts (L42)
f869507396/packages/core/src/types.ts (L79)

This fixes the typing so that suggestions can correctly refer separately
to their own items (of any type), while ensuring the `command`ed item be
of whatever type is necessary (and so in the Mention context, could be
restricted further).

* Add generics to override selected suggestion type

---------

Co-authored-by: Steven DeMartini <sjdemartini@users.noreply.github.com>
2024-05-17 05:12:04 +02:00
Nick the Sick
738c436a9f
fix: disable parsing javascript: links, add tests 2024-05-16 17:10:15 +02:00
Christofer Roth
980b54f62b fix(extension-link): use whitelist for allowed href values 2024-05-16 09:05:42 +02:00
bdbch
6a581153d8 v2.4.0 2024-05-14 14:45:38 +02:00
Nick Perez
4db463c6bb
fix(core): configure should use the parent of the current instance, to avoid duplication (#5147) 2024-05-14 14:45:03 +02:00
bdbch
6049985c04
refactor(core): clean up constructor & extension setup in extension manager (#5035)
* refactor(core): refactor extension manager

* refactor(core): update comment for setupExtensions function
2024-05-14 14:43:53 +02:00
Nick Perez
1ff58aea21
test: get tests running on macOS again by leveraging built-in platform detection (#5144) 2024-05-14 14:42:57 +02:00
bdbch
d70e8a70b6
refactor(core): add jsdocs for utility functions (#5141)
* refactor(core): add jsdocs to utilitiy functions

* refactor(core): add jsdocs to more utility functions
2024-05-13 18:28:53 +02:00
bdbch
bc6d081fa1
refactor(core): add jsdoc comments for ExtensionManager (#5140) 2024-05-13 18:19:46 +02:00
bdbch
b941eea6da
feat: added jsdocs (#4356)
* added JSDocs for almost all extensions

* start adding commands jsdocs

* add jsdocs for rest of extensions

* add jsdocs for Extensions

* add js docs for all extensions

* add more jsdocs

* add js docs for node spec definitions
2024-05-11 14:30:44 +02:00
Illia Sakovich
edceec4898
Fix getTextBetween (#5055) 2024-05-10 02:51:22 +02:00
cosine
baff4af39e
fix: fix ts error for BubbleMenu and FloatingMenu in @tiptap/react (#5126) 2024-05-10 02:50:12 +02:00
echatzief
152c7cb8ae
fixed issue with blocking update attribute when we have multiple types at text-align-extension (#5097) 2024-05-10 02:32:59 +02:00
Nantris
c52a6026fc
Prevent history checkpoints during backspace in empty editor (#5063)
* Prevent history checkpoints during backspace in empty editor

* Remove errant comment/lint problem
2024-05-09 15:49:59 +02:00
Joel
3a21bc1d2f
Update Context.tsx (#5102) 2024-05-09 15:47:28 +02:00
Dominik Biedebach
ca4f13461e v2.3.2 2024-05-08 17:43:53 +02:00
bdbch
e307034088
upgrade y-prosemirror (#5124) 2024-05-08 17:41:53 +02:00
Dalius C
4900a27c53
fix: NodePos querySelectorAll function (#5094)
* fix nodepos queryselector

* fix NodePos querySelectorAll function

* tests

* remove test variable

* test fix
2024-05-08 12:22:13 +02:00
bdbch
dfd5ff5c6b v2.3.1 2024-04-30 17:27:07 +02:00
icode
ad89de3c86
Fix packing ySyncPluginOptions error (#5101)
* Fix package ySyncPluginOptions error

* remove semi
2024-04-30 17:25:56 +02:00
bdbch
7343c518ae
fix issue with code pasting from VS Code when at the last line of code (#5106) 2024-04-30 17:22:37 +02:00
Jan Thurau
e73073c020
Feature/y sync options: allow passing ySyncOptions to extension-collaboration (#4976)
* extension-collaboration: allow passing ySyncOptions

* fixes import
2024-04-11 19:16:44 +02:00
svenadlung
b132d9207d v2.3.0 2024-04-09 13:17:27 +02:00
bdbch
22ced31872
fix(core): fix nodepos child lookup (#5038) 2024-04-09 13:12:28 +02:00
Sven Adlung
96b6abcf6e
feat(core): apply input and paste rules when using insertContent methods (#5046) 2024-04-09 13:04:16 +02:00
Benjamin Kroeger
0f41e389b3
extension/link: adds 'whenNotEditable' as option for openOnClick (#3312)
* checks whenNotEditable condition in clickHandler

* passes whenNotEditable option from to helper

* adds docs for whenNotEditable

* adds  to ClickHandlerOptions type
2024-04-08 13:21:10 +02:00
Illia Sakovich
b7107832c0
Add blockSeparator option to clipboardTextSerializer core extension (#5019)
* Update clipboardTextSerializer.ts

* Update clipboardTextSerializer.ts

* feat(core): add core extension options to editor options

---------

Co-authored-by: Dominik Biedebach <dominik.biedebach@ueber.io>
2024-04-08 13:12:40 +02:00
Pontus Lundin
677642eda8
return invokation of command (#4882)
Co-authored-by: Pontus Lundin <pontus.lundin@klarna.com>
2024-04-06 19:02:55 +02:00
bdbch
e79523fb8b v2.2.6 2024-04-06 17:46:17 +02:00
bdbch
d78f99920d style(react): fix linting issues 2024-04-06 13:15:34 +02:00
Karol Firmanty
8d5077a1a5
fix editor cleanup (#4973) 2024-04-06 04:02:05 +02:00
Solomon Astley
1439a91624
check if (pos - 1) >= 0 before resolving in handleBackspace keymap helper (#4835)
Co-authored-by: bdbch <6538827+bdbch@users.noreply.github.com>
2024-04-06 01:30:39 +02:00
Myles J
d6c71a838d
fix: unexpected renderText() for contentful nodes (#3410) 2024-04-06 01:29:46 +02:00
Tommy-Sun
ee645c1eca
Optionally delete full mention chip (#3341)
* Optionally delete full mention chip

* Added documentation for deleteOnBackspace

* rename all references of deleteOnBackspace to deleteTriggerWithBackspace
2024-04-06 00:26:48 +02:00
bdbch
51c5e5fc5c fix linting issues in react exports 2024-04-06 00:15:52 +02:00
bdbch
0e5af53778 v2.2.5 2024-04-06 00:09:00 +02:00
MOHAMMAD RASIM
cc41c4c2d2 fix for data attributes not rendering after pr #4082 (#4980) 2024-04-05 23:55:44 +02:00
Ricardo Amaral
4474d056da
fix(extension-link): Avoid auto-linking partial text for invalid TLDs (#4865) 2024-03-28 22:00:24 +01:00
Laurens Lavaert
82979740a6
Export useReactNodeView (#4996) 2024-03-27 19:25:51 +01:00
Ricardo Amaral
aa029fe224
fix: Disallow only whitespace between markdown shortcuts delimiters (#4866) 2024-03-27 19:23:04 +01:00