Просмотр исходного кода

wip: move paste as link to context menu

Konstantinos Kaloutas 3 лет назад
Родитель
Сommit
da4e945529

+ 13 - 0
tldraw/apps/tldraw-logseq/src/components/ContextMenu/ContextMenu.tsx

@@ -164,6 +164,19 @@ export const ContextMenu = observer(function ContextMenu({
               </span>
             </div>
           </ReactContextMenu.Item>
+          {app.selectedShapes?.size === 1 && (
+          <ReactContextMenu.Item
+            className="tl-menu-item"
+            onClick={() => runAndTransition(() => app.paste(undefined, true))}
+          >
+            Paste as link
+            <div className="tl-menu-right-slot">
+              <span className="keyboard-shortcut">
+                <code>{MOD_KEY}</code> <code>⇧</code> <code>V</code>
+              </span>
+            </div>
+          </ReactContextMenu.Item>
+          )}
           <ReactContextMenu.Separator className="menu-separator" />
           <ReactContextMenu.Item
             className="tl-menu-item"

+ 8 - 17
tldraw/apps/tldraw-logseq/src/components/inputs/ShapeLinksInput.tsx

@@ -144,23 +144,14 @@ export const ShapeLinksInput = observer(function ShapeLinksInput({
           <div className="h-2" />
 
           {canAddLink && (
-            <>
-              <LogseqQuickSearch
-                style={{
-                  width: 'calc(100% - 46px)',
-                  marginLeft: '46px',
-                }}
-                placeholder="Start typing to search..."
-                onChange={addNewRef}
-              />
-              <div className="h-2" />
-              <div className="text-center">
-                <span className="opacity-50 mr-1">Paste from clipboard with</span>
-                <span className="keyboard-shortcut">
-                  <code>{MOD_KEY}</code> <code>⇧</code> <code>V</code>
-                </span>
-              </div>
-            </>
+            <LogseqQuickSearch
+              style={{
+                width: 'calc(100% - 46px)',
+                marginLeft: '46px',
+              }}
+              placeholder="Start typing to search..."
+              onChange={addNewRef}
+            />
           )}
 
           {refs.length > 0 && (