wiki-viewer 1.14.1 → 1.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/standalone/.next/BUILD_ID +1 -1
- package/.next/standalone/.next/build-manifest.json +3 -3
- package/.next/standalone/.next/server/app/_global-error.html +1 -1
- package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.html +1 -1
- package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/api/agent/activity/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/events/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/files/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/file/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/ls/[[...path]]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/move/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/fs/search/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/internal/span/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/settings/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/agent/sidecar/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/assets/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/share/[token]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/share/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/reveal/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/set-root/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/open/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/refresh/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/workspaces/[id]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/system/workspaces/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/upload/[...path]/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/app/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/backlinks/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/content/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/download/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/file/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/folder/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-branches/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-checkout/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-diff/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-file-info/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-history/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/git-pull/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/move/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/new-file/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/outlinks/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/page/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/presence/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/search/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/slugs/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/upload/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/api/wiki/watch/route.js.nft.json +1 -1
- package/.next/standalone/.next/server/app/index.html +1 -1
- package/.next/standalone/.next/server/app/index.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_full.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_index.segment.rsc +1 -1
- package/.next/standalone/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
- package/.next/standalone/.next/server/middleware-manifest.json +1 -1
- package/.next/standalone/.next/server/pages/404.html +1 -1
- package/.next/standalone/.next/server/pages/500.html +1 -1
- package/.next/standalone/package.json +1 -1
- package/bin/postbuild.js +21 -0
- package/package.json +1 -1
- package/.next/standalone/.github/workflows/publish.yml +0 -37
- package/.next/standalone/.handoffs/archive/handoff-20260612-113332.md +0 -98
- package/.next/standalone/.handoffs/archive/handoff-20260612-141032.md +0 -73
- package/.next/standalone/.pi/ownership.json +0 -3
- package/.next/standalone/AGENTS.md +0 -114
- package/.next/standalone/DESIGN.md +0 -521
- package/.next/standalone/README.md +0 -821
- package/.next/standalone/TODO.md +0 -20
- package/.next/standalone/agents/bootstrap-prompt.md +0 -14
- package/.next/standalone/agents/wiki-viewer-skill/SKILL.md +0 -456
- package/.next/standalone/bin/postbuild.js +0 -78
- package/.next/standalone/bin/wiki-viewer.js +0 -922
- package/.next/standalone/certificates/localhost-key.pem +0 -28
- package/.next/standalone/certificates/localhost.pem +0 -24
- package/.next/standalone/docs/agent-collab-plan.md +0 -1615
- package/.next/standalone/docs/agent-collab-v2-plan.md +0 -771
- package/.next/standalone/docs/agent-fs-plan.md +0 -232
- package/.next/standalone/docs/editorial-skin-spec.md +0 -242
- package/.next/standalone/docs/file-vs-collab-authority.md +0 -124
- package/.next/standalone/docs/mobile-readiness-spec.md +0 -229
- package/.next/standalone/docs/workspacing-plan.md +0 -364
- package/.next/standalone/packages/wiki-viewer-mcp/README.md +0 -195
- package/.next/standalone/packages/wiki-viewer-mcp/bench-e2e.mjs +0 -166
- package/.next/standalone/packages/wiki-viewer-mcp/bench-latency.mjs +0 -87
- package/.next/standalone/packages/wiki-viewer-mcp/bench-payload.mjs +0 -45
- package/.next/standalone/packages/wiki-viewer-mcp/dist/http-client.js +0 -331
- package/.next/standalone/packages/wiki-viewer-mcp/dist/index.js +0 -531
- package/.next/standalone/packages/wiki-viewer-mcp/dist/register.js +0 -94
- package/.next/standalone/packages/wiki-viewer-mcp/dist/state-cache.js +0 -28
- package/.next/standalone/packages/wiki-viewer-mcp/package-lock.json +0 -1716
- package/.next/standalone/packages/wiki-viewer-mcp/package.json +0 -41
- package/.next/standalone/packages/wiki-viewer-mcp/src/http-client.ts +0 -459
- package/.next/standalone/packages/wiki-viewer-mcp/src/index.ts +0 -638
- package/.next/standalone/packages/wiki-viewer-mcp/src/register.ts +0 -144
- package/.next/standalone/packages/wiki-viewer-mcp/src/state-cache.ts +0 -55
- package/.next/standalone/packages/wiki-viewer-mcp/tsconfig.json +0 -19
- package/.next/standalone/pnpm-lock.yaml +0 -6697
- package/.next/standalone/pnpm-workspace.yaml +0 -8
- package/.next/standalone/postcss.config.mjs +0 -2
- package/.next/standalone/src/app/api/agent/activity/route.ts +0 -59
- package/.next/standalone/src/app/api/agent/admin/agents/[agentId]/revoke/route.ts +0 -40
- package/.next/standalone/src/app/api/agent/admin/agents/route.ts +0 -33
- package/.next/standalone/src/app/api/agent/admin/registrations/[regId]/approve/route.ts +0 -83
- package/.next/standalone/src/app/api/agent/admin/registrations/[regId]/deny/route.ts +0 -36
- package/.next/standalone/src/app/api/agent/admin/registrations/route.ts +0 -27
- package/.next/standalone/src/app/api/agent/events/[...path]/route.ts +0 -148
- package/.next/standalone/src/app/api/agent/files/[...path]/route.ts +0 -219
- package/.next/standalone/src/app/api/agent/fs/file/[...path]/route.ts +0 -446
- package/.next/standalone/src/app/api/agent/fs/ls/[[...path]]/route.ts +0 -152
- package/.next/standalone/src/app/api/agent/fs/move/route.ts +0 -130
- package/.next/standalone/src/app/api/agent/fs/search/route.ts +0 -272
- package/.next/standalone/src/app/api/agent/internal/span/route.ts +0 -121
- package/.next/standalone/src/app/api/agent/register/[regId]/route.ts +0 -50
- package/.next/standalone/src/app/api/agent/register/route.ts +0 -118
- package/.next/standalone/src/app/api/agent/settings/route.ts +0 -34
- package/.next/standalone/src/app/api/agent/settings/token/regenerate/route.ts +0 -20
- package/.next/standalone/src/app/api/agent/sidecar/[...path]/route.ts +0 -53
- package/.next/standalone/src/app/api/agents/install/route.ts +0 -143
- package/.next/standalone/src/app/api/agents/skill/route.ts +0 -20
- package/.next/standalone/src/app/api/agents/skill.tar.gz/route.ts +0 -87
- package/.next/standalone/src/app/api/app-proxy/[...path]/route.ts +0 -247
- package/.next/standalone/src/app/api/assets/[...path]/route.ts +0 -75
- package/.next/standalone/src/app/api/auth/[...all]/route.ts +0 -7
- package/.next/standalone/src/app/api/owner/init/route.ts +0 -14
- package/.next/standalone/src/app/api/share/[token]/route.ts +0 -269
- package/.next/standalone/src/app/api/share/route.ts +0 -127
- package/.next/standalone/src/app/api/system/admins/route.ts +0 -103
- package/.next/standalone/src/app/api/system/auth-config/route.ts +0 -22
- package/.next/standalone/src/app/api/system/auth-settings/route.ts +0 -86
- package/.next/standalone/src/app/api/system/browse/route.ts +0 -82
- package/.next/standalone/src/app/api/system/clear-root/route.ts +0 -16
- package/.next/standalone/src/app/api/system/config/route.ts +0 -14
- package/.next/standalone/src/app/api/system/pins/route.ts +0 -38
- package/.next/standalone/src/app/api/system/reveal/route.ts +0 -36
- package/.next/standalone/src/app/api/system/root-status/route.ts +0 -13
- package/.next/standalone/src/app/api/system/set-root/route.ts +0 -53
- package/.next/standalone/src/app/api/system/users/route.ts +0 -120
- package/.next/standalone/src/app/api/system/workspaces/[id]/open/route.ts +0 -34
- package/.next/standalone/src/app/api/system/workspaces/[id]/refresh/route.ts +0 -32
- package/.next/standalone/src/app/api/system/workspaces/[id]/route.ts +0 -78
- package/.next/standalone/src/app/api/system/workspaces/route.ts +0 -128
- package/.next/standalone/src/app/api/upload/[...path]/route.ts +0 -85
- package/.next/standalone/src/app/api/wiki/app/route.ts +0 -60
- package/.next/standalone/src/app/api/wiki/backlinks/route.ts +0 -29
- package/.next/standalone/src/app/api/wiki/content/route.ts +0 -159
- package/.next/standalone/src/app/api/wiki/download/route.ts +0 -100
- package/.next/standalone/src/app/api/wiki/file/route.ts +0 -57
- package/.next/standalone/src/app/api/wiki/folder/route.ts +0 -34
- package/.next/standalone/src/app/api/wiki/git-branches/route.ts +0 -32
- package/.next/standalone/src/app/api/wiki/git-checkout/route.ts +0 -45
- package/.next/standalone/src/app/api/wiki/git-diff/route.ts +0 -33
- package/.next/standalone/src/app/api/wiki/git-file-info/route.ts +0 -27
- package/.next/standalone/src/app/api/wiki/git-history/route.ts +0 -27
- package/.next/standalone/src/app/api/wiki/git-pull/route.ts +0 -48
- package/.next/standalone/src/app/api/wiki/move/route.ts +0 -61
- package/.next/standalone/src/app/api/wiki/new-file/route.ts +0 -56
- package/.next/standalone/src/app/api/wiki/outlinks/route.ts +0 -76
- package/.next/standalone/src/app/api/wiki/page/route.ts +0 -92
- package/.next/standalone/src/app/api/wiki/presence/route.ts +0 -56
- package/.next/standalone/src/app/api/wiki/route.ts +0 -116
- package/.next/standalone/src/app/api/wiki/search/route.ts +0 -44
- package/.next/standalone/src/app/api/wiki/slugs/route.ts +0 -54
- package/.next/standalone/src/app/api/wiki/upload/route.ts +0 -95
- package/.next/standalone/src/app/api/wiki/watch/route.ts +0 -67
- package/.next/standalone/src/app/globals.css +0 -1249
- package/.next/standalone/src/app/icon.svg +0 -11
- package/.next/standalone/src/app/layout.tsx +0 -78
- package/.next/standalone/src/app/manifest.ts +0 -30
- package/.next/standalone/src/app/page.tsx +0 -3260
- package/.next/standalone/src/app/s/[token]/page.tsx +0 -357
- package/.next/standalone/src/app/signin/page.tsx +0 -16
- package/.next/standalone/src/app/signin/signin-form.tsx +0 -238
- package/.next/standalone/src/components/ai-panel/activity-row.tsx +0 -284
- package/.next/standalone/src/components/ai-panel/ai-panel.tsx +0 -311
- package/.next/standalone/src/components/ai-panel/token-section.tsx +0 -313
- package/.next/standalone/src/components/auth-settings-sheet.tsx +0 -474
- package/.next/standalone/src/components/confirm-dialog.tsx +0 -56
- package/.next/standalone/src/components/dir-picker.tsx +0 -606
- package/.next/standalone/src/components/editor/backlinks-panel.tsx +0 -139
- package/.next/standalone/src/components/editor/bubble-menu.tsx +0 -346
- package/.next/standalone/src/components/editor/callout-extension.ts +0 -36
- package/.next/standalone/src/components/editor/comment-pip.tsx +0 -56
- package/.next/standalone/src/components/editor/comment-thread.tsx +0 -254
- package/.next/standalone/src/components/editor/csv-viewer.tsx +0 -379
- package/.next/standalone/src/components/editor/document-outline.tsx +0 -230
- package/.next/standalone/src/components/editor/editor-toolbar.tsx +0 -564
- package/.next/standalone/src/components/editor/editor.tsx +0 -1327
- package/.next/standalone/src/components/editor/extensions/drag-handle.ts +0 -325
- package/.next/standalone/src/components/editor/extensions/heading-anchors.ts +0 -55
- package/.next/standalone/src/components/editor/extensions/proof-span.ts +0 -60
- package/.next/standalone/src/components/editor/extensions/resizable-image.tsx +0 -159
- package/.next/standalone/src/components/editor/extensions.ts +0 -150
- package/.next/standalone/src/components/editor/file-fallback-viewer.tsx +0 -75
- package/.next/standalone/src/components/editor/folder-index.tsx +0 -236
- package/.next/standalone/src/components/editor/google-doc-viewer.tsx +0 -73
- package/.next/standalone/src/components/editor/image-viewer.tsx +0 -57
- package/.next/standalone/src/components/editor/large-file-gate.tsx +0 -108
- package/.next/standalone/src/components/editor/link-popover.tsx +0 -111
- package/.next/standalone/src/components/editor/media-popover.tsx +0 -212
- package/.next/standalone/src/components/editor/media-viewer.tsx +0 -70
- package/.next/standalone/src/components/editor/mermaid-viewer.tsx +0 -286
- package/.next/standalone/src/components/editor/node-app-viewer.tsx +0 -328
- package/.next/standalone/src/components/editor/notebook-viewer.tsx +0 -371
- package/.next/standalone/src/components/editor/office/docx-viewer.tsx +0 -93
- package/.next/standalone/src/components/editor/office/office-chrome.tsx +0 -83
- package/.next/standalone/src/components/editor/office/pptx-viewer.tsx +0 -104
- package/.next/standalone/src/components/editor/office/xlsx-viewer.tsx +0 -192
- package/.next/standalone/src/components/editor/pdf-viewer.tsx +0 -32
- package/.next/standalone/src/components/editor/proof-span-popover.tsx +0 -162
- package/.next/standalone/src/components/editor/slash-commands.tsx +0 -629
- package/.next/standalone/src/components/editor/source-viewer.tsx +0 -289
- package/.next/standalone/src/components/editor/suggest-edit-popover.tsx +0 -229
- package/.next/standalone/src/components/editor/suggestion-card.tsx +0 -206
- package/.next/standalone/src/components/editor/table-menu.tsx +0 -232
- package/.next/standalone/src/components/editor/view-mode-comment-button.tsx +0 -77
- package/.next/standalone/src/components/editor/website-viewer.tsx +0 -75
- package/.next/standalone/src/components/editor/wiki-link-create-dialog.tsx +0 -189
- package/.next/standalone/src/components/editor/wiki-link-decorator.ts +0 -79
- package/.next/standalone/src/components/editor/wiki-link-extension.ts +0 -120
- package/.next/standalone/src/components/editor/wiki-link-picker.tsx +0 -250
- package/.next/standalone/src/components/layout/viewer-toolbar.tsx +0 -54
- package/.next/standalone/src/components/search/search-command-dialog.tsx +0 -246
- package/.next/standalone/src/components/search/sidebar-search-box.tsx +0 -121
- package/.next/standalone/src/components/search/snippet-text.tsx +0 -48
- package/.next/standalone/src/components/share-dialog.tsx +0 -307
- package/.next/standalone/src/components/theme-provider.tsx +0 -16
- package/.next/standalone/src/components/theme-toggle.tsx +0 -24
- package/.next/standalone/src/components/ui/badge.tsx +0 -35
- package/.next/standalone/src/components/ui/button.tsx +0 -56
- package/.next/standalone/src/components/ui/card.tsx +0 -63
- package/.next/standalone/src/components/ui/collapsible.tsx +0 -9
- package/.next/standalone/src/components/ui/command.tsx +0 -151
- package/.next/standalone/src/components/ui/context-menu.tsx +0 -191
- package/.next/standalone/src/components/ui/dialog.tsx +0 -119
- package/.next/standalone/src/components/ui/dropdown-menu.tsx +0 -194
- package/.next/standalone/src/components/ui/input.tsx +0 -22
- package/.next/standalone/src/components/ui/label.tsx +0 -25
- package/.next/standalone/src/components/ui/popover.tsx +0 -33
- package/.next/standalone/src/components/ui/scroll-area.tsx +0 -47
- package/.next/standalone/src/components/ui/select.tsx +0 -156
- package/.next/standalone/src/components/ui/separator.tsx +0 -30
- package/.next/standalone/src/components/ui/sheet.tsx +0 -140
- package/.next/standalone/src/components/ui/skeleton.tsx +0 -15
- package/.next/standalone/src/components/ui/switch.tsx +0 -28
- package/.next/standalone/src/components/ui/tabs.tsx +0 -54
- package/.next/standalone/src/components/ui/textarea.tsx +0 -21
- package/.next/standalone/src/components/ui/tip.tsx +0 -23
- package/.next/standalone/src/components/ui/toggle-group.tsx +0 -41
- package/.next/standalone/src/components/ui/tooltip.tsx +0 -27
- package/.next/standalone/src/components/view-width-toggle.tsx +0 -70
- package/.next/standalone/src/components/wiki/frontmatter-header.tsx +0 -164
- package/.next/standalone/src/hooks/use-is-mobile.ts +0 -14
- package/.next/standalone/src/lib/app-runner.ts +0 -272
- package/.next/standalone/src/lib/auth/admin.ts +0 -120
- package/.next/standalone/src/lib/auth/allowlist.ts +0 -50
- package/.next/standalone/src/lib/auth/client.ts +0 -4
- package/.next/standalone/src/lib/auth/csrf.ts +0 -68
- package/.next/standalone/src/lib/auth/server.ts +0 -215
- package/.next/standalone/src/lib/cabinets/tree.ts +0 -75
- package/.next/standalone/src/lib/config.ts +0 -114
- package/.next/standalone/src/lib/embeds/detect.ts +0 -142
- package/.next/standalone/src/lib/git-secrets.ts +0 -65
- package/.next/standalone/src/lib/git.ts +0 -503
- package/.next/standalone/src/lib/google/detect.ts +0 -107
- package/.next/standalone/src/lib/markdown/parse-frontmatter.ts +0 -104
- package/.next/standalone/src/lib/markdown/remark-wikilinks.ts +0 -100
- package/.next/standalone/src/lib/markdown/sanitize-schema.ts +0 -106
- package/.next/standalone/src/lib/markdown/to-html.ts +0 -282
- package/.next/standalone/src/lib/markdown/to-markdown.ts +0 -252
- package/.next/standalone/src/lib/proof/activity-shared.ts +0 -31
- package/.next/standalone/src/lib/proof/activity.ts +0 -74
- package/.next/standalone/src/lib/proof/audit.ts +0 -88
- package/.next/standalone/src/lib/proof/auth.ts +0 -143
- package/.next/standalone/src/lib/proof/block-refs.ts +0 -133
- package/.next/standalone/src/lib/proof/blocks.ts +0 -73
- package/.next/standalone/src/lib/proof/client-auth.ts +0 -23
- package/.next/standalone/src/lib/proof/collab-state.ts +0 -81
- package/.next/standalone/src/lib/proof/event-bus.ts +0 -47
- package/.next/standalone/src/lib/proof/file-lock.ts +0 -43
- package/.next/standalone/src/lib/proof/glob.ts +0 -51
- package/.next/standalone/src/lib/proof/idempotency.ts +0 -37
- package/.next/standalone/src/lib/proof/lease.ts +0 -117
- package/.next/standalone/src/lib/proof/mutex.ts +0 -36
- package/.next/standalone/src/lib/proof/ops-applier.ts +0 -727
- package/.next/standalone/src/lib/proof/owner-auth.ts +0 -2
- package/.next/standalone/src/lib/proof/pending.ts +0 -97
- package/.next/standalone/src/lib/proof/proof-span.ts +0 -141
- package/.next/standalone/src/lib/proof/rate-limit.ts +0 -53
- package/.next/standalone/src/lib/proof/raw-fs.ts +0 -197
- package/.next/standalone/src/lib/proof/register-rate-limit.ts +0 -53
- package/.next/standalone/src/lib/proof/registry.ts +0 -195
- package/.next/standalone/src/lib/proof/sidecar.ts +0 -103
- package/.next/standalone/src/lib/proof/suggest-capture.ts +0 -69
- package/.next/standalone/src/lib/proof/types.ts +0 -182
- package/.next/standalone/src/lib/proof-config.ts +0 -14
- package/.next/standalone/src/lib/root-dir.ts +0 -35
- package/.next/standalone/src/lib/search/indexable-exts.ts +0 -25
- package/.next/standalone/src/lib/search/indexer.ts +0 -634
- package/.next/standalone/src/lib/search/sanitize.ts +0 -35
- package/.next/standalone/src/lib/search/search-db.ts +0 -57
- package/.next/standalone/src/lib/search/watcher-pool.ts +0 -79
- package/.next/standalone/src/lib/shared-docs/db.ts +0 -177
- package/.next/standalone/src/lib/toast.ts +0 -9
- package/.next/standalone/src/lib/utils.ts +0 -6
- package/.next/standalone/src/lib/wiki-helpers.ts +0 -36
- package/.next/standalone/src/lib/workspace-client.ts +0 -82
- package/.next/standalone/src/lib/workspace-context.ts +0 -173
- package/.next/standalone/src/lib/workspaces.ts +0 -400
- package/.next/standalone/src/middleware.ts +0 -44
- package/.next/standalone/src/stores/ai-panel-store.ts +0 -79
- package/.next/standalone/src/stores/editor-store.ts +0 -439
- package/.next/standalone/src/stores/pin-store.ts +0 -56
- package/.next/standalone/src/stores/proof-store.ts +0 -124
- package/.next/standalone/src/stores/recent-store.ts +0 -51
- package/.next/standalone/src/stores/search-store.ts +0 -104
- package/.next/standalone/src/stores/show-hidden-store.ts +0 -26
- package/.next/standalone/src/stores/sidebar-width-store.ts +0 -39
- package/.next/standalone/src/stores/skin-store.ts +0 -42
- package/.next/standalone/src/stores/tree-store.ts +0 -52
- package/.next/standalone/src/stores/view-width-store.ts +0 -101
- package/.next/standalone/src/stores/wiki-slugs-store.ts +0 -75
- package/.next/standalone/src/tests/proof/activity-aggregator.test.ts +0 -146
- package/.next/standalone/src/tests/proof/admin-create-user.test.ts +0 -43
- package/.next/standalone/src/tests/proof/agent-fs.test.ts +0 -973
- package/.next/standalone/src/tests/proof/agent-ownership.test.ts +0 -140
- package/.next/standalone/src/tests/proof/agent-workspace-scope.test.ts +0 -134
- package/.next/standalone/src/tests/proof/agents-install.test.ts +0 -110
- package/.next/standalone/src/tests/proof/bench-write.ts +0 -179
- package/.next/standalone/src/tests/proof/better-auth.test.ts +0 -68
- package/.next/standalone/src/tests/proof/block-refs.test.ts +0 -108
- package/.next/standalone/src/tests/proof/blocks.test.ts +0 -92
- package/.next/standalone/src/tests/proof/collab-state.test.ts +0 -501
- package/.next/standalone/src/tests/proof/comments-ops.test.ts +0 -177
- package/.next/standalone/src/tests/proof/editor-roundtrip.test.ts +0 -85
- package/.next/standalone/src/tests/proof/external-edit.test.ts +0 -58
- package/.next/standalone/src/tests/proof/file-lock.test.ts +0 -80
- package/.next/standalone/src/tests/proof/git-branches-checkout.test.ts +0 -136
- package/.next/standalone/src/tests/proof/git-read-features.test.ts +0 -473
- package/.next/standalone/src/tests/proof/git-secrets.test.ts +0 -138
- package/.next/standalone/src/tests/proof/git-sparse.test.ts +0 -257
- package/.next/standalone/src/tests/proof/git-workspace.test.ts +0 -135
- package/.next/standalone/src/tests/proof/git.test.ts +0 -243
- package/.next/standalone/src/tests/proof/glob.test.ts +0 -82
- package/.next/standalone/src/tests/proof/helpers/auth-session.ts +0 -27
- package/.next/standalone/src/tests/proof/markdown-to-html.test.ts +0 -46
- package/.next/standalone/src/tests/proof/ops-applier.test.ts +0 -368
- package/.next/standalone/src/tests/proof/owner-init.test.ts +0 -2
- package/.next/standalone/src/tests/proof/parse-frontmatter.test.ts +0 -60
- package/.next/standalone/src/tests/proof/preload.ts +0 -21
- package/.next/standalone/src/tests/proof/proof-span.test.ts +0 -98
- package/.next/standalone/src/tests/proof/rate-limit.test.ts +0 -54
- package/.next/standalone/src/tests/proof/readonly-enforcement.test.ts +0 -161
- package/.next/standalone/src/tests/proof/reconcile-sidecar.test.ts +0 -195
- package/.next/standalone/src/tests/proof/registration-flow.test.ts +0 -330
- package/.next/standalone/src/tests/proof/registry.test.ts +0 -169
- package/.next/standalone/src/tests/proof/routes.test.ts +0 -516
- package/.next/standalone/src/tests/proof/search-index.test.ts +0 -376
- package/.next/standalone/src/tests/proof/sidecar-lifecycle.test.ts +0 -177
- package/.next/standalone/src/tests/proof/sidecar-trim.test.ts +0 -58
- package/.next/standalone/src/tests/proof/suggestion-ops.test.ts +0 -280
- package/.next/standalone/src/tests/proof/wiki-content-put.test.ts +0 -140
- package/.next/standalone/src/tests/proof/wiki-routes-auth.test.ts +0 -208
- package/.next/standalone/src/tests/proof/workspace-isolation.test.ts +0 -87
- package/.next/standalone/src/tests/proof/workspaces-api.test.ts +0 -227
- package/.next/standalone/src/types/index.ts +0 -47
- package/.next/standalone/tailwind.config.ts +0 -191
- package/.next/standalone/tsconfig.json +0 -41
- package/.next/standalone/tsconfig.tsbuildinfo +0 -1
- /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → rRyvFORvJoc5OWbCR2A_P}/_buildManifest.js +0 -0
- /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → rRyvFORvJoc5OWbCR2A_P}/_clientMiddlewareManifest.js +0 -0
- /package/.next/standalone/.next/static/{WMOTgfV82apmdovxzgbMx → rRyvFORvJoc5OWbCR2A_P}/_ssgManifest.js +0 -0
|
@@ -1,564 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
|
|
3
|
-
import type { Editor } from "@tiptap/react";
|
|
4
|
-
import {
|
|
5
|
-
AlignCenter,
|
|
6
|
-
AlignJustify,
|
|
7
|
-
AlignLeft,
|
|
8
|
-
AlignRight,
|
|
9
|
-
Bold,
|
|
10
|
-
CheckSquare,
|
|
11
|
-
ChevronLeft,
|
|
12
|
-
ChevronRight,
|
|
13
|
-
Code,
|
|
14
|
-
FileCode,
|
|
15
|
-
Heading1,
|
|
16
|
-
Heading2,
|
|
17
|
-
Heading3,
|
|
18
|
-
ImageIcon,
|
|
19
|
-
Italic,
|
|
20
|
-
Link as LinkIcon,
|
|
21
|
-
List,
|
|
22
|
-
ListOrdered,
|
|
23
|
-
Minus,
|
|
24
|
-
PilcrowLeft,
|
|
25
|
-
PilcrowRight,
|
|
26
|
-
Quote,
|
|
27
|
-
Redo,
|
|
28
|
-
Strikethrough,
|
|
29
|
-
Subscript as SubIcon,
|
|
30
|
-
Superscript as SuperIcon,
|
|
31
|
-
Underline as UnderlineIcon,
|
|
32
|
-
Undo,
|
|
33
|
-
Video as VideoIcon,
|
|
34
|
-
} from "lucide-react";
|
|
35
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
36
|
-
import { Separator } from "@/components/ui/separator";
|
|
37
|
-
import { cn } from "@/lib/utils";
|
|
38
|
-
import { useEditorStore } from "@/stores/editor-store";
|
|
39
|
-
import { LinkPopover } from "./link-popover";
|
|
40
|
-
import { type MediaKind, MediaPopover } from "./media-popover";
|
|
41
|
-
|
|
42
|
-
interface EditorToolbarProps {
|
|
43
|
-
editor: Editor | null;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
type PopoverKind =
|
|
47
|
-
| null
|
|
48
|
-
| {
|
|
49
|
-
type: "link";
|
|
50
|
-
anchor: { top: number; left: number };
|
|
51
|
-
range: { from: number; to: number };
|
|
52
|
-
existing: string;
|
|
53
|
-
}
|
|
54
|
-
| { type: "media"; kind: MediaKind; anchor: { top: number; left: number } };
|
|
55
|
-
|
|
56
|
-
interface ToolButtonProps {
|
|
57
|
-
label: string;
|
|
58
|
-
icon: React.ComponentType<{ className?: string }>;
|
|
59
|
-
active?: boolean;
|
|
60
|
-
disabled?: boolean;
|
|
61
|
-
style?: React.CSSProperties;
|
|
62
|
-
onAction: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function ToolButton({
|
|
66
|
-
label,
|
|
67
|
-
icon: Icon,
|
|
68
|
-
active,
|
|
69
|
-
disabled,
|
|
70
|
-
style,
|
|
71
|
-
onAction,
|
|
72
|
-
}: ToolButtonProps) {
|
|
73
|
-
return (
|
|
74
|
-
<button
|
|
75
|
-
type="button"
|
|
76
|
-
aria-label={label}
|
|
77
|
-
title={label}
|
|
78
|
-
disabled={disabled}
|
|
79
|
-
style={style}
|
|
80
|
-
onMouseDown={(e) => {
|
|
81
|
-
e.preventDefault();
|
|
82
|
-
}}
|
|
83
|
-
onClick={(e) => {
|
|
84
|
-
e.preventDefault();
|
|
85
|
-
onAction(e);
|
|
86
|
-
}}
|
|
87
|
-
className={cn(
|
|
88
|
-
"h-8 w-8 shrink-0 inline-flex items-center justify-center rounded-md text-foreground/80 hover:bg-accent hover:text-accent-foreground transition-colors disabled:opacity-40",
|
|
89
|
-
active &&
|
|
90
|
-
"bg-accent text-accent-foreground ring-1 ring-inset ring-foreground/15",
|
|
91
|
-
)}
|
|
92
|
-
>
|
|
93
|
-
<Icon className="h-4 w-4" />
|
|
94
|
-
</button>
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export function EditorToolbar({ editor }: EditorToolbarProps) {
|
|
99
|
-
const frontmatter = useEditorStore((s) => s.frontmatter);
|
|
100
|
-
const updateFrontmatter = useEditorStore((s) => s.updateFrontmatter);
|
|
101
|
-
const pagePath = useEditorStore((s) => s.currentPath);
|
|
102
|
-
const isRtl = frontmatter?.dir === "rtl";
|
|
103
|
-
|
|
104
|
-
const [popover, setPopover] = useState<PopoverKind>(null);
|
|
105
|
-
const scrollRef = useRef<HTMLDivElement | null>(null);
|
|
106
|
-
const [canScrollLeft, setCanScrollLeft] = useState(false);
|
|
107
|
-
const [canScrollRight, setCanScrollRight] = useState(false);
|
|
108
|
-
|
|
109
|
-
const [, setTick] = useState(0);
|
|
110
|
-
useEffect(() => {
|
|
111
|
-
if (!editor) return;
|
|
112
|
-
const bump = () => setTick((t) => t + 1);
|
|
113
|
-
editor.on("selectionUpdate", bump);
|
|
114
|
-
editor.on("transaction", bump);
|
|
115
|
-
return () => {
|
|
116
|
-
editor.off("selectionUpdate", bump);
|
|
117
|
-
editor.off("transaction", bump);
|
|
118
|
-
};
|
|
119
|
-
}, [editor]);
|
|
120
|
-
|
|
121
|
-
const updateScrollState = useCallback(() => {
|
|
122
|
-
const el = scrollRef.current;
|
|
123
|
-
if (!el) return;
|
|
124
|
-
setCanScrollLeft(el.scrollLeft > 4);
|
|
125
|
-
setCanScrollRight(el.scrollLeft + el.clientWidth < el.scrollWidth - 4);
|
|
126
|
-
}, []);
|
|
127
|
-
|
|
128
|
-
useEffect(() => {
|
|
129
|
-
if (!editor) return;
|
|
130
|
-
const el = scrollRef.current;
|
|
131
|
-
if (!el) return;
|
|
132
|
-
const raf = requestAnimationFrame(updateScrollState);
|
|
133
|
-
const onResize = () => updateScrollState();
|
|
134
|
-
window.addEventListener("resize", onResize);
|
|
135
|
-
el.addEventListener("scroll", updateScrollState);
|
|
136
|
-
const ro = new ResizeObserver(() => updateScrollState());
|
|
137
|
-
ro.observe(el);
|
|
138
|
-
for (const child of Array.from(el.children)) ro.observe(child);
|
|
139
|
-
return () => {
|
|
140
|
-
cancelAnimationFrame(raf);
|
|
141
|
-
window.removeEventListener("resize", onResize);
|
|
142
|
-
el.removeEventListener("scroll", updateScrollState);
|
|
143
|
-
ro.disconnect();
|
|
144
|
-
};
|
|
145
|
-
}, [editor, updateScrollState]);
|
|
146
|
-
|
|
147
|
-
const onWheel = (e: React.WheelEvent<HTMLDivElement>) => {
|
|
148
|
-
const el = scrollRef.current;
|
|
149
|
-
if (!el) return;
|
|
150
|
-
if (Math.abs(e.deltaY) > Math.abs(e.deltaX)) {
|
|
151
|
-
el.scrollLeft += e.deltaY;
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
const scrollBy = (dir: -1 | 1) => {
|
|
156
|
-
const el = scrollRef.current;
|
|
157
|
-
if (!el) return;
|
|
158
|
-
el.scrollBy({
|
|
159
|
-
left: dir * Math.max(160, el.clientWidth * 0.6),
|
|
160
|
-
behavior: "smooth",
|
|
161
|
-
});
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
if (!editor) return null;
|
|
165
|
-
|
|
166
|
-
const captureRange = () => {
|
|
167
|
-
const { from, to } = editor.state.selection;
|
|
168
|
-
return { from, to };
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
const applyToRange = (
|
|
172
|
-
range: { from: number; to: number },
|
|
173
|
-
run: () => void,
|
|
174
|
-
) => {
|
|
175
|
-
editor.chain().focus().setTextSelection(range).run();
|
|
176
|
-
run();
|
|
177
|
-
};
|
|
178
|
-
|
|
179
|
-
const openPopoverFromButton = (
|
|
180
|
-
e: React.MouseEvent<HTMLElement>,
|
|
181
|
-
build: (
|
|
182
|
-
anchor: { top: number; left: number },
|
|
183
|
-
range: { from: number; to: number },
|
|
184
|
-
) => PopoverKind,
|
|
185
|
-
) => {
|
|
186
|
-
const btn = e.currentTarget.getBoundingClientRect();
|
|
187
|
-
const anchor = { top: btn.bottom + 6, left: btn.left };
|
|
188
|
-
const range = captureRange();
|
|
189
|
-
setPopover(build(anchor, range));
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
const toggleLink = (e: React.MouseEvent<HTMLButtonElement>) => {
|
|
193
|
-
const existing = editor.getAttributes("link")?.href ?? "";
|
|
194
|
-
openPopoverFromButton(e, (anchor, range) => ({
|
|
195
|
-
type: "link",
|
|
196
|
-
anchor,
|
|
197
|
-
range,
|
|
198
|
-
existing,
|
|
199
|
-
}));
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
const applyLink = (url: string) => {
|
|
203
|
-
if (popover?.type !== "link") return;
|
|
204
|
-
applyToRange(popover.range, () => {
|
|
205
|
-
editor
|
|
206
|
-
.chain()
|
|
207
|
-
.focus()
|
|
208
|
-
.extendMarkRange("link")
|
|
209
|
-
.setLink({ href: url })
|
|
210
|
-
.run();
|
|
211
|
-
});
|
|
212
|
-
setPopover(null);
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
const removeLink = () => {
|
|
216
|
-
if (popover?.type !== "link") return;
|
|
217
|
-
applyToRange(popover.range, () => {
|
|
218
|
-
editor.chain().focus().unsetLink().run();
|
|
219
|
-
});
|
|
220
|
-
setPopover(null);
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
const insertMedia = (
|
|
224
|
-
kind: MediaKind,
|
|
225
|
-
payload: { url: string; alt?: string; mimeType?: string },
|
|
226
|
-
) => {
|
|
227
|
-
const { url, alt, mimeType } = payload;
|
|
228
|
-
const type = mimeType ?? "";
|
|
229
|
-
const isImage =
|
|
230
|
-
kind === "image" ||
|
|
231
|
-
type.startsWith("image/") ||
|
|
232
|
-
/\.(png|jpe?g|gif|webp|svg|avif)(\?|$)/i.test(url);
|
|
233
|
-
if (isImage) {
|
|
234
|
-
editor
|
|
235
|
-
.chain()
|
|
236
|
-
.focus()
|
|
237
|
-
.setImage({ src: url, alt: alt ?? "" })
|
|
238
|
-
.run();
|
|
239
|
-
} else {
|
|
240
|
-
editor
|
|
241
|
-
.chain()
|
|
242
|
-
.focus()
|
|
243
|
-
.insertContent(`<a href="${url}">${alt ?? url}</a>`)
|
|
244
|
-
.run();
|
|
245
|
-
}
|
|
246
|
-
setPopover(null);
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
type ButtonSpec =
|
|
250
|
-
| { separator: true }
|
|
251
|
-
| {
|
|
252
|
-
icon: React.ComponentType<{ className?: string }>;
|
|
253
|
-
action: (e: React.MouseEvent<HTMLButtonElement>) => void;
|
|
254
|
-
isActive: boolean;
|
|
255
|
-
label: string;
|
|
256
|
-
style?: React.CSSProperties;
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
const primaryItems: ButtonSpec[] = [
|
|
260
|
-
{
|
|
261
|
-
icon: Heading1,
|
|
262
|
-
action: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
263
|
-
isActive: editor.isActive("heading", { level: 1 }),
|
|
264
|
-
label: "Heading 1",
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
icon: Heading2,
|
|
268
|
-
action: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
269
|
-
isActive: editor.isActive("heading", { level: 2 }),
|
|
270
|
-
label: "Heading 2",
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
icon: Heading3,
|
|
274
|
-
action: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
275
|
-
isActive: editor.isActive("heading", { level: 3 }),
|
|
276
|
-
label: "Heading 3",
|
|
277
|
-
},
|
|
278
|
-
{ separator: true },
|
|
279
|
-
{
|
|
280
|
-
icon: Bold,
|
|
281
|
-
action: () => editor.chain().focus().toggleBold().run(),
|
|
282
|
-
isActive: editor.isActive("bold"),
|
|
283
|
-
label: "Bold",
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
icon: Italic,
|
|
287
|
-
action: () => editor.chain().focus().toggleItalic().run(),
|
|
288
|
-
isActive: editor.isActive("italic"),
|
|
289
|
-
label: "Italic",
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
icon: UnderlineIcon,
|
|
293
|
-
action: () => editor.chain().focus().toggleUnderline().run(),
|
|
294
|
-
isActive: editor.isActive("underline"),
|
|
295
|
-
label: "Underline",
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
icon: Strikethrough,
|
|
299
|
-
action: () => editor.chain().focus().toggleStrike().run(),
|
|
300
|
-
isActive: editor.isActive("strike"),
|
|
301
|
-
label: "Strikethrough",
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
icon: Code,
|
|
305
|
-
action: () => editor.chain().focus().toggleCode().run(),
|
|
306
|
-
isActive: editor.isActive("code"),
|
|
307
|
-
label: "Inline code",
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
icon: LinkIcon,
|
|
311
|
-
action: toggleLink,
|
|
312
|
-
isActive: editor.isActive("link"),
|
|
313
|
-
label: "Link",
|
|
314
|
-
},
|
|
315
|
-
{ separator: true },
|
|
316
|
-
{
|
|
317
|
-
icon: List,
|
|
318
|
-
action: () => editor.chain().focus().toggleBulletList().run(),
|
|
319
|
-
isActive: editor.isActive("bulletList"),
|
|
320
|
-
label: "Bullet list",
|
|
321
|
-
},
|
|
322
|
-
{
|
|
323
|
-
icon: ListOrdered,
|
|
324
|
-
action: () => editor.chain().focus().toggleOrderedList().run(),
|
|
325
|
-
isActive: editor.isActive("orderedList"),
|
|
326
|
-
label: "Ordered list",
|
|
327
|
-
},
|
|
328
|
-
{
|
|
329
|
-
icon: Quote,
|
|
330
|
-
action: () => editor.chain().focus().toggleBlockquote().run(),
|
|
331
|
-
isActive: editor.isActive("blockquote"),
|
|
332
|
-
label: "Blockquote",
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
icon: CheckSquare,
|
|
336
|
-
action: () => editor.chain().focus().toggleTaskList().run(),
|
|
337
|
-
isActive: editor.isActive("taskList"),
|
|
338
|
-
label: "Checklist",
|
|
339
|
-
},
|
|
340
|
-
{
|
|
341
|
-
icon: FileCode,
|
|
342
|
-
action: () => editor.chain().focus().toggleCodeBlock().run(),
|
|
343
|
-
isActive: editor.isActive("codeBlock"),
|
|
344
|
-
label: "Code block",
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
icon: Minus,
|
|
348
|
-
action: () => editor.chain().focus().setHorizontalRule().run(),
|
|
349
|
-
isActive: false,
|
|
350
|
-
label: "Divider",
|
|
351
|
-
},
|
|
352
|
-
];
|
|
353
|
-
|
|
354
|
-
const secondaryItems: ButtonSpec[] = [
|
|
355
|
-
{
|
|
356
|
-
icon: AlignLeft,
|
|
357
|
-
action: () => editor.chain().focus().setTextAlign("left").run(),
|
|
358
|
-
isActive: editor.isActive({ textAlign: "left" }),
|
|
359
|
-
label: "Align left",
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
icon: AlignCenter,
|
|
363
|
-
action: () => editor.chain().focus().setTextAlign("center").run(),
|
|
364
|
-
isActive: editor.isActive({ textAlign: "center" }),
|
|
365
|
-
label: "Align center",
|
|
366
|
-
},
|
|
367
|
-
{
|
|
368
|
-
icon: AlignRight,
|
|
369
|
-
action: () => editor.chain().focus().setTextAlign("right").run(),
|
|
370
|
-
isActive: editor.isActive({ textAlign: "right" }),
|
|
371
|
-
label: "Align right",
|
|
372
|
-
},
|
|
373
|
-
{
|
|
374
|
-
icon: AlignJustify,
|
|
375
|
-
action: () => editor.chain().focus().setTextAlign("justify").run(),
|
|
376
|
-
isActive: editor.isActive({ textAlign: "justify" }),
|
|
377
|
-
label: "Justify",
|
|
378
|
-
},
|
|
379
|
-
{ separator: true },
|
|
380
|
-
{
|
|
381
|
-
icon: SuperIcon,
|
|
382
|
-
action: () => editor.chain().focus().toggleSuperscript().run(),
|
|
383
|
-
isActive: editor.isActive("superscript"),
|
|
384
|
-
label: "Superscript",
|
|
385
|
-
},
|
|
386
|
-
{
|
|
387
|
-
icon: SubIcon,
|
|
388
|
-
action: () => editor.chain().focus().toggleSubscript().run(),
|
|
389
|
-
isActive: editor.isActive("subscript"),
|
|
390
|
-
label: "Subscript",
|
|
391
|
-
},
|
|
392
|
-
{ separator: true },
|
|
393
|
-
{
|
|
394
|
-
icon: ImageIcon,
|
|
395
|
-
action: (e) =>
|
|
396
|
-
openPopoverFromButton(e, (anchor) => ({
|
|
397
|
-
type: "media",
|
|
398
|
-
kind: "image",
|
|
399
|
-
anchor,
|
|
400
|
-
})),
|
|
401
|
-
isActive: false,
|
|
402
|
-
label: "Insert image",
|
|
403
|
-
},
|
|
404
|
-
{
|
|
405
|
-
icon: VideoIcon,
|
|
406
|
-
action: (e) =>
|
|
407
|
-
openPopoverFromButton(e, (anchor) => ({
|
|
408
|
-
type: "media",
|
|
409
|
-
kind: "video",
|
|
410
|
-
anchor,
|
|
411
|
-
})),
|
|
412
|
-
isActive: false,
|
|
413
|
-
label: "Insert video",
|
|
414
|
-
},
|
|
415
|
-
{ separator: true },
|
|
416
|
-
{
|
|
417
|
-
icon: Undo,
|
|
418
|
-
action: () => editor.chain().focus().undo().run(),
|
|
419
|
-
isActive: false,
|
|
420
|
-
label: "Undo",
|
|
421
|
-
},
|
|
422
|
-
{
|
|
423
|
-
icon: Redo,
|
|
424
|
-
action: () => editor.chain().focus().redo().run(),
|
|
425
|
-
isActive: false,
|
|
426
|
-
label: "Redo",
|
|
427
|
-
},
|
|
428
|
-
{ separator: true },
|
|
429
|
-
{
|
|
430
|
-
icon: isRtl ? PilcrowLeft : PilcrowRight,
|
|
431
|
-
action: () => updateFrontmatter({ dir: isRtl ? undefined : "rtl" }),
|
|
432
|
-
isActive: isRtl,
|
|
433
|
-
label: isRtl ? "Switch to LTR" : "Switch to RTL",
|
|
434
|
-
},
|
|
435
|
-
];
|
|
436
|
-
|
|
437
|
-
return (
|
|
438
|
-
<>
|
|
439
|
-
<div className="relative border-b border-border bg-background/50">
|
|
440
|
-
{canScrollLeft && (
|
|
441
|
-
<button
|
|
442
|
-
type="button"
|
|
443
|
-
aria-label="Scroll toolbar left"
|
|
444
|
-
onMouseDown={(e) => e.preventDefault()}
|
|
445
|
-
onClick={() => scrollBy(-1)}
|
|
446
|
-
className="absolute left-0 top-0 bottom-0 w-6 z-10 flex items-center justify-start pl-0.5 bg-gradient-to-r from-background via-background/80 to-transparent text-muted-foreground hover:text-foreground transition-colors"
|
|
447
|
-
>
|
|
448
|
-
<ChevronLeft className="h-4 w-4" />
|
|
449
|
-
</button>
|
|
450
|
-
)}
|
|
451
|
-
{canScrollRight && (
|
|
452
|
-
<button
|
|
453
|
-
type="button"
|
|
454
|
-
aria-label="Scroll toolbar right"
|
|
455
|
-
onMouseDown={(e) => e.preventDefault()}
|
|
456
|
-
onClick={() => scrollBy(1)}
|
|
457
|
-
className="absolute right-0 top-0 bottom-0 w-6 z-10 flex items-center justify-end pr-0.5 bg-gradient-to-l from-background via-background/80 to-transparent text-muted-foreground hover:text-foreground transition-colors"
|
|
458
|
-
>
|
|
459
|
-
<ChevronRight className="h-4 w-4" />
|
|
460
|
-
</button>
|
|
461
|
-
)}
|
|
462
|
-
<div
|
|
463
|
-
ref={scrollRef}
|
|
464
|
-
onWheel={onWheel}
|
|
465
|
-
className="flex items-center gap-0.5 px-2 pt-1 pb-1.5 overflow-x-scroll overflow-y-hidden editor-toolbar-scroll"
|
|
466
|
-
>
|
|
467
|
-
{[
|
|
468
|
-
...primaryItems,
|
|
469
|
-
{ separator: true } as ButtonSpec,
|
|
470
|
-
...secondaryItems,
|
|
471
|
-
].map((item, i) => {
|
|
472
|
-
if ("separator" in item) {
|
|
473
|
-
return (
|
|
474
|
-
<Separator
|
|
475
|
-
key={i}
|
|
476
|
-
orientation="vertical"
|
|
477
|
-
className="mx-1 h-6 shrink-0"
|
|
478
|
-
/>
|
|
479
|
-
);
|
|
480
|
-
}
|
|
481
|
-
return (
|
|
482
|
-
<ToolButton
|
|
483
|
-
key={i}
|
|
484
|
-
label={item.label}
|
|
485
|
-
icon={item.icon}
|
|
486
|
-
active={item.isActive}
|
|
487
|
-
style={item.style}
|
|
488
|
-
onAction={item.action}
|
|
489
|
-
/>
|
|
490
|
-
);
|
|
491
|
-
})}
|
|
492
|
-
</div>
|
|
493
|
-
</div>
|
|
494
|
-
|
|
495
|
-
{popover?.type === "link" && (
|
|
496
|
-
<div
|
|
497
|
-
data-editor-popover="true"
|
|
498
|
-
style={{
|
|
499
|
-
position: "fixed",
|
|
500
|
-
top: popover.anchor.top,
|
|
501
|
-
left: popover.anchor.left,
|
|
502
|
-
zIndex: 60,
|
|
503
|
-
}}
|
|
504
|
-
>
|
|
505
|
-
<LinkPopover
|
|
506
|
-
anchor={{ top: 0, left: 0 }}
|
|
507
|
-
initialUrl={popover.existing}
|
|
508
|
-
onCancel={() => setPopover(null)}
|
|
509
|
-
onApply={applyLink}
|
|
510
|
-
onRemove={popover.existing ? removeLink : undefined}
|
|
511
|
-
/>
|
|
512
|
-
</div>
|
|
513
|
-
)}
|
|
514
|
-
|
|
515
|
-
{popover?.type === "media" && pagePath && (
|
|
516
|
-
<div
|
|
517
|
-
data-editor-popover="true"
|
|
518
|
-
style={{
|
|
519
|
-
position: "fixed",
|
|
520
|
-
top: popover.anchor.top,
|
|
521
|
-
left: popover.anchor.left,
|
|
522
|
-
zIndex: 60,
|
|
523
|
-
}}
|
|
524
|
-
>
|
|
525
|
-
<MediaPopover
|
|
526
|
-
kind={popover.kind}
|
|
527
|
-
pagePath={pagePath}
|
|
528
|
-
anchor={{ top: 0, left: 0 }}
|
|
529
|
-
onCancel={() => setPopover(null)}
|
|
530
|
-
onInsert={(payload) => insertMedia(popover.kind, payload)}
|
|
531
|
-
/>
|
|
532
|
-
</div>
|
|
533
|
-
)}
|
|
534
|
-
|
|
535
|
-
{popover && <ClickOutsideClose onClose={() => setPopover(null)} />}
|
|
536
|
-
</>
|
|
537
|
-
);
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
function ClickOutsideClose({ onClose }: { onClose: () => void }) {
|
|
541
|
-
useEffect(() => {
|
|
542
|
-
const mount = window.setTimeout(() => {
|
|
543
|
-
const handle = (e: MouseEvent) => {
|
|
544
|
-
const target = e.target as HTMLElement | null;
|
|
545
|
-
if (target?.closest('[data-editor-popover="true"]')) return;
|
|
546
|
-
onClose();
|
|
547
|
-
};
|
|
548
|
-
window.addEventListener("mousedown", handle);
|
|
549
|
-
(
|
|
550
|
-
window as unknown as { __editorPopClose?: () => void }
|
|
551
|
-
).__editorPopClose = () =>
|
|
552
|
-
window.removeEventListener("mousedown", handle);
|
|
553
|
-
}, 10);
|
|
554
|
-
return () => {
|
|
555
|
-
window.clearTimeout(mount);
|
|
556
|
-
const w = window as unknown as { __editorPopClose?: () => void };
|
|
557
|
-
if (w.__editorPopClose) {
|
|
558
|
-
w.__editorPopClose();
|
|
559
|
-
w.__editorPopClose = undefined;
|
|
560
|
-
}
|
|
561
|
-
};
|
|
562
|
-
}, [onClose]);
|
|
563
|
-
return null;
|
|
564
|
-
}
|