006d2a7ffc
This PR fixes a bug where you could lose focus of the editor, which caused keyboard shortcuts to stop working. The problem was this: - The duplicate button can become disabled while you have it focused. - This would shove focus back to the document body, and the editor would lose focus. - When we disable the button, we should keep focus in the editor instead. - This shouldn't interfere with a developer manually handling focus of the editor themselves. I applied the same fix to the undo, redo, delete and duplicate buttons. **Is this is a bit hacky? Not sure if I'm handling those `ref`s correctly? WDYT?** ![2024-01-25 at 12 14 50 - Gold Nightingale](https://github.com/tldraw/tldraw/assets/15892272/5ca71f92-45fa-48f6-9039-f6c01c495ce7) ### Change Type - [x] `patch` — Bug fix [^1]: publishes a `patch` release, for devDependencies use `internal` [^2]: will not publish a new version ### Test Plan 1. Create a shape. 2. Select it. 3. Click the duplicate button at the top of the screen. 4. Press the 'd' key. 5. Press the 'a' key. 6. You should have the Arrow tool selected. - [ ] Unit Tests - [ ] End to end tests ### Release Notes - Fixed a bug where keyboard shortcuts could stop working after using an action button. |
||
---|---|---|
.. | ||
api | ||
scripts | ||
src | ||
api-extractor.json | ||
api-report.md | ||
CHANGELOG.md | ||
LICENSE.md | ||
package.json | ||
README.md | ||
setupTests.js | ||
tsconfig.json |
@tldraw/tldraw
This package contains the source code for the tldraw library. Learn more at our docs site: tldraw.dev.
Installation
Install the @tldraw/tldraw
package using @canary
for the latest canary release. (Or @alpha
for the latest alpha release.)
yarn add @tldraw/tldraw@canary
# or
npm install @tldraw/tldraw@canary
# or
pnpm i @tldraw/tldraw@canary
Then start the local development server.
yarn dev
# or
npm run dev
# or
pnpm dev
Usage
An extremely minimal usage (without our UI) might look like this:
import { Tldraw } from '@tldraw/tldraw'
import '@tldraw/tldraw/tldraw.css'
export default function () {
return <Tldraw/>
}
See the examples folder for more examples.
Community
Have questions, comments or feedback? Join our discord or start a discussion.
Distributions
You can find tldraw on npm here.
Contribution
Please see our contributing guide. Found a bug? Please submit an issue.
License
The tldraw source code and its distributions are provided under the tldraw license. This license does not permit commercial use.
If you wish to use this project in commercial product, you need to purchase a commercial license. Please contact us at hello@tldraw.com for more inforion about obtaining a commercial license.
Trademarks
Copyright (c) 2023-present tldraw Inc. The tldraw name and logo are trademarks of tldraw. Please see our trademark guidelines for info on acceptable usage.
Contact
Find us on Twitter at @tldraw or email hello@tldraw.com. You can also join our discord for quick help and support.