Git Product home page Git Product logo

nova-ckeditor's Introduction

CkEditor 5 Field for Laravel Nova

GitHub license Packagist Downloads Latest Version on Packagist

The Nova Ckeditor package combines the power of Laravel Nova with the advanced features of CKEditor 5, a modern and versatile text editor. It aims to bring CKEditor 5 integration to Laravel Nova, providing you with an enhanced content creation experience within your Laravel applications.
With "Nova Ckeditor," you can seamlessly integrate CKEditor 5 into Laravel Nova and unlock advanced text editing capabilities within your Laravel applications. Whether you're building a blog, a content management system, or any other application that requires rich text editing, "Nova Ckeditor" provides the tools and features you need for a seamless content creation experience.

Donate


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 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.
  • Snippet Functionality: "Nova Ckeditor" simplifies the process of inserting code snippets or reusable content blocks into your text. This feature enhances efficiency and consistency by enabling you to quickly add frequently used pieces of code or content.
  • Publishable Stubs: The package provides publishable stubs, which act as placeholders for content. These stubs offer a foundation for further development or collaboration, making it easier to kickstart your content creation process.
  • Multiple Toolbars: Enjoy the flexibility of configuring multiple toolbars within the editor. "Nova Ckeditor" allows you to customize the toolbar settings to match your specific requirements, ensuring a tailored editing experience.
  • Localization: The package supports localization, enabling you to translate the editor interface into different languages. This feature ensures that users worldwide can access the editor in their preferred language.
  • Configurable: "Nova Ckeditor" offers extensive configuration options, allowing you to adapt the editor to suit your application's needs. Customize various settings such as toolbar placement, enabled features, and more.

Documentation

You can find installation instructions and detailed instructions on how to use this package at the dedicated documentation site.



Demo

nova-ckeditor.mp4

nova-ckeditor's People

Contributors

crynobone avatar harmenjanssen avatar lupennat avatar marcobax avatar mennovanhout avatar mostafaznv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nova-ckeditor's Issues

Image title

Hi

When I add image I can set "alt"
What about "title"? Is that possible?

AWS S3

Does it work with aws s3? I can't get it worked.
I changed the next in the filesystems.php file, but it doesn't do the trick
'image' => [
/'driver' => 'local',
'root' => storage_path('app/public/uploads/image'),
'url' => '/storage/uploads/image',
/
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
'endpoint' => env('AWS_ENDPOINT'),
'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
'throw' => false,
],

Issue I found in the styling of CKEditor

Perhaps I might fix this in another PR soon, but I wanted to point it out atleast.
Since CKEditor 5 is used within the new NOVA, their tailwind base.css is overwritting the ckeditor to display list dots and list numbers.

I'll explain it with some screenshots:
image

Disabling the tailwind ovverwrite solves the issue:
image

UnKnown Problem

php 8.0.2
Laravel 9
Nova 4

When I want click to other resources, it shows some error in console and the page stop.
image
image

Need help, thx!!

Stop overflowing

Sorry for this asking, but for me is very discomfortable to use editor when it is overflowing and i need to get more clicks to get functuonality that i want. Can u do by default that this 3 dots is no more there and all functions just set in sepparate line of editor?
image

I tried to set shouldNotGroupWhenFull option somehow, but i failed

Enhancement: Improved Media Insertion (insert images or videos)

Description

I'm currently using the nova-ckeditor package (version 1.2.2) and I suggest enhancing the "insert media" button (insert image button and insert video button). After the writer clicks on it, we should add a new button in the pop-up that allows for direct media insertion, as well as the ability to upload new media if it's not available in the existing resources.

Expected Behavior

I expected that when I write a new blog or post and need to insert an image or video, I could add it directly without the need to open a new tab or navigate away from the editor.

Actual Behavior

Currently, when I write a new blog and need to insert a new image or video, I have to close or open a new tab to upload it, which disrupts the workflow.

Additional Information

  • Package Version: nova-ckeditor version 1.2.2

Screenshot

Screenshot

Other Notes

I appreciate any assistance or insights into resolving this issue. If there's any additional information needed from my end, please let me know.

@mostafaznv Thank you for this chance!

Support for intervention/image:^3.0

Hello,

Excellent package intervention/image is now available in version v3. Will be perfect If nova-ckeditor support that version in upcoming v7.

Height of the editor

Hello!
If I increase the height of the editor with my mouse, edit something and blur the editor, it restores its original height.
The same happens if I go to choose an image.
It's inconsistent that the height changes.
Is it possible to fix that?

target="_blank" issue

Hi!
There's an annoying issue. If a page has several links and one of them has target="_blank" property the editor freezes.
My piece of code is:

test Exosomes

test Exosomes

image

Then, if you click on the first link, you will see the layer for editing the link. Then, if you click elsewhere in the editor, it stops working.

Try these steps and if you need any assistance, let me know.

It'd be grate to fix the issue.

UI language

Thank you very much for adding the html-support feature. But what happened with the ui-language feature and its script setting? I see the comment "Not available". I need to change the UI language, but it seems that I can't do it, can I? In the previous version it worked. My config is:
` 'content-lang' => 'ru',

        'ui-language' => [
            'name' => 'ru',

            /**
             * Example 1: asset('js/ckeditor-fa.js')
             * Example 2: 'https://cdn.ckeditor.com/ckeditor5/34.0.0/decoupled-document/translations/fa.js'
             */
            'script' => public_path('core/ckeditor-ru.js')
        ],

`

Handling audio

Hi, is there a guide on how to extend this to also handle audio?

Issue with the tmp directory

Hello! I came across with an issue. sys_get_temp_dir() returns a directory where my domain doesn't have access. It was /tmp
My hosting provider said that I needed using the full path /var/www/site/tmp
For this reason I had to add the variable in the config: 'tmpDir' => '/var/www/site/tmp', and process it in the resize function like so:
$tmpDir = $config['tmpDir'] ?? sys_get_temp_dir(); $filePath = $this->makeTargetFilePath($fileName, $tmpDir);
It'd be great if you add this feature in your basic installation

Can't display in Laravel8

When I complete Installation
That can't display
001

This is my code

use Mostafaznv\NovaCkEditor\CkEditor;

public function fields(NovaRequest $request)
    {
        return [
            ID::make('id', 'announcement_id')
                ->sortable(),

            BelongsTo::make('announcement_types', 'announcement_types', AnnouncementType::class)
                ->rules('required'),

            Text::make('announcement_title', 'announcement_title')
                ->rules('required', 'max:255', 'min:1'),

            CkEditor::make('announcement_content', 'announcement_content')->stacked(),

            Boolean::make('announcement_is_top', 'announcement_is_top')
                ->default(false),

            Boolean::make('announcement_is_published', 'announcement_is_published')
                ->default(true),

        ];
    }

My Version:

  • Laravel Framework 8.83.27
  • Nova4
  • PHP 8.2.5

I'm wondering if I'm doing something wrong.

Problem with mediaEmbed Feature Not Working as Expected

Description

I'm currently using the nova-ckeditor package (version 1.2.2) in my Nuxt.js project to implement a rich text editor. I'm trying to utilize the mediaEmbed feature to embed media content such as YouTube videos directly within the editor. However, I've encountered an issue where the embedded media is not rendering as expected on my Nuxt.js website.

Steps to Reproduce

  1. Install and set up the nova-ckeditor package (version 1.2.2) in a Nuxt.js project.
  2. Configure the mediaEmbed feature in the CKEditor settings to support YouTube videos (I followed the instructions in the package documentation).
  3. Open the CKEditor and use the insert media button to insert a YouTube video link (e.g., https://www.youtube.com/watch?v=ERKqYBTpUfk) in the editor.
  4. The preview in the CKEditor shows the embedded YouTube video correctly.
  5. However, when the content is rendered on the Nuxt.js website, the embedded video is not displayed.

Expected Behavior

I expected that when I add a YouTube video link in the CKEditor by insert media button, the embedded video would also be displayed correctly on the Nuxt.js website when the content is rendered.

Actual Behavior

The embedded YouTube video is not displaying as expected on the Nuxt.js website. Instead, only the link to the YouTube video is shown.

Additional Information

  • Package Version: nova-ckeditor version 1.2.2

Possible Solutions (If Any)

I've tried rechecking the mediaEmbed configuration and ensuring that I've followed the steps correctly. However, I'm not sure what might be causing the issue on the Nuxt.js website.

Other Notes

I appreciate any assistance or insights into resolving this issue. If there's any additional information needed from my end, please let me know. Thank you!

Switching regex order for mediaEmbed

It would be great to switch the url regex for mediaEmbed from the current one to first match extraProviders and afterwards the default ones. That way one could customize e.g. the embedding for Twitter posts without using the providers array and thereby removing all other default ones.

Image issue

Hi
When I add new image and enter name it not saving (the name set as filename). But when I edit image then name saving.
Can it be fixed?

Source and saving problem

If I edit something in a source and try to save without switching to the normal editing mode, Nova freezes.

GeneralHtmlSupport

Hello! It'd be great to have the GeneralHtmlSupport plugin included. Actually, I have added it myself, but don't want to spawn a new branch.

Passing options to mediaEmbed

Hey,

I would like to add additional providers to the mediaEmbed plugin as described in https://ckeditor.com/docs/ckeditor5/latest/features/media-embed.html

This is the example from the website:

        mediaEmbed: {
            providers: [
                {
                    // A URL regexp or an array of URL regexps:
                    url: /^example\.com\/media\/(\w+)/,

                    // To be defined only if the media are previewable:
                    html: match => '...'
                },
                ...
            ]
        }

This is what I am trying to do in config/nova-ckeditor.php:

 'options' => [
            'mediaEmbed' => [
              /*
                'providers' => [
                    'url' => '/^example\.com\/media\/(\w+)/',
                ]
              */
            ],
  ...

This causes the editor to crash, e.g. not to be displayed in the Nova field.

  1. Do you know how to correctly define additional providers?
  2. How can I debug editor crashes? There is no related output in the console.
  3. How would I write the match function from the example?

Thank you for creating this package!

Several editors on page

Fun bug. Have 2 ckeditors on page, like that
image
Want to update all of them example
image
Pressing update. Fields looks like that
image
Want to update one more time. Example
image
Pressing update. Fields looks like that
image

Every time first editor gets value from second editor. Can u see why it is ?

Custom CSS (Feature Request)

This is a great plugin, thanks so much for creating it.

It would be super helpful to allow the developer to link to a custom CSS file because the default leaves much to be desired - Headings are small and bullets don't show up. I'll post a screenshot of my old (non Nova) admin that uses CKEditor and the new one as an example.

Here's a link to the documentation:
https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_config.html#cfg-contentsCss

Ideally, the developer could edit the config file like so...

    /*
     |--------------------------------------------------------------------------
     | Custom CSS
     |--------------------------------------------------------------------------
     |
     | Specifies the path of your custom CSS
     |
     */
    'contentsCss' => '/css/app.css',

Legacy CKEditor (uses custom CSS)

image

Nova CKEditor (no custom CSS)

image

Content is not displaying

Hi. Have very annoying issue)

Dependencies max updated.

Field inside nova resource
CkEditor::make('Информация', 'information')

Have information field
image

Content stored in database like that
<p>hfghfghfghfghfg</p>

And it do not displaying, like screenshot. And i cant update this field as well. There is no accessors on this field. If i switch to reqular Textarea field, everything works as expected. So, it is Ckeditor issue or something

Can u check what is it? Thanks!

In nova 3, everything works perfectly.


Here is your component

<textarea ref="editor" class="hidden" :id="field.attribute" :class="errorClasses" :value="value" />
.....
methods: {
        setInitialValue() {
            console.log(this.field.value, 22)
            this.value = this.field.value || ''
        },

console log is <p>hfghfghfghfghfg</p> 22

Why it is not there, have no clue) Waiting for your help

File options

Hi!
It'd be great to have the basic "storeAs" feature as well as others. Right now, I have to change the ImageStorage class from the vendor folder that is not a good idea. =/
The deletable method doesn't work as well. Actually, it's inconvenient not to have al the basic nova features =(

Field does not display?

I have followed the installation instructions but I don't see the field when I add it to a resource. There is an error in console when I load the resource with the field:

image

Image / Video drag-and-drop doesn't seem to work

I was trying to upload an image just by dragging one from my file explorer into the CkEditor, but was unable to and saw this response in the console:

image

I have already specified the disk on the App\Nova\Resources\Image.php file, as well as on on the config/filesystems.php as written in the installation instructions:

// App\Nova\Resources\Image.php

ImageUpload::make(trans('File'), 'image', 'image')
    ->rules('required', 'mimes:jpg,jpeg,png,gif', 'max:5000')
    ->help(trans(':size Megabyte Max FileSize.', ['size' => 5])),
// config/filesystems.php

'disks' => [
    'image' => [
        'driver'     => 'local',
        'root'       => public_path('uploads/image'),
        'url'        => env('APP_URL') . '/uploads/image',
    ]
]

However, when I tried using the Image Picker, the file was able to upload without any problems. Is there a way to upload just by drag-and-drop to the CkEditor instead?

My specs:

  • PHP v8.2
  • Laravel v10.28.0
  • laravel/nova v4.27.14
  • mostafaznv/nova-ckeditor v6.1.0

Source Editing resizing the editor to 0px

Anyone having the same issue as I have, when I click the source edit button and click it again to go back to visual mode, the editor textarea is reduce to 0? It seems the source editing plugin seems to have issue calculating the size that it should be when going back to visual:

image

Then:

image

Let me know, an interesting issue. Not sure if relates to Nova 4 being with vue and inertia.

Ckeditor javascript assignment error

Hi,

I am using you pluigin in my lastest laravel nova. and while using ckeditor library getting this error in console:

Uncaught SyntaxError: Invalid left-hand side in assignment (at field-ckeditor:2:215746)

Using Field like:
new Panel('Rich Content', [
CkEditor::make('Content', 'content')->stacked()
->rules('require')->hideFromIndex(),
]),

My Composer.json is like:

"require": {
"php": "^7.3|^8.0",
"artesaos/seotools": "^0.20.2",
"cviebrock/eloquent-sluggable": "^8.0",
"cyrildewit/eloquent-viewable": "^7.0",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.4",
"intervention/image": "^2.7",
"laravel/framework": "^8.65",
"laravel/nova": "^4.0",
"laravel/sanctum": "^2.11",
"laravel/telescope": "^4.15",
"laravel/tinker": "^2.5",
"laravel/ui": "^3.4",
"livewire/livewire": "^2.7",
"mostafaznv/nova-ckeditor": "^1.1",
"renatomarinho/laravel-page-speed": "^2.1",
"studio-42/elfinder": "^2.1"

Can't display at github action push docker hub environment

When I use docker build image and run on local environment, that can work.

but when use GitHub Actions, will show this error.

<form-ckeditor index="4" errors="[object Object]" resource-id="26" resource-name="announcements" field="[object Object]" via-resource="" via-resource-id="" via-relationship="" shown-via-new-relation-modal="false" form-unique-id="4lmd4tmjo4s" mode="form" show-help-text="true"></form-ckeditor>

I've tested not using GitHub Actions and instead used the 'docker pull' command to fetch my image from Docker Hub. At this point, CKEditor is operational.

This is my Dockerfile

FROM php:8.2.0-cli

RUN apt-get update && \
    apt-get install -y \
    vim -y \
    libzip-dev \
    zip \
    libpng-dev \
    libjpeg62-turbo-dev \
    libfreetype6-dev \
    libwebp-dev \
    libssl-dev -y \
    openssl -y\
    wget -y \
    git -y \
    procps -y \
    htop -y \
    libcurl4-openssl-dev \
    && apt-get clean

# install Swoole
RUN cd /tmp && git clone https://github.com/openswoole/ext-openswoole.git && \
    cd ext-openswoole && \
    git checkout v22.0.0 && \
    phpize && \
    ./configure --enable-openssl --enable-hook-curl --enable-http2 --enable-mysqlnd && \
    make && make install

RUN touch /usr/local/etc/php/conf.d/openswoole.ini && \
    echo 'extension=openswoole.so' > /usr/local/etc/php/conf.d/zzz_openswoole.ini

RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64
RUN chmod +x /usr/local/bin/dumb-init

RUN apt-get autoremove -y && rm -rf /var/lib/apt/lists/*

RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp && \
    docker-php-ext-install pdo_mysql zip exif gd pcntl

COPY . /var/www/html

WORKDIR /var/www/html

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
    && composer install \
    && chown -R www-data:www-data /var/www/html/storage /var/www/html/bootstrap/cache \
    && php artisan storage:link

CMD ["php", "artisan", "octane:start", "--host=0.0.0.0", "--port=8000"]

Enhancement: Preview Content in Editor (h tag and number list)

Description

I'm currently using the nova-ckeditor package (version 1.2.2) and I suggest enhancing the preview content before publishing it.

Expected Behavior

I expected that when I write content and use any style I could see its actual preview (How people see this content)

Actual Behavior

Currently, when I write a new blog and need to use a number list or H tags I can't preview the content before publishing it

Additional Information

  • Package Version: nova-ckeditor version 1.2.2

Screenshot

image
image

Other Notes

I appreciate any assistance or insights into resolving this issue. If there's any additional information needed from my end, please let me know.

@mostafaznv Thank you for this chance!

compatibility with lupennat/nova-nested-many

There is a compatibility problem with the lupennat/nova-nested-many package.
The nova-nested-many package allows creating/editing has-many resources from the parent resource.
Using this package, the page contains N fields with the same attribute for each nested resource.
Nova-ckeditor creates within the $options object the reference to the ckeditor via a key consisting only of field.attribute.
To solve the problem, the key should consist of the formUniqueId + field.attribute.

Folders and deletion

Hello! Thank you very much for all the last updates. It'd be great to add two features to the file manager: ability to delete files and ability to add and manage folders. It'd be almost the best file manager ever =)

Clipboard functions

Hello!
I need features from Ckeditor4 like "Paste as plain text", "Paste from word". If I'm not mistaken these features in the Clipboard plugin. Would you mind to implement this plugin? I think it's useful for everyone.

Change size image

Good afternoon. Please tell me how can I change the size of the image in the editor. When I upload a new image, it takes up the entire text field.

webp

Hello!
Why wouldn't you allow the webp format for the Image resource by default? Like so: rules('required', 'mimes:jpg,jpeg,png,gif,webp', 'max:5000')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.