-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathseed.js
More file actions
27 lines (23 loc) · 817 Bytes
/
seed.js
File metadata and controls
27 lines (23 loc) · 817 Bytes
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
import { Configurator, JSONConverter, documentHelpers, series, getChangeFromDocument } from 'substance'
import { SimpleWriterPackage } from 'substance-simple-writer'
import htmlFixture from './app/fixture'
/*
Setup configurator
*/
let configurator = new Configurator()
configurator.import(SimpleWriterPackage)
let htmlImporter = configurator.createImporter('html')
let doc = htmlImporter.importDocument(htmlFixture)
let initialChange = getChangeFromDocument(doc)
let jsonConverter = new JSONConverter()
let v1Snapshot = jsonConverter.exportDocument(doc)
export default function seed(changeStore, snapshotStore, cb) {
series([
(cb) => {
changeStore.addChange('example-doc', initialChange, cb)
},
(cb) => {
snapshotStore.saveSnapshot('example-doc', 1, v1Snapshot, cb)
}
], cb)
}