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

"add/paste/move" elements validation mechanism #766

Open
10 tasks
edenvidal opened this issue Apr 16, 2024 · 0 comments
Open
10 tasks

"add/paste/move" elements validation mechanism #766

edenvidal opened this issue Apr 16, 2024 · 0 comments
Assignees

Comments

@edenvidal
Copy link
Member

edenvidal commented Apr 16, 2024

  • if body is empty ,selecting it and adding an element from “add menu” inserts the element inside but when not, it gives validation error. @atulbhatt-system32 this is related.

  • currently, adding things inside forbidden things is going crazy (try placing a link inside a link). here's a defined way to do it bottom-up.

note for beginners: this functionality involved contextual data coming from "rfrncs"


  • add menu: always show options - display all possible html elements in the add menu, no matter the current context.
  • check context: when adding/moving/pasting an element, see if it fits in the current context.
  • look for parent: if it doesn't fit, check higher-level contexts and add the element(s) there if it's allowed. if one element out of a few is violating, then the fallback rules applies to them too.
  • ignore if not allowed: if no valid context is found, terminate the action and pop a notification for it - "Anchor inside Anchor is not allowed".

example 1: within an empty 'body,' adding a 'div' should place it inside the 'body.'
example 2: inside a 'ul' element and selecting a 'li,' adding another 'li' should put it next to the previous one. adding a 'div' will place it outside the 'ul.'

paste mechanism:

  • follow same rules: use the same context rules when pasting elements.
  • keep tree order: paste elements in the order they appear in the tree, not the initial selection order.

multi-element addition:

  • all-or-nothing: if any element in a multi-addition is not allowed, cancel the entire operation.
  • case-by-case handling: if all elements are allowed, apply the usual context rules to each one.
@edenvidal edenvidal converted this from a draft issue Apr 16, 2024
@edenvidal edenvidal changed the title "add/paste/move" elements mechanism + menu "add/paste/move" elements validation mechanism + menu Apr 16, 2024
@edenvidal edenvidal changed the title "add/paste/move" elements validation mechanism + menu "add/paste/move" elements validation mechanism Apr 16, 2024
@edenvidal edenvidal moved this from Idea to Next Up in rnbw 0.1 Apr 16, 2024
@edenvidal edenvidal moved this from Next Up to Idea in rnbw 0.1 Dec 19, 2024
@edenvidal edenvidal removed their assignment Dec 19, 2024
@edenvidal edenvidal moved this from Idea to Next Up in rnbw 0.1 Dec 22, 2024
@edenvidal edenvidal self-assigned this Dec 24, 2024
@edenvidal edenvidal moved this from Next Up to In Progress in rnbw 0.1 Dec 24, 2024
@edenvidal edenvidal removed their assignment Dec 25, 2024
@edenvidal edenvidal moved this from In Progress to Next Up in rnbw 0.1 Dec 25, 2024
@edenvidal edenvidal moved this from Next Up to Idea in rnbw 0.1 Feb 3, 2025
@edenvidal edenvidal moved this from Idea to Next Up in rnbw 0.1 Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Next Up
Development

No branches or pull requests

2 participants