gxb-ide.js
2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
;(function(window){
GxbIde = function(){
// this.init.apply(this, arguments);
}
// 储存一个树结构和编辑器的对应关系
var treeLinkEditor = [], // 缓存整个目录树结构和代码编辑器的关系
treeData = {}, // 缓存目录树返回结果
mainPath, // 运行编译时候需要知道当前是哪个文件
fileList, // 有值的文件数据结构
treeObj; // 获取ztree对象
var config = {
edit: {
enable: true
// editNameSelectAll: true
},
view: {
addHoverDom: addHoverDom,
removeHoverDom: removeHoverDom,
selectedMulti: false,
showLine: false
},
data: {
simpleData: {
enable: true
}
},
callback: {
beforeClick: beforeClick
}
};
function beforeClick(treeId, treeNodes) {
console.log('567890')
console.log('点击了 ' + treeNodes.name);
console.log('点击了 ' + treeNodes.isParent);
}
function addHoverDom(treeId, treeNodes) {
// console.info('addHoverDom');
// 修复第一个文件夹
if(treeNode.isParent){
$('a[title="'+ treeNode.name +'"]').find("#" + treeId + "_" + treeNode.id + "_edit").hide();
return false;
}
// 不知道为什么 ztree 最后一项不显示编辑按钮
// 只能通过改变参数的值来让它显示编辑按钮
if(treeNode.isLastNode){
treeNode.isLastNode = false;
}
}
function removeHoverDom(treeId, treeNodes){
}
// 初始化目录:增、删、改文件,文件夹目录结构
var Dir = {
treeData: {},
init: function(){
console.log('Dir');
},
buildTree: function(select, treeData){
$.fn.zTree.init(select, config, treeData);
},
getTreeData: function(){
}
}
// 记录编写代码过程:输入代码、记录存放代码
var Coding = {
init: function(){
console.log('Coding');
}
}
// 工具栏:负责编译,展示头部信息功能
var ToolBox = {
init: function(){
console.log('Dir');
}
}
// 主题:IDE 主题
var Theme = {
init: function(){
console.log('Theme');
}
}
// 录制音频:录制、暂停、继续录制
var Record = {
init: function(){
console.log('Record');
}
}
GxbIde.ide = GxbIde.prototype = {
constructor: GxbIde,
init: function(){
this.Coding.init()
}
}
// 老师录制编辑
GxbIde.ide.RecordIde = $.extend({ Coding, Dir, ToolBox, Theme, Record })
window.GxbIde = GxbIde;
})(window)