Skip to content

Latest commit

 

History

History
85 lines (67 loc) · 3.17 KB

Help.md

File metadata and controls

85 lines (67 loc) · 3.17 KB

帮助文档

一、如何将 百度脑图 文件下载到本地?

方法1:

  • 用 Chrome 或 Firefox 浏览器打开百度脑图页面
  • 按下 F12 打开控制台界面
  • 粘贴下面的代码,按下回车即可下载脑图文件
try {
    function saveKm(fileName, content) {
        var el = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
        if (el) {
            el.href = 'data:text/plain,' + content;
            el.download = fileName;

            var event = document.createEvent('MouseEvents');
            event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
            el.dispatchEvent(event);
        }
    }

    var data = JSON.stringify(editor.minder.exportJson());
    var fileName = editor.minder.getRoot().data.text + '.km';
    saveKm(fileName, data);
} catch (e) {
    alert(e);
}

方法2:

  • 在浏览器书签栏的空白处,右键“添加网页”输入“脑图下载”,在“网址”文本框中粘贴下面的代码,点击“保存”就可以长期使用了:
javascript: try{function saveKm(fileName,content){var el=document.createElementNS('http://www.w3.org/1999/xhtml','a');if(el){el.href='data:text/plain,'+content;el.download=fileName;var event=document.createEvent('MouseEvents');event.initMouseEvent('click',true,false,window,0,0,0,0,0,false,false,false,false,0,null);el.dispatchEvent(event)}}var data=JSON.stringify(editor.minder.exportJson());var fileName=editor.minder.getRoot().data.text+'.km';saveKm(fileName,data)}catch(e){alert(e)}; void (0);

二、如何下载 ProcessOn 上的思维导图呢?

操作方法和下载百度脑图一样。在浏览器中按 F12 并在控制台中粘贴下面的代码即可下载。

try {
    function getKmByProcesson(json) {
        function fn(json) {
            var d = { data: { id: json.id, text: json.title.replace(/<br>/g,'\n') } };
            if (json.note != undefined) { d.data.note = json.note; }
            if (json.children == null || json.children.length == 0) { return d; }

            var arr = [];
            json.children.forEach(function (item) { arr.push(fn(item)); });
            d.children = arr;

            return d;
        }

        return { root: fn(json) };
    }

    function saveKm(fileName, content) {
        var el = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
        if (el) {
            el.href = 'data:text/plain,' + content;
            el.download = fileName;

            var event = document.createEvent('MouseEvents');
            event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
            el.dispatchEvent(event);
        }
    }

    var data = getKmByProcesson(definition);
    var fileName = data.root.data.text + '.km';
    saveKm(fileName, JSON.stringify(data));
} catch (e) {
    alert(e);
}