@agent-native/core 0.110.3 → 0.111.0
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/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +11 -0
- package/corpus/core/docs/content/components.mdx +7 -0
- package/corpus/core/docs/content/locales/ar-SA/components.mdx +4 -2
- package/corpus/core/docs/content/locales/de-DE/components.mdx +4 -2
- package/corpus/core/docs/content/locales/es-ES/components.mdx +4 -2
- package/corpus/core/docs/content/locales/fr-FR/components.mdx +4 -2
- package/corpus/core/docs/content/locales/hi-IN/components.mdx +3 -2
- package/corpus/core/docs/content/locales/ja-JP/components.mdx +3 -2
- package/corpus/core/docs/content/locales/ko-KR/components.mdx +3 -2
- package/corpus/core/docs/content/locales/pt-BR/components.mdx +4 -2
- package/corpus/core/docs/content/locales/zh-CN/components.mdx +3 -2
- package/corpus/core/docs/content/locales/zh-TW/components.mdx +3 -2
- package/corpus/core/docs/content/toolkit-agent-ux.mdx +8 -3
- package/corpus/core/migration-manifest.json +133 -266
- package/corpus/core/package.json +32 -33
- package/corpus/core/scripts/check-dist-imports.mjs +25 -1
- package/corpus/core/scripts/finalize-build.mjs +59 -2
- package/corpus/core/src/client/AgentAskPopover.tsx +1 -1
- package/corpus/core/src/client/AgentPanel.tsx +1 -1
- package/corpus/core/src/client/AssistantChat.tsx +12 -14
- package/corpus/core/src/client/NewWorkspaceAppFlow.tsx +1 -1
- package/corpus/core/src/client/agent-chat-adapter.ts +1 -1
- package/corpus/core/src/client/blocks/RegistryBlockDataProvider.tsx +121 -0
- package/corpus/core/src/client/blocks/index.ts +6 -0
- package/corpus/core/src/client/chat/attachment-adapters.ts +4 -5
- package/corpus/core/src/client/chat/index.ts +0 -1
- package/corpus/core/src/client/chat/message-components.tsx +2 -2
- package/corpus/core/src/client/code-agent-chat-adapter.ts +2 -2
- package/corpus/core/src/client/collab/index.ts +0 -22
- package/corpus/core/src/client/composer/index.ts +5 -66
- package/corpus/core/src/client/composer/runtime-adapters.tsx +123 -0
- package/corpus/core/src/client/composer/use-mention-search.ts +2 -79
- package/corpus/core/src/client/composer/wired-components.tsx +53 -0
- package/corpus/core/src/client/extensions/ExtensionViewer.tsx +1 -1
- package/corpus/core/src/client/extensions/ExtensionsListPage.tsx +1 -1
- package/corpus/core/src/client/extensions/ExtensionsSidebarSection.tsx +1 -1
- package/corpus/core/src/client/index.ts +0 -156
- package/corpus/core/src/client/resources/ResourceEditor.tsx +29 -681
- package/corpus/core/src/client/resources/ResourcesPanel.tsx +1 -1
- package/corpus/core/src/client/settings/AutomationsSection.tsx +1 -1
- package/corpus/core/src/client/sharing/index.ts +0 -4
- package/corpus/core/src/client/tombstone/agent-presence-chip.ts +17 -0
- package/corpus/core/src/client/tombstone/editor.ts +265 -0
- package/corpus/core/src/client/tombstone/live-cursor-overlay.ts +21 -0
- package/corpus/core/src/client/tombstone/presence-bar.ts +17 -0
- package/corpus/core/src/client/tombstone/recent-edit-highlights.ts +17 -0
- package/corpus/core/src/client/tombstone/remote-selection-rings.ts +21 -0
- package/corpus/core/src/client/tombstone/rich-markdown-editor.ts +265 -0
- package/corpus/core/src/client/tombstone/ui-dialog.ts +49 -0
- package/corpus/core/src/client/tombstone/ui-dropdown-menu.ts +69 -0
- package/corpus/core/src/client/tombstone/ui-hover-card.ts +21 -0
- package/corpus/core/src/client/tombstone/ui-popover.ts +25 -0
- package/corpus/core/src/client/tombstone/ui-sheet.ts +49 -0
- package/corpus/core/src/client/tombstone/ui-tooltip.ts +29 -0
- package/corpus/core/src/client/tombstone/visual-style-controls.ts +61 -0
- package/corpus/core/src/client/uploads/index.ts +5 -0
- package/corpus/core/src/client/{rich-markdown-editor/uploadEditorImage.ts → uploads/upload-editor-image.ts} +11 -4
- package/corpus/core/src/package-lifecycle/tombstone.ts +16 -2
- package/corpus/core/src/package-lifecycle/upgrade-error.ts +23 -5
- package/corpus/core/src/testing.ts +1 -4
- package/corpus/core/src/vite/client.ts +62 -22
- package/corpus/templates/content/app/components/editor/VisualEditor.tsx +2 -4
- package/corpus/templates/content/app/components/editor/extensions/registryBlocks.ts +1 -1
- package/corpus/templates/content/app/components/editor/registrySlashItems.ts +53 -52
- package/corpus/templates/plan/app/components/editor/PlanBlockNode.tsx +2 -2
- package/corpus/templates/plan/app/components/editor/planSlashCommands.ts +1 -1
- package/corpus/templates/plan/app/components/plan/DocumentArea.tsx +1 -1
- package/corpus/templates/plan/app/components/plan/PlanImageNode.tsx +1 -1
- package/corpus/templates/plan/app/components/plan/PlanMarkdownEditor.tsx +1 -1
- package/dist/catalog.json +1 -0
- package/dist/client/AgentAskPopover.js +1 -1
- package/dist/client/AgentAskPopover.js.map +1 -1
- package/dist/client/AgentPanel.js +1 -1
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +2 -2
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +5 -6
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/NewWorkspaceAppFlow.js +1 -1
- package/dist/client/NewWorkspaceAppFlow.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +1 -1
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/blocks/RegistryBlockDataProvider.d.ts +7 -0
- package/dist/client/blocks/RegistryBlockDataProvider.d.ts.map +1 -0
- package/dist/client/blocks/RegistryBlockDataProvider.js +54 -0
- package/dist/client/blocks/RegistryBlockDataProvider.js.map +1 -0
- package/dist/client/blocks/index.d.ts +2 -0
- package/dist/client/blocks/index.d.ts.map +1 -1
- package/dist/client/blocks/index.js +1 -0
- package/dist/client/blocks/index.js.map +1 -1
- package/dist/client/chat/attachment-adapters.d.ts.map +1 -1
- package/dist/client/chat/attachment-adapters.js +1 -1
- package/dist/client/chat/attachment-adapters.js.map +1 -1
- package/dist/client/chat/index.d.ts +0 -1
- package/dist/client/chat/index.d.ts.map +1 -1
- package/dist/client/chat/index.js +0 -1
- package/dist/client/chat/index.js.map +1 -1
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +2 -2
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/code-agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/code-agent-chat-adapter.js +1 -1
- package/dist/client/code-agent-chat-adapter.js.map +1 -1
- package/dist/client/collab/index.d.ts +0 -5
- package/dist/client/collab/index.d.ts.map +1 -1
- package/dist/client/collab/index.js +0 -5
- package/dist/client/collab/index.js.map +1 -1
- package/dist/client/composer/index.d.ts +3 -11
- package/dist/client/composer/index.d.ts.map +1 -1
- package/dist/client/composer/index.js +3 -10
- package/dist/client/composer/index.js.map +1 -1
- package/dist/client/composer/runtime-adapters.d.ts +5 -0
- package/dist/client/composer/runtime-adapters.d.ts.map +1 -0
- package/dist/client/composer/runtime-adapters.js +85 -0
- package/dist/client/composer/runtime-adapters.js.map +1 -0
- package/dist/client/composer/use-mention-search.d.ts +1 -2
- package/dist/client/composer/use-mention-search.d.ts.map +1 -1
- package/dist/client/composer/use-mention-search.js +2 -69
- package/dist/client/composer/use-mention-search.js.map +1 -1
- package/dist/client/composer/wired-components.d.ts +10 -0
- package/dist/client/composer/wired-components.d.ts.map +1 -0
- package/dist/client/composer/wired-components.js +20 -0
- package/dist/client/composer/wired-components.js.map +1 -0
- package/dist/client/extensions/ExtensionViewer.js +1 -1
- package/dist/client/extensions/ExtensionViewer.js.map +1 -1
- package/dist/client/extensions/ExtensionsListPage.js +1 -1
- package/dist/client/extensions/ExtensionsListPage.js.map +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.js +1 -1
- package/dist/client/extensions/ExtensionsSidebarSection.js.map +1 -1
- package/dist/client/index.d.ts +0 -10
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +0 -26
- package/dist/client/index.js.map +1 -1
- package/dist/client/resources/ResourceEditor.d.ts.map +1 -1
- package/dist/client/resources/ResourceEditor.js +14 -532
- package/dist/client/resources/ResourceEditor.js.map +1 -1
- package/dist/client/resources/ResourcesPanel.js +1 -1
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/client/settings/AutomationsSection.js +1 -1
- package/dist/client/settings/AutomationsSection.js.map +1 -1
- package/dist/client/sharing/index.d.ts +0 -1
- package/dist/client/sharing/index.d.ts.map +1 -1
- package/dist/client/sharing/index.js +0 -1
- package/dist/client/sharing/index.js.map +1 -1
- package/dist/client/tombstone/agent-presence-chip.d.ts +6 -0
- package/dist/client/tombstone/agent-presence-chip.d.ts.map +1 -0
- package/dist/client/tombstone/agent-presence-chip.js +5 -0
- package/dist/client/tombstone/agent-presence-chip.js.map +1 -0
- package/dist/client/tombstone/editor.d.ts +128 -0
- package/dist/client/tombstone/editor.d.ts.map +1 -0
- package/dist/client/tombstone/editor.js +76 -0
- package/dist/client/tombstone/editor.js.map +1 -0
- package/dist/client/tombstone/live-cursor-overlay.d.ts +8 -0
- package/dist/client/tombstone/live-cursor-overlay.d.ts.map +1 -0
- package/dist/client/tombstone/live-cursor-overlay.js +5 -0
- package/dist/client/tombstone/live-cursor-overlay.js.map +1 -0
- package/dist/client/tombstone/presence-bar.d.ts +6 -0
- package/dist/client/tombstone/presence-bar.d.ts.map +1 -0
- package/dist/client/tombstone/presence-bar.js +5 -0
- package/dist/client/tombstone/presence-bar.js.map +1 -0
- package/dist/client/tombstone/recent-edit-highlights.d.ts +6 -0
- package/dist/client/tombstone/recent-edit-highlights.d.ts.map +1 -0
- package/dist/client/tombstone/recent-edit-highlights.js +5 -0
- package/dist/client/tombstone/recent-edit-highlights.js.map +1 -0
- package/dist/client/tombstone/remote-selection-rings.d.ts +8 -0
- package/dist/client/tombstone/remote-selection-rings.d.ts.map +1 -0
- package/dist/client/tombstone/remote-selection-rings.js +5 -0
- package/dist/client/tombstone/remote-selection-rings.js.map +1 -0
- package/dist/client/tombstone/rich-markdown-editor.d.ts +128 -0
- package/dist/client/tombstone/rich-markdown-editor.d.ts.map +1 -0
- package/dist/client/tombstone/rich-markdown-editor.js +76 -0
- package/dist/client/tombstone/rich-markdown-editor.js.map +1 -0
- package/dist/client/tombstone/ui-dialog.d.ts +22 -0
- package/dist/client/tombstone/ui-dialog.d.ts.map +1 -0
- package/dist/client/tombstone/ui-dialog.js +23 -0
- package/dist/client/tombstone/ui-dialog.js.map +1 -0
- package/dist/client/tombstone/ui-dropdown-menu.d.ts +32 -0
- package/dist/client/tombstone/ui-dropdown-menu.d.ts.map +1 -0
- package/dist/client/tombstone/ui-dropdown-menu.js +33 -0
- package/dist/client/tombstone/ui-dropdown-menu.js.map +1 -0
- package/dist/client/tombstone/ui-hover-card.d.ts +8 -0
- package/dist/client/tombstone/ui-hover-card.d.ts.map +1 -0
- package/dist/client/tombstone/ui-hover-card.js +9 -0
- package/dist/client/tombstone/ui-hover-card.js.map +1 -0
- package/dist/client/tombstone/ui-popover.d.ts +10 -0
- package/dist/client/tombstone/ui-popover.d.ts.map +1 -0
- package/dist/client/tombstone/ui-popover.js +11 -0
- package/dist/client/tombstone/ui-popover.js.map +1 -0
- package/dist/client/tombstone/ui-sheet.d.ts +22 -0
- package/dist/client/tombstone/ui-sheet.d.ts.map +1 -0
- package/dist/client/tombstone/ui-sheet.js +23 -0
- package/dist/client/tombstone/ui-sheet.js.map +1 -0
- package/dist/client/tombstone/ui-tooltip.d.ts +12 -0
- package/dist/client/tombstone/ui-tooltip.d.ts.map +1 -0
- package/dist/client/tombstone/ui-tooltip.js +13 -0
- package/dist/client/tombstone/ui-tooltip.js.map +1 -0
- package/dist/client/tombstone/visual-style-controls.d.ts +28 -0
- package/dist/client/tombstone/visual-style-controls.d.ts.map +1 -0
- package/dist/client/tombstone/visual-style-controls.js +23 -0
- package/dist/client/tombstone/visual-style-controls.js.map +1 -0
- package/dist/client/uploads/index.d.ts +1 -0
- package/dist/client/uploads/index.d.ts.map +1 -1
- package/dist/client/uploads/index.js +1 -0
- package/dist/client/uploads/index.js.map +1 -1
- package/dist/client/{rich-markdown-editor/uploadEditorImage.d.ts → uploads/upload-editor-image.d.ts} +8 -4
- package/dist/client/uploads/upload-editor-image.d.ts.map +1 -0
- package/dist/client/{rich-markdown-editor/uploadEditorImage.js → uploads/upload-editor-image.js} +2 -2
- package/dist/client/uploads/upload-editor-image.js.map +1 -0
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/package-lifecycle/tombstone.d.ts.map +1 -1
- package/dist/package-lifecycle/tombstone.js +13 -3
- package/dist/package-lifecycle/tombstone.js.map +1 -1
- package/dist/package-lifecycle/upgrade-error.d.ts +2 -2
- package/dist/package-lifecycle/upgrade-error.d.ts.map +1 -1
- package/dist/package-lifecycle/upgrade-error.js +8 -5
- package/dist/package-lifecycle/upgrade-error.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/testing.d.ts +1 -3
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +1 -3
- package/dist/testing.js.map +1 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +26 -22
- package/dist/vite/client.js.map +1 -1
- package/docs/content/components.mdx +7 -0
- package/docs/content/locales/ar-SA/components.mdx +4 -2
- package/docs/content/locales/de-DE/components.mdx +4 -2
- package/docs/content/locales/es-ES/components.mdx +4 -2
- package/docs/content/locales/fr-FR/components.mdx +4 -2
- package/docs/content/locales/hi-IN/components.mdx +3 -2
- package/docs/content/locales/ja-JP/components.mdx +3 -2
- package/docs/content/locales/ko-KR/components.mdx +3 -2
- package/docs/content/locales/pt-BR/components.mdx +4 -2
- package/docs/content/locales/zh-CN/components.mdx +3 -2
- package/docs/content/locales/zh-TW/components.mdx +3 -2
- package/docs/content/toolkit-agent-ux.mdx +8 -3
- package/migration-manifest.json +133 -266
- package/package.json +31 -32
- package/corpus/core/src/client/composer/AgentComposerFrame.tsx +0 -59
- package/corpus/core/src/client/composer/ComposerPlusMenu.tsx +0 -988
- package/corpus/core/src/client/composer/MentionPopover.tsx +0 -412
- package/corpus/core/src/client/composer/PastedTextChip.tsx +0 -150
- package/corpus/core/src/client/composer/PromptComposer.tsx +0 -714
- package/corpus/core/src/client/composer/RealtimeVoiceMode.tsx +0 -860
- package/corpus/core/src/client/composer/TiptapComposer.tsx +0 -2928
- package/corpus/core/src/client/composer/VoiceButton.tsx +0 -262
- package/corpus/core/src/client/composer/asset-picker-url.ts +0 -80
- package/corpus/core/src/client/composer/attachment-accept.ts +0 -71
- package/corpus/core/src/client/composer/draft-key.ts +0 -7
- package/corpus/core/src/client/composer/extensions/FileReference.tsx +0 -55
- package/corpus/core/src/client/composer/extensions/MentionReference.tsx +0 -93
- package/corpus/core/src/client/composer/extensions/SkillReference.tsx +0 -56
- package/corpus/core/src/client/composer/pasted-text.ts +0 -160
- package/corpus/core/src/client/composer/prompt-attachments.ts +0 -70
- package/corpus/core/src/client/composer/realtime-voice-audio-level.ts +0 -64
- package/corpus/core/src/client/composer/realtime-voice-transcript.ts +0 -134
- package/corpus/core/src/client/composer/types.ts +0 -66
- package/corpus/core/src/client/composer/use-file-search.ts +0 -63
- package/corpus/core/src/client/composer/use-skills.ts +0 -44
- package/corpus/core/src/client/composer/useRealtimeVoiceMode.tsx +0 -2095
- package/corpus/core/src/client/composer/useVoiceDictation.ts +0 -1155
- package/corpus/core/src/client/editor/index.ts +0 -1
- package/corpus/core/src/client/rich-markdown-editor/RegistryBlockNode.tsx +0 -799
- package/corpus/core/src/client/rich-markdown-editor/index.ts +0 -70
- package/corpus/core/src/client/rich-markdown-editor/registrySlashCommands.ts +0 -112
- package/dist/client/composer/AgentComposerFrame.d.ts +0 -19
- package/dist/client/composer/AgentComposerFrame.d.ts.map +0 -1
- package/dist/client/composer/AgentComposerFrame.js +0 -14
- package/dist/client/composer/AgentComposerFrame.js.map +0 -1
- package/dist/client/composer/ComposerPlusMenu.d.ts +0 -17
- package/dist/client/composer/ComposerPlusMenu.d.ts.map +0 -1
- package/dist/client/composer/ComposerPlusMenu.js +0 -501
- package/dist/client/composer/ComposerPlusMenu.js.map +0 -1
- package/dist/client/composer/MentionPopover.d.ts +0 -29
- package/dist/client/composer/MentionPopover.d.ts.map +0 -1
- package/dist/client/composer/MentionPopover.js +0 -180
- package/dist/client/composer/MentionPopover.js.map +0 -1
- package/dist/client/composer/PastedTextChip.d.ts +0 -9
- package/dist/client/composer/PastedTextChip.d.ts.map +0 -1
- package/dist/client/composer/PastedTextChip.js +0 -47
- package/dist/client/composer/PastedTextChip.js.map +0 -1
- package/dist/client/composer/PromptComposer.d.ts +0 -115
- package/dist/client/composer/PromptComposer.d.ts.map +0 -1
- package/dist/client/composer/PromptComposer.js +0 -299
- package/dist/client/composer/PromptComposer.js.map +0 -1
- package/dist/client/composer/RealtimeVoiceMode.d.ts +0 -104
- package/dist/client/composer/RealtimeVoiceMode.d.ts.map +0 -1
- package/dist/client/composer/RealtimeVoiceMode.js +0 -245
- package/dist/client/composer/RealtimeVoiceMode.js.map +0 -1
- package/dist/client/composer/TiptapComposer.d.ts +0 -222
- package/dist/client/composer/TiptapComposer.d.ts.map +0 -1
- package/dist/client/composer/TiptapComposer.js +0 -1834
- package/dist/client/composer/TiptapComposer.js.map +0 -1
- package/dist/client/composer/VoiceButton.d.ts +0 -23
- package/dist/client/composer/VoiceButton.d.ts.map +0 -1
- package/dist/client/composer/VoiceButton.js +0 -100
- package/dist/client/composer/VoiceButton.js.map +0 -1
- package/dist/client/composer/asset-picker-url.d.ts +0 -16
- package/dist/client/composer/asset-picker-url.d.ts.map +0 -1
- package/dist/client/composer/asset-picker-url.js +0 -64
- package/dist/client/composer/asset-picker-url.js.map +0 -1
- package/dist/client/composer/attachment-accept.d.ts +0 -9
- package/dist/client/composer/attachment-accept.d.ts.map +0 -1
- package/dist/client/composer/attachment-accept.js +0 -65
- package/dist/client/composer/attachment-accept.js.map +0 -1
- package/dist/client/composer/draft-key.d.ts +0 -2
- package/dist/client/composer/draft-key.d.ts.map +0 -1
- package/dist/client/composer/draft-key.js +0 -8
- package/dist/client/composer/draft-key.js.map +0 -1
- package/dist/client/composer/extensions/FileReference.d.ts +0 -3
- package/dist/client/composer/extensions/FileReference.d.ts.map +0 -1
- package/dist/client/composer/extensions/FileReference.js +0 -36
- package/dist/client/composer/extensions/FileReference.js.map +0 -1
- package/dist/client/composer/extensions/MentionReference.d.ts +0 -3
- package/dist/client/composer/extensions/MentionReference.d.ts.map +0 -1
- package/dist/client/composer/extensions/MentionReference.js +0 -66
- package/dist/client/composer/extensions/MentionReference.js.map +0 -1
- package/dist/client/composer/extensions/SkillReference.d.ts +0 -3
- package/dist/client/composer/extensions/SkillReference.d.ts.map +0 -1
- package/dist/client/composer/extensions/SkillReference.js +0 -40
- package/dist/client/composer/extensions/SkillReference.js.map +0 -1
- package/dist/client/composer/pasted-text.d.ts +0 -31
- package/dist/client/composer/pasted-text.d.ts.map +0 -1
- package/dist/client/composer/pasted-text.js +0 -130
- package/dist/client/composer/pasted-text.js.map +0 -1
- package/dist/client/composer/prompt-attachments.d.ts +0 -11
- package/dist/client/composer/prompt-attachments.d.ts.map +0 -1
- package/dist/client/composer/prompt-attachments.js +0 -45
- package/dist/client/composer/prompt-attachments.js.map +0 -1
- package/dist/client/composer/realtime-voice-audio-level.d.ts +0 -14
- package/dist/client/composer/realtime-voice-audio-level.d.ts.map +0 -1
- package/dist/client/composer/realtime-voice-audio-level.js +0 -47
- package/dist/client/composer/realtime-voice-audio-level.js.map +0 -1
- package/dist/client/composer/realtime-voice-transcript.d.ts +0 -26
- package/dist/client/composer/realtime-voice-transcript.d.ts.map +0 -1
- package/dist/client/composer/realtime-voice-transcript.js +0 -103
- package/dist/client/composer/realtime-voice-transcript.js.map +0 -1
- package/dist/client/composer/types.d.ts +0 -60
- package/dist/client/composer/types.d.ts.map +0 -1
- package/dist/client/composer/types.js +0 -2
- package/dist/client/composer/types.js.map +0 -1
- package/dist/client/composer/use-file-search.d.ts +0 -6
- package/dist/client/composer/use-file-search.d.ts.map +0 -1
- package/dist/client/composer/use-file-search.js +0 -52
- package/dist/client/composer/use-file-search.js.map +0 -1
- package/dist/client/composer/use-skills.d.ts +0 -7
- package/dist/client/composer/use-skills.d.ts.map +0 -1
- package/dist/client/composer/use-skills.js +0 -39
- package/dist/client/composer/use-skills.js.map +0 -1
- package/dist/client/composer/useRealtimeVoiceMode.d.ts +0 -172
- package/dist/client/composer/useRealtimeVoiceMode.d.ts.map +0 -1
- package/dist/client/composer/useRealtimeVoiceMode.js +0 -1648
- package/dist/client/composer/useRealtimeVoiceMode.js.map +0 -1
- package/dist/client/composer/useVoiceDictation.d.ts +0 -57
- package/dist/client/composer/useVoiceDictation.d.ts.map +0 -1
- package/dist/client/composer/useVoiceDictation.js +0 -975
- package/dist/client/composer/useVoiceDictation.js.map +0 -1
- package/dist/client/editor/index.d.ts +0 -2
- package/dist/client/editor/index.d.ts.map +0 -1
- package/dist/client/editor/index.js +0 -2
- package/dist/client/editor/index.js.map +0 -1
- package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts +0 -130
- package/dist/client/rich-markdown-editor/RegistryBlockNode.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/RegistryBlockNode.js +0 -426
- package/dist/client/rich-markdown-editor/RegistryBlockNode.js.map +0 -1
- package/dist/client/rich-markdown-editor/index.d.ts +0 -5
- package/dist/client/rich-markdown-editor/index.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/index.js +0 -5
- package/dist/client/rich-markdown-editor/index.js.map +0 -1
- package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts +0 -60
- package/dist/client/rich-markdown-editor/registrySlashCommands.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/registrySlashCommands.js +0 -51
- package/dist/client/rich-markdown-editor/registrySlashCommands.js.map +0 -1
- package/dist/client/rich-markdown-editor/uploadEditorImage.d.ts.map +0 -1
- package/dist/client/rich-markdown-editor/uploadEditorImage.js.map +0 -1
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import Placeholder from "@tiptap/extension-placeholder";
|
|
3
|
-
import { useEditor, EditorContent } from "@tiptap/react";
|
|
4
|
-
import StarterKit from "@tiptap/starter-kit";
|
|
1
|
+
import { SharedRichEditor } from "@agent-native/toolkit/editor/SharedRichEditor";
|
|
5
2
|
import React, {
|
|
6
3
|
useState,
|
|
7
4
|
useRef,
|
|
@@ -9,7 +6,6 @@ import React, {
|
|
|
9
6
|
useCallback,
|
|
10
7
|
useMemo,
|
|
11
8
|
} from "react";
|
|
12
|
-
import { Markdown } from "tiptap-markdown";
|
|
13
9
|
|
|
14
10
|
import {
|
|
15
11
|
CLAUDE_SONNET_MODEL_ID,
|
|
@@ -26,11 +22,6 @@ import {
|
|
|
26
22
|
serializeFrontmatter,
|
|
27
23
|
} from "../../resources/metadata.js";
|
|
28
24
|
import { agentNativePath } from "../api-path.js";
|
|
29
|
-
import {
|
|
30
|
-
Tooltip,
|
|
31
|
-
TooltipContent,
|
|
32
|
-
TooltipTrigger,
|
|
33
|
-
} from "../components/ui/tooltip.js";
|
|
34
25
|
import { cn } from "../utils.js";
|
|
35
26
|
import type { Resource } from "./use-resources.js";
|
|
36
27
|
|
|
@@ -257,483 +248,6 @@ function FrontmatterBar({
|
|
|
257
248
|
);
|
|
258
249
|
}
|
|
259
250
|
|
|
260
|
-
// --- Slash Command Menu ---
|
|
261
|
-
|
|
262
|
-
interface CommandItem {
|
|
263
|
-
title: string;
|
|
264
|
-
description: string;
|
|
265
|
-
icon: string;
|
|
266
|
-
action: (editor: any) => void;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
const slashCommands: CommandItem[] = [
|
|
270
|
-
{
|
|
271
|
-
title: "Text",
|
|
272
|
-
description: "Plain text",
|
|
273
|
-
icon: "T",
|
|
274
|
-
action: (editor) => editor.chain().focus().setParagraph().run(),
|
|
275
|
-
},
|
|
276
|
-
{
|
|
277
|
-
title: "Heading 1",
|
|
278
|
-
description: "Large heading",
|
|
279
|
-
icon: "H1",
|
|
280
|
-
action: (editor) =>
|
|
281
|
-
editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
282
|
-
},
|
|
283
|
-
{
|
|
284
|
-
title: "Heading 2",
|
|
285
|
-
description: "Medium heading",
|
|
286
|
-
icon: "H2",
|
|
287
|
-
action: (editor) =>
|
|
288
|
-
editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
title: "Heading 3",
|
|
292
|
-
description: "Small heading",
|
|
293
|
-
icon: "H3",
|
|
294
|
-
action: (editor) =>
|
|
295
|
-
editor.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
296
|
-
},
|
|
297
|
-
{
|
|
298
|
-
title: "Bullet List",
|
|
299
|
-
description: "Unordered list",
|
|
300
|
-
icon: "•",
|
|
301
|
-
action: (editor) => editor.chain().focus().toggleBulletList().run(),
|
|
302
|
-
},
|
|
303
|
-
{
|
|
304
|
-
title: "Numbered List",
|
|
305
|
-
description: "Ordered list",
|
|
306
|
-
icon: "1.",
|
|
307
|
-
action: (editor) => editor.chain().focus().toggleOrderedList().run(),
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
title: "Code Block",
|
|
311
|
-
description: "Code snippet",
|
|
312
|
-
icon: "<>",
|
|
313
|
-
action: (editor) => editor.chain().focus().toggleCodeBlock().run(),
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
title: "Quote",
|
|
317
|
-
description: "Block quote",
|
|
318
|
-
icon: '"',
|
|
319
|
-
action: (editor) => editor.chain().focus().toggleBlockquote().run(),
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
title: "Divider",
|
|
323
|
-
description: "Horizontal rule",
|
|
324
|
-
icon: "—",
|
|
325
|
-
action: (editor) => editor.chain().focus().setHorizontalRule().run(),
|
|
326
|
-
},
|
|
327
|
-
];
|
|
328
|
-
|
|
329
|
-
function SlashMenu({ editor }: { editor: any }) {
|
|
330
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
331
|
-
const [query, setQuery] = useState("");
|
|
332
|
-
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
333
|
-
const [position, setPosition] = useState<{
|
|
334
|
-
top: number;
|
|
335
|
-
left: number;
|
|
336
|
-
flipUp: boolean;
|
|
337
|
-
} | null>(null);
|
|
338
|
-
const slashPosRef = useRef<number | null>(null);
|
|
339
|
-
const menuRef = useRef<HTMLDivElement>(null);
|
|
340
|
-
|
|
341
|
-
const filteredCommands = useMemo(
|
|
342
|
-
() =>
|
|
343
|
-
slashCommands.filter(
|
|
344
|
-
(cmd) =>
|
|
345
|
-
cmd.title.toLowerCase().includes(query.toLowerCase()) ||
|
|
346
|
-
cmd.description.toLowerCase().includes(query.toLowerCase()),
|
|
347
|
-
),
|
|
348
|
-
[query],
|
|
349
|
-
);
|
|
350
|
-
|
|
351
|
-
const executeCommand = useCallback(
|
|
352
|
-
(cmd: CommandItem) => {
|
|
353
|
-
if (slashPosRef.current !== null) {
|
|
354
|
-
const { from } = editor.state.selection;
|
|
355
|
-
editor
|
|
356
|
-
.chain()
|
|
357
|
-
.focus()
|
|
358
|
-
.deleteRange({ from: slashPosRef.current, to: from })
|
|
359
|
-
.run();
|
|
360
|
-
}
|
|
361
|
-
cmd.action(editor);
|
|
362
|
-
setIsOpen(false);
|
|
363
|
-
setQuery("");
|
|
364
|
-
slashPosRef.current = null;
|
|
365
|
-
},
|
|
366
|
-
[editor],
|
|
367
|
-
);
|
|
368
|
-
|
|
369
|
-
useEffect(() => {
|
|
370
|
-
if (!editor) return;
|
|
371
|
-
|
|
372
|
-
const handleKeyDown = (e: KeyboardEvent) => {
|
|
373
|
-
if (!isOpen) return;
|
|
374
|
-
|
|
375
|
-
if (e.key === "ArrowDown") {
|
|
376
|
-
e.preventDefault();
|
|
377
|
-
setSelectedIndex((i) => (i + 1) % filteredCommands.length);
|
|
378
|
-
} else if (e.key === "ArrowUp") {
|
|
379
|
-
e.preventDefault();
|
|
380
|
-
setSelectedIndex(
|
|
381
|
-
(i) => (i - 1 + filteredCommands.length) % filteredCommands.length,
|
|
382
|
-
);
|
|
383
|
-
} else if (e.key === "Enter") {
|
|
384
|
-
e.preventDefault();
|
|
385
|
-
if (filteredCommands[selectedIndex]) {
|
|
386
|
-
executeCommand(filteredCommands[selectedIndex]);
|
|
387
|
-
}
|
|
388
|
-
} else if (e.key === "Escape") {
|
|
389
|
-
setIsOpen(false);
|
|
390
|
-
setQuery("");
|
|
391
|
-
slashPosRef.current = null;
|
|
392
|
-
}
|
|
393
|
-
};
|
|
394
|
-
|
|
395
|
-
document.addEventListener("keydown", handleKeyDown, true);
|
|
396
|
-
return () => document.removeEventListener("keydown", handleKeyDown, true);
|
|
397
|
-
}, [isOpen, selectedIndex, filteredCommands, executeCommand, editor]);
|
|
398
|
-
|
|
399
|
-
useEffect(() => {
|
|
400
|
-
if (!editor) return;
|
|
401
|
-
|
|
402
|
-
const handleTransaction = () => {
|
|
403
|
-
const { state } = editor;
|
|
404
|
-
const { from } = state.selection;
|
|
405
|
-
const textBefore = state.doc.textBetween(
|
|
406
|
-
Math.max(0, from - 20),
|
|
407
|
-
from,
|
|
408
|
-
"\n",
|
|
409
|
-
);
|
|
410
|
-
|
|
411
|
-
const slashMatch = textBefore.match(/\/([a-zA-Z0-9]*)$/);
|
|
412
|
-
|
|
413
|
-
if (slashMatch) {
|
|
414
|
-
const slashStart = from - slashMatch[0].length;
|
|
415
|
-
slashPosRef.current = slashStart;
|
|
416
|
-
setQuery(slashMatch[1]);
|
|
417
|
-
setSelectedIndex(0);
|
|
418
|
-
|
|
419
|
-
const coords = editor.view.coordsAtPos(from);
|
|
420
|
-
// Estimate menu height (~320px max) and check if it fits below
|
|
421
|
-
const menuHeight = 320;
|
|
422
|
-
const spaceBelow = window.innerHeight - coords.bottom;
|
|
423
|
-
const flipUp = spaceBelow < menuHeight && coords.top > menuHeight;
|
|
424
|
-
|
|
425
|
-
setPosition({
|
|
426
|
-
top: flipUp ? coords.top : coords.bottom + 4,
|
|
427
|
-
left: Math.min(coords.left, window.innerWidth - 240),
|
|
428
|
-
flipUp,
|
|
429
|
-
});
|
|
430
|
-
setIsOpen(true);
|
|
431
|
-
} else {
|
|
432
|
-
if (isOpen) {
|
|
433
|
-
setIsOpen(false);
|
|
434
|
-
setQuery("");
|
|
435
|
-
slashPosRef.current = null;
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
};
|
|
439
|
-
|
|
440
|
-
editor.on("transaction", handleTransaction);
|
|
441
|
-
return () => {
|
|
442
|
-
editor.off("transaction", handleTransaction);
|
|
443
|
-
};
|
|
444
|
-
}, [editor, isOpen]);
|
|
445
|
-
|
|
446
|
-
if (!isOpen || !position || filteredCommands.length === 0) return null;
|
|
447
|
-
|
|
448
|
-
return (
|
|
449
|
-
<div
|
|
450
|
-
ref={menuRef}
|
|
451
|
-
style={{
|
|
452
|
-
position: "fixed",
|
|
453
|
-
...(position.flipUp
|
|
454
|
-
? { bottom: window.innerHeight - position.top + 4 }
|
|
455
|
-
: { top: position.top }),
|
|
456
|
-
left: position.left,
|
|
457
|
-
zIndex: 9999,
|
|
458
|
-
}}
|
|
459
|
-
className="re-slash-menu"
|
|
460
|
-
>
|
|
461
|
-
<div className="py-1">
|
|
462
|
-
<div
|
|
463
|
-
style={{
|
|
464
|
-
padding: "4px 10px",
|
|
465
|
-
fontSize: 10,
|
|
466
|
-
fontWeight: 600,
|
|
467
|
-
textTransform: "uppercase",
|
|
468
|
-
letterSpacing: "0.06em",
|
|
469
|
-
opacity: 0.5,
|
|
470
|
-
}}
|
|
471
|
-
>
|
|
472
|
-
Blocks
|
|
473
|
-
</div>
|
|
474
|
-
{filteredCommands.map((cmd, i) => (
|
|
475
|
-
<button
|
|
476
|
-
key={cmd.title}
|
|
477
|
-
onClick={() => executeCommand(cmd)}
|
|
478
|
-
onMouseEnter={() => setSelectedIndex(i)}
|
|
479
|
-
className={cn(
|
|
480
|
-
"re-slash-item",
|
|
481
|
-
i === selectedIndex && "re-slash-item--active",
|
|
482
|
-
)}
|
|
483
|
-
>
|
|
484
|
-
<span className="re-slash-icon">{cmd.icon}</span>
|
|
485
|
-
<span>
|
|
486
|
-
<span className="re-slash-title">{cmd.title}</span>
|
|
487
|
-
<span className="re-slash-desc">{cmd.description}</span>
|
|
488
|
-
</span>
|
|
489
|
-
</button>
|
|
490
|
-
))}
|
|
491
|
-
</div>
|
|
492
|
-
</div>
|
|
493
|
-
);
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
// --- Inline Bubble Toolbar ---
|
|
497
|
-
|
|
498
|
-
function InlineBubbleToolbar({ editor }: { editor: any }) {
|
|
499
|
-
const [visible, setVisible] = useState(false);
|
|
500
|
-
const [coords, setCoords] = useState({ top: 0, left: 0 });
|
|
501
|
-
const [showLinkInput, setShowLinkInput] = useState(false);
|
|
502
|
-
const [linkUrl, setLinkUrl] = useState("");
|
|
503
|
-
const toolbarRef = useRef<HTMLDivElement>(null);
|
|
504
|
-
|
|
505
|
-
useEffect(() => {
|
|
506
|
-
if (!editor) return;
|
|
507
|
-
const update = () => {
|
|
508
|
-
const { from, to } = editor.state.selection;
|
|
509
|
-
if (from === to || !editor.isFocused) {
|
|
510
|
-
setVisible(false);
|
|
511
|
-
return;
|
|
512
|
-
}
|
|
513
|
-
const domSelection = window.getSelection();
|
|
514
|
-
if (!domSelection || domSelection.rangeCount === 0) {
|
|
515
|
-
setVisible(false);
|
|
516
|
-
return;
|
|
517
|
-
}
|
|
518
|
-
const range = domSelection.getRangeAt(0);
|
|
519
|
-
const rect = range.getBoundingClientRect();
|
|
520
|
-
if (rect.width === 0) {
|
|
521
|
-
setVisible(false);
|
|
522
|
-
return;
|
|
523
|
-
}
|
|
524
|
-
// Use fixed positioning with viewport coordinates
|
|
525
|
-
setCoords({
|
|
526
|
-
top: rect.top - 8,
|
|
527
|
-
left: rect.left + rect.width / 2,
|
|
528
|
-
});
|
|
529
|
-
setVisible(true);
|
|
530
|
-
};
|
|
531
|
-
editor.on("selectionUpdate", update);
|
|
532
|
-
const onBlur = () => {
|
|
533
|
-
// Delay so clicks on toolbar buttons register before hiding
|
|
534
|
-
setTimeout(() => {
|
|
535
|
-
if (!editor.isFocused) setVisible(false);
|
|
536
|
-
}, 150);
|
|
537
|
-
};
|
|
538
|
-
editor.on("blur", onBlur);
|
|
539
|
-
return () => {
|
|
540
|
-
editor.off("selectionUpdate", update);
|
|
541
|
-
editor.off("blur", onBlur);
|
|
542
|
-
};
|
|
543
|
-
}, [editor]);
|
|
544
|
-
|
|
545
|
-
const handleSetLink = () => {
|
|
546
|
-
if (linkUrl.trim()) {
|
|
547
|
-
editor
|
|
548
|
-
.chain()
|
|
549
|
-
.focus()
|
|
550
|
-
.extendMarkRange("link")
|
|
551
|
-
.setLink({ href: linkUrl.trim() })
|
|
552
|
-
.run();
|
|
553
|
-
} else {
|
|
554
|
-
editor.chain().focus().extendMarkRange("link").unsetLink().run();
|
|
555
|
-
}
|
|
556
|
-
setShowLinkInput(false);
|
|
557
|
-
setLinkUrl("");
|
|
558
|
-
};
|
|
559
|
-
|
|
560
|
-
const toggleLink = () => {
|
|
561
|
-
if (editor.isActive("link")) {
|
|
562
|
-
editor.chain().focus().unsetLink().run();
|
|
563
|
-
return;
|
|
564
|
-
}
|
|
565
|
-
const previousUrl = editor.getAttributes("link").href || "";
|
|
566
|
-
setLinkUrl(previousUrl);
|
|
567
|
-
setShowLinkInput(true);
|
|
568
|
-
};
|
|
569
|
-
|
|
570
|
-
const items = [
|
|
571
|
-
{
|
|
572
|
-
label: "B",
|
|
573
|
-
title: "Bold",
|
|
574
|
-
action: () => editor.chain().focus().toggleBold().run(),
|
|
575
|
-
isActive: () => editor.isActive("bold"),
|
|
576
|
-
style: { fontWeight: 700 } as React.CSSProperties,
|
|
577
|
-
},
|
|
578
|
-
{
|
|
579
|
-
label: "I",
|
|
580
|
-
title: "Italic",
|
|
581
|
-
action: () => editor.chain().focus().toggleItalic().run(),
|
|
582
|
-
isActive: () => editor.isActive("italic"),
|
|
583
|
-
style: { fontStyle: "italic" } as React.CSSProperties,
|
|
584
|
-
},
|
|
585
|
-
{
|
|
586
|
-
label: "S",
|
|
587
|
-
title: "Strikethrough",
|
|
588
|
-
action: () => editor.chain().focus().toggleStrike().run(),
|
|
589
|
-
isActive: () => editor.isActive("strike"),
|
|
590
|
-
style: { textDecoration: "line-through" } as React.CSSProperties,
|
|
591
|
-
},
|
|
592
|
-
{
|
|
593
|
-
label: "<>",
|
|
594
|
-
title: "Code",
|
|
595
|
-
action: () => editor.chain().focus().toggleCode().run(),
|
|
596
|
-
isActive: () => editor.isActive("code"),
|
|
597
|
-
style: { fontFamily: "monospace", fontSize: 11 } as React.CSSProperties,
|
|
598
|
-
},
|
|
599
|
-
{ type: "divider" as const },
|
|
600
|
-
{
|
|
601
|
-
label: "H1",
|
|
602
|
-
title: "Heading 1",
|
|
603
|
-
action: () => editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
604
|
-
isActive: () => editor.isActive("heading", { level: 1 }),
|
|
605
|
-
},
|
|
606
|
-
{
|
|
607
|
-
label: "H2",
|
|
608
|
-
title: "Heading 2",
|
|
609
|
-
action: () => editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
610
|
-
isActive: () => editor.isActive("heading", { level: 2 }),
|
|
611
|
-
},
|
|
612
|
-
{
|
|
613
|
-
label: "H3",
|
|
614
|
-
title: "Heading 3",
|
|
615
|
-
action: () => editor.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
616
|
-
isActive: () => editor.isActive("heading", { level: 3 }),
|
|
617
|
-
},
|
|
618
|
-
{ type: "divider" as const },
|
|
619
|
-
{
|
|
620
|
-
label: "Link",
|
|
621
|
-
title: "Link",
|
|
622
|
-
action: toggleLink,
|
|
623
|
-
isActive: () => editor.isActive("link"),
|
|
624
|
-
},
|
|
625
|
-
];
|
|
626
|
-
|
|
627
|
-
if (!visible) return null;
|
|
628
|
-
|
|
629
|
-
return (
|
|
630
|
-
<div
|
|
631
|
-
ref={toolbarRef}
|
|
632
|
-
className="re-bubble-toolbar"
|
|
633
|
-
onMouseDown={(e) => e.preventDefault()}
|
|
634
|
-
style={{
|
|
635
|
-
position: "fixed",
|
|
636
|
-
top: coords.top,
|
|
637
|
-
left: coords.left,
|
|
638
|
-
transform: "translate(-50%, -100%)",
|
|
639
|
-
zIndex: 9999,
|
|
640
|
-
}}
|
|
641
|
-
>
|
|
642
|
-
{showLinkInput ? (
|
|
643
|
-
<div
|
|
644
|
-
style={{ display: "flex", alignItems: "center", gap: 4, padding: 4 }}
|
|
645
|
-
onMouseDown={(e) => e.preventDefault()}
|
|
646
|
-
>
|
|
647
|
-
<input
|
|
648
|
-
autoFocus
|
|
649
|
-
type="url"
|
|
650
|
-
placeholder="Paste link..."
|
|
651
|
-
value={linkUrl}
|
|
652
|
-
onChange={(e) => setLinkUrl(e.target.value)}
|
|
653
|
-
onKeyDown={(e) => {
|
|
654
|
-
if (e.key === "Enter") handleSetLink();
|
|
655
|
-
if (e.key === "Escape") {
|
|
656
|
-
setShowLinkInput(false);
|
|
657
|
-
setLinkUrl("");
|
|
658
|
-
}
|
|
659
|
-
}}
|
|
660
|
-
style={{
|
|
661
|
-
background: "transparent",
|
|
662
|
-
border: "none",
|
|
663
|
-
outline: "none",
|
|
664
|
-
color: "white",
|
|
665
|
-
fontSize: 12,
|
|
666
|
-
width: 160,
|
|
667
|
-
padding: "2px 4px",
|
|
668
|
-
}}
|
|
669
|
-
/>
|
|
670
|
-
<button
|
|
671
|
-
onClick={handleSetLink}
|
|
672
|
-
style={{
|
|
673
|
-
fontSize: 11,
|
|
674
|
-
color: "hsl(var(--primary))",
|
|
675
|
-
padding: "2px 6px",
|
|
676
|
-
fontWeight: 500,
|
|
677
|
-
background: "none",
|
|
678
|
-
border: "none",
|
|
679
|
-
cursor: "pointer",
|
|
680
|
-
}}
|
|
681
|
-
>
|
|
682
|
-
Apply
|
|
683
|
-
</button>
|
|
684
|
-
</div>
|
|
685
|
-
) : (
|
|
686
|
-
<div
|
|
687
|
-
style={{ display: "flex", alignItems: "center", gap: 2 }}
|
|
688
|
-
onMouseDown={(e) => e.preventDefault()}
|
|
689
|
-
>
|
|
690
|
-
{items.map((item, i) => {
|
|
691
|
-
if ("type" in item && item.type === "divider") {
|
|
692
|
-
return (
|
|
693
|
-
<div
|
|
694
|
-
key={`d-${i}`}
|
|
695
|
-
style={{
|
|
696
|
-
width: 1,
|
|
697
|
-
height: 16,
|
|
698
|
-
background: "hsl(var(--border))",
|
|
699
|
-
margin: "0 2px",
|
|
700
|
-
}}
|
|
701
|
-
/>
|
|
702
|
-
);
|
|
703
|
-
}
|
|
704
|
-
const { label, title, action, isActive, style } = item as {
|
|
705
|
-
label: string;
|
|
706
|
-
title: string;
|
|
707
|
-
action: () => void;
|
|
708
|
-
isActive: () => boolean;
|
|
709
|
-
style?: React.CSSProperties;
|
|
710
|
-
};
|
|
711
|
-
return (
|
|
712
|
-
<Tooltip key={title}>
|
|
713
|
-
<TooltipTrigger asChild>
|
|
714
|
-
<button
|
|
715
|
-
onClick={action}
|
|
716
|
-
className={cn(
|
|
717
|
-
"re-bubble-btn",
|
|
718
|
-
isActive() && "re-bubble-btn--active",
|
|
719
|
-
)}
|
|
720
|
-
style={style}
|
|
721
|
-
>
|
|
722
|
-
{label}
|
|
723
|
-
</button>
|
|
724
|
-
</TooltipTrigger>
|
|
725
|
-
<TooltipContent>{title}</TooltipContent>
|
|
726
|
-
</Tooltip>
|
|
727
|
-
);
|
|
728
|
-
})}
|
|
729
|
-
</div>
|
|
730
|
-
)}
|
|
731
|
-
</div>
|
|
732
|
-
);
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
// --- Visual Markdown Editor ---
|
|
736
|
-
|
|
737
251
|
// --- Syntax-highlighted code editor (textarea + overlay) ---
|
|
738
252
|
|
|
739
253
|
function highlightJson(text: string): string {
|
|
@@ -850,6 +364,12 @@ function SyntaxHighlightEditor({
|
|
|
850
364
|
);
|
|
851
365
|
}
|
|
852
366
|
|
|
367
|
+
const RESOURCE_MARKDOWN_FEATURES = {
|
|
368
|
+
tables: false,
|
|
369
|
+
tasks: false,
|
|
370
|
+
image: false,
|
|
371
|
+
};
|
|
372
|
+
|
|
853
373
|
function VisualMarkdownEditor({
|
|
854
374
|
content,
|
|
855
375
|
onChange,
|
|
@@ -861,114 +381,22 @@ function VisualMarkdownEditor({
|
|
|
861
381
|
resourcePath: string;
|
|
862
382
|
readOnly?: boolean;
|
|
863
383
|
}) {
|
|
864
|
-
const isSettingContent = useRef(false);
|
|
865
|
-
const onChangeRef = useRef(onChange);
|
|
866
|
-
onChangeRef.current = onChange;
|
|
867
|
-
|
|
868
|
-
// Parse frontmatter — strip it from tiptap content, re-prepend on save
|
|
869
384
|
const parsed = useMemo(() => parseFrontmatter(content), [content]);
|
|
870
385
|
const frontmatterRef = useRef(parsed);
|
|
871
386
|
frontmatterRef.current = parsed;
|
|
387
|
+
const body = parsed?.body ?? content;
|
|
872
388
|
|
|
873
|
-
const
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
codeBlock: {},
|
|
878
|
-
link: false,
|
|
879
|
-
dropcursor: { color: "hsl(var(--ring))", width: 2 },
|
|
880
|
-
}),
|
|
881
|
-
Placeholder.configure({
|
|
882
|
-
placeholder: ({ node }) => {
|
|
883
|
-
if (node.type.name === "heading") {
|
|
884
|
-
const level = node.attrs.level;
|
|
885
|
-
if (level === 1) return "Heading 1";
|
|
886
|
-
if (level === 2) return "Heading 2";
|
|
887
|
-
return "Heading 3";
|
|
888
|
-
}
|
|
889
|
-
return "Type '/' for commands...";
|
|
890
|
-
},
|
|
891
|
-
showOnlyWhenEditable: true,
|
|
892
|
-
showOnlyCurrent: true,
|
|
893
|
-
}),
|
|
894
|
-
Link.configure({
|
|
895
|
-
openOnClick: false,
|
|
896
|
-
HTMLAttributes: { class: "re-link" },
|
|
897
|
-
}),
|
|
898
|
-
Markdown.configure({
|
|
899
|
-
html: true,
|
|
900
|
-
transformPastedText: true,
|
|
901
|
-
transformCopiedText: true,
|
|
902
|
-
}),
|
|
903
|
-
],
|
|
904
|
-
content: parsed?.body ?? content,
|
|
905
|
-
editable: !readOnly,
|
|
906
|
-
editorProps: {
|
|
907
|
-
attributes: {
|
|
908
|
-
class: "re-prose",
|
|
909
|
-
},
|
|
910
|
-
},
|
|
911
|
-
onUpdate: ({ editor }) => {
|
|
912
|
-
if (readOnly) return;
|
|
913
|
-
if (isSettingContent.current) return;
|
|
914
|
-
try {
|
|
915
|
-
const md = (editor.storage as any).markdown.getMarkdown();
|
|
916
|
-
// Re-prepend frontmatter if it existed
|
|
917
|
-
const fm = frontmatterRef.current;
|
|
918
|
-
const full = fm ? fm.raw + md : md;
|
|
919
|
-
onChangeRef.current(full);
|
|
920
|
-
} catch (err) {
|
|
921
|
-
console.error("Markdown serialization error:", err);
|
|
922
|
-
}
|
|
389
|
+
const commitBody = useCallback(
|
|
390
|
+
(nextBody: string) => {
|
|
391
|
+
const frontmatter = frontmatterRef.current;
|
|
392
|
+
onChange(frontmatter ? frontmatter.raw + nextBody : nextBody);
|
|
923
393
|
},
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
useEffect(() => {
|
|
927
|
-
if (!editor || editor.isDestroyed) return;
|
|
928
|
-
editor.setEditable(!readOnly);
|
|
929
|
-
}, [editor, readOnly]);
|
|
930
|
-
|
|
931
|
-
useEffect(() => {
|
|
932
|
-
if (!editor || editor.isDestroyed) return;
|
|
933
|
-
const currentMd = (editor.storage as any).markdown.getMarkdown();
|
|
934
|
-
if (currentMd !== (parsed?.body ?? content)) {
|
|
935
|
-
if (editor.isFocused) return;
|
|
936
|
-
isSettingContent.current = true;
|
|
937
|
-
editor.commands.setContent(parsed?.body ?? content);
|
|
938
|
-
isSettingContent.current = false;
|
|
939
|
-
}
|
|
940
|
-
}, [content, editor, parsed]);
|
|
941
|
-
|
|
942
|
-
useEffect(() => {
|
|
943
|
-
return () => {
|
|
944
|
-
editor?.destroy();
|
|
945
|
-
};
|
|
946
|
-
}, [editor]);
|
|
947
|
-
|
|
948
|
-
if (!editor) return null;
|
|
949
|
-
|
|
950
|
-
const handleWrapperClick = (e: React.MouseEvent<HTMLDivElement>) => {
|
|
951
|
-
// If the click was on the wrapper (empty area), not on editor content, focus at end
|
|
952
|
-
const target = e.target as HTMLElement;
|
|
953
|
-
if (
|
|
954
|
-
target.classList.contains("re-editor-clickable") ||
|
|
955
|
-
target.classList.contains("re-editor-wrapper")
|
|
956
|
-
) {
|
|
957
|
-
editor.chain().focus("end").run();
|
|
958
|
-
}
|
|
959
|
-
};
|
|
394
|
+
[onChange],
|
|
395
|
+
);
|
|
960
396
|
|
|
961
397
|
return (
|
|
962
|
-
<div
|
|
963
|
-
|
|
964
|
-
onClick={handleWrapperClick}
|
|
965
|
-
style={{
|
|
966
|
-
position: "relative",
|
|
967
|
-
minHeight: "100%",
|
|
968
|
-
cursor: readOnly ? "default" : "text",
|
|
969
|
-
}}
|
|
970
|
-
>
|
|
971
|
-
{parsed && (
|
|
398
|
+
<div className="re-editor-wrapper min-h-full">
|
|
399
|
+
{parsed ? (
|
|
972
400
|
<FrontmatterBar
|
|
973
401
|
resourcePath={resourcePath}
|
|
974
402
|
frontmatter={parsed}
|
|
@@ -976,19 +404,21 @@ function VisualMarkdownEditor({
|
|
|
976
404
|
onChange={(updated) => {
|
|
977
405
|
if (readOnly) return;
|
|
978
406
|
frontmatterRef.current = updated;
|
|
979
|
-
|
|
980
|
-
try {
|
|
981
|
-
const md = (editor.storage as any).markdown.getMarkdown();
|
|
982
|
-
onChangeRef.current(updated.raw + md);
|
|
983
|
-
} catch {
|
|
984
|
-
// fallback
|
|
985
|
-
}
|
|
407
|
+
onChange(updated.raw + body);
|
|
986
408
|
}}
|
|
987
409
|
/>
|
|
988
|
-
)}
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
410
|
+
) : null}
|
|
411
|
+
<SharedRichEditor
|
|
412
|
+
value={body}
|
|
413
|
+
onChange={commitBody}
|
|
414
|
+
editable={!readOnly}
|
|
415
|
+
interactive={!readOnly}
|
|
416
|
+
dialect="gfm"
|
|
417
|
+
features={RESOURCE_MARKDOWN_FEATURES}
|
|
418
|
+
placeholder="Type '/' for commands..."
|
|
419
|
+
editorClassName="re-prose"
|
|
420
|
+
ariaLabel="Resource markdown"
|
|
421
|
+
/>
|
|
992
422
|
</div>
|
|
993
423
|
);
|
|
994
424
|
}
|
|
@@ -1439,86 +869,4 @@ const editorStyles = `
|
|
|
1439
869
|
background: hsl(210 100% 52% / 0.2);
|
|
1440
870
|
}
|
|
1441
871
|
|
|
1442
|
-
/* Bubble toolbar */
|
|
1443
|
-
.re-bubble-toolbar {
|
|
1444
|
-
display: flex;
|
|
1445
|
-
align-items: center;
|
|
1446
|
-
background: hsl(var(--popover));
|
|
1447
|
-
color: hsl(var(--popover-foreground));
|
|
1448
|
-
border: 1px solid hsl(var(--border));
|
|
1449
|
-
border-radius: 6px;
|
|
1450
|
-
padding: 3px;
|
|
1451
|
-
box-shadow: 0 4px 16px rgb(0 0 0 / 0.12);
|
|
1452
|
-
}
|
|
1453
|
-
.re-bubble-btn {
|
|
1454
|
-
padding: 3px 6px;
|
|
1455
|
-
border-radius: 4px;
|
|
1456
|
-
font-size: 12px;
|
|
1457
|
-
color: hsl(var(--muted-foreground));
|
|
1458
|
-
background: none;
|
|
1459
|
-
border: none;
|
|
1460
|
-
cursor: pointer;
|
|
1461
|
-
line-height: 1;
|
|
1462
|
-
}
|
|
1463
|
-
.re-bubble-btn:hover {
|
|
1464
|
-
background: hsl(var(--accent));
|
|
1465
|
-
color: hsl(var(--accent-foreground));
|
|
1466
|
-
}
|
|
1467
|
-
.re-bubble-btn--active {
|
|
1468
|
-
background: hsl(var(--accent));
|
|
1469
|
-
color: hsl(var(--accent-foreground));
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
/* Slash command menu */
|
|
1473
|
-
.re-slash-menu {
|
|
1474
|
-
background: hsl(var(--popover));
|
|
1475
|
-
border: 1px solid hsl(var(--border));
|
|
1476
|
-
border-radius: 6px;
|
|
1477
|
-
box-shadow: 0 4px 20px rgb(0 0 0 / 0.12), 0 0 0 1px rgb(0 0 0 / 0.04);
|
|
1478
|
-
min-width: 220px;
|
|
1479
|
-
max-height: 320px;
|
|
1480
|
-
overflow-y: auto;
|
|
1481
|
-
color: hsl(var(--foreground));
|
|
1482
|
-
}
|
|
1483
|
-
.re-slash-item {
|
|
1484
|
-
width: 100%;
|
|
1485
|
-
display: flex;
|
|
1486
|
-
align-items: center;
|
|
1487
|
-
gap: 8px;
|
|
1488
|
-
padding: 6px 10px;
|
|
1489
|
-
text-align: left;
|
|
1490
|
-
background: none;
|
|
1491
|
-
border: none;
|
|
1492
|
-
cursor: pointer;
|
|
1493
|
-
color: hsl(var(--foreground));
|
|
1494
|
-
font-size: 13px;
|
|
1495
|
-
}
|
|
1496
|
-
.re-slash-item:hover,
|
|
1497
|
-
.re-slash-item--active {
|
|
1498
|
-
background: hsl(var(--accent));
|
|
1499
|
-
}
|
|
1500
|
-
.re-slash-icon {
|
|
1501
|
-
display: flex;
|
|
1502
|
-
align-items: center;
|
|
1503
|
-
justify-content: center;
|
|
1504
|
-
width: 28px;
|
|
1505
|
-
height: 28px;
|
|
1506
|
-
border-radius: 4px;
|
|
1507
|
-
border: 1px solid hsl(var(--border));
|
|
1508
|
-
background: hsl(var(--background));
|
|
1509
|
-
font-size: 12px;
|
|
1510
|
-
font-weight: 600;
|
|
1511
|
-
color: hsl(var(--muted-foreground));
|
|
1512
|
-
flex-shrink: 0;
|
|
1513
|
-
}
|
|
1514
|
-
.re-slash-title {
|
|
1515
|
-
display: block;
|
|
1516
|
-
font-weight: 500;
|
|
1517
|
-
font-size: 13px;
|
|
1518
|
-
}
|
|
1519
|
-
.re-slash-desc {
|
|
1520
|
-
display: block;
|
|
1521
|
-
font-size: 11px;
|
|
1522
|
-
color: hsl(var(--muted-foreground));
|
|
1523
|
-
}
|
|
1524
872
|
`;
|