Make sharing reachable from more places.#392
Merged
Merged
Conversation
…tree, and project root (#2286)
* fix(open-knowledge): share project root when nothing is selected
The editor-header Share trigger disabled whenever there was no active doc
and no selected folder, so a freshly opened project (or one with everything
deselected) had no way to share the project as a whole. Default the
genuinely-empty editor to the folder-scope share's empty-string root
sentinel so Share targets the content root instead of being a dead control.
Non-shareable surfaces (asset previews, skill-bundle files, missing docs,
managed skill/template tabs) keep the disabled trigger: each has a target or
synthetic doc name set and never falls through to the new root default.
* feat(open-knowledge): add Share to the file-tree right-click menu
Add a Share item to the file-tree context menu, alongside the editor-header
Share button. It builds the same share-link via runShareAction — folder rows
share the folder (content-relative folderPath), doc rows share the doc — and
copies the URL with a confirmation toast.
Gating mirrors the header's shareable-surface rules: shown only for folders
and real docs (never assets, which have no shareable doc path) and only when
a GitHub remote exists (useGitSyncStatusDetailed().hasRemote). No-remote
routing to the Publish wizard stays the header's job; the sidebar simply
hides the item, matching the "if sharing is enabled" intent. The rare
server-side no-remote divergence falls back to an explanatory toast.
* feat(open-knowledge): share the project root from the sidebar root menu
Right-clicking the project-root header row (the project name at the top of
the file tree) previously did nothing — it's a CollapsibleTrigger button, so
the sidebar's context-menu handler suppressed it as an interactive control.
Exempt the root header (data-sidebar-root-context) so the right-click falls
through to the existing project-scoped ContextMenu instead of being swallowed;
left-click still toggles the group.
Add a Share item to that project-root menu (the empty-space menu), gated on a
GitHub remote like the header button and file-tree rows. It shares the content
root via buildFolderShareInput('') and copies the link with a confirmation
toast, reusing runShareAction.
* refactor(open-knowledge): address share-menu review suggestions
Apply the actionable suggestions from the PR review:
- Hoist the duplicated Share menu-item JSX in FileTreeMenu into a single
shareMenuItem const rendered in both the folder and file branches, so the
item's icon/test-id/ordering has one source of truth.
- Move the sidebar empty-space Share item above "Copy full path" so the
project-root menu ordering (OpenInAgent -> Share -> Copy path) matches the
file-tree row menu.
- Add an EditorHeader test pinning the managed-artifact (skill/template)
share-disable path — a skill doc name yields a null share input — covering
the parseManagedArtifactName guard that was previously untested.
Deferred (out of scope): extracting a shared makeShareDeps/useShareDispatch
factory for the runShareAction wiring across FileTree, FileSidebar, and
ShareButton. Worth a focused follow-up since ShareButton's clipboard-error
toast suppression is a real variation to parameterize.
* chore(open-knowledge): trim verbose share-feature comments
Collapse the multi-line explanatory comments added for the share work down to
single descriptive lines across EditorHeader, FileTree, FileSidebar, and their
share tests. No behavior change.
---------
GitOrigin-RevId: 147efaf2d619c5e2afce6a9aff1a1b1046dfde52
Contributor
There was a problem hiding this comment.
Automated approval from agents-private public-mirror-sync (run: https://github.com/inkeep/agents-private/actions/runs/28462054693). Source of truth is the monorepo; direct edits on inkeep/open-knowledge are overwritten on next sync.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Make sharing reachable from more places.
Keep the editor-header Share button usable when nothing is open or selected. Previously the trigger was disabled whenever there was no active doc and no selected folder (a freshly opened project, or after deselecting everything), leaving no way to grab a link to the project as a whole. The genuinely-empty editor now defaults to sharing the content root via the folder-scope share's empty-string root sentinel, so Share is no longer a dead control just because nothing is focused. Non-shareable surfaces — asset previews, skill-bundle files, missing docs, and managed skill/template tabs — still keep the trigger disabled, since those have a target or synthetic doc name and never fall through to the root default.
Add a Share item to the file-tree right-click menu. It appears for folders and docs (never assets) and only when the project has a GitHub remote, reusing the same share-link path as the header button — folder rows share the folder, doc rows share the doc, and the link is copied to the clipboard with a confirmation toast.
Make the project-root context menu reachable. Right-clicking the project-root header row (the project name at the top of the sidebar) previously did nothing — it was suppressed as an interactive control. It now opens the existing project-scoped menu, which gains a Share item that shares the content root (and shows alongside New file/folder, Reveal, Copy path, etc.). Root Share is likewise gated on a GitHub remote.