Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The render function does not respect multiple attributes #90

Open
twithers-univerus opened this issue Sep 3, 2024 · 1 comment · May be fixed by #91
Open

The render function does not respect multiple attributes #90

twithers-univerus opened this issue Sep 3, 2024 · 1 comment · May be fixed by #91

Comments

@twithers-univerus
Copy link

Describe the bug
Using v. 3.0 (can't upgrade until we update PHP)
This may already be a feature, sorry if it is. Please point me to right place if it is duplicate.
If an element, like an li tag, has multiple formatting attributes assigned in the delta, like alignment, the li tag gets dropped and is replaced by a paragraph element with the alignment style.

The delta code which generates the Problem

Example:

{"ops":
    [
        {"insert":"1"},
        {"attributes":{"list":"ordered"},"insert":"\n"},
        {"insert":"3"},
        {"attributes":{"indent":1,"align":"right","list":"ordered"},"insert":"\n"},
        {"insert":"4"},
        {"attributes":{"list":"ordered"},"insert":"\n"},
        {"insert":"5"},
        {"attributes":{"align":"center","list":"ordered"},"insert":"\n"},
        {"insert":"6"},
        {"attributes":{"list":"ordered"},"insert":"\n"},
        {"attributes":{"underline":true},"insert":"Hello"},
        {"attributes":{"list":"bullet"},"insert":"\n"},
        {"attributes":{"italic":true},"insert":"Please"},
        {"attributes":{"align":"center","list":"bullet"},"insert":"\n"},
        {"attributes":{"bold":true},"insert":"Work"},
        {"attributes":{"align":"right","list":"bullet"},"insert":"\n"}
    ]
}

However the html produced is:

<ol>\n<li>1<ol>\n<p style="text-align: right;">3</p><li>4</li>\n<p style="text-align: center;">5</p><li>6</li>\n</ol>\n<ul>\n<li><u>Hello</u></li>\n<p style="text-align: center;"><em>Please</em></p><p style="text-align: right;"><strong>Work</strong></p>

The expected html output the delta should produce

Example:

<ol><li>1</li><li style="text-align: right;">3</li><li>4</li><li style="text-align: center;">5</li><li>6</li></ol><ul><li><u>Hello</u></li><li style="text-align: center;"><em>Please</em></li><li style="text-align: right;"><strong>Work</strong></li></ul>

Expected behavior
The format is rendered with each of the specified attributes. So a li tag that is formatted to be in the center would have a style attribute added to it. It seems like Quill supports multiple attributes on headers, blockquotes, alignment, lists, and indentation.

Please let me know if I can provide more context. Thanks!

@nadar nadar linked a pull request Sep 4, 2024 that will close this issue
@nadar
Copy link
Owner

nadar commented Sep 4, 2024

This is indeed a problem, but i am not yet sure what the best solution would be. Lists elements usually are not "styled", the content inside the list element is. I have prepared add branch and tests if you like to help on this, see #91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants