verbb / vizy

A flexible visual editor for Craft CMS
Other
44 stars 8 forks source link

[4.x] Missing formatting options in rich text editor #307

Closed anita-chouhan closed 1 month ago

anita-chouhan commented 1 month ago

Describe the bug

Setup:

Issue:

If I first add the block with fewer formatting options to the matrix field and then add another block with more options, the second block will only show the common options and not all the available options.

Steps to reproduce

Here are the instructions:

  1. Create a matrix field and add two blocks to it.
  2. Name the blocks "Rich Text" and "List" respectively.
  3. Add a Vizy-type field to each block.
  4. Set the editor mode to "Blocks and Rich Text".
  5. In the editor config option, select the "RichText" and "List" config files for the fields.
  6. Enable the empty paragraph removal option for both blocks.
  7. Add the matrix field to an entry.
  8. Go to the entry and select the "List" block first, then choose the "Rich Text" block.
  9. Check the available formatting options for both blocks.

Config files to test: RichText.json { "buttons": [ "formatting", "bold", "italic", "link", "unordered-list", "ordered-list" ], "toolbarFixed": true, "formatting": [ "h3", { "title": "Heading 3 Caption", "type": "heading", "editorStyle": ".vizy-h3-caption { font-size: 1.3em; }", "attrs": { "class": "vizy-h3-caption", "level": "6" } }, "h4", "h5", "blockquote", "paragraph" ] }

List.json { "buttons": ["formatting", "bold", "italic", "link", "unordered-list"], "formatting": ["h3", "paragraph"] }

Craft CMS version

4.10.6

Plugin version

2.1.20

Multi-site?

No

Additional context

No response

engram-design commented 1 month ago

I've just replicated your field setup and that seems to be working.

CleanShot 2024-08-09 at 12 57 48@2x

Anything else worth noting about your reproduction?

anita-chouhan commented 1 month ago

I've just replicated your field setup and that seems to be working.

CleanShot 2024-08-09 at 12 57 48@2x

Anything else worth noting about your reproduction?

@engram-design I expect the Rich Text editor block to show all the formatting options available in the RichText.json config. Currently, the H4, H5 and Blockquote are missing.

engram-design commented 1 month ago

Oh, my mistake! I missed those due to the JSON formatting.

{
    "buttons":[
        "formatting",
        "bold",
        "italic",
        "link",
        "unordered-list",
        "ordered-list"
    ],
    "toolbarFixed":true,
    "formatting":[
        "h3",
        {
            "title":"Heading 3 Caption",
            "type":"heading",
            "editorStyle":".vizy-h3-caption { font-size: 1.3em; }",
            "attrs":{
                "class":"vizy-h3-caption",
                "level":"6"
            }
        },
        "h4",
        "h5",
        "blockquote",
        "paragraph"
    ]
}

Indeed, h4, h5 and blockquote are missing. Fixed for the next release. To get this early, run composer require verbb/vizy:"dev-craft-4 as 2.1.20".

anita-chouhan commented 1 month ago

Hello @engram-design, thank you for looking into it. I tried the bug-fix release but found that formatting options are not working. The only two options that are working are Heading 3 Caption and Link

https://github.com/user-attachments/assets/0be0fe14-ff61-4314-a8ee-50eff8c23c51

.

engram-design commented 1 month ago

Should be fixed in 2.1.22