-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: reworked Camunda Modeler plugin code
- Loading branch information
Showing
52 changed files
with
1,715 additions
and
2,023 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,39 @@ | ||
import { PureComponent } from "camunda-modeler-plugin-helpers/react"; | ||
|
||
import pluginTabState from "./PluginTabState"; | ||
import PluginState from "./PluginState"; | ||
|
||
/** | ||
* Extension, which runs outside of BPMN JS to be able to subscribe to tab change events. | ||
* Extension, which runs outside of BPMN JS to be able to manage the different plugin instances. | ||
*/ | ||
export default class ModelerExtension extends PureComponent { | ||
constructor(props) { | ||
super(props); | ||
|
||
this.props.subscribe("app.activeTabChanged", (event) => { | ||
const { activeTab } = event; | ||
this.pluginState = new PluginState(); | ||
|
||
// handle tab changes | ||
props.subscribe("app.activeTabChanged", (event) => { | ||
const { activeTab } = event; | ||
if (activeTab.type === "bpmn") { | ||
pluginTabState.setActiveTab(activeTab.id); | ||
this.pluginState.showPlugin(activeTab.id); | ||
} else { | ||
pluginTabState.disablePlugin(); | ||
this.pluginState.hidePlugin(); | ||
} | ||
}); | ||
|
||
// register plugin, when BPMN modeler was created | ||
props.subscribe("bpmn.modeler.created", (event) => { | ||
const { modeler, tab } = event; | ||
|
||
const plugin = modeler.get("bpmndt"); | ||
plugin.unregister = this.pluginState.unregisterPlugin.bind(this.pluginState, tab.id); | ||
|
||
this.pluginState.registerPlugin(tab.id, plugin); | ||
}); | ||
} | ||
|
||
render() { | ||
// not needed for this kind of extension | ||
// currently not needed | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.