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

Line-breaks in a Delta Format #2469

Closed
npcole opened this issue Jan 20, 2019 · 4 comments
Closed

Line-breaks in a Delta Format #2469

npcole opened this issue Jan 20, 2019 · 4 comments

Comments

@npcole
Copy link

npcole commented Jan 20, 2019

In common with #1511 and also with #252, I think there is a compelling reason to decide on a way to represent a line-break within a line. Even within a heading, it may be necessary to specify a line-break that is not in fact a paragraph break, but for many applications, the ability to have line-breaks within table cells, list items, etc. is important. In other words, the need is more general than the one outlined by #1511 .

The easiest way to represent this would seem to be to pick a character to represent a line-break. In #252 someone suggested the Unicode \u000b character, which seems appropriate.

As for a compelling use-case: I'm looking at adapting quilljs to work as an editor for TEI -- and in the document-editing world it is absolutely essential to be able to distinguish line-breaks from paragraph blocks.

From a technical point of view, is there any reason not to adopt this proposal? A line-break character could be treated by delta formats as just another character, couldn't it? There's no reason to treat it as special in any way that I can see. However, if there is a technical reason this is difficult, I'd be really interested in understanding it.

@ile
Copy link

ile commented Feb 27, 2019

I made this and it seems to work to some extent: https://gist.github.com/ile/8a08c23b5ae0f331dee8ca062fdef40d

@martijndekuijper
Copy link

I still can't believe line-breaks are not supported :(

@ile you say:

To some extent

What are the limitations?

@ile
Copy link

ile commented Mar 7, 2019

What are the limitations?

The whole thing is a bit of a guesswork. And it needs my fork of Quill which has a "dirty hack".

There are no real tests to verify that it works 100 %. And I noticed that it seems to get confused if there are a lot of styles and undo/redo is applied. "A lot of styles" means here that I tested it with a template from Google Docs, edited that and tried undo/redo.

But the problems were quite minor that I could find so at the moment I'm using it. Improvements are welcome of course.

Of, and the soft linebreak is created with Ctrl+Shift+Enter because for some reason Shift+Enter didn't seem to be able to trigger the keyboard handler function.

@quill-bot
Copy link

Quill 2.0 has been released (announcement post) with many changes and fixes. If this is still an issue please create a new issue after reviewing our updated Contributing guide 🙏

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

No branches or pull requests

4 participants