Commit Graph

50 Commits

Author SHA1 Message Date
Nick the Sick
69917881ce
chore: merge branch 'main' into develop 2024-05-29 10:17:05 +02:00
REMY Matthieu
393d83e199
fix(suggestion): unused parameter oldState in apply. (#4771) 2024-05-23 22:20:39 +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
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
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
Eric Bailey
ad47c49298 allow users to pass a custom findSuggestionMatch 2023-11-17 12:25:44 +01:00
Ben Asher
e97630c639
Require file extensions for imports and exports (#4001)
* Require .js endings

* add extension alias for cypress to resolve ts files with js endings
2023-06-30 21:03:49 +02:00
Dominik
f387ad3dd4
feat(pm): new prosemirror package for dependency resolving
* chore:(core): migrate to tsup

* chore: migrate blockquote and bold to tsup

* chore: migrated bubble-menu and bullet-list to tsup

* chore: migrated more packages to tsup

* chore: migrate code and character extensions to tsup

* chore: update package.json to simplify build for all packages

* chore: move all packages to tsup as a build process

* chore: change ci build task

* feat(pm): add prosemirror meta package

* rfix: resolve issues with build paths & export mappings

* docs: update documentation to include notes for @tiptap/pm

* chore(pm): update tsconfig

* chore(packages): update packages

* fix(pm): add package export infos & fix dependencies

* chore(general): start moving to pm package as deps

* chore: move to tiptap pm package internally

* fix(demos): fix demos working with new pm package

* fix(tables): fix tables package

* fix(tables): fix tables package

* chore(demos): pinned typescript version

* chore: remove unnecessary tsconfig

* chore: fix netlify build

* fix(demos): fix package resolving for pm packages

* fix(tests): fix package resolving for pm packages

* fix(tests): fix package resolving for pm packages

* chore(tests): fix tests not running correctly after pm package

* chore(pm): add files to files array

* chore: update build workflow

* chore(tests): increase timeout time back to 12s

* chore(docs): update docs

* chore(docs): update installation guides & pm information to docs

* chore(docs): add link to prosemirror docs

* fix(vue-3): add missing build step

* chore(docs): comment out cdn link

* chore(docs): remove semicolons from docs

* chore(docs): remove unnecessary installation note

* chore(docs): remove unnecessary installation note
2023-02-02 17:37:33 +01:00
Alejandro García Salas
154a82a007
Update suggestion.ts
fixes typo
2022-11-04 15:18:56 -07:00
Dominik Biedebach
b38c9eb139 fix(suggestion): revert #3239 2022-11-04 12:32:01 +01:00
matrixbirds
04b9da4760
fix(suggestion): set default allowedPrefixes null (#3239)
Co-authored-by: Zoe.L <yang.li06@mihoyo.com>
2022-09-29 15:20:08 +02:00
Faleij
791c89d943
Make Suggestion use view.dom instead of document (#3093) 2022-08-22 14:23:46 +02:00
Ricardo Amaral
482cb960d6
feat: Allow multiple prefix characters to trigger a suggestion (#2896)
* feat: Allow multiple prefix characters to trigger a suggestion

* review: Turn `allowedPrefixes` into an array instead
2022-06-21 23:17:26 +02:00
Dominik
53e39d0c47
refactor(maintainment): set dependency versions for prosemirror and y… (#2904)
* refactor(maintainment): set dependency versions for prosemirror and yjs to fixed versions

* refactor(docs): fix dependency versions in demos

* chore: update package-lock.json

* chore: update latest prosemirror packages
2022-06-21 00:17:10 +02:00
Dominik
1ebc8f8e14
chore: migrate to new versions of prosemirror packages (#2854)
* refactor: upgrade prosemirror packages to new typescript versions

* refactor: migrate to new typings from prosemirror

* style: fix linting issues

* style: fix linting issues

* style: fix linting issues

* fix(ci): fix build process by reimplement filterTransaction

* fix(extension-test): fix broken build because of wrong output file names

* fix: fix prosemirror-tables not being bundled correctly for ES6

* fix: move to prosemirror-tables-contently until es6 build is working

* fix: fix tests for youtube

* fix: fix youtube test

* fix(demos): fix demos build
2022-06-20 11:45:37 +02:00
Dominik
8c6751f0c6
add precommit hook for linting and automatic eslint fixes + update eslint packages (#2862)
* chore: add precommit hook for eslint fixes, fix linting issues
* chore: add eslint import sort plugin
2022-06-08 14:10:25 +02:00
Dominik
f019f70a19
fix(suggestion): 🐛 make clientrect prop optional as it can potentially be undefined (#2813)
This commit makes the clientRect prop optional - this means that this value can be null. This allows developers using the suggestion extension to know that they have to implement a check for the clientRect before using it.

#2795
2022-05-27 12:31:46 +02:00
Ricardo Amaral
7cae9673f0 feat: Add a generic type for suggestion items 2022-04-28 14:23:00 +02:00
Ricardo Amaral
70cb809702 feat: Add onBeforeStart and onBeforeUpdate handlers to the render function 2022-04-28 12:22:16 +02:00
Scott Sidwell
45990cdc0f fix: prevent suggestions from being active when editor is readonly 2022-04-10 12:14:42 +10:00
Philipp Kühn
55fa220899 fix: fixes an error when using the mention extension and pasting text ending with "@", fix #2413 2022-01-21 09:29:36 +01:00
Philipp Kühn
5d2ef71d33 fix: call onExit hook when editor is destroyed, fix #1645 2021-12-04 23:24:21 +01:00
Philipp Kühn
a6f731af39
feat!: Add editor to items prop in suggestion plugin (#2082)
* add editor to items prop

* docs: update content
2021-10-25 09:42:41 +02:00
Ruben Robles
4a6c3cbaac
fix: Add type for async items on suggestions (fix TS strict types complaining) (#1912) 2021-09-20 11:02:40 +02:00
Jakob Košir
4dd0d6d4dc
feat: allow triggering suggestions without prefix space (#1826, fix #1384) 2021-09-06 22:25:41 +02:00
Philipp Kühn
839acc1d9f fix: get correct clientRect when using async suggesteion items, fix #1782 2021-08-23 22:13:51 +02:00
Philipp Kühn
9789372cea fix: improve suggestion handling for chinese input, fix #1449 2021-08-13 15:13:19 +02:00
Philipp Kühn
7cf3350a83 fix: add pluginKey option to suggestion plugin, fix #1282 2021-08-13 13:14:54 +02:00
Philipp Kühn
a0444b5ec3 code style 2021-08-09 15:21:44 +02:00
dkrym
60606f99a1
fix: use correct state when doc changed externally (#1646) 2021-08-09 15:20:46 +02:00
Philipp Kühn
07c6d51338 fix: fix type for clientRect 2021-04-16 23:33:30 +02:00
Philipp Kühn
33773c01f3 add allow option to suggestion extension 2021-02-07 20:38:33 +01:00
Philipp Kühn
aef0acf53d fix bug in suggestion extension, fix #143 2021-02-07 20:00:13 +01:00
Philipp Kühn
319eb83303 rename suggestion command argument 2021-01-21 12:28:58 +01:00
Philipp Kühn
faa8842698 fix tippy position 2021-01-20 11:32:58 +01:00
Philipp Kühn
8f95eb6aed add decorationTag and decorationClass option 2021-01-20 10:47:31 +01:00
Philipp Kühn
ba0d379101 add editor to suggestion command props 2021-01-20 09:23:44 +01:00
Philipp Kühn
7a9b1f5c46 refactoring 2021-01-19 20:45:18 +01:00
Philipp Kühn
6b517a47ef refactoring 2021-01-19 12:28:33 +01:00
Philipp Kühn
7712325ba9 fix mention rendering 2021-01-19 12:03:38 +01:00
Philipp Kühn
c13d65c842 refactoring 2021-01-19 10:09:32 +01:00
Philipp Kühn
aaa0832883 refactoring 2021-01-18 23:41:38 +01:00
Philipp Kühn
dd3a2ce490 improve styling 2021-01-18 16:54:02 +01:00
Philipp Kühn
7adc8b24a0 add basic keyboard navigation 2021-01-18 16:45:49 +01:00
Philipp Kühn
f96dff1f0f add tippy 2021-01-18 12:40:13 +01:00
Philipp Kühn
9f0ae94201 refactoring 2021-01-15 15:58:39 +01:00
Philipp Kühn
decabc09c6 refactoring 2021-01-15 14:49:28 +01:00
Philipp Kühn
3d28386e11 maybe improve text match 2021-01-15 09:55:15 +01:00
Philipp Kühn
a5d28a0184 refactoring 2021-01-15 09:25:50 +01:00
Philipp Kühn
5a9b96aaf0 add basic mention extension 2020-12-17 17:13:35 +01:00