|
2 | 2 | import React, { useState, useRef, useEffect, useCallback } from 'react'; |
3 | 3 | import { CheckIcon, ChevronDownIcon, ClipboardIcon, SearchIcon, XIcon, ArrowUpwardIcon, ArrowDownwardIcon, CaseSensitiveIcon, WholeWordIcon, RegexIcon, ImageIcon } from './icons/material-icons-imports'; |
4 | 4 |
|
5 | | -// Search context for highlighting and navigation |
6 | | -interface SearchState { |
7 | | - query: string; |
8 | | - currentMatchIndex: number; |
9 | | - totalMatches: number; |
10 | | - isActive: boolean; |
11 | | -} |
| 5 | +// Removed unused SearchState interface |
12 | 6 |
|
13 | 7 | // Helper function to highlight search matches in text |
14 | 8 | // Helper function to highlight search matches in text |
@@ -65,7 +59,7 @@ const highlightText = (text: string, searchRegex: RegExp | null): React.ReactNod |
65 | 59 | // Component to render ObjectId with both click navigation and copy functionality |
66 | 60 | const ObjectIdDisplay: React.FC<{ |
67 | 61 | objectId: string; |
68 | | - onObjectIdClick?: (id: string, keyContext?: string, openInNewTab?: boolean) => void; |
| 62 | + onObjectIdClick?: (id: string, keyContext?: string, openInNewTab?: boolean, openToSide?: boolean) => void; |
69 | 63 | keyContext?: string; |
70 | 64 | showAsLink?: boolean; |
71 | 65 | }> = ({ objectId, onObjectIdClick, keyContext, showAsLink = true }) => { |
@@ -175,6 +169,15 @@ const ObjectIdDisplay: React.FC<{ |
175 | 169 | > |
176 | 170 | <span>Open in New Tab</span> |
177 | 171 | </button> |
| 172 | + <button |
| 173 | + onClick={() => { |
| 174 | + setShowContextMenu(false); |
| 175 | + onObjectIdClick?.(objectId, keyContext, false, true); |
| 176 | + }} |
| 177 | + className="w-full text-left px-3 py-2 text-sm hover:bg-slate-100 dark:hover:bg-slate-700 flex items-center gap-2" |
| 178 | + > |
| 179 | + <span>Open to Side</span> |
| 180 | + </button> |
178 | 181 | <div className="border-t border-slate-200 dark:border-slate-600 my-1"></div> |
179 | 182 | <button |
180 | 183 | onClick={handleCopyFromMenu} |
@@ -296,7 +299,7 @@ const JsonNode: React.FC<{ |
296 | 299 | nodeValue: any; |
297 | 300 | nodeKey?: string; // The key of this node, if it's in an object |
298 | 301 | isRoot?: boolean; // The top-level object is not collapsible |
299 | | - onObjectIdClick?: (id: string, keyContext?: string, openInNewTab?: boolean) => void; |
| 302 | + onObjectIdClick?: (id: string, keyContext?: string, openInNewTab?: boolean, openToSide?: boolean) => void; |
300 | 303 | parentKeyContext?: string; // The key of the parent, used for context in clicks |
301 | 304 | searchRegex?: RegExp | null; // Regex for highlighting |
302 | 305 | currentMatchIndex?: number; // Current match index for highlighting |
@@ -516,7 +519,7 @@ const JsonNode: React.FC<{ |
516 | 519 |
|
517 | 520 | interface JsonDisplayProps { |
518 | 521 | data: any; |
519 | | - onObjectIdClick?: (id: string, keyContext?: string, openInNewTab?: boolean) => void; |
| 522 | + onObjectIdClick?: (id: string, keyContext?: string, openInNewTab?: boolean, openToSide?: boolean) => void; |
520 | 523 | } |
521 | 524 |
|
522 | 525 | const JsonDisplay: React.FC<JsonDisplayProps> = ({ data, onObjectIdClick }) => { |
|
0 commit comments