-
Notifications
You must be signed in to change notification settings - Fork 3
Add doc & rename & add type information #191
base: master
Are you sure you want to change the base?
Conversation
Note: We should add more doc pages. We actually have none. |
ok [IMP] Link: add type information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the excessively detailed review but when you write doc for code that I wrote I guess that's to be expected :-) There are also a few notes on form (language mostly).
@@ -0,0 +1,20 @@ | |||
# Modifiers | |||
A modifier is: ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
You could think of a modifier the way you think of a loadable but for nodes: they are simple holders of information that have the potential of modifying the node.
# Modifiers | ||
A modifier is: ... | ||
|
||
The main modifiers are `Attribute` and `Format`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. And they are on plugins ^^
|
||
The main modifiers are `Attribute` and `Format`. | ||
|
||
## Attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On XML Plugin.
- retrieve HTML attributes that a DOM node has originally | ||
- render the HTML attributes that a VNode has | ||
|
||
## Format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Inline Plugin (though that might have to move to core
, I don't know).
|
||
## Attributes | ||
When parsing and rendering a document, we need to save the attributes that a | ||
DOM node has and save it in our VNode. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- "save them"
- you mention the DOM, that's because indeed this is from XML plugin.
@@ -1,6 +1,12 @@ | |||
import { Modifier } from './Modifier'; | |||
import { Constructor, isConstructor } from '../../utils/src/utils'; | |||
|
|||
/** | |||
* When parsing dom elements, modifiers can be DOM inline nodes (a, b, strong). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't write this here.
- No mention of the DOM in
core
- No mention of a plugin in
core
(Format
in this case) - Start your description of the class by talking about the general case, the general purpose, not the edge cases.
- Be consistent: you write "dom" and "DOM" in the same sentence.
/** | ||
* When parsing dom elements, modifiers can be DOM inline nodes (a, b, strong). | ||
* | ||
* The order of modifiers are important because it impact the way they will |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"The order" -> "is"
"It" -> "impacts"
=> "The order of modifiers is important because it may impact their rendering." ?
* A Format might represent DOM inline nodes (a, b, strong) that were parsed or | ||
* the DOM inline node (a, b, strong) that we might render. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a TODO just below: "remove this reference to DOM."
I would try and rewrite this to not invoke the DOM.
Plus, all the uses of "might" make this very hesitant ^^
Now what this does however is reveal how a Format
is not fundamentally different from any other Modifier
apart from its DOM rendering... @dmo-odoo Any input?
export class Format extends Modifier { | ||
htmlTag: string; // TODO: remove this reference to DOM. | ||
/** | ||
* The modifiers for a format is `Attribute`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea what that sentence is supposed to mean. If you mean that the only modifier a Format
can have is Attributes
, that's wrong. Modifiers
can potentially hold any kind of information to modify a node or a format.
* Render the current format into a dom Node. | ||
* | ||
* Meant to be used with `FormatDomRenderer`. | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// TODO: remove this reference to DOM.
(my bad)
No description provided.