tldraw 4.2.0-next.d76c345101d5 → 4.2.0-next.e824a30c434e
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.
- package/dist-cjs/index.d.ts +20 -3
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/ui/components/DebugMenu/DefaultDebugMenuContent.js +10 -7
- package/dist-cjs/lib/ui/components/DebugMenu/DefaultDebugMenuContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultRichTextToolbar.js +6 -2
- package/dist-cjs/lib/ui/components/Toolbar/DefaultRichTextToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js +1 -1
- package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js.map +2 -2
- package/dist-cjs/lib/ui/version.js +3 -3
- package/dist-cjs/lib/ui/version.js.map +1 -1
- package/dist-cjs/lib/utils/text/richText.js +5 -6
- package/dist-cjs/lib/utils/text/richText.js.map +3 -3
- package/dist-esm/index.d.mts +20 -3
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/ui/components/DebugMenu/DefaultDebugMenuContent.mjs +10 -7
- package/dist-esm/lib/ui/components/DebugMenu/DefaultDebugMenuContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultRichTextToolbar.mjs +6 -2
- package/dist-esm/lib/ui/components/Toolbar/DefaultRichTextToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs +1 -1
- package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs.map +2 -2
- package/dist-esm/lib/ui/version.mjs +3 -3
- package/dist-esm/lib/ui/version.mjs.map +1 -1
- package/dist-esm/lib/utils/text/richText.mjs +5 -6
- package/dist-esm/lib/utils/text/richText.mjs.map +2 -2
- package/package.json +10 -10
- package/src/index.ts +3 -0
- package/src/lib/ui/components/DebugMenu/DefaultDebugMenuContent.tsx +27 -7
- package/src/lib/ui/components/Toolbar/DefaultRichTextToolbar.tsx +6 -2
- package/src/lib/ui/components/Toolbar/LinkEditor.tsx +1 -1
- package/src/lib/ui/version.ts +3 -3
- 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-next.
|
|
4
|
+
"version": "4.2.0-next.e824a30c434e",
|
|
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": "
|
|
59
|
-
"@tiptap/extension-code": "
|
|
60
|
-
"@tiptap/extension-highlight": "
|
|
61
|
-
"@tiptap/extension-
|
|
62
|
-
"@tiptap/pm": "
|
|
63
|
-
"@tiptap/react": "
|
|
64
|
-
"@tiptap/starter-kit": "
|
|
65
|
-
"@tldraw/editor": "4.2.0-next.
|
|
66
|
-
"@tldraw/store": "4.2.0-next.
|
|
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-next.e824a30c434e",
|
|
66
|
+
"@tldraw/store": "4.2.0-next.e824a30c434e",
|
|
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,7 +241,10 @@ export {
|
|
|
241
241
|
DefaultDebugMenuContent,
|
|
242
242
|
ExampleDialog,
|
|
243
243
|
FeatureFlags,
|
|
244
|
+
type CustomDebugFlags,
|
|
245
|
+
type DebugFlagsProps,
|
|
244
246
|
type ExampleDialogProps,
|
|
247
|
+
type FeatureFlagsProps,
|
|
245
248
|
} from './lib/ui/components/DebugMenu/DefaultDebugMenuContent'
|
|
246
249
|
export { DefaultMenuPanel } from './lib/ui/components/DefaultMenuPanel'
|
|
247
250
|
export {
|
|
@@ -29,8 +29,17 @@ 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
|
+
|
|
32
38
|
/** @public @react */
|
|
33
|
-
export function DefaultDebugMenuContent(
|
|
39
|
+
export function DefaultDebugMenuContent({
|
|
40
|
+
customDebugFlags,
|
|
41
|
+
customFeatureFlags,
|
|
42
|
+
}: CustomDebugFlags) {
|
|
34
43
|
const editor = useEditor()
|
|
35
44
|
const { addToast } = useToasts()
|
|
36
45
|
const { addDialog } = useDialogs()
|
|
@@ -161,15 +170,21 @@ export function DefaultDebugMenuContent() {
|
|
|
161
170
|
<TldrawUiMenuItem id="throw-error" onSelect={() => setError(true)} label={'Throw error'} />
|
|
162
171
|
</TldrawUiMenuGroup>
|
|
163
172
|
<TldrawUiMenuGroup id="flags">
|
|
164
|
-
<DebugFlags />
|
|
165
|
-
<FeatureFlags />
|
|
173
|
+
<DebugFlags customDebugFlags={customDebugFlags} />
|
|
174
|
+
<FeatureFlags customFeatureFlags={customFeatureFlags} />
|
|
166
175
|
</TldrawUiMenuGroup>
|
|
167
176
|
</>
|
|
168
177
|
)
|
|
169
178
|
}
|
|
179
|
+
|
|
180
|
+
/** @public */
|
|
181
|
+
export interface DebugFlagsProps {
|
|
182
|
+
customDebugFlags?: Record<string, DebugFlag<boolean>> | undefined
|
|
183
|
+
}
|
|
184
|
+
|
|
170
185
|
/** @public @react */
|
|
171
|
-
export function DebugFlags() {
|
|
172
|
-
const items = Object.values(debugFlags)
|
|
186
|
+
export function DebugFlags(props: DebugFlagsProps) {
|
|
187
|
+
const items = Object.values(props.customDebugFlags ?? debugFlags)
|
|
173
188
|
if (!items.length) return null
|
|
174
189
|
return (
|
|
175
190
|
<TldrawUiMenuSubmenu id="debug flags" label="Debug flags">
|
|
@@ -181,9 +196,14 @@ export function DebugFlags() {
|
|
|
181
196
|
</TldrawUiMenuSubmenu>
|
|
182
197
|
)
|
|
183
198
|
}
|
|
199
|
+
/** @public */
|
|
200
|
+
export interface FeatureFlagsProps {
|
|
201
|
+
customFeatureFlags?: Record<string, DebugFlag<boolean>> | undefined
|
|
202
|
+
}
|
|
203
|
+
|
|
184
204
|
/** @public @react */
|
|
185
|
-
export function FeatureFlags() {
|
|
186
|
-
const items = Object.values(featureFlags)
|
|
205
|
+
export function FeatureFlags(props: FeatureFlagsProps) {
|
|
206
|
+
const items = Object.values(props.customFeatureFlags ?? featureFlags)
|
|
187
207
|
if (!items.length) return null
|
|
188
208
|
return (
|
|
189
209
|
<TldrawUiMenuSubmenu id="feature flags" label="Feature flags">
|
|
@@ -117,7 +117,9 @@ function useEditingLinkBehavior(textEditor?: TiptapEditor) {
|
|
|
117
117
|
|
|
118
118
|
textEditor.view.dom.addEventListener('click', handleClick)
|
|
119
119
|
return () => {
|
|
120
|
-
textEditor.
|
|
120
|
+
if (textEditor.isInitialized) {
|
|
121
|
+
textEditor.view.dom.removeEventListener('click', handleClick)
|
|
122
|
+
}
|
|
121
123
|
}
|
|
122
124
|
}, [textEditor, isEditingLink])
|
|
123
125
|
|
|
@@ -193,7 +195,9 @@ function useIsMousingDownOnTextEditor(textEditor: TiptapEditor) {
|
|
|
193
195
|
})
|
|
194
196
|
return () => {
|
|
195
197
|
touchDownEvents.forEach((eventName: string) => {
|
|
196
|
-
textEditor.
|
|
198
|
+
if (textEditor.isInitialized) {
|
|
199
|
+
textEditor.view.dom.removeEventListener(eventName, handlePointingDown)
|
|
200
|
+
}
|
|
197
201
|
})
|
|
198
202
|
touchUpEvents.forEach((eventName: string) => {
|
|
199
203
|
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.
|
|
34
|
+
textEditor.chain().setLink({ href: link }).run()
|
|
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) {
|
package/src/lib/ui/version.ts
CHANGED
|
@@ -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-next.
|
|
4
|
+
export const version = '4.2.0-next.e824a30c434e'
|
|
5
5
|
export const publishDates = {
|
|
6
6
|
major: '2025-09-18T14:39:22.803Z',
|
|
7
|
-
minor: '2025-10-
|
|
8
|
-
patch: '2025-10-
|
|
7
|
+
minor: '2025-10-27T15:34:35.912Z',
|
|
8
|
+
patch: '2025-10-27T15:34:35.912Z',
|
|
9
9
|
}
|
|
@@ -8,7 +8,6 @@ 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'
|
|
12
11
|
import { Node } from '@tiptap/pm/model'
|
|
13
12
|
import StarterKit from '@tiptap/starter-kit'
|
|
14
13
|
import {
|
|
@@ -35,6 +34,7 @@ export const KeyboardShiftEnterTweakExtension = Extension.create({
|
|
|
35
34
|
|
|
36
35
|
// We change the default Code to override what's in the StarterKit.
|
|
37
36
|
// 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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
link: {
|
|
56
|
+
openOnClick: false,
|
|
57
|
+
autolink: true,
|
|
58
|
+
},
|
|
59
59
|
}),
|
|
60
60
|
Highlight,
|
|
61
61
|
KeyboardShiftEnterTweakExtension,
|