tldraw 4.2.0-canary.fda2467026d5 → 4.2.0-next.47462e908ff5

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 (33) hide show
  1. package/dist-cjs/index.d.ts +3 -20
  2. package/dist-cjs/index.js +1 -1
  3. package/dist-cjs/index.js.map +2 -2
  4. package/dist-cjs/lib/ui/components/DebugMenu/DefaultDebugMenuContent.js +7 -10
  5. package/dist-cjs/lib/ui/components/DebugMenu/DefaultDebugMenuContent.js.map +2 -2
  6. package/dist-cjs/lib/ui/components/Toolbar/DefaultRichTextToolbar.js +2 -6
  7. package/dist-cjs/lib/ui/components/Toolbar/DefaultRichTextToolbar.js.map +2 -2
  8. package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js +1 -1
  9. package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js.map +2 -2
  10. package/dist-cjs/lib/ui/version.js +3 -3
  11. package/dist-cjs/lib/ui/version.js.map +1 -1
  12. package/dist-cjs/lib/utils/text/richText.js +6 -5
  13. package/dist-cjs/lib/utils/text/richText.js.map +3 -3
  14. package/dist-esm/index.d.mts +3 -20
  15. package/dist-esm/index.mjs +1 -1
  16. package/dist-esm/index.mjs.map +2 -2
  17. package/dist-esm/lib/ui/components/DebugMenu/DefaultDebugMenuContent.mjs +7 -10
  18. package/dist-esm/lib/ui/components/DebugMenu/DefaultDebugMenuContent.mjs.map +2 -2
  19. package/dist-esm/lib/ui/components/Toolbar/DefaultRichTextToolbar.mjs +2 -6
  20. package/dist-esm/lib/ui/components/Toolbar/DefaultRichTextToolbar.mjs.map +2 -2
  21. package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs +1 -1
  22. package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs.map +2 -2
  23. package/dist-esm/lib/ui/version.mjs +3 -3
  24. package/dist-esm/lib/ui/version.mjs.map +1 -1
  25. package/dist-esm/lib/utils/text/richText.mjs +6 -5
  26. package/dist-esm/lib/utils/text/richText.mjs.map +2 -2
  27. package/package.json +10 -10
  28. package/src/index.ts +0 -3
  29. package/src/lib/ui/components/DebugMenu/DefaultDebugMenuContent.tsx +7 -27
  30. package/src/lib/ui/components/Toolbar/DefaultRichTextToolbar.tsx +2 -6
  31. package/src/lib/ui/components/Toolbar/LinkEditor.tsx +1 -1
  32. package/src/lib/ui/version.ts +3 -3
  33. package/src/lib/utils/text/richText.ts +5 -5
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tldraw",
3
3
  "description": "A tiny little drawing editor.",
4
- "version": "4.2.0-canary.fda2467026d5",
4
+ "version": "4.2.0-next.47462e908ff5",
5
5
  "author": {
6
6
  "name": "tldraw Inc.",
7
7
  "email": "hello@tldraw.com"
@@ -55,15 +55,15 @@
55
55
  "src"
56
56
  ],
57
57
  "dependencies": {
58
- "@tiptap/core": "3.6.2",
59
- "@tiptap/extension-code": "3.6.2",
60
- "@tiptap/extension-highlight": "3.6.2",
61
- "@tiptap/extension-list": "3.6.2",
62
- "@tiptap/pm": "3.6.2",
63
- "@tiptap/react": "3.6.2",
64
- "@tiptap/starter-kit": "3.6.2",
65
- "@tldraw/editor": "4.2.0-canary.fda2467026d5",
66
- "@tldraw/store": "4.2.0-canary.fda2467026d5",
58
+ "@tiptap/core": "^2.9.1",
59
+ "@tiptap/extension-code": "^2.9.1",
60
+ "@tiptap/extension-highlight": "^2.9.1",
61
+ "@tiptap/extension-link": "^2.9.1",
62
+ "@tiptap/pm": "^2.9.1",
63
+ "@tiptap/react": "^2.9.1",
64
+ "@tiptap/starter-kit": "^2.9.1",
65
+ "@tldraw/editor": "4.2.0-next.47462e908ff5",
66
+ "@tldraw/store": "4.2.0-next.47462e908ff5",
67
67
  "classnames": "^2.5.1",
68
68
  "hotkeys-js": "^3.13.9",
69
69
  "idb": "^7.1.1",
package/src/index.ts CHANGED
@@ -241,10 +241,7 @@ export {
241
241
  DefaultDebugMenuContent,
242
242
  ExampleDialog,
243
243
  FeatureFlags,
244
- type CustomDebugFlags,
245
- type DebugFlagsProps,
246
244
  type ExampleDialogProps,
247
- type FeatureFlagsProps,
248
245
  } from './lib/ui/components/DebugMenu/DefaultDebugMenuContent'
249
246
  export { DefaultMenuPanel } from './lib/ui/components/DefaultMenuPanel'
250
247
  export {
@@ -29,17 +29,8 @@ import { TldrawUiMenuGroup } from '../primitives/menus/TldrawUiMenuGroup'
29
29
  import { TldrawUiMenuItem } from '../primitives/menus/TldrawUiMenuItem'
30
30
  import { TldrawUiMenuSubmenu } from '../primitives/menus/TldrawUiMenuSubmenu'
31
31
 
32
- /** @public */
33
- export interface CustomDebugFlags {
34
- customDebugFlags?: Record<string, DebugFlag<boolean>>
35
- customFeatureFlags?: Record<string, DebugFlag<boolean>>
36
- }
37
-
38
32
  /** @public @react */
39
- export function DefaultDebugMenuContent({
40
- customDebugFlags,
41
- customFeatureFlags,
42
- }: CustomDebugFlags) {
33
+ export function DefaultDebugMenuContent() {
43
34
  const editor = useEditor()
44
35
  const { addToast } = useToasts()
45
36
  const { addDialog } = useDialogs()
@@ -170,21 +161,15 @@ export function DefaultDebugMenuContent({
170
161
  <TldrawUiMenuItem id="throw-error" onSelect={() => setError(true)} label={'Throw error'} />
171
162
  </TldrawUiMenuGroup>
172
163
  <TldrawUiMenuGroup id="flags">
173
- <DebugFlags customDebugFlags={customDebugFlags} />
174
- <FeatureFlags customFeatureFlags={customFeatureFlags} />
164
+ <DebugFlags />
165
+ <FeatureFlags />
175
166
  </TldrawUiMenuGroup>
176
167
  </>
177
168
  )
178
169
  }
179
-
180
- /** @public */
181
- export interface DebugFlagsProps {
182
- customDebugFlags?: Record<string, DebugFlag<boolean>> | undefined
183
- }
184
-
185
170
  /** @public @react */
186
- export function DebugFlags(props: DebugFlagsProps) {
187
- const items = Object.values(props.customDebugFlags ?? debugFlags)
171
+ export function DebugFlags() {
172
+ const items = Object.values(debugFlags)
188
173
  if (!items.length) return null
189
174
  return (
190
175
  <TldrawUiMenuSubmenu id="debug flags" label="Debug flags">
@@ -196,14 +181,9 @@ export function DebugFlags(props: DebugFlagsProps) {
196
181
  </TldrawUiMenuSubmenu>
197
182
  )
198
183
  }
199
- /** @public */
200
- export interface FeatureFlagsProps {
201
- customFeatureFlags?: Record<string, DebugFlag<boolean>> | undefined
202
- }
203
-
204
184
  /** @public @react */
205
- export function FeatureFlags(props: FeatureFlagsProps) {
206
- const items = Object.values(props.customFeatureFlags ?? featureFlags)
185
+ export function FeatureFlags() {
186
+ const items = Object.values(featureFlags)
207
187
  if (!items.length) return null
208
188
  return (
209
189
  <TldrawUiMenuSubmenu id="feature flags" label="Feature flags">
@@ -117,9 +117,7 @@ function useEditingLinkBehavior(textEditor?: TiptapEditor) {
117
117
 
118
118
  textEditor.view.dom.addEventListener('click', handleClick)
119
119
  return () => {
120
- if (textEditor.isInitialized) {
121
- textEditor.view.dom.removeEventListener('click', handleClick)
122
- }
120
+ textEditor.view.dom.removeEventListener('click', handleClick)
123
121
  }
124
122
  }, [textEditor, isEditingLink])
125
123
 
@@ -195,9 +193,7 @@ function useIsMousingDownOnTextEditor(textEditor: TiptapEditor) {
195
193
  })
196
194
  return () => {
197
195
  touchDownEvents.forEach((eventName: string) => {
198
- if (textEditor.isInitialized) {
199
- textEditor.view.dom.removeEventListener(eventName, handlePointingDown)
200
- }
196
+ textEditor.view.dom.removeEventListener(eventName, handlePointingDown)
201
197
  })
202
198
  touchUpEvents.forEach((eventName: string) => {
203
199
  document.body.removeEventListener(eventName, handlePointingUp)
@@ -31,7 +31,7 @@ export function LinkEditor({ textEditor, value: initialValue, onClose }: LinkEdi
31
31
  link = `https://${link}`
32
32
  }
33
33
 
34
- textEditor.chain().setLink({ href: link }).run()
34
+ textEditor.commands.setLink({ href: link })
35
35
  // N.B. We shouldn't focus() on mobile because it causes the
36
36
  // Return key to replace the link with a newline :facepalm:
37
37
  if (editor.getInstanceState().isCoarsePointer) {
@@ -1,9 +1,9 @@
1
1
  // This file is automatically generated by internal/scripts/refresh-assets.ts.
2
2
  // Do not edit manually. Or do, I'm a comment, not a cop.
3
3
 
4
- export const version = '4.2.0-canary.fda2467026d5'
4
+ export const version = '4.2.0-next.47462e908ff5'
5
5
  export const publishDates = {
6
6
  major: '2025-09-18T14:39:22.803Z',
7
- minor: '2025-10-17T09:01:09.102Z',
8
- patch: '2025-10-17T09:01:09.102Z',
7
+ minor: '2025-10-17T10:30:50.909Z',
8
+ patch: '2025-10-17T10:30:50.909Z',
9
9
  }
@@ -8,6 +8,7 @@ import {
8
8
  } from '@tiptap/core'
9
9
  import Code from '@tiptap/extension-code'
10
10
  import Highlight from '@tiptap/extension-highlight'
11
+ import Link from '@tiptap/extension-link'
11
12
  import { Node } from '@tiptap/pm/model'
12
13
  import StarterKit from '@tiptap/starter-kit'
13
14
  import {
@@ -34,7 +35,6 @@ export const KeyboardShiftEnterTweakExtension = Extension.create({
34
35
 
35
36
  // We change the default Code to override what's in the StarterKit.
36
37
  // It allows for other attributes/extensions.
37
- // @ts-ignore this is fine.
38
38
  Code.config.excludes = undefined
39
39
 
40
40
  // We want the highlighting to take precedence over bolding/italics/links
@@ -52,10 +52,10 @@ export const tipTapDefaultExtensions: Extensions = [
52
52
  blockquote: false,
53
53
  codeBlock: false,
54
54
  horizontalRule: false,
55
- link: {
56
- openOnClick: false,
57
- autolink: true,
58
- },
55
+ }),
56
+ Link.configure({
57
+ openOnClick: false,
58
+ autolink: true,
59
59
  }),
60
60
  Highlight,
61
61
  KeyboardShiftEnterTweakExtension,