Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can i use a json String to call api to show a mindChar #48

Closed
guanpanpan opened this issue Feb 25, 2014 · 2 comments
Closed

how can i use a json String to call api to show a mindChar #48

guanpanpan opened this issue Feb 25, 2014 · 2 comments

Comments

@guanpanpan
Copy link

i store the json string to server, want to use string to show the mindChar to client
i write script:
var promise = new Promise();
var str='{ "root": {"id": "ztemuzzo","text": "ssss", "layout": "map"}, "id": "pqlnmijv"}';
promise.fulfill({data:str, name:"exception.mymind"});

i think i miss some call,but cant't find,can you tell me what i miss,thanks!

@ondras
Copy link
Owner

ondras commented Feb 25, 2014

Hi,

I am not sure where is your code located (what function? what backend? etc...), but to load a Mind Map data from a string, you can use the code here: https://github.com/ondras/my-mind/blob/master/bin/phantomjs-my-mind.js#L49

Basically, you do:

var json = MM.Format.JSON.from(string);
var map = MM.Map.fromJSON(json);
MM.App.setMap(map);

@guanpanpan
Copy link
Author

thanks! i use the index.html in my-mind-master to test,ok! can work.
you project is very good!
MM.App.init();
MM.App.io.restore();
var str='{ "root": {"id": "ztemuzzo","text": "ssss", "layout": "map"}, "id": "pqlnmijv"}';
var json = MM.Format.JSON.from(str);
var map = MM.Map.fromJSON(json);
MM.App.setMap(map);

@ondras ondras closed this as completed Feb 25, 2014
ondras added a commit that referenced this issue Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants