-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
36 lines (33 loc) · 906 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import Renderer_0_3, { // eslint-disable-line
MOBILE_DOC_VERSION_0_3_0,
MOBILE_DOC_VERSION_0_3_1
} from './renderers/0-3';
// ///////////////////////////////////////
//
// This will be factored out into a seperate NPM package
// and made publically available as TDB's first open-source
// contribution.
//
// NOTE: Currently unsupported mobiledoc features are:
// native image card, default card renderers
//
// ///////////////////////////////////////
export default class MobiledocReactRenderer {
constructor ({ atoms = [], cards = [], markups = [] }) {
this.options = {
atoms,
cards,
markups
};
}
render (mobiledoc) {
const { version } = mobiledoc;
switch (version) {
case MOBILE_DOC_VERSION_0_3_0:
case MOBILE_DOC_VERSION_0_3_1:
return new Renderer_0_3(mobiledoc, this.options).render();
default:
return null;
}
}
}