Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ondras committed Jul 22, 2014
2 parents 82d80e6 + 0ecfcb5 commit 132ce78
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 20 deletions.
4 changes: 4 additions & 0 deletions css/ui.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ button:not(:disabled) {
margin: 8px 16px;
}

.ui p.desc {
font-size: 13px;
}

.ui:not([id]) button {
border: none;
padding: 0;
Expand Down
29 changes: 19 additions & 10 deletions examples/features.mymind
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
{
"id": "zcrefcfz",
"text": "Folding\n",
"text": "Folding",
"collapsed": 1,
"children": [
{
Expand Down Expand Up @@ -75,11 +75,21 @@
},
{
"id": "megldbuw",
"text": "Firebase"
"text": "Firebase",
"children": [
{
"id": "krsvhker",
"text": "Realtime sync"
}
]
},
{
"id": "rmxmrpum",
"text": "Google Drive"
},
{
"id": "eiocvrju",
"text": "REST DAV-like"
}
]
},
Expand Down Expand Up @@ -138,7 +148,7 @@
"id": "pjqwdjad",
"text": "Bool node statuses",
"value": "maybe",
"status": "maybe",
"status": "computed",
"children": [
{
"id": "jsrxnhgy",
Expand All @@ -150,7 +160,7 @@
"id": "oqzwbzvf",
"text": "Auto-propagation to parent",
"value": "no",
"status": "maybe"
"status": "computed"
}
]
},
Expand All @@ -176,6 +186,10 @@
{
"id": "rsruxymh",
"text": "Infinite undo/redo"
},
{
"id": "jaalsyvs",
"text": "Export to image"
}
]
},
Expand All @@ -185,10 +199,6 @@
"side": "left",
"color": "#d3d",
"children": [
{
"id": "krsvhker",
"text": "Realtime sync (Firebase)"
},
{
"id": "vcmxdsvj",
"text": "Custom styles"
Expand All @@ -200,6 +210,5 @@
]
}
]
},
"id": "dwqxduay"
}
}
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ <h3></h3>
</p>

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

<div id="image">
<p class="desc">Export your design as a PNG image.</p>
<p data-for="save">
<button class="go"></button><button class="cancel">Cancel</button>
</p>
</div>

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

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

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

<div id="gdrive">
<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>
<p data-for="save">
<span>Format</span>
<select class="format"></select>
Expand Down
23 changes: 18 additions & 5 deletions my-mind.js
Original file line number Diff line number Diff line change
Expand Up @@ -892,16 +892,29 @@ MM.Map.prototype.mergeWith = function(data) {
/* store a sequence of nodes to be selected when merge is over */
var ids = [];
var current = MM.App.current;
while (current != this) {
ids.push(current.getId());
current = current.getParent();
var node = current;
while (node != this) {
ids.push(node.getId());
node = node.getParent();
}

this._root.mergeWith(data.root);

if (MM.App.current.getMap()) { return; } /* selected node still in tree, cool */
if (current.getMap()) { /* selected node still in tree, cool */
/* if one of the parents got collapsed, act as if the node got removed */
var node = current.getParent();
var hidden = false;
while (node != this) {
if (node.isCollapsed()) { hidden = true; }
node = node.getParent();
}
if (!hidden) { return; } /* nothing bad happened, continue */
}

/* previously selected node is no longer in the tree OR it is folded */

/* FIXME what if the current node was being edited? */
/* what if the node was being edited? */
if (MM.App.editing) { current.stopEditing(); }

/* get all items by their id */
var idMap = {};
Expand Down
23 changes: 18 additions & 5 deletions src/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,29 @@ MM.Map.prototype.mergeWith = function(data) {
/* store a sequence of nodes to be selected when merge is over */
var ids = [];
var current = MM.App.current;
while (current != this) {
ids.push(current.getId());
current = current.getParent();
var node = current;
while (node != this) {
ids.push(node.getId());
node = node.getParent();
}

this._root.mergeWith(data.root);

if (MM.App.current.getMap()) { return; } /* selected node still in tree, cool */
if (current.getMap()) { /* selected node still in tree, cool */
/* if one of the parents got collapsed, act as if the node got removed */
var node = current.getParent();
var hidden = false;
while (node != this) {
if (node.isCollapsed()) { hidden = true; }
node = node.getParent();
}
if (!hidden) { return; } /* nothing bad happened, continue */
}

/* previously selected node is no longer in the tree OR it is folded */

/* FIXME what if the current node was being edited? */
/* what if the node was being edited? */
if (MM.App.editing) { current.stopEditing(); }

/* get all items by their id */
var idMap = {};
Expand Down

0 comments on commit 132ce78

Please sign in to comment.