@tiptap/react 2.0.0-beta.19 → 2.0.0-beta.195

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +2 -2
  2. package/dist/packages/react/src/BubbleMenu.d.ts +6 -3
  3. package/dist/packages/react/src/Editor.d.ts +1 -1
  4. package/dist/packages/react/src/EditorContent.d.ts +2 -2
  5. package/dist/packages/react/src/FloatingMenu.d.ts +6 -3
  6. package/dist/packages/react/src/NodeViewContent.d.ts +1 -1
  7. package/dist/packages/react/src/NodeViewWrapper.d.ts +1 -1
  8. package/dist/packages/react/src/ReactNodeViewRenderer.d.ts +12 -6
  9. package/dist/packages/react/src/ReactRenderer.d.ts +12 -9
  10. package/dist/packages/react/src/index.d.ts +6 -6
  11. package/dist/packages/react/src/useEditor.d.ts +2 -1
  12. package/dist/packages/react/src/useReactNodeView.d.ts +1 -0
  13. package/dist/tiptap-react.cjs.js +227 -152
  14. package/dist/tiptap-react.cjs.js.map +1 -1
  15. package/dist/tiptap-react.esm.js +227 -150
  16. package/dist/tiptap-react.esm.js.map +1 -1
  17. package/dist/tiptap-react.umd.js +229 -154
  18. package/dist/tiptap-react.umd.js.map +1 -1
  19. package/package.json +18 -12
  20. package/src/BubbleMenu.tsx +37 -15
  21. package/src/Editor.ts +2 -1
  22. package/src/EditorContent.tsx +9 -7
  23. package/src/FloatingMenu.tsx +37 -14
  24. package/src/NodeViewContent.tsx +10 -3
  25. package/src/NodeViewWrapper.tsx +11 -8
  26. package/src/ReactNodeViewRenderer.tsx +76 -32
  27. package/src/ReactRenderer.tsx +58 -25
  28. package/src/index.ts +6 -6
  29. package/src/useEditor.ts +16 -4
  30. package/src/useReactNodeView.ts +1 -0
  31. package/CHANGELOG.md +0 -170
  32. package/LICENSE.md +0 -21
  33. package/dist/tiptap-react.bundle.umd.min.js +0 -54
  34. package/dist/tiptap-react.bundle.umd.min.js.map +0 -1
package/src/useEditor.ts CHANGED
@@ -1,5 +1,6 @@
1
- import { useState, useEffect } from 'react'
2
1
  import { EditorOptions } from '@tiptap/core'
2
+ import { DependencyList, useEffect, useState } from 'react'
3
+
3
4
  import { Editor } from './Editor'
4
5
 
5
6
  function useForceUpdate() {
@@ -8,21 +9,32 @@ function useForceUpdate() {
8
9
  return () => setValue(value => value + 1)
9
10
  }
10
11
 
11
- export const useEditor = (options: Partial<EditorOptions> = {}) => {
12
+ export const useEditor = (options: Partial<EditorOptions> = {}, deps: DependencyList = []) => {
12
13
  const [editor, setEditor] = useState<Editor | null>(null)
13
14
  const forceUpdate = useForceUpdate()
14
15
 
15
16
  useEffect(() => {
17
+ let isMounted = true
18
+
16
19
  const instance = new Editor(options)
17
20
 
18
21
  setEditor(instance)
19
22
 
20
- instance.on('transaction', forceUpdate)
23
+ instance.on('transaction', () => {
24
+ requestAnimationFrame(() => {
25
+ requestAnimationFrame(() => {
26
+ if (isMounted) {
27
+ forceUpdate()
28
+ }
29
+ })
30
+ })
31
+ })
21
32
 
22
33
  return () => {
23
34
  instance.destroy()
35
+ isMounted = false
24
36
  }
25
- }, [])
37
+ }, deps)
26
38
 
27
39
  return editor
28
40
  }
@@ -2,6 +2,7 @@ import { createContext, useContext } from 'react'
2
2
 
3
3
  export interface ReactNodeViewContextProps {
4
4
  onDragStart: (event: DragEvent) => void,
5
+ nodeViewContentRef: (element: HTMLElement | null) => void,
5
6
  }
6
7
 
7
8
  export const ReactNodeViewContext = createContext<Partial<ReactNodeViewContextProps>>({
package/CHANGELOG.md DELETED
@@ -1,170 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- # [2.0.0-beta.19](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.18...@tiptap/react@2.0.0-beta.19) (2021-04-11)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * fix using react node views with insertContent ([ea0992f](https://github.com/ueberdosis/tiptap-next/commit/ea0992f66e9942c590e75c0ab2f5705640764f4d))
12
-
13
-
14
-
15
-
16
-
17
- # [2.0.0-beta.18](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.17...@tiptap/react@2.0.0-beta.18) (2021-04-08)
18
-
19
- **Note:** Version bump only for package @tiptap/react
20
-
21
-
22
-
23
-
24
-
25
- # [2.0.0-beta.17](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.16...@tiptap/react@2.0.0-beta.17) (2021-04-08)
26
-
27
-
28
- ### Bug Fixes
29
-
30
- * improve node view error message ([536663f](https://github.com/ueberdosis/tiptap-next/commit/536663f816039df6e3d8de23989f343d78e5d08e))
31
- * make `as` prop optional ([f8dec5f](https://github.com/ueberdosis/tiptap-next/commit/f8dec5f905baf5692dd257b3dddec3de2bcad1a1))
32
-
33
-
34
-
35
-
36
-
37
- # [2.0.0-beta.16](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.15...@tiptap/react@2.0.0-beta.16) (2021-04-07)
38
-
39
- **Note:** Version bump only for package @tiptap/react
40
-
41
-
42
-
43
-
44
-
45
- # [2.0.0-beta.15](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.14...@tiptap/react@2.0.0-beta.15) (2021-04-07)
46
-
47
- **Note:** Version bump only for package @tiptap/react
48
-
49
-
50
-
51
-
52
-
53
- # [2.0.0-beta.14](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.13...@tiptap/react@2.0.0-beta.14) (2021-04-04)
54
-
55
-
56
- ### Features
57
-
58
- * render wrapper element for inline node views as span, fix [#242](https://github.com/ueberdosis/tiptap-next/issues/242) ([bdb5d72](https://github.com/ueberdosis/tiptap-next/commit/bdb5d724956c0c757e29be38fb2c9dd85d8fd36b))
59
-
60
-
61
-
62
-
63
-
64
- # [2.0.0-beta.13](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.12...@tiptap/react@2.0.0-beta.13) (2021-04-01)
65
-
66
- **Note:** Version bump only for package @tiptap/react
67
-
68
-
69
-
70
-
71
-
72
- # [2.0.0-beta.12](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.11...@tiptap/react@2.0.0-beta.12) (2021-04-01)
73
-
74
- **Note:** Version bump only for package @tiptap/react
75
-
76
-
77
-
78
-
79
-
80
- # [2.0.0-beta.11](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.10...@tiptap/react@2.0.0-beta.11) (2021-04-01)
81
-
82
- **Note:** Version bump only for package @tiptap/react
83
-
84
-
85
-
86
-
87
-
88
- # [2.0.0-beta.10](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.9...@tiptap/react@2.0.0-beta.10) (2021-04-01)
89
-
90
- **Note:** Version bump only for package @tiptap/react
91
-
92
-
93
-
94
-
95
-
96
- # [2.0.0-beta.9](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.8...@tiptap/react@2.0.0-beta.9) (2021-03-31)
97
-
98
- **Note:** Version bump only for package @tiptap/react
99
-
100
-
101
-
102
-
103
-
104
- # [2.0.0-beta.8](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.7...@tiptap/react@2.0.0-beta.8) (2021-03-31)
105
-
106
- **Note:** Version bump only for package @tiptap/react
107
-
108
-
109
-
110
-
111
-
112
- # [2.0.0-beta.7](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.6...@tiptap/react@2.0.0-beta.7) (2021-03-31)
113
-
114
- **Note:** Version bump only for package @tiptap/react
115
-
116
-
117
-
118
-
119
-
120
- # [2.0.0-beta.6](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.5...@tiptap/react@2.0.0-beta.6) (2021-03-28)
121
-
122
- **Note:** Version bump only for package @tiptap/react
123
-
124
-
125
-
126
-
127
-
128
- # [2.0.0-beta.5](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.4...@tiptap/react@2.0.0-beta.5) (2021-03-24)
129
-
130
- **Note:** Version bump only for package @tiptap/react
131
-
132
-
133
-
134
-
135
-
136
- # [2.0.0-beta.4](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.3...@tiptap/react@2.0.0-beta.4) (2021-03-18)
137
-
138
- **Note:** Version bump only for package @tiptap/react
139
-
140
-
141
-
142
-
143
-
144
- # [2.0.0-beta.3](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.2...@tiptap/react@2.0.0-beta.3) (2021-03-16)
145
-
146
- **Note:** Version bump only for package @tiptap/react
147
-
148
-
149
-
150
-
151
-
152
- # [2.0.0-beta.2](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-beta.1...@tiptap/react@2.0.0-beta.2) (2021-03-09)
153
-
154
- **Note:** Version bump only for package @tiptap/react
155
-
156
-
157
-
158
-
159
-
160
- # [2.0.0-beta.1](https://github.com/ueberdosis/tiptap-next/compare/@tiptap/react@2.0.0-alpha.2...@tiptap/react@2.0.0-beta.1) (2021-03-05)
161
-
162
- **Note:** Version bump only for package @tiptap/react
163
-
164
-
165
-
166
-
167
-
168
- # 2.0.0-alpha.2 (2021-02-26)
169
-
170
- **Note:** Version bump only for package @tiptap/react
package/LICENSE.md DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2020, überdosis GbR
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.