mirror of
https://github.com/outline/outline.git
synced 2026-11-20 21:23:06 +03:00
* feat: Unpin and context menu controls on pinned documents - Adds an unpin control to document chips in the collapsed pinned view - Adds the collapse toggle to collections, matching home - Makes the Pin menu items toggles with a selected state - Adds a document context menu to pinned cards and chips - Stops the drag sensor swallowing clicks on the card unpin button Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * fix: Hide the collection pin toggle for a mixed selection Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
26 lines
834 B
TypeScript
26 lines
834 B
TypeScript
import type Document from "~/models/Document";
|
||
import type Model from "~/models/base/Model";
|
||
import useStores from "~/hooks/useStores";
|
||
|
||
/**
|
||
* Returns the models that document actions should operate on – the document
|
||
* itself, and its collection unless the document is only reachable through a
|
||
* direct share with the user.
|
||
*
|
||
* @param document the document the actions will be performed on.
|
||
* @returns the active models to provide to the action context.
|
||
*/
|
||
export function useDocumentActiveModels(document: Document): Model[] {
|
||
const { userMemberships, groupMemberships } = useStores();
|
||
|
||
const isShared = !!(
|
||
userMemberships.getByDocumentId(document.id) ||
|
||
groupMemberships.getByDocumentId(document.id)
|
||
);
|
||
|
||
return [
|
||
document,
|
||
...(!isShared && document.collection ? [document.collection] : []),
|
||
];
|
||
}
|