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

Wrap content if it exceeds the editor width #2679

Open
wants to merge 2 commits into
base: next
Choose a base branch
from

Conversation

paescuj
Copy link

@paescuj paescuj commented Apr 6, 2024

Long words can currently exceed the editor area - to be observed especially with rather small areas.
Instead, the content should always be wrapped at the end of the line (as it behaves in a native text field).
This can easily be achieved with word-break: break-word 1 applied to all "contenteditable" elements.
With this, paragraph wrapping will still behave the same (see "Lorem Ipsum" example below).

Some plugins appear to have recognized this issue and are addressing it individually at the moment, for example @editorjs/nested-list 2.
However, this is something that should be addressed in core by default for all block tools.

Fixes editor-js/paragraph#57 (external)

Repro

With repo demo (yarn dev), in "thin mode".

JSON
{
    "time" : 1712353636687,
    "blocks" : [
        {
            "id" : "zcKCF1S7X8",
            "type" : "header",
            "data" : {
                "text" : "Supercalifragilisticexpialidocious",
                "level" : 1
            }
        },
        {
            "id" : "FLD-mZIRX7",
            "type" : "paragraph",
            "data" : {
                "text" : "<b>Muvaffakiyetsizleştiricileştiriveremeyebileceklerimizdenmişsinizcesine</b>"
            }
        },
        {
            "id" : "w2bhqGcgbp",
            "type" : "table",
            "data" : {
                "withHeadings" : false,
                "content" : [
                    [
                        "Sünnipäevanädalalõpupeopärastlõunaväsimatus",
                        "Sünnipäevanädalalõpupeopärastlõunaväsimatus"
                    ]
                ]
            }
        },
        {
            "id" : "rkjqTuHxOZ",
            "type" : "list",
            "data" : {
                "style" : "unordered",
                "items" : [
                    {
                        "content" : "miinibaashkiminasiganibiitoosijiganibadagwiingweshiganibakwezhigan",
                        "items" : []
                    }
                ]
            }
        },
        {
            "id" : "dxDWr_Fqgf",
            "type" : "checklist",
            "data" : {
                "items" : [
                    {
                        "text" : "vaðlaheiðarvegavinnuverkfærageymsluskúraútidyralyklakippuhringur",
                        "checked" : false
                    }
                ]
            }
        },
        {
            "id" : "bwnFX5LoX7",
            "type" : "paragraph",
            "data" : {
                "text" : "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \neiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad \nminim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip \nex ea commodo consequat. Duis aute irure dolor in reprehenderit in \nvoluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur \nsint occaecat cupidatat non proident, sunt in culpa qui officia deserunt\n mollit anim id est laborum."
            }
        }
    ],
    "version" : "2.30.0-rc.2"
}

Before

After

Footnotes

  1. https://developer.mozilla.org/en-US/docs/Web/CSS/word-break

  2. https://github.com/editor-js/nested-list/blob/95b37462dc93c19b83f0481f509034a40d436cf2/styles/index.pcss#L27

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 this pull request may close these issues.

Text not autoreturning and moving outside of text editor.
1 participant