Comparing version 0.2.0 to 0.3.0
@@ -7,3 +7,3 @@ 'use strict'; | ||
var ManifestSchemaData = {"start":"manifest","elements":{"manifest":{"name":"manifest","type":"element","attributes":{},"elements":{"name":"manifest","content":{"type":"*","block":"document"}}},"document":{"name":"document","type":"element","attributes":{"id":{"name":"id"},"type":{"name":"type"},"path":{"name":"path"}},"elements":{"name":"document","content":{"type":",","blocks":[]}}}}}; | ||
var ManifestSchemaData = {"start":"container","elements":{"container":{"name":"container","type":"element","attributes":{},"elements":{"name":"container","content":"documents"}},"documents":{"name":"documents","type":"element","attributes":{},"elements":{"name":"documents","content":{"type":"*","block":"document"}}},"document":{"name":"document","type":"element","attributes":{"id":{"name":"id"},"type":{"name":"type"},"path":{"name":"path"}},"elements":{"name":"document","content":{"type":",","blocks":[]}}}}}; | ||
@@ -39,3 +39,3 @@ const ManifestSchema = substance.XMLSchema.fromJSON(ManifestSchemaData); | ||
let node = nodes[ids[i]]; | ||
if (node.type === 'manifest') { | ||
if (node.type === 'container') { | ||
this.root = node; | ||
@@ -71,12 +71,18 @@ } | ||
getDocumentIds() { | ||
const manifest = getManifest(); | ||
let docs = manifest.findAll('document'); | ||
return docs.map(d => d.id).filter(Boolean) | ||
getDocumentEntries() { | ||
const manifest = this.getManifest(); | ||
let docs = manifest.findAll('container > documents > document'); | ||
return docs.map(d => { | ||
return { | ||
id: d.id, | ||
type: d.attr('type'), | ||
path: d.attr('path'), | ||
name: d.attr('name') | ||
} | ||
}) | ||
} | ||
getSessionForId(docId) { | ||
getEditorSession(docId) { | ||
return this.sessions[docId] | ||
} | ||
} | ||
@@ -115,3 +121,3 @@ | ||
sessions['manifest'] = manifestEditorSession; | ||
manifest.findAll('document').forEach((el) => { | ||
manifest.findAll('container > documents > document').forEach((el) => { | ||
let session; | ||
@@ -118,0 +124,0 @@ session = this._loadDocument(rdcUri, el); |
@@ -7,3 +7,3 @@ (function (global, factory) { | ||
var ManifestSchemaData = {"start":"manifest","elements":{"manifest":{"name":"manifest","type":"element","attributes":{},"elements":{"name":"manifest","content":{"type":"*","block":"document"}}},"document":{"name":"document","type":"element","attributes":{"id":{"name":"id"},"type":{"name":"type"},"path":{"name":"path"}},"elements":{"name":"document","content":{"type":",","blocks":[]}}}}}; | ||
var ManifestSchemaData = {"start":"container","elements":{"container":{"name":"container","type":"element","attributes":{},"elements":{"name":"container","content":"documents"}},"documents":{"name":"documents","type":"element","attributes":{},"elements":{"name":"documents","content":{"type":"*","block":"document"}}},"document":{"name":"document","type":"element","attributes":{"id":{"name":"id"},"type":{"name":"type"},"path":{"name":"path"}},"elements":{"name":"document","content":{"type":",","blocks":[]}}}}}; | ||
@@ -39,3 +39,3 @@ const ManifestSchema = substance.XMLSchema.fromJSON(ManifestSchemaData); | ||
let node = nodes[ids[i]]; | ||
if (node.type === 'manifest') { | ||
if (node.type === 'container') { | ||
this.root = node; | ||
@@ -71,12 +71,18 @@ } | ||
getDocumentIds() { | ||
const manifest = getManifest(); | ||
let docs = manifest.findAll('document'); | ||
return docs.map(d => d.id).filter(Boolean) | ||
getDocumentEntries() { | ||
const manifest = this.getManifest(); | ||
let docs = manifest.findAll('container > documents > document'); | ||
return docs.map(d => { | ||
return { | ||
id: d.id, | ||
type: d.attr('type'), | ||
path: d.attr('path'), | ||
name: d.attr('name') | ||
} | ||
}) | ||
} | ||
getSessionForId(docId) { | ||
getEditorSession(docId) { | ||
return this.sessions[docId] | ||
} | ||
} | ||
@@ -115,3 +121,3 @@ | ||
sessions['manifest'] = manifestEditorSession; | ||
manifest.findAll('document').forEach((el) => { | ||
manifest.findAll('container > documents > document').forEach((el) => { | ||
let session; | ||
@@ -118,0 +124,0 @@ session = this._loadDocument(rdcUri, el); |
{ | ||
"name": "rdc-js", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Reproducible Document Container", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,12 +12,18 @@ export default class DocumentContainer { | ||
getDocumentIds() { | ||
const manifest = getManifest() | ||
let docs = manifest.findAll('document') | ||
return docs.map(d => d.id).filter(Boolean) | ||
getDocumentEntries() { | ||
const manifest = this.getManifest() | ||
let docs = manifest.findAll('container > documents > document') | ||
return docs.map(d => { | ||
return { | ||
id: d.id, | ||
type: d.attr('type'), | ||
path: d.attr('path'), | ||
name: d.attr('name') | ||
} | ||
}) | ||
} | ||
getSessionForId(docId) { | ||
getEditorSession(docId) { | ||
return this.sessions[docId] | ||
} | ||
} | ||
} |
@@ -10,3 +10,3 @@ import { XMLDocument } from 'substance' | ||
let node = nodes[ids[i]] | ||
if (node.type === 'manifest') { | ||
if (node.type === 'container') { | ||
this.root = node | ||
@@ -13,0 +13,0 @@ } |
@@ -35,3 +35,3 @@ import loadManifest from './loadManifest' | ||
sessions['manifest'] = manifestEditorSession | ||
manifest.findAll('document').forEach((el) => { | ||
manifest.findAll('container > documents > document').forEach((el) => { | ||
let session | ||
@@ -56,2 +56,2 @@ session = this._loadDocument(rdcUri, el) | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36643
543