A Teable plugin for efficient search and replace operations on table records with multiple search modes and batch processing capabilities.
- π Multiple Search Modes - Simple text, regex, and dictionary-based search with 3x performance boost
- π― Field Selection - Flexible field selection for targeted operations
- π View Filtering - Limit search scope to specific table views
- π Batch Processing - Replace all matches or individual replacements
- π¨ Modern UI - Responsive design with card grid layout and light/dark theme support
- π Internationalization - Complete i18n support (English/Chinese)
- β‘ High Performance - Optimized search algorithms and React components
- π‘οΈ Error Handling - Unified error handling system with user-friendly messages
- π Teable Integration - Seamless integration with Teable tables and fields with auto token refresh
- Next.js 14.2.14 - React framework with App Router
- React 18.2.0 - Modern React features
- TypeScript 5 - Strict type safety
- Tailwind CSS 3.4.1 - Utility-first styling
- React Query 4.36.1 - Data fetching and caching
- Teable SDK - Plugin integration and components
- React i18next - Internationalization support
- Node.js 18+
- npm or yarn
- Teable account with plugin access
npm installnpm run devVisit http://localhost:3001 to view the plugin.
npm run buildnpm startnpm run lint # Run ESLint
npm run analyze # Analyze bundle sizesrc/
βββ app/ # Next.js App Router
β βββ page.tsx # Main app entry with i18n and theme setup
β βββ Main.tsx # Theme and QueryClient integration
β βββ layout.tsx # Root layout component
β βββ globals.css # Global styles and CSS variables
βββ components/
β βββ FindAndReplacePages.tsx # Main find and replace interface component
β βββ ErrorBoundary.tsx # Error boundary component
β βββ context/ # React Context providers
β β βββ EnvProvider.tsx # Environment variable injection
β β βββ I18nProvider.tsx # Internationalization provider
β β βββ getQueryClient.ts # React Query client setup
β β βββ types.ts # TypeScript type definitions
β βββ find-replace/ # Find and replace specific components
β β βββ FieldSelector.tsx # Field selection component
β β βββ ViewSelector.tsx # View selection component
β β βββ ModeSelector.tsx # Search mode selection
β β βββ SimpleModeInput.tsx # Simple text search input
β β βββ RegexModeInput.tsx # Regex pattern input
β β βββ RegexTester.tsx # Regex pattern testing tool
β β βββ DictionaryModeInput.tsx # Dictionary mode input
β β βββ DictionaryEditor.tsx # Dictionary editor component
β β βββ SearchResults.tsx # Search results display
β β βββ PreviewTable.tsx # Preview table component
β βββ ui/ # UI utility components
β βββ Icons.tsx # Icon components
βββ hooks/ # Custom React hooks
β βββ useInitApi.ts # API initialization
β βββ useFields.ts # Field data fetching
β βββ useViews.ts # View data fetching
β βββ useFieldMap.ts # Field mapping utilities
β βββ useFindReplaceState.ts # Find and replace state management
β βββ useGlobalUrlParams.ts # URL parameter management
β βββ useToast.ts # Toast notifications
β βββ useAsyncError.ts # Async error handling
βββ lib/ # Business logic and utilities
β βββ api.ts # API client utilities
βββ utils/ # Utility functions
β βββ findReplace/ # Find and replace utilities
β βββ searchAlgorithms.ts # Search algorithm implementations
β βββ ReplaceHandler.ts # Replace operation handlers
βββ types/ # Global type definitions
β βββ index.ts # Type exports
βββ locales/ # Internationalization files
β βββ en.json # English translations
β βββ zh.json # Chinese translations
βββ styles/ # Additional styles
βββ custom-enhancements.css # Custom CSS enhancements
The plugin reads configuration from URL parameters via EnvProvider.tsx:
baseId- Teable base identifierpluginId- Plugin identifierpluginInstallId- Plugin installation IDtableId- Target table for find and replace operationsviewId- Optional view ID to limit search scopeshareId,positionId,positionType- UI positioninglang,theme- Localization and theme settings
The plugin supports two deployment modes with automatic authentication handling:
- Use case: Plugin and Teable are on the same domain
- Configuration: No additional setup required
- Authentication: Browser automatically sends cookies
- API URL: Uses current domain (
${window.location.origin}/api)
- Use case: Plugin and Teable are on different domains
- Configuration: Set environment variable
NEXT_PUBLIC_TEABLE_HOST - Authentication: Uses bridge.getSelfTempToken() for Bearer token
- API URL: Uses configured host (
${NEXT_PUBLIC_TEABLE_HOST}/api)
Create a .env.local file in the project root:
# Cross-Origin Configuration
NEXT_PUBLIC_TEABLE_HOST=https://teable.yourdomain.comExamples:
# Development: Plugin on localhost:3001, Teable on localhost:3000
NEXT_PUBLIC_TEABLE_HOST=http://localhost:3000
# Production: Plugin on different subdomain
NEXT_PUBLIC_TEABLE_HOST=https://teable.yourdomain.comFor detailed configuration examples, see .env.example.
The plugin supports three search modes:
- Basic text search and replace
- Case-sensitive and whole word options
- Direct text matching
- Regular expression pattern matching
- Support for capture groups ($1, $2, etc.)
- Built-in regex tester for pattern validation
- Common regex patterns included
- Batch search and replace operations
- JSON-based dictionary format
- Visual dictionary editor
- Support for escape characters
- CSS Variables - Comprehensive theme system with HSL color values
- Responsive Design - Mobile-first approach with breakpoints
- Component Isolation - Scoped styles for custom components
- Dark Mode Support - Automatic theme detection and switching
- Shadcn/ui Components - Modern, accessible UI components
- Teable UI Integration - Consistent with Teable design system
- Form Controls - Custom form elements for search configuration
Supported languages:
- English (en)
- Chinese (zh)
- Create translation file in
src/locales/[lang].json - Update
I18nProvider.tsxresources configuration - Add language-specific content to components
import { usePluginBridge } from '@teable/sdk';
const bridge = usePluginBridge();
// Listen for configuration changes
bridge.on('syncUIConfig', handleConfigChange);
// Get temporary token for API calls
const token = await bridge.getSelfTempToken();The plugin uses Teable's OpenAPI with automatic authentication:
import { openApi } from '@teable/openapi';
// All API calls are automatically authenticated
const fields = await openApi.getFields(tableId);
const records = await openApi.getTableRecords(tableId, viewId);The plugin implements three search algorithms:
// Direct text matching with optional case sensitivity
// Supports whole word matching// Full regex pattern matching with capture groups
// Example: (\d{3})-(\d{4}) β $1-$2// Batch replacements using key-value pairs
// Format: { "find": "replace", "hello": "world" }# Build for production
npm run build
# Build with optimization
npm run build:optimized- Build the plugin:
npm run build - Deploy to your hosting service
- Configure in Teable with proper URL parameters
- Test plugin functionality in Teable environment
- TypeScript Strict Mode - Full type safety enabled
- ESLint - Code quality and style enforcement
- Prettier - Consistent code formatting
- React Query - Efficient data fetching and caching
- React.memo - Component optimization
- useMemo/useCallback - Hook optimization
- Code Splitting - Optimized bundle loading
- Select a field to search
- Choose "Simple" mode
- Enter search text
- Enter replacement text
- Click "Find" to search
- Review results and replace
- Select a field to search
- Choose "Regex" mode
- Enter regex pattern
- Use regex tester to validate pattern
- Enter replacement text (use $1, $2 for groups)
- Click "Find" to search
- Review results and replace
- Select a field to search
- Choose "Dictionary" mode
- Add key-value pairs in dictionary editor
- Click "Find" to search
- Review results and replace
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
- Write comprehensive TypeScript types
- Add English JSDoc comments for all public functions
- Follow the existing code style and patterns
- Test your changes thoroughly
- Update documentation as needed
This project is licensed under the MIT License - see the LICENSE file for details.
