chore(project): pull bpmn-moddle changes

This commit is contained in:
Nico Rehwaldt
2014-08-04 16:32:11 +02:00
parent 9e2ad175df
commit 925fbc98b8
4 changed files with 23 additions and 15 deletions

View File

@ -1,7 +1,7 @@
'use strict';
var Diagram = require('diagram-js'),
BpmnModel = require('bpmn-moddle'),
BpmnModdle = require('bpmn-moddle'),
$ = require('jquery'),
_ = require('lodash');
@ -72,6 +72,7 @@ function Viewer(options) {
// unwrap jquery
this.container = container.get(0);
/**
* The code in the <project-logo></project-logo> area
* must not be changed, see http://bpmn.io/license for more information
@ -104,7 +105,9 @@ Viewer.prototype.importXML = function(xml, done) {
var self = this;
BpmnModel.fromXML(xml, 'bpmn:Definitions', function(err, definitions) {
this.moddle = this.createModdle();
this.moddle.fromXML(xml, 'bpmn:Definitions', function(err, definitions) {
if (err) {
err = checkValidationError(err);
@ -128,11 +131,14 @@ Viewer.prototype.saveXML = function(options, done) {
return done(new Error('no definitions loaded'));
}
BpmnModel.toXML(definitions, options, function(err, xml) {
this.moddle.toXML(definitions, options, function(err, xml) {
done(err, xml);
});
};
Viewer.prototype.createModdle = function() {
return new BpmnModdle();
};
var SVG_HEADER =
'<?xml version="1.0" encoding="utf-8"?>\n' +
@ -209,7 +215,8 @@ Viewer.prototype._createDiagram = function(options) {
// add self as an available service
modules.unshift({
bpmnjs: [ 'value', this ]
bpmnjs: [ 'value', this ],
moddle: [ 'value', this.moddle ]
});
options = _.omit(options, 'additionalModules');