소스 검색

fix: code style issues

Peng Xiao 2 년 전
부모
커밋
7847bfb65a

+ 1 - 5
tldraw/apps/tldraw-logseq/src/components/QuickSearch/QuickSearch.tsx

@@ -101,7 +101,6 @@ export const LogseqQuickSearch = observer(
     )
     const rInput = React.useRef<HTMLInputElement>(null)
     const { handlers, renderers } = React.useContext(LogseqContext)
-    const app = useApp<Shape>()
 
     const finishSearching = React.useCallback((id: string) => {
       onChange(id)
@@ -117,10 +116,7 @@ export const LogseqQuickSearch = observer(
         const uuid = handlers?.addNewBlock(content)
         if (uuid) {
           finishSearching(uuid)
-          // wait until the editor is mounted
-          setTimeout(() => {
-            onAddBlock?.(uuid)
-          })
+          onAddBlock?.(uuid)
         }
         return uuid
       },

+ 1 - 1
tldraw/apps/tldraw-logseq/src/components/StatusBar/StatusBar.tsx

@@ -10,7 +10,7 @@ export const StatusBar = observer(function StatusBar() {
     <div className="tl-statusbar">
       {app.selectedTool.id} | {app.selectedTool.currentState.id}
       <div style={{ flex: 1 }} />
-      <div id="tl-statusbar-anchor" className='flex gap-1' />
+      <div id="tl-statusbar-anchor" className="flex gap-1" />
     </div>
   )
 })

+ 6 - 3
tldraw/apps/tldraw-logseq/src/lib/shapes/LogseqPortalShape.tsx

@@ -336,7 +336,7 @@ export class LogseqPortalShape extends TLBoxShape<LogseqPortalShapeProps> {
   ReactComponent = observer((componentProps: TLComponentProps) => {
     const { events, isErasing, isEditing, isBinding } = componentProps
     const {
-      props: { opacity, pageId, stroke, fill, scaleLevel, strokeWidth, size },
+      props: { opacity, pageId, fill, scaleLevel, strokeWidth, size },
     } = this
 
     const app = useApp<Shape>()
@@ -444,8 +444,11 @@ export class LogseqPortalShape extends TLBoxShape<LogseqPortalShapeProps> {
             <LogseqQuickSearch
               onChange={onPageNameChanged}
               onAddBlock={uuid => {
-                app.api.editShape(this)
-                window.logseq?.api?.edit_block?.(uuid)
+                // wait until the editor is mounted
+                setTimeout(() => {
+                  app.api.editShape(this)
+                  window.logseq?.api?.edit_block?.(uuid)
+                })
               }}
               placeholder="Create or search your graph..."
             />

+ 1 - 1
tldraw/apps/tldraw-logseq/src/lib/shapes/TextShape.tsx

@@ -309,7 +309,7 @@ export class TextShape extends TLTextShape<TextShapeProps> {
   getShapeSVGJsx() {
     if (isSafari()) {
       // Safari doesn't support foreignObject well
-      return super.getShapeSVGJsx(null);
+      return super.getShapeSVGJsx(null)
     }
     const {
       props: { text, stroke, fontSize, fontFamily },

+ 1 - 1
tldraw/packages/core/src/lib/tools/TLDrawTool/states/index.ts

@@ -1,3 +1,3 @@
 export * from './CreatingState'
 export * from './IdleState'
-export * from './PinchingState'
+export * from './PinchingState'

+ 1 - 1
tldraw/packages/core/src/types/types.ts

@@ -183,7 +183,7 @@ export type TLSubscriptionEvent =
     }
   | {
       event: 'paste'
-      info: { point: number[]; shiftKey: boolean; dataTransfer?: DataTransfer, fromDrop?: boolean }
+      info: { point: number[]; shiftKey: boolean; dataTransfer?: DataTransfer; fromDrop?: boolean }
     }
   | {
       event: 'create-assets'

+ 7 - 1
tldraw/packages/react/src/components/ui/Grid/Grid.tsx

@@ -38,7 +38,13 @@ const SVGGrid = observer(function CanvasGrid({ size }: TLGridProps) {
               patternUnits="userSpaceOnUse"
             >
               {!hide && (
-                <circle className={`tl-grid-dot`} cx={gxo} cy={gyo} r={1.5} opacity={clamp(opacity, 0, 1)} />
+                <circle
+                  className={`tl-grid-dot`}
+                  cx={gxo}
+                  cy={gyo}
+                  r={1.5}
+                  opacity={clamp(opacity, 0, 1)}
+                />
               )}
             </pattern>
           )