fix: Document search results in editor now show full path

closes #3007
This commit is contained in:
Tom Moor
2022-01-27 07:29:59 -08:00
parent 76e98c31e3
commit 16277d1074
3 changed files with 11 additions and 11 deletions

View File

@@ -337,7 +337,7 @@ class LinkEditor extends React.Component<Props, State> {
title={result.title} title={result.title}
subtitle={result.subtitle} subtitle={result.subtitle}
icon={<DocumentIcon color="currentColor" />} icon={<DocumentIcon color="currentColor" />}
onMouseOver={() => this.handleFocusLink(index)} onPointerMove={() => this.handleFocusLink(index)}
onClick={this.handleSelectLink(result.url, result.title)} onClick={this.handleSelectLink(result.url, result.title)}
selected={index === selectedIndex} selected={index === selectedIndex}
/> />
@@ -349,7 +349,7 @@ class LinkEditor extends React.Component<Props, State> {
title={suggestedLinkTitle} title={suggestedLinkTitle}
subtitle={dictionary.createNewDoc} subtitle={dictionary.createNewDoc}
icon={<PlusIcon color="currentColor" />} icon={<PlusIcon color="currentColor" />}
onMouseOver={() => this.handleFocusLink(results.length)} onPointerMove={() => this.handleFocusLink(results.length)}
onClick={() => { onClick={() => {
this.handleCreateLink(suggestedLinkTitle); this.handleCreateLink(suggestedLinkTitle);
@@ -382,13 +382,14 @@ const SearchResults = styled.ol`
width: 100%; width: 100%;
height: auto; height: auto;
left: 0; left: 0;
padding: 4px 8px 8px; padding: 0;
margin: 0; margin: 0;
margin-top: -3px; margin-top: -3px;
margin-bottom: 0; margin-bottom: 0;
border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px;
overflow-y: auto; overflow-y: auto;
max-height: 25vh; overscroll-behavior: none;
max-height: 260px;
@media (hover: none) and (pointer: coarse) { @media (hover: none) and (pointer: coarse) {
position: fixed; position: fixed;

View File

@@ -2,13 +2,11 @@ import * as React from "react";
import scrollIntoView from "smooth-scroll-into-view-if-needed"; import scrollIntoView from "smooth-scroll-into-view-if-needed";
import styled from "styled-components"; import styled from "styled-components";
type Props = { type Props = React.HTMLAttributes<HTMLLIElement> & {
onClick: (event: React.MouseEvent) => void;
onMouseOver: (event: React.MouseEvent) => void;
icon: React.ReactNode; icon: React.ReactNode;
selected: boolean; selected: boolean;
title: string; title: React.ReactNode;
subtitle?: string; subtitle?: React.ReactNode;
}; };
function LinkSearchResult({ title, subtitle, selected, icon, ...rest }: Props) { function LinkSearchResult({ title, subtitle, selected, icon, ...rest }: Props) {
@@ -55,7 +53,7 @@ const ListItem = styled.li<{
display: flex; display: flex;
align-items: center; align-items: center;
padding: 8px; padding: 8px;
border-radius: 2px; border-radius: 4px;
color: ${(props) => props.theme.toolbarItem}; color: ${(props) => props.theme.toolbarItem};
background: ${(props) => background: ${(props) =>
props.selected ? props.theme.toolbarHoverBackground : "transparent"}; props.selected ? props.theme.toolbarHoverBackground : "transparent"};

View File

@@ -11,6 +11,7 @@ import Document from "~/models/Document";
import Revision from "~/models/Revision"; import Revision from "~/models/Revision";
import Error404 from "~/scenes/Error404"; import Error404 from "~/scenes/Error404";
import ErrorOffline from "~/scenes/ErrorOffline"; import ErrorOffline from "~/scenes/ErrorOffline";
import DocumentBreadcrumb from "~/components/DocumentBreadcrumb";
import withStores from "~/components/withStores"; import withStores from "~/components/withStores";
import { NavigationNode } from "~/types"; import { NavigationNode } from "~/types";
import { NotFoundError, OfflineError } from "~/utils/errors"; import { NotFoundError, OfflineError } from "~/utils/errors";
@@ -138,7 +139,7 @@ class DataLoader extends React.Component<Props> {
return { return {
title: document.title, title: document.title,
subtitle: `Updated ${time}`, subtitle: <DocumentBreadcrumb document={document} onlyText />,
url: document.url, url: document.url,
}; };
}), }),