Skip to content

Commit 364b046

Browse files
Merge pull request #9 from JabRef/gui-integration to add button handlers
empty click handlers for each button, 'new sibling node' and 'new child node click' handlers implemented
2 parents 7e830bc + adf4b6f commit 364b046

File tree

2 files changed

+49
-8
lines changed

2 files changed

+49
-8
lines changed

index.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
<a class="navbar-brand" href="#">JabMap</a>
3636

3737
<!--Save and Load Buttons-->
38-
<button class="btn btn-light me-2" type="button" data-bs-toggle="tooltip" title="Save">
38+
<button id = "saveBtn" class="btn btn-light me-2" type="button" data-bs-toggle="tooltip" title="Save">
3939
<i class="bi bi-save"></i> Save
4040
</button>
41-
<button class="btn btn-light me-2" type="button" data-bs-toggle="tooltip" title="Open">
41+
<button id = "openBtn" class="btn btn-light me-2" type="button" data-bs-toggle="tooltip" title="Open">
4242
<i class="bi bi-folder2-open"></i> Open
4343
</button>
4444
</div>
@@ -47,23 +47,23 @@
4747
<div class="position-absolute top-50 start-50 translate-middle d-flex justify-content-center">
4848
<!--Button class explanation: class = "btn colortheme margin to the right (me-2)"-->
4949
<!--undo Button-->
50-
<button class="btn btn-secondary me-2" type="button" data-bs-toggle="tooltip" title="Undo">
50+
<button id = "undoBtn" class="btn btn-secondary me-2" type="button" data-bs-toggle="tooltip" title="Undo">
5151
<i class="bi bi-arrow-counterclockwise"></i>
5252
</button>
5353
<!--redo Button-->
54-
<button class="btn btn-secondary me-2" type="button" data-bs-toggle="tooltip" title="Redo">
54+
<button id = "redoBtn" class="btn btn-secondary me-2" type="button" data-bs-toggle="tooltip" title="Redo">
5555
<i class="bi bi-arrow-clockwise"></i>
5656
</button>
5757
<!--new topic (sibling node) Button-->
58-
<button class="btn btn-secondary me-2" type="button" data-bs-toggle="tooltip" title="New sibling node">
58+
<button id = "newSiblingBtn" class="btn btn-secondary me-2" type="button" data-bs-toggle="tooltip" title="New sibling node">
5959
<i class="bi bi-node-plus-fill"></i>
6060
</button>
6161
<!--new subtopic (child node) button (Icon rotated 90 degrees)-->
62-
<button class="btn btn-secondary me-2" type="button" data-bs-toggle="tooltip" title="New child node">
62+
<button id = "newChildBtn" class="btn btn-secondary me-2" type="button" data-bs-toggle="tooltip" title="New child node">
6363
<i class="bi bi-diagram-2-fill" style="transform: rotate(-90deg); display: inline-block;"></i>
6464
</button>
6565
<!--tags button-->
66-
<button class="btn btn-secondary" type="button" data-bs-toggle="tooltip" title="Tags">
66+
<button id = "tagsBtn" class="btn btn-secondary" type="button" data-bs-toggle="tooltip" title="Tags">
6767
<i class="bi bi-tags"></i>
6868
</button>
6969
</div>

src/main.js

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,45 @@ const options = {
8282
};
8383
// create and render mindmap
8484
const jm = new jsMind(options);
85-
jm.show(mind);
85+
jm.show(mind);
86+
87+
//--- Button click handlers ---
88+
89+
// saving
90+
saveBtn.onclick = function(){
91+
// saving jabmaps magic here..
92+
}
93+
94+
// open
95+
openBtn.onclick = function(){
96+
// opening jabmaps magic here..
97+
}
98+
99+
// undo
100+
undoBtn.onclick = function(){
101+
// undo magic here..
102+
}
103+
104+
// redo
105+
redoBtn.onclick = function(){
106+
// redo magic here..
107+
}
108+
109+
// new sibling node
110+
newSiblingBtn.onclick = function(){
111+
if(!!jm){
112+
jm.shortcut.handle_addbrother(jm, null); //call the shortcut-handler for adding a sibling node
113+
}
114+
}
115+
116+
// new child node
117+
newChildBtn.onclick = function(){
118+
if(!!jm){
119+
jm.shortcut.handle_addchild(jm, null); //call the shortcut-handler for adding a child node
120+
}
121+
}
122+
123+
// tags
124+
tagsBtn.onclick = function(){
125+
// tags magic here..
126+
}

0 commit comments

Comments
 (0)