chore: run pretty-quick

pull/6560/head
Peng Xiao 2022-08-31 11:10:55 +08:00
parent c2daf9351f
commit 62f1f627b7
8 changed files with 46 additions and 12 deletions

View File

@ -81,7 +81,7 @@ export const App = function App({
const onFileDrop = useFileDrop(contextValue)
const onPaste = usePaste(contextValue)
const onQuickAdd = useQuickAdd()
const ref = React.useRef<HTMLDivElement>(null);
const ref = React.useRef<HTMLDivElement>(null)
const onPersistOnDiff: TLReactCallbacks<Shape>['onPersist'] = React.useCallback(
(app, info) => {

View File

@ -117,6 +117,14 @@ export const ContextMenu = observer(function ContextMenu({
</span>
</div>
</ReactContextMenu.Item>
<ReactContextMenu.Item className="tl-context-menu-button">
Move forwards
<div className="tl-context-menu-right-slot">
<span className="keyboard-shortcut">
<code>]</code>
</span>
</div>
</ReactContextMenu.Item>
<ReactContextMenu.Item
className="tl-context-menu-button"
onClick={() => app.sendToBack()}
@ -128,6 +136,17 @@ export const ContextMenu = observer(function ContextMenu({
</span>
</div>
</ReactContextMenu.Item>
<ReactContextMenu.Item
className="tl-context-menu-button"
onClick={() => app.sendBackward()}
>
Move backwards
<div className="tl-context-menu-right-slot">
<span className="keyboard-shortcut">
<code>[</code>
</span>
</div>
</ReactContextMenu.Item>
</>
)}
</div>

View File

@ -1,6 +1,6 @@
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu'
import { useApp } from '@tldraw/react'
import { MOD_KEY} from '@tldraw/core'
import { MOD_KEY } from '@tldraw/core'
import { observer } from 'mobx-react-lite'
export const ZoomMenu = observer(function ZoomMenu(): JSX.Element {
@ -31,28 +31,48 @@ export const ZoomMenu = observer(function ZoomMenu(): JSX.Element {
onSelect={preventEvent}
onClick={app.api.zoomToSelection}
>
Zoom to Selection <div className="tl-zoom-menu-right-slot"><span className="keyboard-shortcut"><code>{MOD_KEY}</code> <code>-</code></span></div>
Zoom to Selection{' '}
<div className="tl-zoom-menu-right-slot">
<span className="keyboard-shortcut">
<code>{MOD_KEY}</code> <code>-</code>
</span>
</div>
</DropdownMenuPrimitive.Item>
<DropdownMenuPrimitive.Item
className="menu-link tl-zoom-menu-dropdown-item"
onSelect={preventEvent}
onClick={app.api.zoomIn}
>
Zoom In <div className="tl-zoom-menu-right-slot"><span className="keyboard-shortcut"><code>{MOD_KEY}</code> <code>+</code></span></div>
Zoom In{' '}
<div className="tl-zoom-menu-right-slot">
<span className="keyboard-shortcut">
<code>{MOD_KEY}</code> <code>+</code>
</span>
</div>
</DropdownMenuPrimitive.Item>
<DropdownMenuPrimitive.Item
className="menu-link tl-zoom-menu-dropdown-item"
onSelect={preventEvent}
onClick={app.api.zoomOut}
>
Zoom Out <div className="tl-zoom-menu-right-slot"><span className="keyboard-shortcut"><code>{MOD_KEY}</code> <code>-</code></span></div>
Zoom Out{' '}
<div className="tl-zoom-menu-right-slot">
<span className="keyboard-shortcut">
<code>{MOD_KEY}</code> <code>-</code>
</span>
</div>
</DropdownMenuPrimitive.Item>
<DropdownMenuPrimitive.Item
className="menu-link tl-zoom-menu-dropdown-item"
onSelect={preventEvent}
onClick={app.api.resetZoom}
>
Reset Zoom <div className="tl-zoom-menu-right-slot"><span className="keyboard-shortcut"><code></code> <code>0</code></span></div>
Reset Zoom{' '}
<div className="tl-zoom-menu-right-slot">
<span className="keyboard-shortcut">
<code></code> <code>0</code>
</span>
</div>
</DropdownMenuPrimitive.Item>
</DropdownMenuPrimitive.Content>
</DropdownMenuPrimitive.Root>

View File

@ -112,7 +112,6 @@
opacity: 100%;
background-color: var(--ls-primary-background-color);
> span svg {
display: none !important;
}

View File

@ -828,8 +828,6 @@ export class TLApp<
}
readonly onPointerDown: TLEvents<S, K>['pointer'] = (info, e) => {
// Pan canvas when holding middle click
if (!this.editingShape && e.button === 1 && !this.isIn('move')) {
this.temporaryTransitionToMove(e)

View File

@ -57,7 +57,6 @@ export class IdleState<
return
}
switch (info.type) {
case TLTargetType.Selection: {
switch (info.handle) {

View File

@ -77,7 +77,7 @@ export function modKey(e: any): boolean {
return isDarwin() ? e.metaKey : e.ctrlKey
}
export const MOD_KEY = isDarwin() ? '⌘' : 'Ctrl';
export const MOD_KEY = isDarwin() ? '⌘' : 'Ctrl'
export function isNonNullable<TValue>(value: TValue): value is NonNullable<TValue> {
return Boolean(value)

View File

@ -56,7 +56,6 @@ export const ContextBarContainer = observer(function ContextBarContainer<S exten
BoundsUtils.boundsContain(vpBounds, screenBounds) ||
BoundsUtils.boundsCollide(vpBounds, screenBounds)
return (
<div
ref={rBounds}