Skip to content

Commit 13ce2bb

Browse files
author
ondras
committed
finializing firebase sync
1 parent ce99ee4 commit 13ce2bb

File tree

4 files changed

+46
-10
lines changed

4 files changed

+46
-10
lines changed

css/ui.css

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ button:not(:disabled) {
5656
margin: 8px 16px;
5757
}
5858

59+
.ui p.desc {
60+
font-size: 13px;
61+
}
62+
5963
.ui:not([id]) button {
6064
border: none;
6165
padding: 0;

index.html

+6
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ <h3></h3>
9191
</p>
9292

9393
<div id="file">
94+
<p class="desc">Local files are suitable for loading/saving files from other mindmapping applications.</p>
9495
<p data-for="save">
9596
<span>Format</span>
9697
<select class="format"></select>
@@ -101,12 +102,14 @@ <h3></h3>
101102
</div>
102103

103104
<div id="image">
105+
<p class="desc">Export your design as a PNG image.</p>
104106
<p data-for="save">
105107
<button class="go"></button><button class="cancel">Cancel</button>
106108
</p>
107109
</div>
108110

109111
<div id="local">
112+
<p class="desc">Your browser's localStorage can handle many mind maps and creates a permalink, but this URL cannot be shared.</p>
110113
<p data-for="load">
111114
<span>Saved maps</span>
112115
<select class="list"></select>
@@ -120,6 +123,7 @@ <h3></h3>
120123
</div>
121124

122125
<div id="firebase">
126+
<p class="desc">Firebase offers real-time synchronization for true multi-user collaboration.</p>
123127
<p data-for="save load">
124128
<span>Server</span>
125129
<input type="text" class="server" />
@@ -147,6 +151,7 @@ <h3></h3>
147151
</div>
148152

149153
<div id="webdav">
154+
<p class="desc">Use this to access a generic DAV-like REST API.</p>
150155
<p data-for="save load">
151156
<span>URL</span>
152157
<input type="text" class="url" />
@@ -157,6 +162,7 @@ <h3></h3>
157162
</div>
158163

159164
<div id="gdrive">
165+
<p class="desc">Maps stored in Google Drive have a permalink URL and can be shared with other users, if you allow this by setting proper permissions (inside Google Drive itself).</p>
160166
<p data-for="save">
161167
<span>Format</span>
162168
<select class="format"></select>

my-mind.js

+18-5
Original file line numberDiff line numberDiff line change
@@ -892,16 +892,29 @@ MM.Map.prototype.mergeWith = function(data) {
892892
/* store a sequence of nodes to be selected when merge is over */
893893
var ids = [];
894894
var current = MM.App.current;
895-
while (current != this) {
896-
ids.push(current.getId());
897-
current = current.getParent();
895+
var node = current;
896+
while (node != this) {
897+
ids.push(node.getId());
898+
node = node.getParent();
898899
}
899900

900901
this._root.mergeWith(data.root);
901902

902-
if (MM.App.current.getMap()) { return; } /* selected node still in tree, cool */
903+
if (current.getMap()) { /* selected node still in tree, cool */
904+
/* if one of the parents got collapsed, act as if the node got removed */
905+
var node = current.getParent();
906+
var hidden = false;
907+
while (node != this) {
908+
if (node.isCollapsed()) { hidden = true; }
909+
node = node.getParent();
910+
}
911+
if (!hidden) { return; } /* nothing bad happened, continue */
912+
}
913+
914+
/* previously selected node is no longer in the tree OR it is folded */
903915

904-
/* FIXME what if the current node was being edited? */
916+
/* what if the node was being edited? */
917+
if (MM.App.editing) { current.stopEditing(); }
905918

906919
/* get all items by their id */
907920
var idMap = {};

src/map.js

+18-5
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,29 @@ MM.Map.prototype.mergeWith = function(data) {
3131
/* store a sequence of nodes to be selected when merge is over */
3232
var ids = [];
3333
var current = MM.App.current;
34-
while (current != this) {
35-
ids.push(current.getId());
36-
current = current.getParent();
34+
var node = current;
35+
while (node != this) {
36+
ids.push(node.getId());
37+
node = node.getParent();
3738
}
3839

3940
this._root.mergeWith(data.root);
4041

41-
if (MM.App.current.getMap()) { return; } /* selected node still in tree, cool */
42+
if (current.getMap()) { /* selected node still in tree, cool */
43+
/* if one of the parents got collapsed, act as if the node got removed */
44+
var node = current.getParent();
45+
var hidden = false;
46+
while (node != this) {
47+
if (node.isCollapsed()) { hidden = true; }
48+
node = node.getParent();
49+
}
50+
if (!hidden) { return; } /* nothing bad happened, continue */
51+
}
52+
53+
/* previously selected node is no longer in the tree OR it is folded */
4254

43-
/* FIXME what if the current node was being edited? */
55+
/* what if the node was being edited? */
56+
if (MM.App.editing) { current.stopEditing(); }
4457

4558
/* get all items by their id */
4659
var idMap = {};

0 commit comments

Comments
 (0)