MCPcopy Index your code
hub / github.com/TruthHun/BookStack / loadDocument

Function loadDocument

static/js/html-editor.js:71–98  ·  view source on GitHub ↗

* 加载指定的文档到编辑器中 * @param $node

($node)

Source from the content-addressed store, hash-verified

69 * @param $node
70 */
71 function loadDocument($node) {
72 var index = layer.load(1, {
73 shade: [0.1,'#fff'] //0.1透明度的白色背景
74 });
75
76 $.get(window.editURL + $node.node.id ).done(function (res) {
77 layer.close(index);
78
79 if(res.errcode === 0){
80 window.isLoad = true;
81 window.editor.clear();
82 window.editor.$txt.html(res.data.content);
83 // 将原始内容备份
84 window.source = res.data.content;
85 var node = { "id" : res.data.doc_id,'parent' : res.data.parent_id === 0 ? '#' : res.data.parent_id ,"text" : res.data.doc_name,"identify" : res.data.identify,"version" : res.data.version};
86 pushDocumentCategory(node);
87 window.selectNode = node;
88
89 pushVueLists(res.data.attach);
90
91 }else{
92 layer.msg("文档加载失败");
93 }
94 }).fail(function () {
95 layer.close(index);
96 layer.msg("文档加载失败");
97 });
98 }
99
100 /**
101 * 保存文档到服务器

Callers 2

markdown.jsFile · 0.85
html-editor.jsFile · 0.85

Calls 3

pushDocumentCategoryFunction · 0.85
pushVueListsFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected