Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function write(element, options, callback) {
if (isFunction(options)) {
callback = options;
options = {};
}
// skip preamble for tests
options = assign({ preamble: false }, options);
moddle.toXML(element, options, callback);
}
function Provider(entries, headerEntries) {
this.getPopupMenuEntries = isFunction(entries) ? entries : function() {
return entries || {};
};
if (headerEntries) {
this.getPopupMenuHeaderEntries = isFunction(headerEntries) ? headerEntries : function() {
return headerEntries;
};
}
}
function runImport(diagram, xml, diagramId, done) {
if (isFunction(diagramId)) {
done = diagramId;
diagramId = null;
}
var moddle = new BpmnModdle();
moddle.fromXML(xml, function(err, definitions) {
var selectedDiagram = find(definitions.diagrams, function(element) {
return element.id === diagramId;
});
importBpmnDiagram(diagram, definitions, selectedDiagram, done);
});
}
forEach(providers, function(provider) {
var entriesOrUpdater = provider.getContextPadEntries(element);
if (isFunction(entriesOrUpdater)) {
entries = entriesOrUpdater(entries);
} else {
forEach(entriesOrUpdater, function(entry, id) {
entries[id] = entry;
});
}
});
handleLayoutChange(newLayout) {
const {
onLayoutChanged
} = this.props;
if (isFunction(onLayoutChanged)) {
onLayoutChanged(newLayout);
}
}
middlewares
}
});
};
const {
options,
warnings
} = configureModeler(getPlugins, {
exporter: {
name,
version
},
}, handleMiddlewareExtensions);
if (warnings.length && isFunction(onError)) {
onError(
'Problem(s) configuring BPMN editor: \n\t' +
warnings.map(error => error.message).join('\n\t') +
'\n'
);
}
const modeler = new CamundaBpmnModeler({
...options,
position: 'absolute'
});
const commandStack = modeler.get('commandStack');
const stackIdx = commandStack._stackIdx;
onGetComponent(type, priority, callback) {
if (isFunction(priority)) {
callback = priority;
priority = DEFAULT_PRIORITY;
}
if (!isNumber(priority)) {
throw new Error('priority must be a number');
}
const listeners = this._getListeners(type);
let existingListener,
idx;
const newListener = { priority, callback };
for (idx = 0; (existingListener = listeners[idx]); idx++) {
menuEntries.map((entry) => {
const {
accelerator,
action,
enabled,
label,
submenu,
visible
} = entry;
return new MenuItem({
label,
accelerator,
enabled: isFunction(enabled) ? Boolean(enabled()) : enabled,
click: action && wrapPluginAction(action, name),
submenu,
visible
});
})
);
Object.keys(this._entries).forEach((k) => {
if (k.indexOf(key) === 0) {
const entry = this._entries[k];
if (isFunction(entry[__DESTROY])) {
entry[__DESTROY]();
}
delete this._entries[k];
}
});
}
Keyboard.prototype.addListener = function(priority, listener, type) {
if (isFunction(priority)) {
type = listener;
listener = priority;
priority = DEFAULT_PRIORITY;
}
this._eventBus.on(type || KEYDOWN_EVENT, priority, listener);
};