@tldraw/editor 3.14.0-canary.766a02a82239 → 3.14.0-canary.7a886029a0b3
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 +51 -37
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/editor/Editor.js +25 -1
- package/dist-cjs/lib/editor/Editor.js.map +2 -2
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js +73 -42
- package/dist-cjs/lib/editor/managers/TextManager/TextManager.js.map +2 -2
- package/dist-cjs/lib/editor/tools/StateNode.js +3 -3
- package/dist-cjs/lib/editor/tools/StateNode.js.map +2 -2
- package/dist-cjs/lib/editor/types/external-content.js.map +1 -1
- package/dist-cjs/lib/hooks/useCanvasEvents.js +1 -2
- package/dist-cjs/lib/hooks/useCanvasEvents.js.map +2 -2
- package/dist-cjs/version.js +3 -3
- package/dist-cjs/version.js.map +1 -1
- package/dist-esm/index.d.mts +51 -37
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/editor/Editor.mjs +25 -1
- package/dist-esm/lib/editor/Editor.mjs.map +2 -2
- package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs +73 -42
- package/dist-esm/lib/editor/managers/TextManager/TextManager.mjs.map +2 -2
- package/dist-esm/lib/editor/tools/StateNode.mjs +3 -3
- package/dist-esm/lib/editor/tools/StateNode.mjs.map +2 -2
- package/dist-esm/lib/hooks/useCanvasEvents.mjs +1 -2
- package/dist-esm/lib/hooks/useCanvasEvents.mjs.map +2 -2
- package/dist-esm/version.mjs +3 -3
- package/dist-esm/version.mjs.map +1 -1
- package/editor.css +433 -482
- package/package.json +7 -7
- package/src/index.ts +2 -0
- package/src/lib/editor/Editor.ts +28 -1
- package/src/lib/editor/managers/TextManager/TextManager.test.ts +1 -5
- package/src/lib/editor/managers/TextManager/TextManager.ts +117 -86
- package/src/lib/editor/tools/StateNode.ts +3 -3
- package/src/lib/editor/types/external-content.ts +11 -2
- package/src/lib/hooks/useCanvasEvents.ts +0 -1
- package/src/version.ts +3 -3
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tldraw/editor",
|
|
3
3
|
"description": "A tiny little drawing app (editor).",
|
|
4
|
-
"version": "3.14.0-canary.
|
|
4
|
+
"version": "3.14.0-canary.7a886029a0b3",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "tldraw Inc.",
|
|
7
7
|
"email": "hello@tldraw.com"
|
|
@@ -48,12 +48,12 @@
|
|
|
48
48
|
"@tiptap/core": "^2.9.1",
|
|
49
49
|
"@tiptap/pm": "^2.9.1",
|
|
50
50
|
"@tiptap/react": "^2.9.1",
|
|
51
|
-
"@tldraw/state": "3.14.0-canary.
|
|
52
|
-
"@tldraw/state-react": "3.14.0-canary.
|
|
53
|
-
"@tldraw/store": "3.14.0-canary.
|
|
54
|
-
"@tldraw/tlschema": "3.14.0-canary.
|
|
55
|
-
"@tldraw/utils": "3.14.0-canary.
|
|
56
|
-
"@tldraw/validate": "3.14.0-canary.
|
|
51
|
+
"@tldraw/state": "3.14.0-canary.7a886029a0b3",
|
|
52
|
+
"@tldraw/state-react": "3.14.0-canary.7a886029a0b3",
|
|
53
|
+
"@tldraw/store": "3.14.0-canary.7a886029a0b3",
|
|
54
|
+
"@tldraw/tlschema": "3.14.0-canary.7a886029a0b3",
|
|
55
|
+
"@tldraw/utils": "3.14.0-canary.7a886029a0b3",
|
|
56
|
+
"@tldraw/validate": "3.14.0-canary.7a886029a0b3",
|
|
57
57
|
"@types/core-js": "^2.5.8",
|
|
58
58
|
"@use-gesture/react": "^10.3.1",
|
|
59
59
|
"classnames": "^2.5.1",
|
package/src/index.ts
CHANGED
|
@@ -174,6 +174,7 @@ export {
|
|
|
174
174
|
} from './lib/editor/managers/SnapManager/SnapManager'
|
|
175
175
|
export {
|
|
176
176
|
TextManager,
|
|
177
|
+
type TLMeasureTextOpts,
|
|
177
178
|
type TLMeasureTextSpanOpts,
|
|
178
179
|
} from './lib/editor/managers/TextManager/TextManager'
|
|
179
180
|
export { UserPreferencesManager } from './lib/editor/managers/UserPreferencesManager/UserPreferencesManager'
|
|
@@ -252,6 +253,7 @@ export {
|
|
|
252
253
|
type TLExternalContent,
|
|
253
254
|
type TLExternalContentSource,
|
|
254
255
|
type TLFileExternalAsset,
|
|
256
|
+
type TLFileReplaceExternalContent,
|
|
255
257
|
type TLFilesExternalContent,
|
|
256
258
|
type TLSvgTextExternalContent,
|
|
257
259
|
type TLTextExternalContent,
|
package/src/lib/editor/Editor.ts
CHANGED
|
@@ -348,6 +348,8 @@ export class Editor extends EventEmitter<TLEventMap> {
|
|
|
348
348
|
this.getContainer = getContainer
|
|
349
349
|
|
|
350
350
|
this.textMeasure = new TextManager(this)
|
|
351
|
+
this.disposables.add(() => this.textMeasure.dispose())
|
|
352
|
+
|
|
351
353
|
this.fonts = new FontManager(this, fontAssetUrls)
|
|
352
354
|
|
|
353
355
|
this._tickManager = new TickManager(this)
|
|
@@ -2120,6 +2122,20 @@ export class Editor extends EventEmitter<TLEventMap> {
|
|
|
2120
2122
|
return this.getShapesPageBounds(this.getSelectedShapeIds())
|
|
2121
2123
|
}
|
|
2122
2124
|
|
|
2125
|
+
/**
|
|
2126
|
+
* The bounds of the selection bounding box in the current page space.
|
|
2127
|
+
*
|
|
2128
|
+
* @readonly
|
|
2129
|
+
* @public
|
|
2130
|
+
*/
|
|
2131
|
+
getSelectionScreenBounds(): Box | undefined {
|
|
2132
|
+
const bounds = this.getSelectionPageBounds()
|
|
2133
|
+
if (!bounds) return undefined
|
|
2134
|
+
const { x, y } = this.pageToScreen(bounds.point)
|
|
2135
|
+
const zoom = this.getZoomLevel()
|
|
2136
|
+
return new Box(x, y, bounds.width * zoom, bounds.height * zoom)
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2123
2139
|
/**
|
|
2124
2140
|
* @internal
|
|
2125
2141
|
*/
|
|
@@ -6195,11 +6211,12 @@ export class Editor extends EventEmitter<TLEventMap> {
|
|
|
6195
6211
|
*/
|
|
6196
6212
|
duplicateShapes(shapes: TLShapeId[] | TLShape[], offset?: VecLike): this {
|
|
6197
6213
|
this.run(() => {
|
|
6198
|
-
const
|
|
6214
|
+
const _ids =
|
|
6199
6215
|
typeof shapes[0] === 'string'
|
|
6200
6216
|
? (shapes as TLShapeId[])
|
|
6201
6217
|
: (shapes as TLShape[]).map((s) => s.id)
|
|
6202
6218
|
|
|
6219
|
+
const ids = this._shouldIgnoreShapeLock ? _ids : this._getUnlockedShapeIds(_ids)
|
|
6203
6220
|
if (ids.length <= 0) return this
|
|
6204
6221
|
|
|
6205
6222
|
const initialIds = new Set(ids)
|
|
@@ -8811,6 +8828,7 @@ export class Editor extends EventEmitter<TLEventMap> {
|
|
|
8811
8828
|
} = {
|
|
8812
8829
|
text: null,
|
|
8813
8830
|
files: null,
|
|
8831
|
+
'file-replace': null,
|
|
8814
8832
|
embed: null,
|
|
8815
8833
|
'svg-text': null,
|
|
8816
8834
|
url: null,
|
|
@@ -8860,6 +8878,15 @@ export class Editor extends EventEmitter<TLEventMap> {
|
|
|
8860
8878
|
return this.externalContentHandlers[info.type]?.(info as any)
|
|
8861
8879
|
}
|
|
8862
8880
|
|
|
8881
|
+
/**
|
|
8882
|
+
* Handle replacing external content.
|
|
8883
|
+
*
|
|
8884
|
+
* @param info - Info about the external content.
|
|
8885
|
+
*/
|
|
8886
|
+
async replaceExternalContent<E>(info: TLExternalContent<E>): Promise<void> {
|
|
8887
|
+
return this.externalContentHandlers[info.type]?.(info as any)
|
|
8888
|
+
}
|
|
8889
|
+
|
|
8863
8890
|
/**
|
|
8864
8891
|
* Get content that can be exported for the given shape ids.
|
|
8865
8892
|
*
|
|
@@ -99,7 +99,7 @@ describe('TextManager', () => {
|
|
|
99
99
|
})
|
|
100
100
|
|
|
101
101
|
it('should handle empty text', () => {
|
|
102
|
-
const result = textManager.measureText('', defaultOpts)
|
|
102
|
+
const result = textManager.measureText('', { ...defaultOpts, measureScrollWidth: true })
|
|
103
103
|
expect(result).toHaveProperty('x', 0)
|
|
104
104
|
expect(result).toHaveProperty('y', 0)
|
|
105
105
|
expect(result).toHaveProperty('w')
|
|
@@ -128,7 +128,6 @@ describe('TextManager', () => {
|
|
|
128
128
|
y: 0,
|
|
129
129
|
w: expect.any(Number),
|
|
130
130
|
h: expect.any(Number),
|
|
131
|
-
scrollWidth: expect.any(Number),
|
|
132
131
|
})
|
|
133
132
|
})
|
|
134
133
|
|
|
@@ -141,7 +140,6 @@ describe('TextManager', () => {
|
|
|
141
140
|
y: 0,
|
|
142
141
|
w: expect.any(Number),
|
|
143
142
|
h: expect.any(Number),
|
|
144
|
-
scrollWidth: expect.any(Number),
|
|
145
143
|
})
|
|
146
144
|
})
|
|
147
145
|
|
|
@@ -154,7 +152,6 @@ describe('TextManager', () => {
|
|
|
154
152
|
y: 0,
|
|
155
153
|
w: expect.any(Number),
|
|
156
154
|
h: expect.any(Number),
|
|
157
|
-
scrollWidth: expect.any(Number),
|
|
158
155
|
})
|
|
159
156
|
})
|
|
160
157
|
|
|
@@ -173,7 +170,6 @@ describe('TextManager', () => {
|
|
|
173
170
|
y: 0,
|
|
174
171
|
w: expect.any(Number),
|
|
175
172
|
h: expect.any(Number),
|
|
176
|
-
scrollWidth: expect.any(Number),
|
|
177
173
|
})
|
|
178
174
|
})
|
|
179
175
|
})
|
|
@@ -20,6 +20,27 @@ const textAlignmentsForLtr = {
|
|
|
20
20
|
'end-legacy': 'right',
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
/** @public */
|
|
24
|
+
export interface TLMeasureTextOpts {
|
|
25
|
+
fontStyle: string
|
|
26
|
+
fontWeight: string
|
|
27
|
+
fontFamily: string
|
|
28
|
+
fontSize: number
|
|
29
|
+
lineHeight: number
|
|
30
|
+
/**
|
|
31
|
+
* When maxWidth is a number, the text will be wrapped to that maxWidth. When maxWidth
|
|
32
|
+
* is null, the text will be measured without wrapping, but explicit line breaks and
|
|
33
|
+
* space are preserved.
|
|
34
|
+
*/
|
|
35
|
+
maxWidth: null | number
|
|
36
|
+
minWidth?: null | number
|
|
37
|
+
// todo: make this a number so that it is consistent with other TLMeasureTextSpanOpts
|
|
38
|
+
padding: string
|
|
39
|
+
otherStyles?: Record<string, string>
|
|
40
|
+
disableOverflowWrapBreaking?: boolean
|
|
41
|
+
measureScrollWidth?: boolean
|
|
42
|
+
}
|
|
43
|
+
|
|
23
44
|
/** @public */
|
|
24
45
|
export interface TLMeasureTextSpanOpts {
|
|
25
46
|
overflow: 'wrap' | 'truncate-ellipsis' | 'truncate-clip'
|
|
@@ -33,96 +54,99 @@ export interface TLMeasureTextSpanOpts {
|
|
|
33
54
|
lineHeight: number
|
|
34
55
|
textAlign: TLDefaultHorizontalAlignStyle
|
|
35
56
|
otherStyles?: Record<string, string>
|
|
57
|
+
measureScrollWidth?: boolean
|
|
36
58
|
}
|
|
37
59
|
|
|
38
60
|
const spaceCharacterRegex = /\s/
|
|
39
61
|
|
|
40
62
|
/** @public */
|
|
41
63
|
export class TextManager {
|
|
42
|
-
private
|
|
64
|
+
private elm: HTMLDivElement
|
|
65
|
+
private defaultStyles: Record<string, string | null>
|
|
43
66
|
|
|
44
67
|
constructor(public editor: Editor) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
68
|
+
const elm = document.createElement('div')
|
|
69
|
+
elm.classList.add('tl-text')
|
|
70
|
+
elm.classList.add('tl-text-measure')
|
|
71
|
+
elm.setAttribute('dir', 'auto')
|
|
72
|
+
elm.tabIndex = -1
|
|
73
|
+
this.editor.getContainer().appendChild(elm)
|
|
74
|
+
|
|
75
|
+
// we need to save the default styles so that we can restore them when we're done
|
|
76
|
+
// these must be the css names, not the js names for the styles
|
|
77
|
+
this.defaultStyles = {
|
|
78
|
+
'overflow-wrap': 'break-word',
|
|
79
|
+
'word-break': 'auto',
|
|
80
|
+
width: null,
|
|
81
|
+
height: null,
|
|
82
|
+
'max-width': null,
|
|
83
|
+
'min-width': null,
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
this.elm = elm
|
|
49
87
|
}
|
|
50
88
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* When maxWidth is a number, the text will be wrapped to that maxWidth. When maxWidth
|
|
61
|
-
* is null, the text will be measured without wrapping, but explicit line breaks and
|
|
62
|
-
* space are preserved.
|
|
63
|
-
*/
|
|
64
|
-
maxWidth: null | number
|
|
65
|
-
minWidth?: null | number
|
|
66
|
-
padding: string
|
|
67
|
-
disableOverflowWrapBreaking?: boolean
|
|
89
|
+
dispose() {
|
|
90
|
+
return this.elm.remove()
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
private resetElmStyles() {
|
|
94
|
+
const { elm, defaultStyles } = this
|
|
95
|
+
for (const key in defaultStyles) {
|
|
96
|
+
elm.style.setProperty(key, defaultStyles[key])
|
|
68
97
|
}
|
|
69
|
-
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
measureText(textToMeasure: string, opts: TLMeasureTextOpts): BoxModel & { scrollWidth: number } {
|
|
70
101
|
const div = document.createElement('div')
|
|
71
102
|
div.textContent = normalizeTextForDom(textToMeasure)
|
|
72
103
|
return this.measureHtml(div.innerHTML, opts)
|
|
73
104
|
}
|
|
74
105
|
|
|
75
|
-
measureHtml(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
* is null, the text will be measured without wrapping, but explicit line breaks and
|
|
86
|
-
* space are preserved.
|
|
87
|
-
*/
|
|
88
|
-
maxWidth: null | number
|
|
89
|
-
minWidth?: null | number
|
|
90
|
-
otherStyles?: Record<string, string>
|
|
91
|
-
padding: string
|
|
92
|
-
disableOverflowWrapBreaking?: boolean
|
|
106
|
+
measureHtml(html: string, opts: TLMeasureTextOpts): BoxModel & { scrollWidth: number } {
|
|
107
|
+
const { elm } = this
|
|
108
|
+
|
|
109
|
+
if (opts.otherStyles) {
|
|
110
|
+
for (const key in opts.otherStyles) {
|
|
111
|
+
if (!this.defaultStyles[key]) {
|
|
112
|
+
// we need to save the original style so that we can restore it when we're done
|
|
113
|
+
this.defaultStyles[key] = elm.style.getPropertyValue(key)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
93
116
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
|
|
118
|
+
elm.innerHTML = html
|
|
119
|
+
|
|
120
|
+
// Apply the default styles to the element (for all styles here or that were ever seen in opts.otherStyles)
|
|
121
|
+
this.resetElmStyles()
|
|
122
|
+
|
|
123
|
+
elm.style.setProperty('font-family', opts.fontFamily)
|
|
124
|
+
elm.style.setProperty('font-style', opts.fontStyle)
|
|
125
|
+
elm.style.setProperty('font-weight', opts.fontWeight)
|
|
126
|
+
elm.style.setProperty('font-size', opts.fontSize + 'px')
|
|
127
|
+
elm.style.setProperty('line-height', opts.lineHeight * opts.fontSize + 'px')
|
|
128
|
+
elm.style.setProperty('padding', opts.padding)
|
|
129
|
+
|
|
130
|
+
if (opts.maxWidth) {
|
|
131
|
+
elm.style.setProperty('max-width', opts.maxWidth + 'px')
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (opts.minWidth) {
|
|
135
|
+
elm.style.setProperty('min-width', opts.minWidth + 'px')
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
if (opts.disableOverflowWrapBreaking) {
|
|
139
|
+
elm.style.setProperty('overflow-wrap', 'normal')
|
|
140
|
+
}
|
|
141
|
+
|
|
117
142
|
if (opts.otherStyles) {
|
|
118
143
|
for (const [key, value] of Object.entries(opts.otherStyles)) {
|
|
119
|
-
|
|
144
|
+
elm.style.setProperty(key, value)
|
|
120
145
|
}
|
|
121
146
|
}
|
|
122
147
|
|
|
123
|
-
const scrollWidth =
|
|
124
|
-
const rect =
|
|
125
|
-
wrapperElm.remove()
|
|
148
|
+
const scrollWidth = opts.measureScrollWidth ? elm.scrollWidth : 0
|
|
149
|
+
const rect = elm.getBoundingClientRect()
|
|
126
150
|
|
|
127
151
|
return {
|
|
128
152
|
x: 0,
|
|
@@ -247,27 +271,29 @@ export class TextManager {
|
|
|
247
271
|
): { text: string; box: BoxModel }[] {
|
|
248
272
|
if (textToMeasure === '') return []
|
|
249
273
|
|
|
250
|
-
const elm = this
|
|
251
|
-
|
|
274
|
+
const { elm } = this
|
|
275
|
+
|
|
276
|
+
if (opts.otherStyles) {
|
|
277
|
+
for (const key in opts.otherStyles) {
|
|
278
|
+
if (!this.defaultStyles[key]) {
|
|
279
|
+
// we need to save the original style so that we can restore it when we're done
|
|
280
|
+
this.defaultStyles[key] = elm.style.getPropertyValue(key)
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
this.resetElmStyles()
|
|
286
|
+
|
|
287
|
+
elm.style.setProperty('font-family', opts.fontFamily)
|
|
288
|
+
elm.style.setProperty('font-style', opts.fontStyle)
|
|
289
|
+
elm.style.setProperty('font-weight', opts.fontWeight)
|
|
290
|
+
elm.style.setProperty('font-size', opts.fontSize + 'px')
|
|
291
|
+
elm.style.setProperty('line-height', opts.lineHeight * opts.fontSize + 'px')
|
|
252
292
|
|
|
253
293
|
const elementWidth = Math.ceil(opts.width - opts.padding * 2)
|
|
254
|
-
elm.setAttribute('dir', 'auto')
|
|
255
|
-
// N.B. This property, while discouraged ("intended for Document Type Definition (DTD) designers")
|
|
256
|
-
// is necessary for ensuring correct mixed RTL/LTR behavior when exporting SVGs.
|
|
257
|
-
elm.style.setProperty('unicode-bidi', 'plaintext')
|
|
258
294
|
elm.style.setProperty('width', `${elementWidth}px`)
|
|
259
295
|
elm.style.setProperty('height', 'min-content')
|
|
260
|
-
elm.style.setProperty('font-size', `${opts.fontSize}px`)
|
|
261
|
-
elm.style.setProperty('font-family', opts.fontFamily)
|
|
262
|
-
elm.style.setProperty('font-weight', opts.fontWeight)
|
|
263
|
-
elm.style.setProperty('line-height', `${opts.lineHeight * opts.fontSize}px`)
|
|
264
296
|
elm.style.setProperty('text-align', textAlignmentsForLtr[opts.textAlign])
|
|
265
|
-
elm.style.setProperty('font-style', opts.fontStyle)
|
|
266
|
-
if (opts.otherStyles) {
|
|
267
|
-
for (const [key, value] of Object.entries(opts.otherStyles)) {
|
|
268
|
-
elm.style.setProperty(key, value)
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
297
|
|
|
272
298
|
const shouldTruncateToFirstLine =
|
|
273
299
|
opts.overflow === 'truncate-ellipsis' || opts.overflow === 'truncate-clip'
|
|
@@ -277,6 +303,12 @@ export class TextManager {
|
|
|
277
303
|
elm.style.setProperty('word-break', 'break-all')
|
|
278
304
|
}
|
|
279
305
|
|
|
306
|
+
if (opts.otherStyles) {
|
|
307
|
+
for (const [key, value] of Object.entries(opts.otherStyles)) {
|
|
308
|
+
elm.style.setProperty(key, value)
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
280
312
|
const normalizedText = normalizeTextForDom(textToMeasure)
|
|
281
313
|
|
|
282
314
|
// Render the text into the measurement element:
|
|
@@ -313,11 +345,10 @@ export class TextManager {
|
|
|
313
345
|
h: lastSpan.box.h,
|
|
314
346
|
},
|
|
315
347
|
})
|
|
348
|
+
|
|
316
349
|
return truncatedSpans
|
|
317
350
|
}
|
|
318
351
|
|
|
319
|
-
elm.remove()
|
|
320
|
-
|
|
321
352
|
return spans
|
|
322
353
|
}
|
|
323
354
|
}
|
|
@@ -206,15 +206,15 @@ export abstract class StateNode implements Partial<TLEventHandlers> {
|
|
|
206
206
|
}
|
|
207
207
|
|
|
208
208
|
// todo: move this logic into transition
|
|
209
|
-
exit(info: any,
|
|
209
|
+
exit(info: any, to: string) {
|
|
210
210
|
if (debugFlags.measurePerformance.get() && this.performanceTracker.isStarted()) {
|
|
211
211
|
this.performanceTracker.stop()
|
|
212
212
|
}
|
|
213
213
|
this._isActive.set(false)
|
|
214
|
-
this.onExit?.(info,
|
|
214
|
+
this.onExit?.(info, to)
|
|
215
215
|
|
|
216
216
|
if (!this.getIsActive()) {
|
|
217
|
-
this.getCurrent()?.exit(info,
|
|
217
|
+
this.getCurrent()?.exit(info, to)
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TLAssetId } from '@tldraw/tlschema'
|
|
1
|
+
import { TLAssetId, TLShapeId } from '@tldraw/tlschema'
|
|
2
2
|
import { VecLike } from '../../primitives/Vec'
|
|
3
3
|
import { TLContent } from './clipboard-types'
|
|
4
4
|
|
|
@@ -52,7 +52,15 @@ export interface TLTextExternalContent extends TLBaseExternalContent {
|
|
|
52
52
|
export interface TLFilesExternalContent extends TLBaseExternalContent {
|
|
53
53
|
type: 'files'
|
|
54
54
|
files: File[]
|
|
55
|
-
ignoreParent
|
|
55
|
+
ignoreParent?: boolean
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** @public */
|
|
59
|
+
export interface TLFileReplaceExternalContent extends TLBaseExternalContent {
|
|
60
|
+
type: 'file-replace'
|
|
61
|
+
file: File
|
|
62
|
+
shapeId: TLShapeId
|
|
63
|
+
isImage: boolean
|
|
56
64
|
}
|
|
57
65
|
|
|
58
66
|
/** @public */
|
|
@@ -90,6 +98,7 @@ export interface TLExcalidrawExternalContent extends TLBaseExternalContent {
|
|
|
90
98
|
export type TLExternalContent<EmbedDefinition> =
|
|
91
99
|
| TLTextExternalContent
|
|
92
100
|
| TLFilesExternalContent
|
|
101
|
+
| TLFileReplaceExternalContent
|
|
93
102
|
| TLUrlExternalContent
|
|
94
103
|
| TLSvgTextExternalContent
|
|
95
104
|
| TLEmbedExternalContent<EmbedDefinition>
|
package/src/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 = '3.14.0-canary.
|
|
4
|
+
export const version = '3.14.0-canary.7a886029a0b3'
|
|
5
5
|
export const publishDates = {
|
|
6
6
|
major: '2024-09-13T14:36:29.063Z',
|
|
7
|
-
minor: '2025-06-
|
|
8
|
-
patch: '2025-06-
|
|
7
|
+
minor: '2025-06-22T09:29:11.076Z',
|
|
8
|
+
patch: '2025-06-22T09:29:11.076Z',
|
|
9
9
|
}
|