MCPcopy Create free account
hub / github.com/TruthHun/BookStack / jstree_save

Function jstree_save

static/js/editor.js:9–40  ·  view source on GitHub ↗

* 保存排序 * @param node * @param parent

(node, parent)

Source from the content-addressed store, hash-verified

7 * @param parent
8 */
9function jstree_save(node, parent) {
10
11 var parentNode = window.treeCatalog.get_node(parent.parent);
12
13 var nodeData = window.getSiblingSort(parentNode);
14
15 if (parent.parent !== parent.old_parent) {
16 parentNode = window.treeCatalog.get_node(parent.old_parent);
17 var newNodeData = window.getSiblingSort(parentNode);
18 if (newNodeData.length > 0) {
19 nodeData = nodeData.concat(newNodeData);
20 }
21 }
22
23 var index = layer.load(1, {
24 shade: [0.1, '#fff'] //0.1透明度的白色背景
25 });
26
27 $.ajax({
28 url : window.sortURL,
29 type :"post",
30 data : JSON.stringify(nodeData),
31 success : function (res) {
32 layer.close(index);
33 if (res.errcode === 0){
34 layer.msg("保存排序成功");
35 }else{
36 layer.msg(res.message);
37 }
38 }
39 })
40}
41
42/**
43 * 创建文档

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected