tldraw 3.16.0-canary.2e83e38fb91b → 3.16.0-canary.344cec0354f3
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 +99 -13
- package/dist-cjs/index.js +6 -2
- package/dist-cjs/index.js.map +2 -2
- package/dist-cjs/lib/defaultExternalContentHandlers.js +10 -0
- package/dist-cjs/lib/defaultExternalContentHandlers.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/arrow-types.js.map +1 -1
- package/dist-cjs/lib/shapes/arrow/arrowTargetState.js +3 -2
- package/dist-cjs/lib/shapes/arrow/arrowTargetState.js.map +2 -2
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js +1 -1
- package/dist-cjs/lib/shapes/arrow/toolStates/Pointing.js.map +2 -2
- package/dist-cjs/lib/shapes/bookmark/BookmarkShapeUtil.js +1 -1
- package/dist-cjs/lib/shapes/bookmark/BookmarkShapeUtil.js.map +2 -2
- package/dist-cjs/lib/shapes/frame/components/FrameLabelInput.js +8 -2
- package/dist-cjs/lib/shapes/frame/components/FrameLabelInput.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/HyperlinkButton.js +1 -1
- package/dist-cjs/lib/shapes/shared/HyperlinkButton.js.map +2 -2
- package/dist-cjs/lib/shapes/shared/useEditablePlainText.js +2 -3
- package/dist-cjs/lib/shapes/shared/useEditablePlainText.js.map +2 -2
- package/dist-cjs/lib/shapes/text/PlainTextArea.js +2 -1
- package/dist-cjs/lib/shapes/text/PlainTextArea.js.map +2 -2
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js +3 -1
- package/dist-cjs/lib/tools/SelectTool/childStates/DraggingHandle.js.map +2 -2
- package/dist-cjs/lib/ui/components/A11y.js +1 -1
- package/dist-cjs/lib/ui/components/A11y.js.map +2 -2
- package/dist-cjs/lib/ui/components/AccessibilityMenu.js +1 -1
- package/dist-cjs/lib/ui/components/AccessibilityMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/InputModeMenu.js +77 -0
- package/dist-cjs/lib/ui/components/InputModeMenu.js.map +7 -0
- package/dist-cjs/lib/ui/components/LanguageMenu.js +1 -0
- package/dist-cjs/lib/ui/components/LanguageMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js +2 -0
- package/dist-cjs/lib/ui/components/MainMenu/DefaultMainMenuContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/Minimap/DefaultMinimap.js +2 -1
- package/dist-cjs/lib/ui/components/Minimap/DefaultMinimap.js.map +2 -2
- package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js +1 -1
- package/dist-cjs/lib/ui/components/PageMenu/DefaultPageMenu.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js +4 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanel.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/DefaultStylePanelContent.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelButtonPicker.js +12 -3
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelButtonPicker.js.map +2 -2
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelContext.js +4 -2
- package/dist-cjs/lib/ui/components/StylePanel/StylePanelContext.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/AltTextEditor.js +3 -2
- package/dist-cjs/lib/ui/components/Toolbar/AltTextEditor.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js +5 -4
- package/dist-cjs/lib/ui/components/Toolbar/LinkEditor.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js +1 -1
- package/dist-cjs/lib/ui/components/Toolbar/OverflowingToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js +6 -2
- package/dist-cjs/lib/ui/components/Toolbar/ToggleToolLockedButton.js.map +2 -2
- package/dist-cjs/lib/ui/components/menu-items.js +6 -4
- package/dist-cjs/lib/ui/components/menu-items.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js +1 -1
- package/dist-cjs/lib/ui/components/primitives/TldrawUiContextualToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiInput.js +3 -1
- package/dist-cjs/lib/ui/components/primitives/TldrawUiInput.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js +1 -0
- package/dist-cjs/lib/ui/components/primitives/TldrawUiToolbar.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js +44 -21
- package/dist-cjs/lib/ui/components/primitives/TldrawUiTooltip.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.js +3 -0
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.js.map +2 -2
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js +3 -3
- package/dist-cjs/lib/ui/components/primitives/menus/TldrawUiMenuItem.js.map +2 -2
- package/dist-cjs/lib/ui/context/actions.js +11 -25
- package/dist-cjs/lib/ui/context/actions.js.map +2 -2
- package/dist-cjs/lib/ui/context/events.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useClipboardEvents.js +1 -1
- package/dist-cjs/lib/ui/hooks/useClipboardEvents.js.map +2 -2
- package/dist-cjs/lib/ui/hooks/useTranslation/TLUiTranslationKey.js.map +1 -1
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.js +10 -2
- package/dist-cjs/lib/ui/hooks/useTranslation/defaultTranslation.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 +99 -13
- package/dist-esm/index.mjs +11 -3
- package/dist-esm/index.mjs.map +2 -2
- package/dist-esm/lib/defaultExternalContentHandlers.mjs +10 -0
- package/dist-esm/lib/defaultExternalContentHandlers.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs +3 -2
- package/dist-esm/lib/shapes/arrow/arrowTargetState.mjs.map +2 -2
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs +1 -1
- package/dist-esm/lib/shapes/arrow/toolStates/Pointing.mjs.map +2 -2
- package/dist-esm/lib/shapes/bookmark/BookmarkShapeUtil.mjs +1 -2
- package/dist-esm/lib/shapes/bookmark/BookmarkShapeUtil.mjs.map +2 -2
- package/dist-esm/lib/shapes/frame/components/FrameLabelInput.mjs +9 -3
- package/dist-esm/lib/shapes/frame/components/FrameLabelInput.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/HyperlinkButton.mjs +2 -2
- package/dist-esm/lib/shapes/shared/HyperlinkButton.mjs.map +2 -2
- package/dist-esm/lib/shapes/shared/useEditablePlainText.mjs +2 -4
- package/dist-esm/lib/shapes/shared/useEditablePlainText.mjs.map +2 -2
- package/dist-esm/lib/shapes/text/PlainTextArea.mjs +3 -2
- package/dist-esm/lib/shapes/text/PlainTextArea.mjs.map +2 -2
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs +3 -1
- package/dist-esm/lib/tools/SelectTool/childStates/DraggingHandle.mjs.map +2 -2
- package/dist-esm/lib/ui/components/A11y.mjs +1 -2
- package/dist-esm/lib/ui/components/A11y.mjs.map +2 -2
- package/dist-esm/lib/ui/components/AccessibilityMenu.mjs +3 -3
- package/dist-esm/lib/ui/components/AccessibilityMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/InputModeMenu.mjs +57 -0
- package/dist-esm/lib/ui/components/InputModeMenu.mjs.map +7 -0
- package/dist-esm/lib/ui/components/LanguageMenu.mjs +1 -0
- package/dist-esm/lib/ui/components/LanguageMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs +2 -0
- package/dist-esm/lib/ui/components/MainMenu/DefaultMainMenuContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Minimap/DefaultMinimap.mjs +2 -1
- package/dist-esm/lib/ui/components/Minimap/DefaultMinimap.mjs.map +2 -2
- package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs +1 -2
- package/dist-esm/lib/ui/components/PageMenu/DefaultPageMenu.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs +4 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanel.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs +2 -2
- package/dist-esm/lib/ui/components/StylePanel/DefaultStylePanelContent.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/StylePanelButtonPicker.mjs +12 -3
- package/dist-esm/lib/ui/components/StylePanel/StylePanelButtonPicker.mjs.map +2 -2
- package/dist-esm/lib/ui/components/StylePanel/StylePanelContext.mjs +4 -2
- package/dist-esm/lib/ui/components/StylePanel/StylePanelContext.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs +3 -2
- package/dist-esm/lib/ui/components/Toolbar/AltTextEditor.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs +5 -4
- package/dist-esm/lib/ui/components/Toolbar/LinkEditor.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs +1 -1
- package/dist-esm/lib/ui/components/Toolbar/OverflowingToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs +6 -2
- package/dist-esm/lib/ui/components/Toolbar/ToggleToolLockedButton.mjs.map +2 -2
- package/dist-esm/lib/ui/components/menu-items.mjs +6 -4
- package/dist-esm/lib/ui/components/menu-items.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs +1 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiContextualToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiInput.mjs +3 -1
- package/dist-esm/lib/ui/components/primitives/TldrawUiInput.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs +1 -0
- package/dist-esm/lib/ui/components/primitives/TldrawUiToolbar.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs +44 -21
- package/dist-esm/lib/ui/components/primitives/TldrawUiTooltip.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs +3 -0
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.mjs.map +2 -2
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs +3 -3
- package/dist-esm/lib/ui/components/primitives/menus/TldrawUiMenuItem.mjs.map +2 -2
- package/dist-esm/lib/ui/context/actions.mjs +11 -25
- package/dist-esm/lib/ui/context/actions.mjs.map +2 -2
- package/dist-esm/lib/ui/context/events.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs +1 -2
- package/dist-esm/lib/ui/hooks/useClipboardEvents.mjs.map +2 -2
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.mjs +10 -2
- package/dist-esm/lib/ui/hooks/useTranslation/defaultTranslation.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/index.ts +8 -1
- package/src/lib/defaultExternalContentHandlers.ts +14 -0
- package/src/lib/shapes/arrow/ArrowShapeOptions.test.ts +83 -13
- package/src/lib/shapes/arrow/ArrowShapeTool.test.ts +97 -3
- package/src/lib/shapes/arrow/arrow-types.ts +3 -5
- package/src/lib/shapes/arrow/arrowTargetState.ts +34 -3
- package/src/lib/shapes/arrow/toolStates/Pointing.tsx +1 -1
- package/src/lib/shapes/bookmark/BookmarkShapeUtil.tsx +1 -2
- package/src/lib/shapes/frame/components/FrameLabelInput.tsx +10 -3
- package/src/lib/shapes/shared/HyperlinkButton.tsx +2 -2
- package/src/lib/shapes/shared/useEditablePlainText.ts +2 -5
- package/src/lib/shapes/text/PlainTextArea.tsx +3 -2
- package/src/lib/tools/SelectTool/childStates/DraggingHandle.tsx +6 -2
- package/src/lib/ui/components/A11y.tsx +1 -2
- package/src/lib/ui/components/AccessibilityMenu.tsx +2 -2
- package/src/lib/ui/components/InputModeMenu.tsx +65 -0
- package/src/lib/ui/components/LanguageMenu.tsx +1 -0
- package/src/lib/ui/components/MainMenu/DefaultMainMenuContent.tsx +4 -0
- package/src/lib/ui/components/Minimap/DefaultMinimap.tsx +2 -1
- package/src/lib/ui/components/PageMenu/DefaultPageMenu.tsx +1 -2
- package/src/lib/ui/components/StylePanel/DefaultStylePanel.tsx +4 -2
- package/src/lib/ui/components/StylePanel/DefaultStylePanelContent.tsx +4 -2
- package/src/lib/ui/components/StylePanel/StylePanelButtonPicker.tsx +10 -3
- package/src/lib/ui/components/StylePanel/StylePanelContext.tsx +5 -3
- package/src/lib/ui/components/Toolbar/AltTextEditor.tsx +4 -3
- package/src/lib/ui/components/Toolbar/LinkEditor.tsx +6 -5
- package/src/lib/ui/components/Toolbar/OverflowingToolbar.tsx +1 -1
- package/src/lib/ui/components/Toolbar/ToggleToolLockedButton.tsx +9 -2
- package/src/lib/ui/components/menu-items.tsx +5 -3
- package/src/lib/ui/components/primitives/TldrawUiContextualToolbar.tsx +1 -2
- package/src/lib/ui/components/primitives/TldrawUiInput.tsx +3 -0
- package/src/lib/ui/components/primitives/TldrawUiToolbar.tsx +2 -1
- package/src/lib/ui/components/primitives/TldrawUiTooltip.tsx +26 -5
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuCheckboxItem.tsx +4 -0
- package/src/lib/ui/components/primitives/menus/TldrawUiMenuItem.tsx +3 -3
- package/src/lib/ui/context/actions.tsx +18 -27
- package/src/lib/ui/context/events.tsx +2 -1
- package/src/lib/ui/hooks/useClipboardEvents.ts +1 -2
- package/src/lib/ui/hooks/useTranslation/TLUiTranslationKey.ts +10 -2
- package/src/lib/ui/hooks/useTranslation/defaultTranslation.ts +10 -2
- package/src/lib/ui/version.ts +3 -3
- package/src/lib/ui.css +25 -2
- package/src/test/TestEditor.ts +8 -2
- package/src/test/commands/setCamera.test.ts +13 -0
- package/src/test/frames.test.ts +15 -0
- package/tldraw.css +25 -2
|
@@ -159,7 +159,7 @@ export function DefaultMinimap() {
|
|
|
159
159
|
type: 'pointer',
|
|
160
160
|
target: 'canvas',
|
|
161
161
|
name: 'pointer_move',
|
|
162
|
-
...getPointerInfo(e),
|
|
162
|
+
...getPointerInfo(editor, e),
|
|
163
163
|
point: screenPoint,
|
|
164
164
|
isPen: editor.getInstanceState().isPenMode,
|
|
165
165
|
}
|
|
@@ -204,6 +204,7 @@ export function DefaultMinimap() {
|
|
|
204
204
|
<canvas
|
|
205
205
|
role="img"
|
|
206
206
|
aria-label={msg('navigation-zone.minimap')}
|
|
207
|
+
data-testid="minimap.canvas"
|
|
207
208
|
ref={rCanvas}
|
|
208
209
|
className="tlui-minimap__canvas"
|
|
209
210
|
onDoubleClick={onDoubleClick}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PageRecordType,
|
|
3
3
|
TLPageId,
|
|
4
|
-
markEventAsHandled,
|
|
5
4
|
releasePointerCapture,
|
|
6
5
|
setPointerCapture,
|
|
7
6
|
tlenv,
|
|
@@ -451,7 +450,7 @@ export const DefaultPageMenu = memo(function DefaultPageMenu() {
|
|
|
451
450
|
if (e.key === 'Enter') {
|
|
452
451
|
if (page.id === currentPage.id) {
|
|
453
452
|
toggleEditing()
|
|
454
|
-
markEventAsHandled(e)
|
|
453
|
+
editor.markEventAsHandled(e)
|
|
455
454
|
}
|
|
456
455
|
}
|
|
457
456
|
}}
|
|
@@ -24,7 +24,9 @@ export const DefaultStylePanel = memo(function DefaultStylePanel({
|
|
|
24
24
|
children,
|
|
25
25
|
}: TLUiStylePanelProps) {
|
|
26
26
|
const editor = useEditor()
|
|
27
|
-
const
|
|
27
|
+
const enhancedA11yMode = useValue('enhancedA11yMode', () => editor.user.getEnhancedA11yMode(), [
|
|
28
|
+
editor,
|
|
29
|
+
])
|
|
28
30
|
|
|
29
31
|
const ref = useRef<HTMLDivElement>(null)
|
|
30
32
|
usePassThroughWheelEvents(ref)
|
|
@@ -62,7 +64,7 @@ export const DefaultStylePanel = memo(function DefaultStylePanel({
|
|
|
62
64
|
data-testid="style.panel"
|
|
63
65
|
className={classNames('tlui-style-panel', { 'tlui-style-panel__wrapper': !isMobile })}
|
|
64
66
|
data-ismobile={isMobile}
|
|
65
|
-
data-
|
|
67
|
+
data-enhanced-a11y-mode={enhancedA11yMode}
|
|
66
68
|
onPointerLeave={handlePointerOut}
|
|
67
69
|
>
|
|
68
70
|
<StylePanelContextProvider styles={styles}>
|
|
@@ -91,7 +91,7 @@ const tldrawSupportedOpacities = [0.1, 0.25, 0.5, 0.75, 1] as const
|
|
|
91
91
|
/** @public @react */
|
|
92
92
|
export function StylePanelOpacityPicker() {
|
|
93
93
|
const editor = useEditor()
|
|
94
|
-
const { onHistoryMark,
|
|
94
|
+
const { onHistoryMark, enhancedA11yMode } = useStylePanelContext()
|
|
95
95
|
|
|
96
96
|
const opacity = useValue('opacity', () => editor.getSharedOpacity(), [editor])
|
|
97
97
|
const trackEvent = useUiEvents()
|
|
@@ -126,7 +126,9 @@ export function StylePanelOpacityPicker() {
|
|
|
126
126
|
|
|
127
127
|
return (
|
|
128
128
|
<>
|
|
129
|
-
{
|
|
129
|
+
{enhancedA11yMode && (
|
|
130
|
+
<StylePanelSubheading>{msg('style-panel.opacity')}</StylePanelSubheading>
|
|
131
|
+
)}
|
|
130
132
|
<TldrawUiSlider
|
|
131
133
|
data-testid="style.opacity"
|
|
132
134
|
value={opacityIndex >= 0 ? opacityIndex : tldrawSupportedOpacities.length - 1}
|
|
@@ -127,7 +127,7 @@ export const StylePanelButtonPicker = memo(function StylePanelButtonPicker<T ext
|
|
|
127
127
|
|
|
128
128
|
return (
|
|
129
129
|
<>
|
|
130
|
-
{ctx.
|
|
130
|
+
{ctx.enhancedA11yMode && <StylePanelSubheading>{title}</StylePanelSubheading>}
|
|
131
131
|
<TldrawUiToolbar label={title}>
|
|
132
132
|
<TldrawUiToolbarToggleGroup
|
|
133
133
|
data-testid={`style.${uiType}`}
|
|
@@ -137,6 +137,7 @@ export const StylePanelButtonPicker = memo(function StylePanelButtonPicker<T ext
|
|
|
137
137
|
>
|
|
138
138
|
<Layout>
|
|
139
139
|
{items.map((item) => {
|
|
140
|
+
const isActive = value.type === 'shared' && value.value === item.value
|
|
140
141
|
const label =
|
|
141
142
|
title + ' — ' + msg(`${uiType}-style.${item.value}` as TLUiTranslationKey)
|
|
142
143
|
return (
|
|
@@ -145,10 +146,16 @@ export const StylePanelButtonPicker = memo(function StylePanelButtonPicker<T ext
|
|
|
145
146
|
key={item.value}
|
|
146
147
|
data-id={item.value}
|
|
147
148
|
data-testid={`style.${uiType}.${item.value}`}
|
|
148
|
-
aria-label={label}
|
|
149
|
+
aria-label={label + (isActive ? ` (${msg('style-panel.selected')})` : '')}
|
|
150
|
+
tooltip={
|
|
151
|
+
<>
|
|
152
|
+
<div>{label}</div>
|
|
153
|
+
{isActive ? <div>({msg('style-panel.selected')})</div> : null}
|
|
154
|
+
</>
|
|
155
|
+
}
|
|
149
156
|
value={item.value}
|
|
150
157
|
data-state={value.type === 'shared' && value.value === item.value ? 'on' : 'off'}
|
|
151
|
-
data-isactive={
|
|
158
|
+
data-isactive={isActive}
|
|
152
159
|
title={label}
|
|
153
160
|
style={
|
|
154
161
|
style === (DefaultColorStyle as StyleProp<unknown>)
|
|
@@ -5,7 +5,7 @@ import { useUiEvents } from '../../context/events'
|
|
|
5
5
|
/** @public */
|
|
6
6
|
export interface StylePanelContext {
|
|
7
7
|
styles: ReadonlySharedStyleMap
|
|
8
|
-
|
|
8
|
+
enhancedA11yMode: boolean
|
|
9
9
|
onHistoryMark(id: string): void
|
|
10
10
|
onValueChange<T>(style: StyleProp<T>, value: T): void
|
|
11
11
|
}
|
|
@@ -23,7 +23,9 @@ export function StylePanelContextProvider({ children, styles }: StylePanelContex
|
|
|
23
23
|
const trackEvent = useUiEvents()
|
|
24
24
|
|
|
25
25
|
const onHistoryMark = useCallback((id: string) => editor.markHistoryStoppingPoint(id), [editor])
|
|
26
|
-
const
|
|
26
|
+
const enhancedA11yMode = useValue('enhancedA11yMode', () => editor.user.getEnhancedA11yMode(), [
|
|
27
|
+
editor,
|
|
28
|
+
])
|
|
27
29
|
const onValueChange = useCallback(
|
|
28
30
|
function <T>(style: StyleProp<T>, value: T) {
|
|
29
31
|
editor.run(() => {
|
|
@@ -43,7 +45,7 @@ export function StylePanelContextProvider({ children, styles }: StylePanelContex
|
|
|
43
45
|
<StylePanelContext.Provider
|
|
44
46
|
value={{
|
|
45
47
|
styles: styles,
|
|
46
|
-
|
|
48
|
+
enhancedA11yMode,
|
|
47
49
|
onHistoryMark,
|
|
48
50
|
onValueChange,
|
|
49
51
|
}}
|
|
@@ -2,9 +2,9 @@ import { preventDefault, TLShape, TLShapeId, useEditor } from '@tldraw/editor'
|
|
|
2
2
|
import { useCallback, useEffect, useRef, useState } from 'react'
|
|
3
3
|
import { useUiEvents } from '../../context/events'
|
|
4
4
|
import { useTranslation } from '../../hooks/useTranslation/useTranslation'
|
|
5
|
+
import { TldrawUiButton } from '../primitives/Button/TldrawUiButton'
|
|
5
6
|
import { TldrawUiButtonIcon } from '../primitives/Button/TldrawUiButtonIcon'
|
|
6
7
|
import { TldrawUiInput } from '../primitives/TldrawUiInput'
|
|
7
|
-
import { TldrawUiToolbarButton } from '../primitives/TldrawUiToolbar'
|
|
8
8
|
|
|
9
9
|
/** @public */
|
|
10
10
|
export interface AltTextEditorProps {
|
|
@@ -70,13 +70,14 @@ export function AltTextEditor({ shapeId, onClose, source }: AltTextEditorProps)
|
|
|
70
70
|
data-testid="media-toolbar.alt-text-input"
|
|
71
71
|
value={altText}
|
|
72
72
|
placeholder={msg('tool.media-alt-text-desc')}
|
|
73
|
+
aria-label={msg('tool.media-alt-text-desc')}
|
|
73
74
|
onValueChange={handleValueChange}
|
|
74
75
|
onComplete={handleComplete}
|
|
75
76
|
onCancel={handleAltTextCancel}
|
|
76
77
|
disabled={isReadonly}
|
|
77
78
|
/>
|
|
78
79
|
{!isReadonly && (
|
|
79
|
-
<
|
|
80
|
+
<TldrawUiButton
|
|
80
81
|
title={msg('tool.media-alt-text-confirm')}
|
|
81
82
|
data-testid="tool.media-alt-text-confirm"
|
|
82
83
|
type="icon"
|
|
@@ -84,7 +85,7 @@ export function AltTextEditor({ shapeId, onClose, source }: AltTextEditorProps)
|
|
|
84
85
|
onClick={handleConfirm}
|
|
85
86
|
>
|
|
86
87
|
<TldrawUiButtonIcon small icon="check" />
|
|
87
|
-
</
|
|
88
|
+
</TldrawUiButton>
|
|
88
89
|
)}
|
|
89
90
|
</>
|
|
90
91
|
)
|
|
@@ -2,9 +2,9 @@ import { preventDefault, TiptapEditor, useEditor } from '@tldraw/editor'
|
|
|
2
2
|
import { useEffect, useRef, useState } from 'react'
|
|
3
3
|
import { useUiEvents } from '../../context/events'
|
|
4
4
|
import { useTranslation } from '../../hooks/useTranslation/useTranslation'
|
|
5
|
+
import { TldrawUiButton } from '../primitives/Button/TldrawUiButton'
|
|
5
6
|
import { TldrawUiButtonIcon } from '../primitives/Button/TldrawUiButtonIcon'
|
|
6
7
|
import { TldrawUiInput } from '../primitives/TldrawUiInput'
|
|
7
|
-
import { TldrawUiToolbarButton } from '../primitives/TldrawUiToolbar'
|
|
8
8
|
|
|
9
9
|
/** @public */
|
|
10
10
|
export interface LinkEditorProps {
|
|
@@ -75,8 +75,9 @@ export function LinkEditor({ textEditor, value: initialValue, onClose }: LinkEdi
|
|
|
75
75
|
onComplete={handleLinkComplete}
|
|
76
76
|
onCancel={handleLinkCancel}
|
|
77
77
|
placeholder="example.com"
|
|
78
|
+
aria-label="example.com"
|
|
78
79
|
/>
|
|
79
|
-
<
|
|
80
|
+
<TldrawUiButton
|
|
80
81
|
className="tlui-rich-text__toolbar-link-visit"
|
|
81
82
|
title={msg('tool.rich-text-link-visit')}
|
|
82
83
|
type="icon"
|
|
@@ -85,8 +86,8 @@ export function LinkEditor({ textEditor, value: initialValue, onClose }: LinkEdi
|
|
|
85
86
|
disabled={!value}
|
|
86
87
|
>
|
|
87
88
|
<TldrawUiButtonIcon small icon="external-link" />
|
|
88
|
-
</
|
|
89
|
-
<
|
|
89
|
+
</TldrawUiButton>
|
|
90
|
+
<TldrawUiButton
|
|
90
91
|
className="tlui-rich-text__toolbar-link-remove"
|
|
91
92
|
title={msg('tool.rich-text-link-remove')}
|
|
92
93
|
data-testid="rich-text.link-remove"
|
|
@@ -95,7 +96,7 @@ export function LinkEditor({ textEditor, value: initialValue, onClose }: LinkEdi
|
|
|
95
96
|
onClick={handleRemoveLink}
|
|
96
97
|
>
|
|
97
98
|
<TldrawUiButtonIcon small icon="trash" />
|
|
98
|
-
</
|
|
99
|
+
</TldrawUiButton>
|
|
99
100
|
</>
|
|
100
101
|
)
|
|
101
102
|
}
|
|
@@ -101,7 +101,7 @@ export function OverflowingToolbar({
|
|
|
101
101
|
items: collectItems(child.children),
|
|
102
102
|
element: child as HTMLElement,
|
|
103
103
|
})
|
|
104
|
-
} else {
|
|
104
|
+
} else if (!child.hasAttribute('data-radix-popper-content-wrapper')) {
|
|
105
105
|
items.push({ type: 'item', element: child as HTMLElement })
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { useEditor, useValue } from '@tldraw/editor'
|
|
2
2
|
import classNames from 'classnames'
|
|
3
3
|
import { PORTRAIT_BREAKPOINT } from '../../constants'
|
|
4
|
+
import { useActions } from '../../context/actions'
|
|
4
5
|
import { useBreakpoint } from '../../context/breakpoints'
|
|
5
6
|
import { useTranslation } from '../../hooks/useTranslation/useTranslation'
|
|
7
|
+
import { kbdStr } from '../../kbd-utils'
|
|
6
8
|
import { TldrawUiButton } from '../primitives/Button/TldrawUiButton'
|
|
7
9
|
import { TldrawUiButtonIcon } from '../primitives/Button/TldrawUiButtonIcon'
|
|
8
10
|
import { TldrawUiTooltip } from '../primitives/TldrawUiTooltip'
|
|
@@ -17,6 +19,7 @@ export function ToggleToolLockedButton({ activeToolId }: ToggleToolLockedButtonP
|
|
|
17
19
|
const editor = useEditor()
|
|
18
20
|
const breakpoint = useBreakpoint()
|
|
19
21
|
const msg = useTranslation()
|
|
22
|
+
const actions = useActions()
|
|
20
23
|
|
|
21
24
|
const isToolLocked = useValue('is tool locked', () => editor.getInstanceState().isToolLocked, [
|
|
22
25
|
editor,
|
|
@@ -25,11 +28,15 @@ export function ToggleToolLockedButton({ activeToolId }: ToggleToolLockedButtonP
|
|
|
25
28
|
|
|
26
29
|
if (!activeToolId || !tool.isLockable) return null
|
|
27
30
|
|
|
31
|
+
const toggleLockAction = actions['toggle-tool-lock']
|
|
32
|
+
const tooltipContent = toggleLockAction?.kbd
|
|
33
|
+
? `${msg('action.toggle-tool-lock')} ${kbdStr(toggleLockAction.kbd)}`
|
|
34
|
+
: msg('action.toggle-tool-lock')
|
|
35
|
+
|
|
28
36
|
return (
|
|
29
|
-
<TldrawUiTooltip content={
|
|
37
|
+
<TldrawUiTooltip content={tooltipContent}>
|
|
30
38
|
<TldrawUiButton
|
|
31
39
|
type="normal"
|
|
32
|
-
title={msg('action.toggle-tool-lock')}
|
|
33
40
|
data-testid="tool-lock"
|
|
34
41
|
className={classNames('tlui-main-toolbar__lock-button', {
|
|
35
42
|
'tlui-main-toolbar__lock-button__mobile': breakpoint < PORTRAIT_BREAKPOINT.TABLET_SM,
|
|
@@ -652,11 +652,13 @@ export function ToggleKeyboardShortcutsItem() {
|
|
|
652
652
|
}
|
|
653
653
|
|
|
654
654
|
/** @public @react */
|
|
655
|
-
export function
|
|
655
|
+
export function ToggleEnhancedA11yModeItem() {
|
|
656
656
|
const editor = useEditor()
|
|
657
|
-
const
|
|
657
|
+
const enhancedA11yMode = useValue('enhancedA11yMode', () => editor.user.getEnhancedA11yMode(), [
|
|
658
|
+
editor,
|
|
659
|
+
])
|
|
658
660
|
|
|
659
|
-
return <TldrawUiMenuActionCheckboxItem actionId="
|
|
661
|
+
return <TldrawUiMenuActionCheckboxItem actionId="enhanced-a11y-mode" checked={enhancedA11yMode} />
|
|
660
662
|
}
|
|
661
663
|
|
|
662
664
|
/** @public @react */
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
Box,
|
|
4
4
|
clamp,
|
|
5
5
|
Editor,
|
|
6
|
-
markEventAsHandled,
|
|
7
6
|
react,
|
|
8
7
|
useAtom,
|
|
9
8
|
useEditor,
|
|
@@ -170,7 +169,7 @@ export const TldrawUiContextualToolbar = ({
|
|
|
170
169
|
data-visible={false}
|
|
171
170
|
data-testid="contextual-toolbar"
|
|
172
171
|
className={classNames('tlui-contextual-toolbar', className)}
|
|
173
|
-
onPointerDown={markEventAsHandled}
|
|
172
|
+
onPointerDown={editor.markEventAsHandled}
|
|
174
173
|
>
|
|
175
174
|
<TldrawUiToolbar
|
|
176
175
|
orientation="horizontal"
|
|
@@ -35,6 +35,7 @@ export interface TLUiInputProps {
|
|
|
35
35
|
shouldManuallyMaintainScrollPositionWhenFocused?: boolean
|
|
36
36
|
value?: string
|
|
37
37
|
'data-testid'?: string
|
|
38
|
+
'aria-label'?: string
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
/** @public @react */
|
|
@@ -60,6 +61,7 @@ export const TldrawUiInput = React.forwardRef<HTMLInputElement, TLUiInputProps>(
|
|
|
60
61
|
value,
|
|
61
62
|
'data-testid': dataTestId,
|
|
62
63
|
disabled,
|
|
64
|
+
'aria-label': ariaLabel,
|
|
63
65
|
},
|
|
64
66
|
ref
|
|
65
67
|
) {
|
|
@@ -198,6 +200,7 @@ export const TldrawUiInput = React.forwardRef<HTMLInputElement, TLUiInputProps>(
|
|
|
198
200
|
onCompositionStart={handleCompositionStart}
|
|
199
201
|
onCompositionEnd={handleCompositionEnd}
|
|
200
202
|
autoFocus={autoFocus}
|
|
203
|
+
aria-label={ariaLabel}
|
|
201
204
|
placeholder={placeholder}
|
|
202
205
|
value={value}
|
|
203
206
|
data-testid={dataTestId}
|
|
@@ -71,6 +71,7 @@ export const TldrawUiToolbarButton = React.forwardRef<HTMLButtonElement, TLUiToo
|
|
|
71
71
|
draggable={false}
|
|
72
72
|
data-isactive={isActive}
|
|
73
73
|
{...props}
|
|
74
|
+
aria-label={props.title}
|
|
74
75
|
// The tooltip takes care of this.
|
|
75
76
|
title={undefined}
|
|
76
77
|
className={classnames('tlui-button', `tlui-button__${type}`, props.className)}
|
|
@@ -127,7 +128,7 @@ export interface TLUiToolbarToggleItemProps extends React.HTMLAttributes<HTMLBut
|
|
|
127
128
|
className?: string
|
|
128
129
|
type: 'icon' | 'tool'
|
|
129
130
|
value: string
|
|
130
|
-
tooltip?:
|
|
131
|
+
tooltip?: React.ReactNode
|
|
131
132
|
}
|
|
132
133
|
|
|
133
134
|
/** @public @react */
|
|
@@ -171,6 +171,20 @@ function TooltipSingleton() {
|
|
|
171
171
|
}
|
|
172
172
|
}, [cameraState, isOpen, currentTooltip, editor])
|
|
173
173
|
|
|
174
|
+
useEffect(() => {
|
|
175
|
+
function handleKeyDown(event: KeyboardEvent) {
|
|
176
|
+
if (event.key === 'Escape' && currentTooltip && isOpen) {
|
|
177
|
+
tooltipManager.hideTooltip(editor, currentTooltip.id)
|
|
178
|
+
event.stopPropagation()
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
document.addEventListener('keydown', handleKeyDown, { capture: true })
|
|
183
|
+
return () => {
|
|
184
|
+
document.removeEventListener('keydown', handleKeyDown, { capture: true })
|
|
185
|
+
}
|
|
186
|
+
}, [editor, currentTooltip, isOpen])
|
|
187
|
+
|
|
174
188
|
// Update open state and trigger position
|
|
175
189
|
useEffect(() => {
|
|
176
190
|
let timer: ReturnType<typeof setTimeout> | null = null
|
|
@@ -253,7 +267,11 @@ export const TldrawUiTooltip = forwardRef<HTMLButtonElement, TldrawUiTooltipProp
|
|
|
253
267
|
const editor = useMaybeEditor()
|
|
254
268
|
const tooltipId = useRef<string>(uniqueId())
|
|
255
269
|
const hasProvider = useContext(TooltipSingletonContext)
|
|
256
|
-
const
|
|
270
|
+
const enhancedA11yMode = useValue(
|
|
271
|
+
'enhancedA11yMode',
|
|
272
|
+
() => editor?.user.getEnhancedA11yMode(),
|
|
273
|
+
[editor]
|
|
274
|
+
)
|
|
257
275
|
|
|
258
276
|
const orientationCtx = useTldrawUiOrientation()
|
|
259
277
|
const sideToUse = side ?? orientationCtx.tooltipSide
|
|
@@ -279,13 +297,13 @@ export const TldrawUiTooltip = forwardRef<HTMLButtonElement, TldrawUiTooltipProp
|
|
|
279
297
|
}
|
|
280
298
|
}, [content, sideToUse, sideOffset, showOnMobile, hasProvider])
|
|
281
299
|
|
|
282
|
-
// Don't show tooltip if disabled, no content, or
|
|
300
|
+
// Don't show tooltip if disabled, no content, or enhanced accessibility mode is disabled
|
|
283
301
|
if (disabled || !content) {
|
|
284
302
|
return <>{children}</>
|
|
285
303
|
}
|
|
286
304
|
|
|
287
305
|
let delayDurationToUse
|
|
288
|
-
if (
|
|
306
|
+
if (enhancedA11yMode) {
|
|
289
307
|
delayDurationToUse = 0
|
|
290
308
|
} else {
|
|
291
309
|
delayDurationToUse =
|
|
@@ -293,9 +311,12 @@ export const TldrawUiTooltip = forwardRef<HTMLButtonElement, TldrawUiTooltipProp
|
|
|
293
311
|
}
|
|
294
312
|
|
|
295
313
|
// Fallback to old behavior if no provider
|
|
296
|
-
if (!hasProvider) {
|
|
314
|
+
if (!hasProvider || enhancedA11yMode) {
|
|
297
315
|
return (
|
|
298
|
-
<_Tooltip.Root
|
|
316
|
+
<_Tooltip.Root
|
|
317
|
+
delayDuration={delayDurationToUse}
|
|
318
|
+
disableHoverableContent={!enhancedA11yMode}
|
|
319
|
+
>
|
|
299
320
|
<_Tooltip.Trigger asChild ref={ref}>
|
|
300
321
|
{children}
|
|
301
322
|
</_Tooltip.Trigger>
|
|
@@ -19,6 +19,7 @@ export interface TLUiMenuCheckboxItemProps<
|
|
|
19
19
|
kbd?: string
|
|
20
20
|
title?: string
|
|
21
21
|
label?: TranslationKey | { [key: string]: TranslationKey }
|
|
22
|
+
lang?: string
|
|
22
23
|
readonlyOk?: boolean
|
|
23
24
|
onSelect(source: TLUiEventSource): Promise<void> | void
|
|
24
25
|
toggle?: boolean
|
|
@@ -34,6 +35,7 @@ export function TldrawUiMenuCheckboxItem<
|
|
|
34
35
|
id,
|
|
35
36
|
kbd,
|
|
36
37
|
label,
|
|
38
|
+
lang,
|
|
37
39
|
readonlyOk,
|
|
38
40
|
onSelect,
|
|
39
41
|
toggle = false,
|
|
@@ -55,6 +57,7 @@ export function TldrawUiMenuCheckboxItem<
|
|
|
55
57
|
return (
|
|
56
58
|
<_DropdownMenu.CheckboxItem
|
|
57
59
|
dir="ltr"
|
|
60
|
+
lang={lang}
|
|
58
61
|
className="tlui-button tlui-button__menu tlui-button__checkbox"
|
|
59
62
|
title={labelStr}
|
|
60
63
|
onSelect={(e) => {
|
|
@@ -84,6 +87,7 @@ export function TldrawUiMenuCheckboxItem<
|
|
|
84
87
|
key={id}
|
|
85
88
|
className="tlui-button tlui-button__menu tlui-button__checkbox"
|
|
86
89
|
dir="ltr"
|
|
90
|
+
lang={lang}
|
|
87
91
|
title={labelStr}
|
|
88
92
|
onSelect={(e) => {
|
|
89
93
|
onSelect(sourceId)
|
|
@@ -333,7 +333,7 @@ function useDraggableEvents(
|
|
|
333
333
|
type: 'pointer',
|
|
334
334
|
target: 'canvas',
|
|
335
335
|
name: 'pointer_down',
|
|
336
|
-
...getPointerInfo(e),
|
|
336
|
+
...getPointerInfo(editor, e),
|
|
337
337
|
point: screenSpaceStart,
|
|
338
338
|
})
|
|
339
339
|
|
|
@@ -345,7 +345,7 @@ function useDraggableEvents(
|
|
|
345
345
|
type: 'pointer',
|
|
346
346
|
target: 'canvas',
|
|
347
347
|
name: 'pointer_move',
|
|
348
|
-
...getPointerInfo(e),
|
|
348
|
+
...getPointerInfo(editor, e),
|
|
349
349
|
point: screenSpaceStart,
|
|
350
350
|
})
|
|
351
351
|
|
|
@@ -365,7 +365,7 @@ function useDraggableEvents(
|
|
|
365
365
|
type: 'pointer',
|
|
366
366
|
target: 'canvas',
|
|
367
367
|
name: 'pointer_up',
|
|
368
|
-
...getPointerInfo(e),
|
|
368
|
+
...getPointerInfo(editor, e),
|
|
369
369
|
})
|
|
370
370
|
}
|
|
371
371
|
|
|
@@ -1270,16 +1270,16 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
|
|
|
1270
1270
|
checkbox: true,
|
|
1271
1271
|
},
|
|
1272
1272
|
{
|
|
1273
|
-
id: '
|
|
1273
|
+
id: 'enhanced-a11y-mode',
|
|
1274
1274
|
label: {
|
|
1275
|
-
default: 'action.
|
|
1276
|
-
menu: 'action.
|
|
1275
|
+
default: 'action.enhanced-a11y-mode',
|
|
1276
|
+
menu: 'action.enhanced-a11y-mode.menu',
|
|
1277
1277
|
},
|
|
1278
1278
|
readonlyOk: true,
|
|
1279
1279
|
onSelect(source) {
|
|
1280
|
-
trackEvent('
|
|
1280
|
+
trackEvent('enhanced-a11y-mode', { source })
|
|
1281
1281
|
editor.user.updateUserPreferences({
|
|
1282
|
-
|
|
1282
|
+
enhancedA11yMode: !editor.user.getEnhancedA11yMode(),
|
|
1283
1283
|
})
|
|
1284
1284
|
},
|
|
1285
1285
|
checkbox: true,
|
|
@@ -1344,28 +1344,6 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
|
|
|
1344
1344
|
}
|
|
1345
1345
|
},
|
|
1346
1346
|
},
|
|
1347
|
-
{
|
|
1348
|
-
id: 'toggle-focus-mode',
|
|
1349
|
-
label: {
|
|
1350
|
-
default: 'action.toggle-focus-mode',
|
|
1351
|
-
menu: 'action.toggle-focus-mode.menu',
|
|
1352
|
-
},
|
|
1353
|
-
readonlyOk: true,
|
|
1354
|
-
kbd: 'cmd+.,ctrl+.',
|
|
1355
|
-
checkbox: true,
|
|
1356
|
-
onSelect(source) {
|
|
1357
|
-
// this needs to be deferred because it causes the menu
|
|
1358
|
-
// UI to unmount which puts us in a dodgy state
|
|
1359
|
-
editor.timers.requestAnimationFrame(() => {
|
|
1360
|
-
editor.run(() => {
|
|
1361
|
-
trackEvent('toggle-focus-mode', { source })
|
|
1362
|
-
helpers.clearDialogs()
|
|
1363
|
-
helpers.clearToasts()
|
|
1364
|
-
editor.updateInstanceState({ isFocusMode: !editor.getInstanceState().isFocusMode })
|
|
1365
|
-
})
|
|
1366
|
-
})
|
|
1367
|
-
},
|
|
1368
|
-
},
|
|
1369
1347
|
{
|
|
1370
1348
|
id: 'toggle-grid',
|
|
1371
1349
|
label: {
|
|
@@ -1584,6 +1562,19 @@ export function ActionsProvider({ overrides, children }: ActionsProviderProps) {
|
|
|
1584
1562
|
onSelect: async (source) => {
|
|
1585
1563
|
if (!canApplySelectionAction()) return
|
|
1586
1564
|
|
|
1565
|
+
const onlySelectedShape = editor.getOnlySelectedShape()
|
|
1566
|
+
if (
|
|
1567
|
+
onlySelectedShape &&
|
|
1568
|
+
(editor.isShapeOfType<TLImageShape>(onlySelectedShape, 'image') ||
|
|
1569
|
+
editor.isShapeOfType<TLVideoShape>(onlySelectedShape, 'video'))
|
|
1570
|
+
) {
|
|
1571
|
+
const firstToolbarButton = editor
|
|
1572
|
+
.getContainer()
|
|
1573
|
+
.querySelector('.tlui-contextual-toolbar button:first-child') as HTMLElement | null
|
|
1574
|
+
firstToolbarButton?.focus()
|
|
1575
|
+
return
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1587
1578
|
const firstButton = editor
|
|
1588
1579
|
.getContainer()
|
|
1589
1580
|
.querySelector('.tlui-style-panel button') as HTMLElement | null
|
|
@@ -102,13 +102,14 @@ export interface TLUiEventMap {
|
|
|
102
102
|
'toggle-grid-mode': null
|
|
103
103
|
'toggle-wrap-mode': null
|
|
104
104
|
'toggle-focus-mode': null
|
|
105
|
+
'input-mode': { value: string }
|
|
105
106
|
'toggle-debug-mode': null
|
|
106
107
|
'toggle-dynamic-size-mode': null
|
|
107
108
|
'toggle-paste-at-cursor': null
|
|
108
109
|
'toggle-lock': null
|
|
109
110
|
'toggle-reduce-motion': null
|
|
110
111
|
'toggle-keyboard-shortcuts': null
|
|
111
|
-
'
|
|
112
|
+
'enhanced-a11y-mode': null
|
|
112
113
|
'toggle-edge-scrolling': null
|
|
113
114
|
'color-scheme': { value: string }
|
|
114
115
|
'exit-pen-mode': null
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
assert,
|
|
8
8
|
compact,
|
|
9
9
|
isDefined,
|
|
10
|
-
markEventAsHandled,
|
|
11
10
|
preventDefault,
|
|
12
11
|
uniq,
|
|
13
12
|
useEditor,
|
|
@@ -763,7 +762,7 @@ export function useNativeClipboardEvents() {
|
|
|
763
762
|
|
|
764
763
|
const paste = (e: ClipboardEvent) => {
|
|
765
764
|
if (disablingMiddleClickPaste) {
|
|
766
|
-
markEventAsHandled(e)
|
|
765
|
+
editor.markEventAsHandled(e)
|
|
767
766
|
return
|
|
768
767
|
}
|
|
769
768
|
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
/** @public */
|
|
5
5
|
export type TLUiTranslationKey =
|
|
6
|
+
| 'action.toggle-auto-pan'
|
|
7
|
+
| 'action.toggle-auto-zoom'
|
|
8
|
+
| 'action.toggle-auto-none'
|
|
9
|
+
| 'action.toggle-mouse'
|
|
10
|
+
| 'action.toggle-trackpad'
|
|
6
11
|
| 'action.convert-to-bookmark'
|
|
7
12
|
| 'action.convert-to-embed'
|
|
8
13
|
| 'action.open-embed-link'
|
|
@@ -93,8 +98,8 @@ export type TLUiTranslationKey =
|
|
|
93
98
|
| 'action.toggle-reduce-motion'
|
|
94
99
|
| 'action.toggle-keyboard-shortcuts.menu'
|
|
95
100
|
| 'action.toggle-keyboard-shortcuts'
|
|
96
|
-
| 'action.
|
|
97
|
-
| 'action.
|
|
101
|
+
| 'action.enhanced-a11y-mode.menu'
|
|
102
|
+
| 'action.enhanced-a11y-mode'
|
|
98
103
|
| 'action.toggle-edge-scrolling.menu'
|
|
99
104
|
| 'action.toggle-edge-scrolling'
|
|
100
105
|
| 'action.toggle-debug-mode.menu'
|
|
@@ -122,6 +127,7 @@ export type TLUiTranslationKey =
|
|
|
122
127
|
| 'action.zoom-to-fit'
|
|
123
128
|
| 'action.zoom-to-selection'
|
|
124
129
|
| 'assets.files.size-too-big'
|
|
130
|
+
| 'assets.files.maximum-size'
|
|
125
131
|
| 'assets.files.type-not-allowed'
|
|
126
132
|
| 'assets.files.upload-failed'
|
|
127
133
|
| 'assets.files.amount-too-many'
|
|
@@ -310,6 +316,7 @@ export type TLUiTranslationKey =
|
|
|
310
316
|
| 'menu.language'
|
|
311
317
|
| 'menu.preferences'
|
|
312
318
|
| 'menu.view'
|
|
319
|
+
| 'menu.input-mode'
|
|
313
320
|
| 'context-menu.title'
|
|
314
321
|
| 'context-menu.edit'
|
|
315
322
|
| 'context-menu.arrange'
|
|
@@ -411,6 +418,7 @@ export type TLUiTranslationKey =
|
|
|
411
418
|
| 'style-panel.opacity'
|
|
412
419
|
| 'style-panel.size'
|
|
413
420
|
| 'style-panel.spline'
|
|
421
|
+
| 'style-panel.selected'
|
|
414
422
|
| 'tool-panel.title'
|
|
415
423
|
| 'tool-panel.more'
|
|
416
424
|
| 'navigation-zone.title'
|
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
|
|
4
4
|
/** @internal */
|
|
5
5
|
export const DEFAULT_TRANSLATION = {
|
|
6
|
+
'action.toggle-auto-pan': 'Auto (trackpad)',
|
|
7
|
+
'action.toggle-auto-zoom': 'Auto (mouse)',
|
|
8
|
+
'action.toggle-auto-none': 'Auto',
|
|
9
|
+
'action.toggle-mouse': 'Mouse',
|
|
10
|
+
'action.toggle-trackpad': 'Trackpad',
|
|
6
11
|
'action.convert-to-bookmark': 'Convert to Bookmark',
|
|
7
12
|
'action.convert-to-embed': 'Convert to Embed',
|
|
8
13
|
'action.open-embed-link': 'Open link',
|
|
@@ -94,8 +99,8 @@ export const DEFAULT_TRANSLATION = {
|
|
|
94
99
|
'action.toggle-reduce-motion': 'Toggle reduce motion',
|
|
95
100
|
'action.toggle-keyboard-shortcuts.menu': 'Enable keyboard shortcuts',
|
|
96
101
|
'action.toggle-keyboard-shortcuts': 'Toggle keyboard shortcuts',
|
|
97
|
-
'action.
|
|
98
|
-
'action.
|
|
102
|
+
'action.enhanced-a11y-mode.menu': 'Enhanced accessibility mode',
|
|
103
|
+
'action.enhanced-a11y-mode': 'Toggle enhanced accessibility mode',
|
|
99
104
|
'action.toggle-edge-scrolling.menu': 'Edge scrolling',
|
|
100
105
|
'action.toggle-edge-scrolling': 'Toggle edge scrolling',
|
|
101
106
|
'action.toggle-debug-mode.menu': 'Debug mode',
|
|
@@ -123,6 +128,7 @@ export const DEFAULT_TRANSLATION = {
|
|
|
123
128
|
'action.zoom-to-fit': 'Zoom to fit',
|
|
124
129
|
'action.zoom-to-selection': 'Zoom to selection',
|
|
125
130
|
'assets.files.size-too-big': 'File size is too big',
|
|
131
|
+
'assets.files.maximum-size': 'Maximum file size is {size}',
|
|
126
132
|
'assets.files.type-not-allowed': 'File type is not allowed',
|
|
127
133
|
'assets.files.upload-failed': 'Upload failed',
|
|
128
134
|
'assets.files.amount-too-many': 'Too many files',
|
|
@@ -311,6 +317,7 @@ export const DEFAULT_TRANSLATION = {
|
|
|
311
317
|
'menu.language': 'Language',
|
|
312
318
|
'menu.preferences': 'Preferences',
|
|
313
319
|
'menu.view': 'View',
|
|
320
|
+
'menu.input-mode': 'Input mode',
|
|
314
321
|
'context-menu.title': 'Context menu',
|
|
315
322
|
'context-menu.edit': 'Edit',
|
|
316
323
|
'context-menu.arrange': 'Arrange',
|
|
@@ -414,6 +421,7 @@ export const DEFAULT_TRANSLATION = {
|
|
|
414
421
|
'style-panel.opacity': 'Opacity',
|
|
415
422
|
'style-panel.size': 'Size',
|
|
416
423
|
'style-panel.spline': 'Spline',
|
|
424
|
+
'style-panel.selected': 'selected',
|
|
417
425
|
'tool-panel.title': 'Tools',
|
|
418
426
|
'tool-panel.more': 'More',
|
|
419
427
|
'navigation-zone.title': 'Navigation',
|