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

Document editor structure protections #304

Open
pepoospina opened this issue Apr 17, 2021 · 0 comments
Open

Document editor structure protections #304

pepoospina opened this issue Apr 17, 2021 · 0 comments
Assignees

Comments

@pepoospina
Copy link
Contributor

pepoospina commented Apr 17, 2021

Add protections to document editor on drop to prevent document inconsistencies.

Assume the editor is a tree that is rendered as a list, so rendering visually flattens the tree. The style of a block is linked to the tree structure and some conditions must be met.

condition 1)
Paragraphs are wrapped by titles.

condition 2)
At any given level, all paragraphs must be the first children, followed by all titles.

All paragraphs "under" a title must be its children until the next title of that level. (here "under" refers to the visually flattened view). In other words, the lower syblings of a title cannot be a paragraph.

For example, this is a valid doc structure

P0
T1
  P2
  P2
T2
  P4

But this is not valid

P0
T1
  P1 
  P2
P3
P4

This is not valid because P2 and P3 are in different levels of the tree, but visually they look like syblings.

--

These conditions are forced while editing the document, but they are not forced when droping new content.

A Protection must be included so that if a title is dropped above a paragraph, it is moved under the last paragraph at that level.

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

2 participants