Skip to content

Commit

Permalink
Update ATOMS.md, MOBILEDOC.md
Browse files Browse the repository at this point in the history
  • Loading branch information
bantic committed Feb 4, 2016
1 parent bc3fa94 commit 3b063de
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions ATOMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ An atom is a JavaScript object with 3 *required* properties:
The `render` function on an atom is called by an instance of a renderer and passed an object with the following four properties:

* `env` [object] - A set of environment-specific properties
* `options` [object] - Rendering options that were passed to the renderer (as `cardOptions`) when it was instantiated
* `options` [object] - Rendering options that were passed to the renderer (as `atomOptions`) when it was instantiated
* `payload` [object] - The data payload for this atom from the mobiledoc
* `value` [string] - The textual representation to for this atom

Expand All @@ -27,7 +27,7 @@ must be of the correct type (a DOM Node for the dom renderer, a string of html o

`env` always has the following properties:

* `name` [string] - the name of the card
* `name` [string] - the name of the atom
* `onTeardown` [function] - The atom can pass a callback function: `onTeardown(callbackFn)`. The callback will be called when the rendered content is torn down.

## Atom Examples
Expand All @@ -46,7 +46,7 @@ export default {

Example dom atom that registers a teardown callback:
```js
let card = {
let atom = {
name: 'atom-with-teardown-callback',
type: 'dom',
render({env, options, value, payload}) {
Expand Down
20 changes: 10 additions & 10 deletions MOBILEDOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ The wrapper signature:
```
{
version: "0.3", ──── Versioning information
markups: [ ──── List of markup types
markups: [ ──── Ordered list of markup types
markup,
markup
],
atoms: [ ──── List of atom types
atoms: [ ──── Ordered list of atom types
atom,
atom
],
cards: [ ──── List of card types
cards: [ ──── Ordered list of card types
card,
card
],
sections: [ ──── List of sections.
sections: [ ──── Ordered list of sections.
section,
section,
section
Expand All @@ -66,7 +66,7 @@ Markups have a tagName, and optionally an array of `attributeName, attributeValu
version: "0.3",
markups: [
[tagName, optionalAttributes], ──── Markup
['em'], ──── Example simple markup
['em'], ──── Example simple markup with no attributes
['a', ['href', 'http://google.com']], ──── Example markup with attributes
]
}
Expand Down Expand Up @@ -125,11 +125,11 @@ Markup sections, in addition to plain text, can include markups and atoms.
[1, "p", [
[textTypeIdentifier, openMarkupsIndexes, numberOfClosedMarkups, value],
[0, [], 0, "Example with no markup"], ──── textTypeIdentifier for markup is always 0
[0, [0], 1, "Example wrapped in b tag"],
[0, [1], 0, "Example opening i tag"],
[0, [], 1, "Example closing i tag"],
[0, [1, 0], 1, "Example opening i tag and b tag, closing b tag"],
[0, [], 1, "Example closing b tag"],
[0, [0], 1, "Example wrapped in b tag (opened markup #0), 1 closed markup"],
[0, [1], 0, "Example opening i tag (opened markup with #1, 0 closed markups)"],
[0, [], 1, "Example closing i tag (no opened markups, 1 closed markup)"],
[0, [1, 0], 1, "Example opening i tag and b tag, closing b tag (opened markups #1 and #0, 1 closed markup [closes markup #1])"],
[0, [], 1, "Example closing b tag, (no opened markups, 1 closed markup [closes markup #0])"],
]],
[1, "p", [
[textTypeIdentifier, atomIndex, openMarkupsIndexes, numberOfClosedMarkups],
Expand Down

0 comments on commit 3b063de

Please sign in to comment.