Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 12 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,21 @@ You can install the package via composer:
composer require codedor/filament-custom-tiptap-extensions
```

You can publish and run the migrations with:

```bash
php artisan vendor:publish --tag="filament-custom-tiptap-extensions-migrations"
php artisan migrate
```

You can publish the config file with:

```bash
php artisan vendor:publish --tag="filament-custom-tiptap-extensions-config"
```

This is the contents of the published config file:

```php
return [
];
```

Optionally, you can publish the views using

```bash
php artisan vendor:publish --tag="filament-custom-tiptap-extensions-views"
```

## Usage

```php
$filamentCustomTiptapExtensions = new Codedor\FilamentCustomTiptapExtensions();
echo $filamentCustomTiptapExtensions->echoPhrase('Hello, Codedor!');
use Codedor\FilamentCustomTiptapExtensions\Plugins\LinkPickerRichContentPlugin;
use Filament\Forms\Components\RichEditor;

RichEditor::make('description')
->toolbarButtons([
[
'linkPicker',
],
])
->plugins([
LinkPickerRichContentPlugin::make(),
]);
```

## Documentation
Expand Down
25 changes: 11 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,25 @@
"license": "MIT",
"require": {
"php": "^8.2",
"awcodes/filament-tiptap-editor": "^3.2",
"codedor/filament-link-picker": "^1.6",
"codedor/filament-media-library": "^1.0|^2.0|^3.0",
"filament/filament": "^3.1",
"illuminate/contracts": "^10.0|^11.0|^12.0",
"codedor/filament-link-picker": "dev-feature/filament-v4",
"filament/filament": "^4.0",
"illuminate/contracts": "^11.0|^12.0",
"spatie/laravel-package-tools": "^1.12"
},
"require-dev": {
"larastan/larastan": "^3.0",
"laravel/pint": "^1.0",
"nunomaduro/collision": "^7.0|^8.0",
"larastan/larastan": "^2.0|^3.0",
"orchestra/testbench": "^8.0|^9.0|^10.0",
"pestphp/pest": "^2.0|^3.0",
"pestphp/pest-plugin-laravel": "^2.0|^3.0",
"phpstan/extension-installer": "^1.1|^2.0",
"phpstan/phpstan-deprecation-rules": "^1.0|^2.0",
"phpstan/phpstan-phpunit": "^1.0|^2.0"
"orchestra/testbench": "^9.0|^10.0",
"pestphp/pest": "^3.0",
"pestphp/pest-plugin-laravel": "^3.0",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan-deprecation-rules": "^2.0",
"phpstan/phpstan-phpunit": "^2.0"
},
"autoload": {
"psr-4": {
"Codedor\\FilamentCustomTiptapExtensions\\": "src",
"Codedor\\FilamentCustomTiptapExtensions\\Database\\Factories\\": "database/factories"
"Codedor\\FilamentCustomTiptapExtensions\\": "src"
}
},
"autoload-dev": {
Expand Down
6 changes: 0 additions & 6 deletions config/filament-custom-tiptap-extensions.php

This file was deleted.

17 changes: 0 additions & 17 deletions database/factories/ModelFactory.php

This file was deleted.

18 changes: 0 additions & 18 deletions database/migrations/2021_04_06_000000_create_package_table.php

This file was deleted.

89 changes: 25 additions & 64 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,73 +12,34 @@ First, install this package via the Composer package manager:
composer require codedor/filament-custom-tiptap-extensions
```

## LinkAction
## LinkPicker Plugin

This overrides the default `LinkAction` to use our [link picker](https://github.com/codedor/filament-link-picker) instead.
This provides a custom Tiptap plugin that allows you to pick links via our [link picker](https://github.com/codedor/filament-link-picker) package.

### Setup
If you want to enable this plugin for each RichEditor, you can do this by adding the following code to your Filament service provider:

Update the `filament-tiptap-editor` config file to use the custom `LinkAction`:

```php
return [
// ...
'extensions' => [
// ...
[
'id' => 'linkpicker',
'name' => 'Linkpicker',
'button' => 'filament-custom-tiptap-extensions::linkpicker',
'parser' => \Codedor\FilamentCustomTiptapExtensions\LinkAction\Linkpicker::class,
],
],
];
```

Follow the instructions [here](https://github.com/awcodes/filament-tiptap-editor#custom-extensions) to add a `extension.js` file.

```js
import Link from '@tiptap/extension-link'

window.TiptapEditorExtensions = {
// ...
linkpicker: [
Link.configure({
openOnClick: false,
HTMLAttributes: {
// Change rel to different value
// Allow search engines to follow links(remove nofollow)
rel: '',
// Remove target entirely so links open in current tab
target: null
}
})
]
}
```

Update the `link_action` in the config file to
```php
return [
// ...
'link_action' => \Codedor\FilamentCustomTiptapExtensions\LinkAction\LinkAction::class,
// ...
];
use Codedor\FilamentCustomTiptapExtensions\Plugins\LinkPickerRichContentPlugin;
use Filament\Forms\Components\RichEditor;

RichEditor::configureUsing(function (RichEditor $editor) {
$editor
->toolbarButtons([
[
'h2', 'h3', 'bulletList', 'orderedList', 'blockquote',
],
[
'bold', 'italic', 'strike', 'underline', 'superscript', 'subscript', 'lead', 'small', 'alignStart', 'alignCenter', 'alignEnd',
],
[
'linkPicker',
],
['undo', 'redo'],
])
->plugins([
LinkPickerRichContentPlugin::make(),
]);
});
```

And replace `'link'` with `'linkpicker'` in the `toolbar` config.

## MediaAction

This overrides the default `MediaAction` to use our [media library](https://github.com/codedor/filament-media-library) instead.

### Setup

Update the `media_action` in the config file to
```php
return [
// ...
'media_action' => \Codedor\FilamentCustomTiptapExtensions\MediaAction\MediaAction::class,
// ...
];
```
That's all you need to do to enable the LinkPicker plugin for all RichEditor components in your Filament application.
8 changes: 0 additions & 8 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
parameters:
ignoreErrors:
-
message: "#^Call to an undefined method Filament\\\\Forms\\\\Contracts\\\\HasForms\\:\\:dispatch\\(\\)\\.$#"
count: 2
path: src/LinkAction/LinkAction.php
-
message: "#^Call to an undefined method Filament\\\\Forms\\\\Contracts\\\\HasForms\\:\\:dispatch\\(\\)\\.$#"
count: 1
path: src/MediaAction/MediaAction.php
28 changes: 0 additions & 28 deletions resources/views/components/linkpicker.blade.php

This file was deleted.

19 changes: 0 additions & 19 deletions src/Components/Linkpicker.php

This file was deleted.

75 changes: 0 additions & 75 deletions src/LinkAction/LinkAction.php

This file was deleted.

7 changes: 0 additions & 7 deletions src/LinkAction/Linkpicker.php

This file was deleted.

Loading