mirror of
https://github.com/outline/outline.git
synced 2026-11-22 22:02:35 +03:00
* feat: Add [[ trigger for mentioning or creating a document Opens a suggestions menu filtered to documents, backed by a title search, with options to create a new or nested document from the search term. Generalizes the suggestion machinery to support multi-character triggers, and extracts the mention menu item builders into app/editor/menus/mention. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: Trim the mention search term Spaces are allowed in the search term, so a whitespace-only query rendered create-document items with an empty title and issued a title search that the server rejects. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: Close suggestion menus on a space directly after the trigger Spaces remain allowed within a search term, they are only rejected as its first character. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: Return models from fetchNamedPage The raw API payload was returned rather than the models added to the store, so callers that render the result are missing computed properties. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * refactor: Render the document menu from the store Matches the mention menu and paginated lists, where the request populates the store and the list is rendered from observables. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * feat: Order people above documents in the mention menu Uses a mention specific section so the command bar, where the section holds user management actions, is unaffected. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: Hide create document options without a create handler Editors that do not pass onCreateLink, such as comments, inserted a mention pointing at a document that was never created. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
86 lines
2.6 KiB
TypeScript
86 lines
2.6 KiB
TypeScript
import type { ActionContext } from "~/types";
|
||
|
||
export const CollectionSection = ({ t }: ActionContext) => t("Collection");
|
||
|
||
export const CollectionsSection = ({ t }: ActionContext) => t("Collections");
|
||
|
||
export const ActiveCollectionSection = ({ t, stores }: ActionContext) => {
|
||
const activeCollection = stores.collections.active;
|
||
return `${t("Collection")} · ${activeCollection?.name}`;
|
||
};
|
||
|
||
ActiveCollectionSection.priority = 0.8;
|
||
|
||
export const DeveloperSection = ({ t }: ActionContext) => t("Debug");
|
||
|
||
export const DateSection = ({ t }: ActionContext) => t("Date");
|
||
|
||
DateSection.priority = 1;
|
||
|
||
export const DocumentSection = ({ t }: ActionContext) => t("Document");
|
||
|
||
export const SearchResultsSection = ({ t }: ActionContext) =>
|
||
t("Search results");
|
||
|
||
SearchResultsSection.priority = -1;
|
||
|
||
export const DocumentsSection = ({ t }: ActionContext) => t("Documents");
|
||
|
||
DocumentsSection.priority = 0.8;
|
||
|
||
export const ActiveDocumentSection = ({ t, stores }: ActionContext) => {
|
||
const activeDocument = stores.documents.active;
|
||
return `${t("Document")} · ${activeDocument?.titleWithDefault}`;
|
||
};
|
||
|
||
ActiveDocumentSection.priority = 0.9;
|
||
|
||
export const TemplateSection = ({ t }: ActionContext) => t("Template");
|
||
|
||
export const ActiveTemplateSection = ({ t, stores }: ActionContext) => {
|
||
const activeTemplate = stores.templates.active;
|
||
return `${t("Template")} · ${activeTemplate?.titleWithDefault}`;
|
||
};
|
||
|
||
ActiveTemplateSection.priority = 0.9;
|
||
|
||
export const RecentSection = ({ t }: ActionContext) => t("Recently viewed");
|
||
|
||
RecentSection.priority = 1;
|
||
|
||
export const RevisionSection = ({ t }: ActionContext) => t("Revision");
|
||
|
||
export const SettingsSection = ({ t }: ActionContext) => t("Settings");
|
||
|
||
export const NavigationSection = ({ t }: ActionContext) => t("Navigation");
|
||
|
||
export const NotificationSection = ({ t }: ActionContext) => t("Notification");
|
||
|
||
export const GroupSection = ({ t }: ActionContext) => t("Groups");
|
||
|
||
export const EmojiSecion = ({ t }: ActionContext) => t("Emoji");
|
||
|
||
export const UserSection = ({ t }: ActionContext) => t("People");
|
||
|
||
UserSection.priority = 0.5;
|
||
|
||
/**
|
||
* People are the most common target when mentioning, so they rank above
|
||
* documents – unlike in the command bar, where the section holds user
|
||
* management actions.
|
||
*/
|
||
export const MentionUserSection = ({ t }: ActionContext) => t("People");
|
||
|
||
MentionUserSection.priority = 0.9;
|
||
|
||
export const ShareSection = ({ t }: ActionContext) => t("Share");
|
||
|
||
export const TeamSection = ({ t }: ActionContext) => t("Workspace");
|
||
|
||
export const RecentSearchesSection = ({ t }: ActionContext) =>
|
||
t("Recent searches");
|
||
|
||
RecentSearchesSection.priority = -0.1;
|
||
|
||
export const TrashSection = ({ t }: ActionContext) => t("Trash");
|