Skip to content

Commit

Permalink
Merge pull request #80 from mostafaznv/dev
Browse files Browse the repository at this point in the history
GITBOOK-3: change request with no subject merged in GitBook
  • Loading branch information
mostafaznv authored Sep 29, 2023
2 parents 1c836de + f9a4c74 commit 194ccc0
Show file tree
Hide file tree
Showing 9 changed files with 144 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ With "Nova Ckeditor," you can seamlessly integrate CKEditor 5 into Laravel Nova
### Features:

* **CKEditor 5 Integration**: "Nova Ckeditor" seamlessly integrates CKEditor 5 into Laravel Nova, empowering you with a feature-rich and user-friendly text editing solution.
* **Custom Media Plugins**: The package includes custom-written plugins that enhance media handling within the editor. These plugins offer convenient options for embedding and managing media elements like images and videos in your content.
* **Custom Media Plugins**: The package includes custom-written plugins that enhance media handling within the editor. These plugins offer convenient options for embedding and managing media elements like image, video and audio in your content.
* **Drag & Drop Uploading in Media Picker**: With the drag and drop uploading feature in the media picker, you can conveniently upload media files directly into the editor, saving time and effort.
* **Optimize Images:** "Nova Ckeditor" includes functionality to optimize images, reducing file sizes while maintaining visual quality and improving page load times.
* **Generate Cover for Videos**: Enhance your videos by generating custom covers. "Nova Ckeditor" allows you to generate visually appealing video covers, ensuring an engaging experience for your audience.
Expand Down
4 changes: 4 additions & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
## ⚙ Advanced Usage

* [Customize ImageStorage](advanced-usage/customize-imagestorage.md)
* [Customize AudioStorage](advanced-usage/customize-audiostorage.md)
* [Multiple Toolbars](advanced-usage/multiple-toolbars.md)
* [Customize Toolbar Items](advanced-usage/customize-toolbar-items.md)
* [Media Embed](advanced-usage/media-embed.md)
Expand All @@ -27,6 +28,7 @@
* [General HTML Support](advanced-usage/ckeditor-field-options/general-html-support.md)
* [Group Items In Overflow Mode](advanced-usage/ckeditor-field-options/group-items-in-overflow-mode.md)
* [Image Browser](advanced-usage/ckeditor-field-options/image-browser.md)
* [Audio Browser](advanced-usage/ckeditor-field-options/audio-browser.md)
* [Video Browser](advanced-usage/ckeditor-field-options/video-browser.md)
* [Snippets](advanced-usage/ckeditor-field-options/snippets.md)
* [Configuration](advanced-usage/configuration/README.md)
Expand All @@ -36,6 +38,7 @@
* [Image Max Width](advanced-usage/configuration/image-max-width.md)
* [Image Max Height](advanced-usage/configuration/image-max-height.md)
* [Image Naming Method](advanced-usage/configuration/image-naming-method.md)
* [Audio Naming Method](advanced-usage/configuration/audio-naming-method.md)
* [Toolbars](advanced-usage/configuration/toolbars/README.md)
* [Defualt Toolbar](advanced-usage/configuration/toolbars/defualt-toolbar.md)
* [Toolbar 1](advanced-usage/configuration/toolbars/toolbar-1/README.md)
Expand All @@ -50,6 +53,7 @@
* [General HTML Support](advanced-usage/configuration/toolbars/toolbar-1/general-html-support.md)
* [Group Items In Overflow Mode](advanced-usage/configuration/toolbars/toolbar-1/group-items-in-overflow-mode.md)
* [Image Browser](advanced-usage/configuration/toolbars/toolbar-1/image-browser.md)
* [Audio Browser](advanced-usage/configuration/toolbars/toolbar-1/audio-browser.md)
* [Video Browser](advanced-usage/configuration/toolbars/toolbar-1/video-browser.md)
* [Snippets](advanced-usage/configuration/toolbars/toolbar-1/snippets.md)

Expand Down
35 changes: 35 additions & 0 deletions docs/advanced-usage/ckeditor-field-options/audio-browser.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
description: audioBrowser
---

# Audio Browser

<table><thead><tr><th>Argument</th><th width="140">Type</th><th width="155" data-type="checkbox">Required</th><th>Default</th></tr></thead><tbody><tr><td>enabled</td><td>bool</td><td>false</td><td>true</td></tr></tbody></table>

This method allows you to enable or disable the audio picker functionality within the CKEditor field.

By utilizing the `audioBrowser` method, you have control over whether the audio picker is enabled or disabled for the CKEditor field. The method accepts a boolean value as the `enabled` argument, where `true` enables the audio picker, and `false` disables it.

Enabling the audio picker provides a convenient way for users to select and insert audio files directly into the CKEditor field. This feature streamlines the audio insertion process, enhancing the content creation experience. On the other hand, disabling the audio picker removes the option for users to select audio files through the CKEditor field, limiting the content to text-only input.

To utilize the `audioBrowser` method, simply pass `true` or `false` as the `status` argument based on whether you want to enable or disable the audio picker, respectively.



```php
use Mostafaznv\NovaCkEditor\CkEditor;

class Article extends Resource
{
public function fields(Request $request): array
{
return [
CkEditor::make(trans('Content'), 'content')
->audioBrowser()
];
}
}
```



28 changes: 28 additions & 0 deletions docs/advanced-usage/configuration/audio-naming-method.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
description: audio-naming-method
---

# Audio Naming Method

| Property Name | Type | Default |
| ------------------- | ------ | ------------------------------------------- |
| audio-naming-method | string | <mark style="color:red;">`hash-file`</mark> |

The `audio-naming-method` configuration option allows you to specify the naming method for uploaded audio files within the CKEditor field. This setting determines how the audio files will be named when they are saved to the storage.

By default, the `audio-naming-method` configuration option is set to `hash-file`, which generates a unique hash-based name for each uploaded audio file. This helps avoid naming conflicts and ensures uniqueness of the file names.



The available naming methods for the `audio-naming-method` configuration option are as follows:

* `hash-file`: This method generates a unique hash-based name for each uploaded audio file.
* `real-file-name`: This method retains the original file name of the uploaded audio.
* `unique-real-file-name`: This method retains the original file name but adds a unique identifier to prevent naming conflicts.

To configure the `audio-naming-method` option, update the value in the configuration file `config/nova-ckeditor.php` with the desired naming method.





Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
description: toolbars.toolbar-1.browser.audio
---

# Audio Browser

<table><thead><tr><th width="340">Property Name</th><th width="158.33333333333331">Type</th><th>Default</th></tr></thead><tbody><tr><td>toolbars.toolbar-1.browser.audio</td><td>bool</td><td>true</td></tr></tbody></table>

This option allows you to enable or disable the audio picker within the toolbar. By default, this option is set to `true`, indicating that the audio picker is enabled.

The audio picker provides a convenient way to select and insert audio files into the CKEditor field. However, in some cases, you may want to disable the audio picker functionality.

To disable the audio picker within Toolbar 1, update the value of `toolbars.toolbar-1.browser.audio` in the `config/nova-ckeditor.php` file to `false`.



23 changes: 23 additions & 0 deletions docs/advanced-usage/customize-audiostorage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Customize AudioStorage

You have the option to override the `AudioStorage` service by binding your own extended version using the following code snippet:

```php
use Illuminate\Http\Request;
use Mostafaznv\NovaCkEditor\AudioStorage;

class MyAudioStorage extends AudioStorage
{
public function __invoke(Request $request)
{
// TODO: Change the default implementation.
}
}

$this->app->bind('ckeditor-audio-storage', MyAudioStorage::class);
```

By creating a custom `MyAudioStorage` class that extends `AudioStorage`, you can define your own logic for handling audio storage within the `__invoke()` method. Afterward, binding the custom class to the `'ckeditor-audio-storage'` key allows Laravel Nova to use your extended implementation instead of the default one.

Within the `__invoke()` method of `MyAudioStorage`, you can implement your desired functionality to handle audio storage according to your specific requirements.

2 changes: 1 addition & 1 deletion docs/basic-usage/notes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Notes

{% hint style="warning" %}
Please note that by default, the video and image file fields are **not updatable**. This means that replacing the media files may result in broken links.
Please note that by default, the video, audio and image file fields are **not updatable**. This means that replacing the media files may result in broken links.

The intended methodology for updating such files is to delete the existing file and then re-upload the new file. This ensures the integrity and proper functioning of the media files within your application.
{% endhint %}
Expand Down
22 changes: 20 additions & 2 deletions docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ php artisan vendor:publish --provider="Mostafaznv\NovaCkEditor\FieldServiceProvi

#### 3. Prepare the migration and models

After publishing stubs, essential `Image` and `Video` classes will be created in the `app/Models` and `app/Nova/Resources` directories respectively. These classes are used for the `media-picker` in the CKEditor field.
After publishing stubs, essential `Image`, `Video` and `Audio` classes will be created in the `app/Models` and `app/Nova/Resources` directories respectively. These classes are used for the `media-picker` in the CKEditor field.

{% tabs %}
{% tab title="Image" %}
Expand All @@ -51,7 +51,7 @@ You should create a disk in `config/filesystems.php`:
```

{% hint style="info" %}
If you wish to modify the disk name, remember to update it in the `App\Nova\Resources\Image` class as well. The second argument of the make function in the ImageUpload field corresponds to the disk name.
If you wish to modify the disk name, remember to update it in the `App\Nova\Resources\Image` class as well. The third argument of the make function in the ImageUpload field corresponds to the disk name.
{% endhint %}
{% endtab %}

Expand Down Expand Up @@ -90,6 +90,24 @@ php artisan vendor:publish --provider="Mostafaznv\Larupload\LaruploadServiceProv
{% endhint %}
{% endtab %}
{% tab title="Audio" %}
You should create a disk in `config/filesystems.php`:
```php
'disks' => [
'audio' => [
'driver' => 'local',
'root' => public_path('uploads/audio'),
'url' => env('APP_URL') . '/uploads/audio',
]
]
```
{% hint style="info" %}
If you wish to modify the disk name, remember to update it in the `App\Nova\Resources\Audio` class as well. The third argument of the make function in the AudioUpload field corresponds to the disk name.
{% endhint %}
{% endtab %}
{% tab title="Migration" %}
**If you have chosen Larupload**, there is no need to make any changes to the migration file. You can refer to the [nova-video](https://github.com/mostafaznv/nova-video) and [larupload](https://github.com/mostafaznv/larupload) documentations for additional configuration options.
Expand Down
16 changes: 16 additions & 0 deletions docs/other/migration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Migration

**From 5.3.0 to 5.4.0**

The `AudioPicker` feature has been introduced to the ckeditor field.

To activate this functionality, you need to republish the configuration, migrations, models and resources.

Execute the following command:

```sh
php artisan vendor:publish --provider="Mostafaznv\NovaCkEditor\FieldServiceProvider"
```

This command will generate two classes for Audio in `Models` and `App\Nova\Resources` directories, along with a migration file for the audio table.\
Additionally, a new `config/nova-ckeditor.php` will be created, including audio-related configurations such as `audio-naming-method`, `toolbars.toolbar-1.browser.audio`, `toolbars.toolbar-1.items.audioBrowser`.\


**From 5.1.0 to 5.1.1**

* `html-support` has been added to the toolbar properties in `config/nova-ckeditor.php`.
Expand Down

0 comments on commit 194ccc0

Please sign in to comment.