Edited bindings

This commit is contained in:
NWalker4483 2021-06-03 06:56:40 -04:00
parent 81a38dfeed
commit 239cbcedec
1 changed files with 23 additions and 4 deletions

View File

@ -54,6 +54,7 @@ export default function Editor(
if (context.newSelection[0].type == "bpmn:ScriptTask") {
domClasses(self._parent).add('enabled');
self._state.isEnabled = true;
if(self.isOpen()){self.close(); self.open();} // close old window to reopen
return;
}
}
@ -75,12 +76,19 @@ Editor.$inject = [
];
Editor.prototype._init = function () {
var canvas = this._canvas,
container = canvas.getContainer();
// create parent div
var parent = this._parent = document.createElement('div');
// prevent drag propagation
domEvent.bind(parent, 'mousemove', function(event) {
event.stopPropagation();
});
domClasses(parent).add('djs-editor');
container.appendChild(parent);
@ -92,6 +100,11 @@ Editor.prototype._init = function () {
parent.appendChild(toggle);
// ? I'm pretty sure I can just create a template string that will hold all these definitions but I'll have to get into that
var main_window = document.createElement('div');
var toolbar = document.createElement('div');
// create ide textarea
var ide_window = document.createElement('div');
@ -102,7 +115,6 @@ Editor.prototype._init = function () {
parent.appendChild(ide_window);
};
Editor.prototype.validate = function () {
// ! This parts gonna be hard
}
@ -115,7 +127,7 @@ Editor.prototype.open = function () {
var translate = this._injector.get('translate', false) || function (s) { return s; };
domAttr(this._toggle, 'title', translate('Close Editor'));
if (this._state.isEnabled) {
this._ide = ace.edit("editor");
//this._ide.setTheme("ace/theme/monokai");
this._ide.session.setMode("ace/mode/python");
@ -127,16 +139,23 @@ Editor.prototype.open = function () {
codestore.addEventListener("input", (event) => {
this._ide.session.setValue(codestore.value);
});
this._ide.addEventListener("input", (event) => {
codestore.value = this._ide.getValue();
});
}
this._eventBus.fire('editor.toggle', { open: true });
};
Editor.prototype.close = function () {
// if (this.isOpen()){
// this._codestore.focus();
// const e = new Event("change");
// this._codestore.dispatchEvent(e);
// }
assign(this._state, { isOpen: false });
domClasses(this._parent).remove('open');