Part of Fixing Issue #14976
### Pull Request Summary: SlashCommand Integration in Advanced Text
Editor
This pull request introduces **SlashCommand functionality** within the
Advanced Text Editor, specifically used in the **Workflow node** of
**Send Email body** components. The implementation leverages the
`@tiptap/suggestion` extension from the TipTap ecosystem, enabling
dynamic styling and command execution via a custom dropdown triggered by
typing `/`.
---
### Implementation Overview
#### 1. **Custom Extension & Dropdown Rendering**
- A new extension was created to handle SlashCommand interactions.
- This extension renders a **Dropdown component** that displays
available commands with relevant styles, icons etc.
#### 2. **Command Configuration**
- Each command includes:
- Visibility and active state logic
- Execution behavior upon selection
- All commands are initialized and configured centrally.
#### 3. **Search & Filtering**
- As users type after the `/`, the command list is **filtered based on
the query**.
- For example, typing `/car` filters and displays matching commands in
the dropdown.
#### 4. **Dropdown Lifecycle & Positioning**
- The dropdown is rendered using React lifecycle hooks provided by
`SuggestionTip`:
- `onStart`: Initializes state, sets selected command, and captures
cursor position via `DOMRect`.
- `onUpdate`, `onKeyDown`, `onExit`: Manage dropdown updates and
interactions.
- Positioning is handled via a **`useFloating` hook**, which aligns the
dropdown relative to the cursor and editor bounds.
- The dropdown is rendered in a **react-portal**, wrapped in the current
theme for consistent styling and animation.
#### 6. **State Management**
- A dedicated `SlashCommandState.ts` file manages:
- Callback functions
- Current command and selected item
- Cleanup utilities for event listeners
- Dropdown navigation (arrow keys, enter key)
#### 7. **Integration Points**
- SlashCommand functionality is now **enabled in Send Email body of the
Workflow**.
- Relevant changes have been applied to support this components in
Storybook as well.
[slash command
test.webm](https://github.com/user-attachments/assets/5c537844-8987-4ce5-9fca-b29ea93d8063)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> Updates Portuguese (Brazil and Portugal) generated locale files,
including a new editor hint string for “Enter text or type '/' for
commands,” plus assorted translation tweaks.
>
> - **i18n/locales**:
> - **Portuguese (Brazil) `src/locales/generated/pt-BR.ts`**: Add new
editor hint message (`"Enter text or Type '/' for commands"`) and adjust
multiple translations/wording.
> - **Portuguese (Portugal) `src/locales/generated/pt-PT.ts`**: Add the
same editor hint message and refine numerous translations/labels.
> - No functional code changes; translation files regenerated/updated.
>
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
b3d7407525. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Félix Malfait <felix@twenty.com>
148 lines
5.1 KiB
JSON
148 lines
5.1 KiB
JSON
{
|
|
"name": "twenty-front",
|
|
"private": true,
|
|
"type": "module",
|
|
"scripts": {
|
|
"build": "NODE_ENV=production VITE_DISABLE_TYPESCRIPT_CHECKER=true VITE_DISABLE_ESLINT_CHECKER=true NODE_OPTIONS=--max-old-space-size=8192 npx vite build && sh ./scripts/inject-runtime-env.sh",
|
|
"build:sourcemaps": "NODE_ENV=production VITE_BUILD_SOURCEMAP=true VITE_DISABLE_TYPESCRIPT_CHECKER=true VITE_DISABLE_ESLINT_CHECKER=true NODE_OPTIONS=--max-old-space-size=8192 npx vite build && sh ./scripts/inject-runtime-env.sh",
|
|
"start:prod": "NODE_ENV=production npx serve -s build",
|
|
"tsup": "npx tsup"
|
|
},
|
|
"engines": {
|
|
"node": "^24.5.0",
|
|
"npm": "please-use-yarn",
|
|
"yarn": "^4.0.2"
|
|
},
|
|
"browserslist": {
|
|
"production": [
|
|
">0.2%",
|
|
"not dead",
|
|
"not op_mini all"
|
|
],
|
|
"development": [
|
|
"last 1 chrome version",
|
|
"last 1 firefox version",
|
|
"last 1 safari version"
|
|
]
|
|
},
|
|
"msw": {
|
|
"workerDirectory": "public"
|
|
},
|
|
"dependencies": {
|
|
"@ai-sdk/react": "^2.0.51",
|
|
"@apollo/client": "^3.7.17",
|
|
"@blocknote/mantine": "^0.31.1",
|
|
"@blocknote/react": "^0.31.1",
|
|
"@blocknote/xl-docx-exporter": "^0.31.1",
|
|
"@blocknote/xl-pdf-exporter": "^0.31.1",
|
|
"@calcom/embed-react": "^1.5.3",
|
|
"@cyntler/react-doc-viewer": "^1.17.0",
|
|
"@dagrejs/dagre": "^1.1.2",
|
|
"@floating-ui/react": "^0.24.3",
|
|
"@graphiql/plugin-explorer": "^1.0.2",
|
|
"@graphiql/react": "^0.23.0",
|
|
"@hello-pangea/dnd": "^16.2.0",
|
|
"@hookform/resolvers": "^5.2.2",
|
|
"@lingui/core": "^5.1.2",
|
|
"@lingui/detect-locale": "^5.2.0",
|
|
"@lingui/react": "^5.1.2",
|
|
"@monaco-editor/react": "^4.6.0",
|
|
"@nivo/bar": "^0.99.0",
|
|
"@nivo/core": "^0.99.0",
|
|
"@nivo/line": "^0.99.0",
|
|
"@nivo/pie": "^0.99.0",
|
|
"@nivo/radial-bar": "^0.99.0",
|
|
"@react-email/components": "^0.5.3",
|
|
"@react-pdf/renderer": "^4.1.6",
|
|
"@scalar/api-reference-react": "^0.4.36",
|
|
"@tiptap/core": "^3.4.2",
|
|
"@tiptap/extension-bold": "^3.4.2",
|
|
"@tiptap/extension-document": "^3.4.2",
|
|
"@tiptap/extension-hard-break": "^3.4.2",
|
|
"@tiptap/extension-heading": "^3.4.2",
|
|
"@tiptap/extension-image": "^3.4.4",
|
|
"@tiptap/extension-italic": "^3.4.2",
|
|
"@tiptap/extension-link": "^3.4.2",
|
|
"@tiptap/extension-list": "3.4.2",
|
|
"@tiptap/extension-paragraph": "^3.4.2",
|
|
"@tiptap/extension-strike": "^3.4.2",
|
|
"@tiptap/extension-text": "^3.4.2",
|
|
"@tiptap/extension-underline": "^3.4.2",
|
|
"@tiptap/extensions": "^3.4.2",
|
|
"@tiptap/react": "^3.4.2",
|
|
"@xyflow/react": "^12.4.2",
|
|
"ai": "^5.0.49",
|
|
"apollo-link-rest": "^0.9.0",
|
|
"apollo-upload-client": "^17.0.0",
|
|
"buffer": "^6.0.3",
|
|
"cron-parser": "5.1.1",
|
|
"date-fns": "^2.30.0",
|
|
"docx": "^9.1.0",
|
|
"file-saver": "^2.0.5",
|
|
"graphiql": "^3.1.1",
|
|
"graphql": "16.8.1",
|
|
"graphql-sse": "^2.5.4",
|
|
"input-otp": "^1.4.2",
|
|
"js-cookie": "^3.0.5",
|
|
"json-2-csv": "^5.4.0",
|
|
"jwt-decode": "^4.0.0",
|
|
"qs": "^6.11.2",
|
|
"react-data-grid": "7.0.0-beta.13",
|
|
"react-datepicker": "^6.7.1",
|
|
"react-dropzone": "^14.2.3",
|
|
"react-error-boundary": "^4.0.11",
|
|
"react-grid-layout": "^1.5.2",
|
|
"react-helmet-async": "^1.3.0",
|
|
"react-hook-form": "^7.45.1",
|
|
"react-hotkeys-hook": "^4.4.4",
|
|
"react-imask": "^7.6.0",
|
|
"react-intersection-observer": "^9.15.1",
|
|
"react-loading-skeleton": "^3.3.1",
|
|
"react-markdown": "^10.1.0",
|
|
"react-phone-number-input": "patch:react-phone-number-input@npm%3A3.4.5#../../.yarn/patches/react-phone-number-input-npm-3.4.5-dc2895c306.patch",
|
|
"react-qr-code": "^2.0.18",
|
|
"react-responsive": "^9.0.2",
|
|
"react-router-dom": "^6.4.4",
|
|
"react-textarea-autosize": "^8.4.1",
|
|
"recoil": "^0.7.7",
|
|
"remark-gfm": "^4.0.1",
|
|
"transliteration": "^2.3.5",
|
|
"twenty-shared": "workspace:*",
|
|
"twenty-ui": "workspace:*",
|
|
"use-debounce": "^10.0.0"
|
|
},
|
|
"devDependencies": {
|
|
"@lingui/cli": "^5.1.2",
|
|
"@lingui/swc-plugin": "^5.6.0",
|
|
"@lingui/vite-plugin": "^5.1.2",
|
|
"@tiptap/suggestion": "^3.4.2",
|
|
"@types/apollo-upload-client": "^17.0.2",
|
|
"@types/file-saver": "^2.0.7",
|
|
"@types/js-cookie": "^3.0.3",
|
|
"@types/react-grid-layout": "^1",
|
|
"@typescript-eslint/eslint-plugin": "^8.39.0",
|
|
"@typescript-eslint/parser": "^8.39.0",
|
|
"@typescript-eslint/utils": "^8.39.0",
|
|
"eslint": "^9.32.0",
|
|
"eslint-config-prettier": "^9.1.0",
|
|
"eslint-plugin-import": "^2.31.0",
|
|
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
"eslint-plugin-lingui": "^0.9.0",
|
|
"eslint-plugin-prefer-arrow": "^1.2.3",
|
|
"eslint-plugin-prettier": "^5.1.2",
|
|
"eslint-plugin-project-structure": "^3.9.1",
|
|
"eslint-plugin-react": "^7.37.2",
|
|
"eslint-plugin-react-hooks": "^5.0.0",
|
|
"eslint-plugin-react-refresh": "^0.4.4",
|
|
"eslint-plugin-simple-import-sort": "^10.0.0",
|
|
"eslint-plugin-storybook": "^0.9.0",
|
|
"eslint-plugin-unicorn": "^56.0.1",
|
|
"eslint-plugin-unused-imports": "^3.0.0",
|
|
"monaco-editor": "^0.51.0",
|
|
"monaco-editor-auto-typings": "^0.4.5",
|
|
"optionator": "^0.9.1",
|
|
"rollup-plugin-visualizer": "^5.14.0",
|
|
"vite-tsconfig-paths": "^4.2.1"
|
|
}
|
|
}
|