@dreamkidd/univer-plugin-rtl-tools
v0.3.0
Published
A Univer plugin to provide UI tools and smart detection for Right-To-Left (RTL) text layout.
Maintainers
Readme
Univer RTL Tools Plugin
univer-plugin-rtl-tools is an extension for the Univer spreadsheet and document platform. It provides a set of UI tools and utilities specifically designed to improve the experience of handling Right-To-Left (RTL) languages such as Arabic, Persian, and Hebrew within Univer.
Status: 🚧 Work in Progress (WIP). This plugin is currently a scaffold and serves as a bridging tool while waiting for deeper RTL layout support in the core Univer rendering engine.
Features (Planned)
- 🎛 Toolbar Integration: Adds a quick-toggle button to the Univer toolbar for switching RTL contexts.
- 🧠 Smart Detection: Automatically detects RTL language input (e.g., Arabic/Persian Unicode blocks) in cells and prompts the user to adjust the layout/direction.
- 🌐 Seamless UI Hooking: Built on top of Univer's Plugin and Dependency Injection (DI) architecture.
Installation
npm install univer-plugin-rtl-toolsUsage
Register the plugin when initializing your Univer instance:
import { Univer } from '@univerjs/core';
import { UniverRtlToolsPlugin } from 'univer-plugin-rtl-tools';
const univer = new Univer();
// Register core plugins first...
// univer.registerPlugin(UniverSheetsUIPlugin);
// Register the RTL Tools plugin
univer.registerPlugin(UniverRtlToolsPlugin);Development
This project uses tsup for extremely fast, zero-config bundling.
- Install dependencies:
npm install - Start development watch mode:
npm run dev - Build for production:
npm run build
Architecture
This plugin follows the standard Univer architecture:
UniverRtlToolsPlugin: The main entry point that registers the lifecycle hooks.RtlUIController: Handles the injection of UI elements (like the toolbar button) usingIMenuManagerService.ToggleRtlCommand: The command that executes the state mutation when the UI is interacted with.
Contributing
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
