Skip to content
This repository was archived by the owner on May 5, 2021. It is now read-only.

Add doc & rename & add type information #191

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Goaman
Copy link
Contributor

@Goaman Goaman commented May 28, 2020

No description provided.

@Goaman
Copy link
Contributor Author

Goaman commented May 28, 2020

Note: We should add more doc pages. We actually have none.

@dmo-odoo
Copy link
Collaborator

ok [IMP] Link: add type information
ko [DOC] Modifiers => [DOC] Core: add Modifiers doc
ko [RENAME] InsertTextParams formats -> modifiers => [REN] Char: InsertTextParams formats -> modifiers

@dmo-odoo dmo-odoo added needs refactoring Extra renaming/refactoring is needed and removed awaiting review labels May 28, 2020
Copy link
Contributor

@Zynton Zynton left a 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: ...
Copy link
Contributor

@Zynton Zynton May 29, 2020

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`.
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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.
Copy link
Contributor

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).
Copy link
Contributor

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.

  1. No mention of the DOM in core
  2. No mention of a plugin in core (Format in this case)
  3. Start your description of the class by talking about the general case, the general purpose, not the edge cases.
  4. 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
Copy link
Contributor

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." ?

Comment on lines +6 to +7
* 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.
Copy link
Contributor

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`.
Copy link
Contributor

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`.
*/
Copy link
Contributor

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)

@dmo-odoo dmo-odoo added the documentation Improvements or additions to documentation label Jun 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation needs refactoring Extra renaming/refactoring is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants