Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
malzariey committed Jan 5, 2025
1 parent a0b6f88 commit d26a5a9
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 23 deletions.
91 changes: 68 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Implemenation of meta's lexical editor in FilamentPHP, a modern, extensible text editor framework.
# Filament Lexical Editor.

[![Latest Version on Packagist](https://img.shields.io/packagist/v/malzariey/filament-lexical-editor.svg?style=flat-square)](https://packagist.org/packages/malzariey/filament-lexical-editor)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/malzariey/filament-lexical-editor/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/malzariey/filament-lexical-editor/actions?query=workflow%3Arun-tests+branch%3Amain)
Expand All @@ -7,7 +7,7 @@



This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.
This package provides an implementation of Meta's Lexical Editor within the FilamentPHP framework. It offers a modern, extensible text editor that can be easily integrated into your FilamentPHP projects.

## Installation

Expand All @@ -17,45 +17,83 @@ You can install the package via composer:
composer require malzariey/filament-lexical-editor
```

You can publish and run the migrations with:
Optionally, you can publish the views using

```bash
php artisan vendor:publish --tag="filament-lexical-editor-migrations"
php artisan migrate
php artisan vendor:publish --tag="filament-lexical-editor-views"
```

You can publish the config file with:

```bash
php artisan vendor:publish --tag="filament-lexical-editor-config"
```

Optionally, you can publish the views using

```bash
php artisan vendor:publish --tag="filament-lexical-editor-views"
## Usage
Use the `FilamentLexicalEditor` field in your form schema to add the Lexical Editor to your form.
```php
use Malzariey\FilamentLexicalEditor\FilamentLexicalEditor;

public static function form(Form $form): Form
{
return $form
->schema([
FilamentLexicalEditor::make('content'),
]);
}
```

This is the contents of the published config file:
## Customize Toolbar
You can customize the toolbar by using the `enabledToolbars` method. The method accepts an array of ToolbarItem constants. The following is a list of available toolbar items:

```php
return [
];
```

FilamentLexicalEditor::make('content')
->enabledToolbars([
ToolbarItem::UNDO, ToolbarItem::REDO,ToolbarItem::FONT_FAMILY, ToolbarItem::NORMAL, ToolbarItem::H1, ToolbarItem::H2, ToolbarItem::H3,
ToolbarItem::H4, ToolbarItem::H5, ToolbarItem::H6, ToolbarItem::BULLET, ToolbarItem::NUMBERED, ToolbarItem::QUOTE,
ToolbarItem::CODE, ToolbarItem::FONT_SIZE, ToolbarItem::BOLD, ToolbarItem::ITALIC, ToolbarItem::UNDERLINE,
ToolbarItem::ICODE, ToolbarItem::LINK, ToolbarItem::TEXT_COLOR, ToolbarItem::BACKGROUND_COLOR, ToolbarItem::LOWERCASE,
ToolbarItem::UPPERCASE, ToolbarItem::CAPITALIZE, ToolbarItem::STRIKETHROUGH, ToolbarItem::SUBSCRIPT, ToolbarItem::SUPERSCRIPT,
ToolbarItem::CLEAR, ToolbarItem::LEFT, ToolbarItem::CENTER, ToolbarItem::RIGHT, ToolbarItem::JUSTIFY, ToolbarItem::START,
ToolbarItem::END, ToolbarItem::INDENT, ToolbarItem::OUTDENT, ToolbarItem::HR,ToolbarItem::IMAGE
]),

## Usage
```

## Adding Dividers between Toolbar Actions
To add a divider between toolbar actions, you can use the ToolbarItem::DIVIDER constant.
```php
$filamentLexicalEditor = new Malzariey\FilamentLexicalEditor();
echo $filamentLexicalEditor->echoPhrase('Hello, Malzariey!');

FilamentLexicalEditor::make('content')
->enabledToolbars([
ToolbarItem::UNDO, ToolbarItem::REDO,
ToolbarItem::DIVIDER,
ToolbarItem::FONT_FAMILY,
ToolbarItem::DIVIDER,
ToolbarItem::NORMAL,
]),

```

## Testing
### Screenshots

```bash
composer test
#### Light mode

![FilamentLexicalEditor Light](https://github.com/malzariey/filament-lexical-editor/raw/main/art/light.png)

#### Dark mode

![FilamentLexicalEditor Dark](https://github.com/malzariey/filament-lexical-editor/raw/main/art/dark.png)


# Styling

If you're [building a custom Filament theme](https://filamentphp.com/docs/2.x/admin/appearance#building-themes), you need one more step to make the calendar theme match your custom theme.

Add this line to your `resources/css/{panel_name}/theme.css` file.

```css
@import '/vendor/malzariey/filament-lexical-editor/resources/css/index.css';
```


## Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
Expand All @@ -76,3 +114,10 @@ Please review [our security policy](../../security/policy) on how to report secu
## License

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

## Acknowledgements

- This project makes use of [Lexical Editor](https://github.com/facebook/lexical) by [Meta](https://github.com/facebook).
- Special thanks to [JetBrains](https://www.jetbrains.com), whose support to open-source projects has been tremendously valuable for our project's progress and improvement. Through their [Open Source Support Program](https://www.jetbrains.com/community/opensource/#support), JetBrains has generously provided us with free licenses to their high-quality professional developer tools, including IntelliJ IDEA and PhpStorm. These tools have greatly improved our productivity and made it easier to maintain high quality code. JetBrains has demonstrated a strong commitment to assisting the open source community, making a significant contribution to promoting open-source software and collaboration. We wholeheartedly thank JetBrains for their support and for having us in their open-source project support program.

[![JetBrains Logo](https://www.jetbrains.com/company/brand/img/jetbrains_logo.png)](https://www.jetbrains.com/)
Binary file added raw/main/art/dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added raw/main/art/light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d26a5a9

Please sign in to comment.