-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add xml viewer * remove ace * add border to resize editor * enable live update on diagram change * fix tests * increase initial size of xml viewer & limit max height * change size of modeler when xml viewer is enabled * remove jump after first resize * remove button from bottom left, add button to toolbar * add icon
- Loading branch information
1 parent
b903d74
commit e5d95ab
Showing
12 changed files
with
408 additions
and
188 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,4 +1,5 @@ | ||
node_modules/* | ||
public/* | ||
!public/index.html | ||
bpmnlint-plugin-custom/node_modules/* | ||
!public/src | ||
bpmnlint-plugin-custom/node_modules/* |
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
Binary file added
BIN
+4.41 KB
components/bpmn-q/modeler-component/editor/resources/icons/xml-viewer-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
63 changes: 63 additions & 0 deletions
63
components/bpmn-q/modeler-component/editor/ui/XMLViewerButton.js
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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import React, { useState } from "react"; | ||
import { getModeler } from "../ModelerHandler"; | ||
import ace from "ace-builds"; | ||
import { loadDiagram } from "../util/IoUtilities"; | ||
|
||
/** | ||
* React button which enables the XML Viewer. | ||
* | ||
* @returns {JSX.Element} | ||
* @constructor | ||
*/ | ||
export default function XMLViewerButton() { | ||
|
||
const [enabledXMLView, setEnabledXMLView] = useState(false); | ||
function enableXMLViewer(enabledXMLView) { | ||
let modelerContainer = document.getElementById('modeler-container'); | ||
let editor = document.getElementById('editor'); | ||
let editorWrap = document.getElementById('editor_wrap'); | ||
let panel = document.getElementById("properties"); | ||
let aceEditor = ace.edit(editor); | ||
if (!enabledXMLView) { | ||
modelerContainer.style.height = '93vh'; | ||
editor.style.display = 'block'; | ||
editor.style.height = '93vh'; | ||
panel.style.display = 'none'; | ||
editorWrap.style.display = 'block'; | ||
|
||
// Dynamically set the value of the editor | ||
let xml = getModeler().xml; | ||
if (xml.xml != undefined) { | ||
xml = xml.xml; | ||
} | ||
aceEditor.setValue(xml); | ||
} else { | ||
modelerContainer.style.height = '98vh'; | ||
editor.style.display = 'none'; | ||
panel.style.display = 'block'; | ||
editorWrap.style.display = 'none'; | ||
|
||
|
||
aceEditor.getSession().on('change', function () { | ||
update(); | ||
}); | ||
|
||
function update() { | ||
let xml = aceEditor.getSession().getValue(); | ||
loadDiagram(xml, getModeler()); | ||
} | ||
} | ||
|
||
setEnabledXMLView(!enabledXMLView) | ||
|
||
} | ||
|
||
return ( | ||
<button className="qwm-toolbar-btn" title="Trigger XML Viewer" | ||
onClick={() => enableXMLViewer(enabledXMLView)}> | ||
<span className="qwm-icon-xml-viewer"> | ||
<span className="qwm-indent">XML Viewer</span> | ||
</span> | ||
</button> | ||
); | ||
} |
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.