Giter Club home page Giter Club logo

syliusricheditorplugin's Introduction

Banner of Sylius Rich Editor plugin

Rich Editor

Rich Editor Plugin license Tests Security Flex Recipe

This plugin adds a rich editor on the fields you want. Now you can manage your content very easily!

Example of rich editor field

Installation

composer require monsieurbiz/sylius-rich-editor-plugin

Change your config/bundles.php file to add the line for the plugin :

<?php

return [
    //..
    MonsieurBiz\SyliusRichEditorPlugin\MonsieurBizSyliusRichEditorPlugin::class => ['all' => true],
];

Then create the config file in config/packages/monsieurbiz_sylius_rich_editor_plugin.yaml :

imports:
    - { resource: "@MonsieurBizSyliusRichEditorPlugin/Resources/config/config.yaml" }

Finally import the routes in config/routes/monsieurbiz_sylius_rich_editor_plugin.yaml :

monsieurbiz_richeditor_admin:
    resource: "@MonsieurBizSyliusRichEditorPlugin/Resources/config/routing/admin.yaml"
    prefix: /%sylius_admin.path_name%

And install the assets

bin/console asset:install

Use the Rich Editor

Update your form type

To make a field use the rich editor, you must use the RichEditorType type for it.
We have an example of implementation in the file for the test application.

If your field has some data already, like some previous text before installing this plugin, then we will convert it for you as an HTML Element which contains… HTML.

Example of a rich editor field

This way you will be able to use our plugin right away without risking any data lost!

To make it clear: to have rich editor for original admin fields, like Product description, Taxon desription etc. you have to update each form type by an extension as the example shows above.

Call twig render

To display the content of the rich editor field you must call the twig filter:

{{ content | monsieurbiz_richeditor_render_field }}

You can see an example in the file for the test application

Custom rendering of elements

You can also render your elements with some custom DOM around that. To do so, you have access to a twig filter that gives you the elements list :

{% set elements = monsieurbiz_richeditor_get_elements(content) %}

And then you can either render them all :

{{ elements|monsieurbiz_richeditor_render_elements }}

Or one by one :

{% for element in elements %}
    {{ element|monsieurbiz_richeditor_render_element }}
{% endfor %}

Filter the elements

If you want to filter the elements which are available for your field, you can use the tags option when you build your form.
As example:

$builder->add('description', RichEditorType::class, [
    'required' => false,
    'label' => 'sylius.form.product.description',
    'tags' => ['-default', 'product'],
]);

In that example, all Ui Elements with the tag default will be excluded, then the Ui Elements with the tag product will be included.
Don't worry, you can add this filter afterwards, we won't remove the already present Ui Elements of your field. But we won't allow to add more if they don't have one of the allowed tags!

Order matters

The order of the tags matters! The first tag will be less important then the second.
As example, if you have 3 Ui Elements with the following tags:

  • element1: tag1, tag2, tag3
  • element2: tag1, tag2
  • element3: tag2, tag3

And you set the tags of your field to -tag1, tag2, -tag3, then the only available Ui Element will be: element2.
They all have the tag2 to include them, but the element1 and element3 have the tag3 which is excluding them after being both included.

Example of setting tags to an Ui Element using yaml

monsieurbiz_sylius_richeditor:
    ui_elements:
        app.my_element:
            #
            tags: ['product']

Deactivate an available element

Here is what really happens when deactivating an Ui Element:

  • it's not displayed anymore in frontend
  • it's still editable in backend for old contents but you can't add a new one
  • if the element has an alias, the alias is treated the same way

Define the overload of a proposed UiElement in your configuration folder, let's say in config/packages/monsieurbiz_sylius_richeditor_plugin.yaml as example.

monsieurbiz_sylius_richeditor:
    ui_elements:
        monsieurbiz.youtube:
            enabled: false

Available elements

Row Element (Layout)

It contains another rich editor field, each element will be displayed one below the other (as rows…).

Column Element (Layout)

It contains another rich editor field, each element will be displayed side by side (as columns…).

By using this element in the Row element, you will be able to build some layout like the screenshot below.
You can distinguish the Row element and the Column element by their dotted borders.

The Columns and Rows elements

HTML Element

The HTML element

Text element

The text element

Quote element

The quote element

Image element

The image element

Video element

The video element

Button element

The button element

Title element

The title element

Separator element

The separator element

Youtube element

The Youtube element

Image collection element

The Image collection element

Example of a rich product description

Admin form with preview

Admin full form

Front display

Front full display

Create your own elements

In this example, we will add a Google Maps element.

With the Maker Bundle, you can create a new UiElement very easily:

bin/console make:ui-element

Then you will have to answer some questions, or you can add arguments to the command to avoid the questions.

bin/console make:ui-element app.google_maps "map pin"

Just add the translations!

Define your UiElement (for PHP < 8.1)

Tips: If you are using PHP 8.1 or newer, you can use the #[AsUiElement] attribute to define your UiElement. You can skip this step.

Define your UiElement in your configuration folder, let's say in config/packages/monsieurbiz_sylius_richeditor_plugin.yaml as example.

monsieurbiz_sylius_richeditor:
    ui_elements:
        app.google_maps:
            title: 'app.ui_element.google_maps.title'
            description: 'app.ui_element.google_maps.description'
            icon: map pin
            classes:
                form: App\Form\Type\UiElement\GoogleMapsType
                #ui_element: App\UiElement\MyUiElement
            templates:
                admin_render: '/Admin/UiElement/google_maps.html.twig'
                front_render: '/Shop/UiElement/google_maps.html.twig'
            tags: []

You can use your own Ui Element object if needed. Be sure to implement the \MonsieurBiz\SyliusRichEditorPlugin\UiElement\UiElementInterface interface.
A trait is there for you 🤗 as well. This is very useful when you need to do some custom work in your templates, it's like having a helper around. The Ui Element is then available via the ui_element variable in your templates.

Create the Form Type we use in admin to fill your UiElement

<?php

declare(strict_types=1);

namespace App\Form\Type\UiElement;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints as Assert;

class GoogleMapsType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('link', TextType::class, [
                'label' => 'app.ui_element.google_maps.link',
                'required' => true,
                'constraints' => [
                    new Assert\NotBlank(),
                ],
            ])
        ;
    }
}

For PHP 8.1 and newer, you can use the #[AsUiElement] attribute to define your UiElement. For example:

<?php

// ...

use MonsieurBiz\SyliusRichEditorPlugin\Attribute\AsUiElement;

#[AsUiElement(
    code: 'app.google_maps',
    icon: 'map pin',
)]
class GoogleMapsType extends AbstractType
// ...

The title, description and templates values are generated automatically from the code. In this example :

  • the title will be app.ui_element.google_maps.title,
  • the description will be app.ui_element.google_maps.description,
  • the admin template will be /Admin/UiElement/google_maps.html.twig,
  • and the front template will be /Shop/UiElement/google_maps.html.twig.

But you can override them if you want:

#[AsUiElement(
    code: 'app.google_maps',
    title: 'my_cusom.title', // Use your own translation key or a string
    description: 'my_custom.description',
    icon: 'map pin',
    templates: new TemplatesUiElement(
        adminRender: 'MyCusomPath/google_maps.html.twig',
        frontRender: 'MyCusomPath/google_maps.html.twig',
    ),
    uiElement: GoogleMapsUiElement::class, // Use your own UiElement class
    tags: ['map'], // Add some tags to filter the UiElement
    wireframe: 'google_maps', // Add a wireframe to help the user to understand the UiElement, see below
)]

Add your translations of course

Here is an example of possible translation for the GMap element :

app:
    ui_element:
        google_maps:
            title: 'Google Maps Element'
            short_description: 'Include a Google Maps'
            description: 'An element with a Google Maps link'
            link: 'Link'

Create the templates to render it in front and in admin

You have to create a template for the front and also for the admin's preview.

Here is an example of a simple template for this our which can be used in front and admin:

<iframe id="gmap_canvas" src="{{ element.link }}" scrolling="no" marginheight="0" marginwidth="0" width="600" height="500" frameborder="0"></iframe>

The result !

The element is in the UI Elements list

The Google Maps element

You now have a form to edit it (your form!)

The Google Maps form

And we use your templates to render your UiElement

In admin :

The GMap display

In front :

The GMap display

File in fixtures management

In some cases you will want to add UI elements to your content fixtures which are Rich Editor fields. If you need files in your UI elements, you can use a dedicated fixture. It is used as follows.

sylius_fixtures:
    suites:
        my_project:
            fixtures:
                my_files:
                    name: monsieurbiz_rich_editor_file
                    options:
                        files:
                            -   source_path: 'src/Resources/fixtures/bar1.png'
                                target_path: 'image/foo/bar1.png'
                            -   source_path: 'src/Resources/fixtures/file.pdf'
                                target_path: 'baz/file.pdf'

The example below will copy files to public/media/image/foo/bar1.png and public/media/foo/file.pdf.

Now you can use files in your content fixtures:

description: |
    [{
        "code": "app.my_ui_element",
        "data": {
          "title": "My title",
          "image": "/media/image/foo/bar1.png",
          "file": "/media/baz/file.pdf"
        }
    }]

Wireframes

You can add a wireframe to your UiElement. It will be displayed in the admin form to help the user to understand what the UiElement is about. The file can be either:

  • An SVG with a .twig extension. Example: button.svg.twig.
  • A classic twig template. Example button.html.twig. You can add the files in the folder : templates/MonsieurBizSyliusRichEditorPlugin/Wireframe/*.{svg/html}.twig In the YAML declaration of a UI Element, you can add the wireframe key with the name of the file without the extension.
    monsieurbiz.title:
        alias: title
        title: 'monsieurbiz_richeditor_plugin.ui_element.monsieurbiz.title.title'
        description: 'monsieurbiz_richeditor_plugin.ui_element.monsieurbiz.title.description'
        icon: heading
        wireframe: title
        tags: [ default ]
        classes:
            form: MonsieurBiz\SyliusRichEditorPlugin\Form\Type\UiElement\TitleType
        templates:
            admin_render: '@MonsieurBizSyliusRichEditorPlugin/Admin/UiElement/title.html.twig'
            front_render: '@MonsieurBizSyliusRichEditorPlugin/Shop/UiElement/title.html.twig'

Wysiwyg Type

The WysiwygType form type is a custom form type provided by the MonsieurBiz Sylius Rich Editor plugin. It extends the Symfony's TextareaType and provides a rich text editor interface in the admin form. It will work only in admin.

Basic Usage

To use the WysiwygType in your form, you can add it to your form builder like this:

$builder->add('content', WysiwygType::class, [
    'required' => false,
    'label' => 'app.form.content',
]);

Options

The WysiwygType form type accepts several options:

  • editor_type: The type of the editor. Default is SunEditor::TYPE. At this time, the only supported editor type is SunEditor::TYPE.
  • editor_height: The height of the editor in pixels. Default is 300.
  • editor_locale: The locale of the editor. Default is the current admin locale or 'en' if it cannot be determined.
  • editor_toolbar_type: The type of the toolbar. It can be one of the following: EditorInterface::TOOLBAR_TYPE_MINIMAL, EditorInterface::TOOLBAR_TYPE_BASIC, EditorInterface::TOOLBAR_TYPE_FULL, EditorInterface::TOOLBAR_TYPE_CUSTOM. Default is EditorInterface::TOOLBAR_TYPE_BASIC.
  • editor_toolbar_buttons: An array of buttons to be displayed in the toolbar when editor_toolbar_type is EditorInterface::TOOLBAR_TYPE_CUSTOM. Default is null.
  • editor_custom_config: An array of custom configuration options for the editor. Default is null.

Here is an example of how to use these options:

$builder->add('content', WysiwygType::class, [
    'required' => false,
    'label' => 'app.form.content',
    'editor_height' => 500,
    'editor_locale' => 'fr',
    'editor_toolbar_type' => EditorInterface::TOOLBAR_TYPE_CUSTOM,
    'editor_toolbar_buttons' => ['bold', 'italic', 'underline'],
    'editor_custom_config' => ['option1' => 'value1', 'option2' => 'value2'],
]);

In this example, we have set a custom editor type, increased the height of the editor, set the locale to French, chosen a full toolbar, specified the buttons to be displayed in the toolbar, and provided some custom configuration options for the editor.

Contributing

You can open an issue or a Pull Request if you want! 😘
Thank you!

syliusricheditorplugin's People

Contributors

delyriand avatar dieterholvoet avatar elyanory avatar etienne-monsieurbiz avatar fplantinet avatar gseric avatar jacquesbh avatar jaroslavtyc avatar julien1619 avatar kgonella avatar lanfisis avatar maximehuran avatar nayluge avatar oallain avatar redhotman avatar roshyo avatar toofff 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

syliusricheditorplugin's Issues

How to put it in my product description? Example link is in 404

Hi,
Sorry I'm new with Sylius/php.
I did install your plugin but I don't know how to put it in my product description.
Please classify.

Use the Rich Editor
Update your form type

To make a field use the rich editor, you must use the RichEditorType type for it.
We have an example of implementation in the [test application](https://github.com/monsieurbiz/SyliusRichEditorPlugin/blob/master/tests/Application/src/Form/Extension/ProductTypeExtension.php).

Content of UI element edit dialog overflows

When editing a UI element and the content of the dialog becomes bigger than its container, it overflows and there's no way to scroll.

Steps to reproduce

  1. Add an empty Image Collection element to a rich editor field
  2. Edit the newly added element and a couple of new images

Correct PHP MD tests

PHPMD is added in #168
But errors are not corrected yet and used || true in Makefile to ignore it.

Autocomplete fields inside dialogs are broken

When using an autocomplete field in a UI element form, it doesn't work automatically. You have to add JavaScript that initialises the autocomplete field. I suggest we auto-initialise autocomplete fields after opening a dialog.

Detect changes on Rich Editor inputs field

Hello,

I'm wondering how can we easly detect changes on rich editor fields because I want to implement this : https://plugins.jquery.com/are-you-sure/

After adding/removing any part of a rich editor field, I need to reload the hidden input field in order to make the "Are you sure" working well.

Can we handle that with the current version of the JS ? If yes, any help will be appreciated

Thanks in advance!

Upload a video

I have an issue in Admin when i want to create a block the "monsieurbiz.video", i can load on form but when i want to send my video with the button "submit", Javascript launch an error and the page stop here.
Capture d’écran de 2022-07-13 14-45-06
e

Compatibility with Sylius 1.11

Hello 😄 , I have a question
Why did you drop Sylius 1.11 compatibility since the SyliusRichEditorPlugin v2.0.9 release ?

I use SyliusRichEditorPlugin v2.0.8 on a headless Sylius 1.11 project. The Admin side works. I didn't test the Shop side (because I'm headless)

symfony6 and sylius 1.12 compatibility

Hello

I don't think there's need a pull request for this "bug".

Can you specify return type in the Extension file in depedency directory ?

as this : public function getAlias(): string

Thanks

(idem for your CMS plugin ^^)

Customize Wysiwyg editor

I need a field with only the h3 and paragraph levels

I'd like to add a configuration in my form builder to customize the Wysiwyg toolbar.

Recipe outdated

Hello, the import fail with recipe with :

Unable to find file "@MonsieurBizSyliusRichEditorPlugin/Resources/config/routing.yaml".

It should be fixed to routing/admin.yaml

Twig extension getCurrentFilePath throw exception (solved, need confirmation)

Hello there,

I want to know if my solution is the best regarding to your plugin. I've added a second image file type in the ImageType form.
But after that, it throw an error 500 on the form validation if one of the two input image file type is empty/not set.

It come from the RichEditorExtension.php, twig filter function getCurrentFilePath because it's needed to return a string or a null but it's returning an object (UploadedFile)

So my solution is to add a is_object check and return null if true because the file/image isn't uploaded yet and we canno't get the right path :
image

Is it a good solution for you @jacquesbh ?
I can make a PR if that's good for you :)

Thanks

Unable to Upload Images to AWS S3 Bucket Using Rich Editor Plugin

Hello, I use the Rich Editor plugin for specific sections on my website. However, I'm facing an issue where images are only uploaded to the public folder instead of my AWS S3 bucket. I've ensured that my AWS configuration is correct because I can successfully upload images on pages that do not utilize the Rich Editor plugin.

Here's a snippet from my monsieurbiz_sylius_rich_editor_plugin.yaml:

knp_gaufrette:
    adapters:
        sylius_image:
            aws_s3:
                service_id: acme.aws_s3.client
                bucket_name: "%aws_s3_bucket%"
                detect_content_type: true
                options:
                    create: true
                    directory: "media/image"
                    acl: "private"
        monsieurbiz_rich_editor_fixture_file:
            aws_s3:
                service_id: 'acme.aws_s3.client'
                bucket_name: '%aws_s3_bucket%'
                detect_content_type: true
                options:
                    create: true
                    directory: '/media/image'
                    acl: 'private'
    filesystems:
         sylius_image:
            adapter: sylius_image
        monsieurbiz_rich_editor_fixture_file:
            adapter: 'monsieurbiz_rich_editor_fixture_file'
        
monsieurbiz_sylius_richeditor:
    upload_directory: '/media/image'
    image_upload_directory: '/media/image'
    ui_elements:
        sections.hero:
            alias: hero
            title: 'Hero'
            description: 'Hero'
            icon: html5
            tags: [default]
            classes:
                form: App\Form\UiElement\HeroType
            templates:
                admin_render: 'bundles/SyliusAdminBundle/UiElement/hero.html.twig'
                front_render: '@MonsieurBizSyliusRichEditorPlugin/Shop/UiElement/html.html.twig'

Here' my config\services.yaml:

    env(AWS_ACCESS_KEY_ID): ""
    env(AWS_SECRET_ACCESS_KEY): ""
    env(AWS_BUCKET_NAME): ""
    env(AWS_REGION): ""
    aws_s3_key: "%env(AWS_ACCESS_KEY_ID)%"
    aws_s3_secret: "%env(AWS_SECRET_ACCESS_KEY)%"
    aws_s3_bucket: "%env(AWS_BUCKET_NAME)%"
    aws_s3_region: "%env(AWS_REGION)%"
    aws_s3_version: "2006-03-01"

services:
    # Default configuration for services in *this* file
    monolog.logger.paypal: '@logger'
    acme.aws_s3.client:
        class: Aws\S3\S3Client
        factory: [ Aws\S3\S3Client, 'factory' ]
        arguments:
            -
                version: "%aws_s3_version%"
                region: "%aws_s3_region%"
                credentials: { key: "%aws_s3_key%", secret: "%aws_s3_secret%" }
    acme.imagine.cache.resolver.aws_s3_resolver:
        class: Liip\ImagineBundle\Imagine\Cache\Resolver\AwsS3Resolver
        arguments:
            - "@acme.aws_s3.client"
            - "%aws_s3_bucket%"
            - "private"
            - { Scheme: https }
        tags:
            - { name: "liip_imagine.cache.resolver", resolver: "aws_s3" }

It seems that I have configured my YAML file to upload images to my AWS S3 bucket, but it's not working as expected. Any guidance or assistance on resolving this issue would be greatly appreciated.

Thank you!

Warning when you get disconnected

When you login without selected "rester connecté" you get disconnected from the back office (without warning you) if you stay too long.
Capture d’écran 2022-01-31 à 11 02 03

So when I tried to add modification I had this error :
Capture d’écran 2022-01-31 à 18 09 28

It could be a good thing to have a warning telling you, so that you will not loose your changes.

Sanitize HTML in Wysiwyg

I always end up with such saved code when pasting text in the pell Wysiwyg editor.

<p><span style="color: rgb(0, 0, 0); font-family: &quot;Open Sans&quot;, Arial, sans-serif; text-align: justify;">Sed interdum turpis a arcu cursus ultricies. Ut nec augue interdum, tempor tortor id, rhoncus ipsum. Donec viverra, nibh a elementum scelerisque, nisi erat ullamcorper lorem, vel molestie magna purus vel dolor. Praesent vel risus congue, gravida mi eu, consequat ligula. Donec dolor metus, tempor in finibus sed, mattis et felis. Sed convallis erat vitae sapien venenatis sodales. Etiam eu facilisis est. Aenean nec ex vestibulum, convallis lectus vitae, porttitor turpis.</span></p>

I think this should be cleaned up automatically without any user configuration needed as it seems to be the philosophy of this plugin to prevent UI breaking due to bad "client" content management. And it would be a security improvement.

Could be done through JS sanitizing on change events, on paste events (downvote from me) with a lib like https://github.com/apostrophecms/sanitize-html, and/or server-side.

It may be good to override the behavior and allow a specific list of tags/attributes in userland also.

jaredreich/pell#53

Add documentation about standalone WYSIWYG

We could add this in the documentation to help people using the simple wysiwyg (pell) as a standalone field, not only in UI Elements.

<script type="text/javascript">
    (function () {
        document.addEventListener('DOMContentLoaded', () => {
            let wysiwyg = new MonsieurBizRichEditorWysiwyg({
                actions: [
                    'bold',
                    'italic',
                    'underline',
                    'ulist',
                    'olist',
                    'heading1',
                    'heading2',
                    {
                        name: 'heading3',
                        icon: '<b>H<sub>3</sub></b>',
                        title: 'Heading 3',
                        result: () => wysiwyg.exec('formatBlock', '<h3>')
                    },
                    'link'
                ]
            });
            let forms = document.querySelectorAll('form.form');
            forms.forEach(function (form) {
                wysiwyg.load(form);
            });
        });
    })();
</script>

Can't update the plugin on newer version (post 2.0.2)

Hi;
When I try to composer update this plugin, during the cache clear I have the following error :

The service "MonsieurBiz\SyliusRichEditorPlugin\Uploader\FixtureFileUploader" has a dependency on a non-existent service "gaufrette.monsieurbiz_rich_editor_fixture_file_filesystem".

I have this problem on any version post 2.0.2.
I'm pretty sure this come from the commit dba0d5a witch added a bind on filesystem to use the one for the fixture.
There is probably a config to add or something like that but there is noting in the upgrade.md that mention it :/

Thanks for your time;
Cheers

[Feature proposal] Copy to clipboard/import from clipboard

This is just an idea to save some time while editing content.

Use case

I created my french content with a stack of lots of different elements and I want to translate it all to english.

I'd like to not re-create the structure by hand.

Solution

  1. Click "copy elements to clipboard" in the french content section of the form
    Json get copied to my clipboard

  2. Click "import elements from clipboard" in the english form section
    Json is pasted and elements are created

Options

  • Ability to paste only the structure (empty elements)
  • Ability to paste only structure AND images (just not text)

Remove HTML br tag from WYSIWYG text element

Hello guys,

I'm wondering how can we remove any tag (for example, the <br> tag) from the WYSIWYG text element ?
I didn't found an easy way to do this.

Why I'm asking that ?

  • I'm getting after saving some <p><br></p> sometimes
  • And a <br> at the beginning and end of each content

My version of RichEditor is v2 RC 14

Thanks in advance

Replacing Pell with CKEditor editor

Hello,

could you please help with this replacement, I need CKEditor because of general file upload and storage support (mostly PDFs)?

The easy part was extending TextType form type and replacing WysiwygType (Pell) with FOSCKEditorBundle's CKEditorType.

But unfortunately CKEditor doesn't load at all. I debugged it a bit and found that UI element forms are loaded using innerHTML which doesn't execute script tags. CKEditor, on the other hand, consists of a textarea and 3 script tags: some inline JS code, external JS file loading, and some inline JS code again which relies on external JS file from second script tag.

My first attempt was to dynamically re-insert script tags using appendChild but didn't managed to ensure execution order - third script tag (inline code) is executed before the external JS file is loaded.

This could be fixed but I stopped at that point because this solution seems dirty and I wonder if there is any better approach...

Add visual indicator while saving element

As I create or update an element and my edit involves uploading a few images, clicking save will seem to "do nothing".

It's actually waiting for the POST request to succeed before closing the element edit modal.

The "save" button should indicate that the save is actually pending.

I suggest disabling the button and add a indeterminate loader animation.

monsieurbiz_sylius_rich_editor_admin_modal_form route does not work

When clicking the edit button of a text element, nothing happens. In background, the call to /monsieurbiz_sylius_rich_editor/modal/edit gives a 404:

No route found for "POST /admin/monsieurbiz_sylius_rich_editor/modal/edit" (from "https://[host]/admin/homepages/1/edit")

After some debugging, I discovered that the problem is fixed by removing the condition: "request.isXmlHttpRequest()" line from admin.yaml. Is there any reason to leave it there? Doesn't seem essential to me. The fact that you're relying on a certain header being set by the client also doesn't make it 100% reliable.

Some questions :)

Hi there ! Thanks for all this works :)

I have some questions:

  • It's seems that this plugin provide features like https://github.com/BitBagCommerce/SyliusCmsPlugin, it's cool to have another plugin to have a different implementation, is it in the plan to provide dynamic routes for the frontend to expose the pages builts with this rich editor ? Or a controller that we can call from template like {{ render(path('monsieur_fait_du_bizbiz_render_page', {'code' : 'homepage''})) }}
  • Do you have an idea when the 2.0 will be out ? :)

All images arrive in the same directory

It could be great to have at least two levels of sub-directories.

If the image identifier is 5fbaafd37cc2b, we could put it under {rich editor dir}/5f/ba/.

This way we avoid having too many files in the same directory. Which could lead to reaching the maximum of files in a directory on unix systems.

[FEATURE] Nested UI elements

We had this use case where we'd like to reuse some UI elements but wrap them in some container.
I tried to do a simple RicheditorType on a UIelement field but doesn't seems to work.

What do you think ?

Add ability to use another storage layer with this plugin

Sylius allows by default the ability to use Gaufrette as a storage abstraction layer allowing users to host their files in S3 or any other kind of file storage.

It seems this plugin does not allow that, having this class (https://github.com/monsieurbiz/SyliusRichEditorPlugin/blob/master/src/Uploader/FileUploader.php) as a concrete implementation, rather than an interface that can be easily swapped with something else.

Is there any interest in addressing this issue by MonsieurBiz? or would you be willing to accept a PR that addresses this?

either way, a project I am working on plans to implement this, the question is if we can have it in the main repo or if we have to fork it and maintain our own fork.

Close the panels only with a CTA

On the Selection panel, having a "Close" or "Cancel" button on top right could be great.
And we should remove the auto close when we click outside, it's like a productivity killer: I am editing something and by mistake I click no the left black space… damn I have to rewrite everything, it's not good!

compatibility

but is it compatible with sylius 1.8 ? I've extended the app\form\extension\ProductTranslationTypeExtension but the description field becomes a normal text input instead of a textarea with richtext... thanks

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.