chore(project): pull bpmn-moddle changes
This commit is contained in:
parent
9e2ad175df
commit
925fbc98b8
|
@ -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');
|
||||
|
|
|
@ -2,15 +2,13 @@
|
|||
|
||||
var _ = require('lodash');
|
||||
|
||||
var BpmnModdle = require('bpmn-moddle');
|
||||
|
||||
|
||||
function BpmnFactory() {
|
||||
this._model = BpmnModdle.instance();
|
||||
function BpmnFactory(moddle) {
|
||||
this._model = moddle;
|
||||
this._uuid = 1;
|
||||
}
|
||||
|
||||
BpmnFactory.$inject = [ ];
|
||||
BpmnFactory.$inject = [ 'moddle' ];
|
||||
|
||||
|
||||
BpmnFactory.prototype._needsId = function(element) {
|
||||
|
|
|
@ -9,17 +9,17 @@ var Matchers = require('../../Matchers'),
|
|||
var fs = require('fs');
|
||||
|
||||
var Diagram = require('diagram-js/lib/Diagram'),
|
||||
BpmnModel = require('bpmn-moddle'),
|
||||
BpmnModdle = require('bpmn-moddle'),
|
||||
Importer = require('../../../lib/import/Importer'),
|
||||
Viewer = require('../../../lib/Viewer');
|
||||
|
||||
|
||||
describe('import - importer', function() {
|
||||
|
||||
var bpmnModel = BpmnModel.instance();
|
||||
var moddle = new BpmnModdle();
|
||||
|
||||
function read(xml, opts, callback) {
|
||||
return BpmnModel.fromXML(xml, 'bpmn:Definitions', opts, callback);
|
||||
return moddle.fromXML(xml, 'bpmn:Definitions', opts, callback);
|
||||
}
|
||||
|
||||
beforeEach(Matchers.addDeepEquals);
|
||||
|
@ -47,7 +47,7 @@ describe('import - importer', function() {
|
|||
|
||||
|
||||
function runImport(diagram, xml, done) {
|
||||
BpmnModel.fromXML(xml, function(err, definitions) {
|
||||
moddle.fromXML(xml, function(err, definitions) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
var BpmnModel = require('bpmn-moddle');
|
||||
var BpmnModdle = require('bpmn-moddle');
|
||||
|
||||
describe('model - browser support', function() {
|
||||
|
||||
var moddle = new BpmnModdle();
|
||||
|
||||
function read(xml, callback, done) {
|
||||
|
||||
BpmnModel.fromXML(xml, 'bpmn:Definitions', function(err, definitions) {
|
||||
moddle.fromXML(xml, 'bpmn:Definitions', function(err, definitions) {
|
||||
|
||||
if (err) {
|
||||
done(err);
|
||||
|
@ -15,6 +17,7 @@ describe('model - browser support', function() {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
it('should parse simple xml', function(done) {
|
||||
|
||||
var xml =
|
||||
|
|
Loading…
Reference in New Issue