Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kityminder-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴志俊
kityminder-core
Commits
8f997604
Commit
8f997604
authored
Jun 17, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add temlate feture
parent
05521569
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
5 deletions
+84
-5
import.js
import.js
+2
-0
template.js
src/core/template.js
+63
-0
theme.js
src/core/theme.js
+5
-5
bottom.js
src/template/bottom.js
+14
-0
No files found.
import.js
View file @
8f997604
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
'core/connect.js'
,
'core/connect.js'
,
'core/render.js'
,
'core/render.js'
,
'core/theme.js'
,
'core/theme.js'
,
'core/template.js'
,
'layout/default.js'
,
'layout/default.js'
,
'layout/default.connect.js'
,
'layout/default.connect.js'
,
'layout/bottom.js'
,
'layout/bottom.js'
,
...
@@ -32,6 +33,7 @@
...
@@ -32,6 +33,7 @@
'theme/default.js'
,
'theme/default.js'
,
'theme/bottom.js'
,
'theme/bottom.js'
,
'theme/filetree.js'
,
'theme/filetree.js'
,
'template/bottom.js'
,
'module/node.js'
,
'module/node.js'
,
'module/text.js'
,
'module/text.js'
,
'module/outline.js'
,
'module/outline.js'
,
...
...
src/core/template.js
0 → 100644
View file @
8f997604
utils
.
extend
(
KityMinder
,
{
_templates
:
{},
registerTemplate
:
function
(
name
,
supports
)
{
KityMinder
.
_templates
[
name
]
=
supports
;
}
});
kity
.
extendClass
(
Minder
,
(
function
()
{
var
originGetTheme
=
Minder
.
prototype
.
getTheme
;
return
{
useTemplate
:
function
(
name
)
{
this
.
_template
=
name
;
this
.
getRoot
().
traverse
(
function
(
node
)
{
node
.
render
();
});
this
.
layout
(
300
);
},
getTemplateSupports
:
function
()
{
return
KityMinder
.
_templates
[
this
.
_template
]
||
null
;
},
getTheme
:
function
(
node
)
{
var
supports
=
this
.
getTemplateSupports
();
if
(
supports
&&
supports
.
getTheme
)
{
return
supports
.
getTheme
(
node
);
}
return
originGetTheme
.
call
(
this
,
node
);
}
};
})());
kity
.
extendClass
(
MinderNode
,
(
function
()
{
var
originGetLayout
=
MinderNode
.
prototype
.
getLayout
;
return
{
getLayout
:
function
()
{
var
supports
=
this
.
getMinder
().
getTemplateSupports
();
if
(
supports
&&
supports
.
getLayout
)
{
return
supports
.
getLayout
(
this
);
}
return
originGetLayout
.
call
(
this
);
}
};
})());
KityMinder
.
registerModule
(
'TemplateModule'
,
{
commands
:
{
'template'
:
kity
.
createClass
(
'TemplateCommand'
,
{
base
:
Command
,
execute
:
function
(
minder
,
name
)
{
minder
.
useTemplate
(
name
);
},
queryCommandValue
:
function
(
minder
)
{
return
minder
.
_template
;
}
})
}
});
\ No newline at end of file
src/core/theme.js
View file @
8f997604
...
@@ -63,7 +63,7 @@ kity.extendClass(Minder, {
...
@@ -63,7 +63,7 @@ kity.extendClass(Minder, {
* 获取脑图实例上的当前主题
* 获取脑图实例上的当前主题
* @return {[type]} [description]
* @return {[type]} [description]
*/
*/
getTheme
:
function
()
{
getTheme
:
function
(
node
)
{
return
this
.
_theme
||
KityMinder
.
_defaultTheme
;
return
this
.
_theme
||
KityMinder
.
_defaultTheme
;
},
},
...
@@ -71,8 +71,8 @@ kity.extendClass(Minder, {
...
@@ -71,8 +71,8 @@ kity.extendClass(Minder, {
* 获得脑图实例上的样式
* 获得脑图实例上的样式
* @param {String} item 样式名称
* @param {String} item 样式名称
*/
*/
getStyle
:
function
(
item
)
{
getStyle
:
function
(
item
,
node
)
{
var
theme
=
KityMinder
.
_themes
[
this
.
getTheme
()];
var
theme
=
KityMinder
.
_themes
[
this
.
getTheme
(
node
)];
var
segment
,
dir
,
selector
,
value
,
matcher
;
var
segment
,
dir
,
selector
,
value
,
matcher
;
if
(
item
in
theme
)
return
theme
[
item
];
if
(
item
in
theme
)
return
theme
[
item
];
...
@@ -102,8 +102,8 @@ kity.extendClass(Minder, {
...
@@ -102,8 +102,8 @@ kity.extendClass(Minder, {
* @param {String} name 样式名称,可以不加节点类型的前缀
* @param {String} name 样式名称,可以不加节点类型的前缀
*/
*/
getNodeStyle
:
function
(
node
,
name
)
{
getNodeStyle
:
function
(
node
,
name
)
{
var
value
=
this
.
getStyle
(
name
);
var
value
=
this
.
getStyle
(
name
,
node
);
return
value
!==
null
?
value
:
this
.
getStyle
(
node
.
getType
()
+
'-'
+
name
);
return
value
!==
null
?
value
:
this
.
getStyle
(
node
.
getType
()
+
'-'
+
name
,
node
);
}
}
});
});
...
...
src/template/bottom.js
0 → 100644
View file @
8f997604
KityMinder
.
registerTemplate
(
'bottom'
,
{
getLayout
:
function
(
node
)
{
if
(
node
.
getData
(
'layout'
))
return
node
.
getData
(
'layout'
);
if
(
node
.
isRoot
())
return
'bottom'
;
return
'filetree'
;
},
getTheme
:
function
(
node
)
{
return
node
.
isRoot
()
?
'bottom'
:
'filetree'
;
}
});
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment