tldraw 4.3.0-canary.b2e9b1218a6b → 4.3.0-canary.b9cf1eed518f
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 +9 -0
- package/dist-cjs/index.js +1 -1
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js +4 -2
- package/dist-cjs/lib/shapes/arrow/ArrowShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/arrow-types.js.map +1 -1
- package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js +7 -2
- package/dist-cjs/lib/shapes/geo/GeoShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/note/NoteShapeUtil.js +1 -0
- package/dist-cjs/lib/shapes/note/NoteShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/PlainTextLabel.js +14 -2
- package/dist-cjs/lib/shapes/shared/PlainTextLabel.js.map +3 -3
- package/dist-cjs/lib/shapes/shared/RichTextLabel.js +11 -3
- package/dist-cjs/lib/shapes/shared/RichTextLabel.js.map +3 -3
- package/dist-cjs/lib/shapes/text/TextShapeUtil.js +5 -2
- package/dist-cjs/lib/shapes/text/TextShapeUtil.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-esm/index.d.mts +9 -0
- package/dist-esm/index.mjs +1 -1
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs +4 -2
- package/dist-esm/lib/shapes/arrow/ArrowShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs +7 -2
- package/dist-esm/lib/shapes/geo/GeoShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs +1 -0
- package/dist-esm/lib/shapes/note/NoteShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs +14 -2
- package/dist-esm/lib/shapes/shared/PlainTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/RichTextLabel.mjs +11 -3
- package/dist-esm/lib/shapes/shared/RichTextLabel.mjs.map +2 -2
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs +5 -2
- package/dist-esm/lib/shapes/text/TextShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/ui/version.mjs +3 -3
- package/dist-esm/lib/ui/version.mjs.map +1 -1
- package/package.json +3 -3
- package/src/lib/shapes/arrow/ArrowShapeUtil.tsx +4 -1
- package/src/lib/shapes/arrow/arrow-types.ts +2 -0
- package/src/lib/shapes/geo/GeoShapeUtil.tsx +6 -0
- package/src/lib/shapes/note/NoteShapeUtil.tsx +1 -0
- package/src/lib/shapes/shared/PlainTextLabel.tsx +10 -1
- package/src/lib/shapes/shared/RichTextLabel.tsx +11 -2
- package/src/lib/shapes/text/TextShapeUtil.tsx +5 -0
- package/src/lib/ui/version.ts +3 -3
- package/src/test/commands/__snapshots__/getSvgString.test.ts.snap +2 -2
- package/tldraw.css +8 -4
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
useReactor,
|
|
16
16
|
useValue,
|
|
17
17
|
} from '@tldraw/editor'
|
|
18
|
+
import classNames from 'classnames'
|
|
18
19
|
import React, { useMemo } from 'react'
|
|
19
20
|
import { renderHtmlFromRichText } from '../../utils/text/richText'
|
|
20
21
|
import { RichTextArea } from '../text/RichTextArea'
|
|
@@ -44,6 +45,7 @@ export interface RichTextLabelProps {
|
|
|
44
45
|
textHeight?: number
|
|
45
46
|
padding?: number
|
|
46
47
|
hasCustomTabBehavior?: boolean
|
|
48
|
+
showTextOutline?: boolean
|
|
47
49
|
}
|
|
48
50
|
|
|
49
51
|
/**
|
|
@@ -72,6 +74,7 @@ export const RichTextLabel = React.memo(function RichTextLabel({
|
|
|
72
74
|
textWidth,
|
|
73
75
|
textHeight,
|
|
74
76
|
hasCustomTabBehavior,
|
|
77
|
+
showTextOutline = true,
|
|
75
78
|
}: RichTextLabelProps) {
|
|
76
79
|
const editor = useEditor()
|
|
77
80
|
const isDragging = React.useRef(false)
|
|
@@ -129,7 +132,10 @@ export const RichTextLabel = React.memo(function RichTextLabel({
|
|
|
129
132
|
const cssPrefix = classNamePrefix || 'tl-text'
|
|
130
133
|
return (
|
|
131
134
|
<div
|
|
132
|
-
className={
|
|
135
|
+
className={classNames(
|
|
136
|
+
`${cssPrefix}-label tl-text-wrapper tl-rich-text-wrapper`,
|
|
137
|
+
showTextOutline ? 'tl-text__outline' : 'tl-text__no-outline'
|
|
138
|
+
)}
|
|
133
139
|
aria-hidden={!isEditing}
|
|
134
140
|
data-font={font}
|
|
135
141
|
data-align={align}
|
|
@@ -259,7 +265,10 @@ export function RichTextSVG({
|
|
|
259
265
|
y={bounds.minY}
|
|
260
266
|
width={bounds.w}
|
|
261
267
|
height={bounds.h}
|
|
262
|
-
className=
|
|
268
|
+
className={classNames(
|
|
269
|
+
'tl-export-embed-styles tl-rich-text tl-rich-text-svg',
|
|
270
|
+
showTextOutline ? 'tl-text__outline' : 'tl-text__no-outline'
|
|
271
|
+
)}
|
|
263
272
|
>
|
|
264
273
|
<div style={wrapperStyle}>
|
|
265
274
|
<div dangerouslySetInnerHTML={{ __html: html }} style={style} />
|
|
@@ -43,6 +43,8 @@ const sizeCache = createComputedCache(
|
|
|
43
43
|
export interface TextShapeOptions {
|
|
44
44
|
/** How much addition padding should be added to the horizontal geometry of the shape when binding to an arrow? */
|
|
45
45
|
extraArrowHorizontalPadding: number
|
|
46
|
+
/** Whether to show the outline of the text shape (using the same color as the canvas). This helps with overlapping shapes. It does not show up on Safari, where text outline is a performance issues. */
|
|
47
|
+
showTextOutline: boolean
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
/** @public */
|
|
@@ -53,6 +55,7 @@ export class TextShapeUtil extends ShapeUtil<TLTextShape> {
|
|
|
53
55
|
|
|
54
56
|
override options: TextShapeOptions = {
|
|
55
57
|
extraArrowHorizontalPadding: 10,
|
|
58
|
+
showTextOutline: true,
|
|
56
59
|
}
|
|
57
60
|
|
|
58
61
|
getDefaultProps(): TLTextShape['props'] {
|
|
@@ -140,6 +143,7 @@ export class TextShapeUtil extends ShapeUtil<TLTextShape> {
|
|
|
140
143
|
isSelected={isSelected}
|
|
141
144
|
textWidth={width}
|
|
142
145
|
textHeight={height}
|
|
146
|
+
showTextOutline={this.options.showTextOutline}
|
|
143
147
|
style={{
|
|
144
148
|
transform: `scale(${scale})`,
|
|
145
149
|
transformOrigin: 'top left',
|
|
@@ -175,6 +179,7 @@ export class TextShapeUtil extends ShapeUtil<TLTextShape> {
|
|
|
175
179
|
labelColor={getColorValue(theme, shape.props.color, 'solid')}
|
|
176
180
|
bounds={exportBounds}
|
|
177
181
|
padding={0}
|
|
182
|
+
showTextOutline={this.options.showTextOutline}
|
|
178
183
|
/>
|
|
179
184
|
)
|
|
180
185
|
}
|
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.3.0-canary.
|
|
4
|
+
export const version = '4.3.0-canary.b9cf1eed518f'
|
|
5
5
|
export const publishDates = {
|
|
6
6
|
major: '2025-09-18T14:39:22.803Z',
|
|
7
|
-
minor: '2025-12-
|
|
8
|
-
patch: '2025-12-
|
|
7
|
+
minor: '2025-12-07T14:49:42.949Z',
|
|
8
|
+
patch: '2025-12-07T14:49:42.949Z',
|
|
9
9
|
}
|
|
@@ -83,7 +83,7 @@ exports[`Matches a snapshot > Basic SVG 1`] = `
|
|
|
83
83
|
stroke-width="3.5"
|
|
84
84
|
/>
|
|
85
85
|
<foreignobject
|
|
86
|
-
class="tl-export-embed-styles tl-rich-text tl-rich-text-svg"
|
|
86
|
+
class="tl-export-embed-styles tl-rich-text tl-rich-text-svg tl-text__outline"
|
|
87
87
|
height="100"
|
|
88
88
|
width="100"
|
|
89
89
|
x="0"
|
|
@@ -223,7 +223,7 @@ exports[`Returns all shapes when no ids are provided > All shapes 1`] = `
|
|
|
223
223
|
stroke-width="3.5"
|
|
224
224
|
/>
|
|
225
225
|
<foreignobject
|
|
226
|
-
class="tl-export-embed-styles tl-rich-text tl-rich-text-svg"
|
|
226
|
+
class="tl-export-embed-styles tl-rich-text tl-rich-text-svg tl-text__outline"
|
|
227
227
|
height="100"
|
|
228
228
|
width="100"
|
|
229
229
|
x="0"
|
package/tldraw.css
CHANGED
|
@@ -611,7 +611,6 @@ input,
|
|
|
611
611
|
pointer-events: all;
|
|
612
612
|
white-space: pre-wrap;
|
|
613
613
|
overflow-wrap: break-word;
|
|
614
|
-
text-shadow: var(--tl-text-outline);
|
|
615
614
|
}
|
|
616
615
|
|
|
617
616
|
.tl-text-wrapper[data-font='draw'] {
|
|
@@ -774,7 +773,6 @@ input,
|
|
|
774
773
|
justify-content: center;
|
|
775
774
|
align-items: center;
|
|
776
775
|
color: var(--tl-color-text);
|
|
777
|
-
text-shadow: var(--tl-text-outline);
|
|
778
776
|
line-height: inherit;
|
|
779
777
|
position: absolute;
|
|
780
778
|
inset: 0px;
|
|
@@ -974,6 +972,14 @@ input,
|
|
|
974
972
|
display: block;
|
|
975
973
|
}
|
|
976
974
|
|
|
975
|
+
.tl-text__outline {
|
|
976
|
+
text-shadow: var(--tl-text-outline);
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
.tl-text__no-outline {
|
|
980
|
+
text-shadow: none;
|
|
981
|
+
}
|
|
982
|
+
|
|
977
983
|
/* --------------------- Loading -------------------- */
|
|
978
984
|
|
|
979
985
|
.tl-loading {
|
|
@@ -1221,7 +1227,6 @@ input,
|
|
|
1221
1227
|
align-items: center;
|
|
1222
1228
|
text-align: center;
|
|
1223
1229
|
color: var(--tl-color-text);
|
|
1224
|
-
text-shadow: var(--tl-text-outline);
|
|
1225
1230
|
}
|
|
1226
1231
|
|
|
1227
1232
|
.tl-shape[data-shape-type='arrow'] .tl-text-label__inner {
|
|
@@ -1450,7 +1455,6 @@ input,
|
|
|
1450
1455
|
}
|
|
1451
1456
|
|
|
1452
1457
|
.tl-note__container > .tl-text-label {
|
|
1453
|
-
text-shadow: none;
|
|
1454
1458
|
color: currentColor;
|
|
1455
1459
|
}
|
|
1456
1460
|
|