You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The indent and format properties should not be unique to all ElementNodes. Nodes like RootNode, LinkNode, or MarkNode unnecessarily expose those properties, methods, and serialized properties.
The format and especially the indentations are subject to many opinions. Some examples:
Should there be a maximum level of indentation?
If in the selection there are some nodes with the minimum or maximum level of indentation, should the others be able to be indented/outdented?
Which nodes should be indented or formatted and which should not? For example, what should happen to Code, Table, or DecoratorNodes? Should the alignment be applied on the ListNode or on its ListItems?
Should backspace at the beginning of a listItem do outdent? Or 'enter' on an empty listItem?
If the logic about format and indents are in the same place, it is much easier for each user to customize the behavior to their liking.
The reconciler doesn't seem like the right place to modify the DOM element for these two properties. It could be achieved with createDOM, simplifying the reconciler and using the API it was designed for.
The code would be cleaner. There are many edge cases to consider and having things related to indent and format scattered throughout the packages makes it more difficult to modify and debug the code.
It would be a good learning resource. There is currently no example in the playground of how to add properties and methods to many nodes at once. It is very plausible that users want to do this with properties like collapse, color, etc. They do not have the ability to extend ElementNode or modify the reconcile.
I could help with this. I've been experimenting with ways to extend many nodes with the same properties (1) using the mixin pattern or (2) by modifying the node prototype. One of the things I still have to work on though is getting good type-safety, but this change would be very challenging so I'd like to hear your thoughts on it first.
The text was updated successfully, but these errors were encountered:
The
indent
andformat
properties should not be unique to all ElementNodes. Nodes like RootNode, LinkNode, or MarkNode unnecessarily expose those properties, methods, and serialized properties.The format and especially the indentations are subject to many opinions. Some examples:
If the logic about format and indents are in the same place, it is much easier for each user to customize the behavior to their liking.
The reconciler doesn't seem like the right place to modify the DOM element for these two properties. It could be achieved with createDOM, simplifying the reconciler and using the API it was designed for.
The code would be cleaner. There are many edge cases to consider and having things related to indent and format scattered throughout the packages makes it more difficult to modify and debug the code.
It would be a good learning resource. There is currently no example in the playground of how to add properties and methods to many nodes at once. It is very plausible that users want to do this with properties like collapse, color, etc. They do not have the ability to extend ElementNode or modify the reconcile.
I could help with this. I've been experimenting with ways to extend many nodes with the same properties (1) using the mixin pattern or (2) by modifying the node prototype. One of the things I still have to work on though is getting good type-safety, but this change would be very challenging so I'd like to hear your thoughts on it first.
The text was updated successfully, but these errors were encountered: