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
d36bd9e3
Commit
d36bd9e3
authored
Apr 14, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed readonly
parent
7ddb9c32
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
43 deletions
+44
-43
kityminder.config.js
kityminder.config.js
+4
-3
basestyle.js
src/module/basestyle.js
+40
-40
No files found.
kityminder.config.js
View file @
d36bd9e3
...
...
@@ -62,11 +62,12 @@
window
.
KITYMINDER_CONFIG
=
{
'KITYMINDER_HOME_URL'
:
getKMBasePath
()
//定义工具栏
,
toolbars
:
[
,
toolbars
:
[
'hand zoom-in zoom-out | undo redo | bold italic | fontfamily fontsize forecolor | saveto | markers | node | switchlayout | help'
]
]
,
//只读模式,默认是false
//readOnly
: fals
e
//readOnly
: tru
e
//设置主题
//,defaultlayoutstyle : 'default' //设置默认的主题
...
...
src/module/basestyle.js
View file @
d36bd9e3
...
...
@@ -6,70 +6,70 @@ KityMinder.registerModule( "basestylemodule", function () {
"bold"
:
kity
.
createClass
(
"boldCommand"
,
{
base
:
Command
,
execute
:
function
(
)
{
execute
:
function
()
{
var
nodes
=
km
.
getSelectedNodes
();
if
(
this
.
queryState
(
'bold'
)
==
1
)
{
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
n
.
setData
(
'bold'
);
n
.
getTextShape
().
setAttr
(
'font-weight'
);
km
.
updateLayout
(
n
)
})
}
else
{
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
n
.
setData
(
'bold'
,
true
);
n
.
getTextShape
().
setAttr
(
'font-weight'
,
'bold'
);
km
.
updateLayout
(
n
)
})
if
(
this
.
queryState
(
'bold'
)
==
1
)
{
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
n
.
setData
(
'bold'
);
n
.
getTextShape
().
setAttr
(
'font-weight'
);
km
.
updateLayout
(
n
)
}
)
}
else
{
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
n
.
setData
(
'bold'
,
true
);
n
.
getTextShape
().
setAttr
(
'font-weight'
,
'bold'
);
km
.
updateLayout
(
n
)
}
)
}
},
queryState
:
function
(
)
{
queryState
:
function
()
{
var
nodes
=
km
.
getSelectedNodes
(),
result
=
0
;
if
(
nodes
.
length
==
0
)
{
if
(
nodes
.
length
==
0
)
{
return
-
1
;
}
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
if
(
n
&&
n
.
getData
(
'bold'
)
)
{
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
if
(
n
&&
n
.
getData
(
'bold'
)
)
{
result
=
1
;
return
false
;
}
});
}
);
return
result
;
}
}
),
"italic"
:
kity
.
createClass
(
"italicCommand"
,
{
base
:
Command
,
execute
:
function
(
)
{
execute
:
function
()
{
var
nodes
=
km
.
getSelectedNodes
();
if
(
this
.
queryState
(
'italic'
)
==
1
)
{
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
n
.
setData
(
'italic'
);
n
.
getTextShape
().
setAttr
(
'font-style'
);
km
.
updateLayout
(
n
)
})
}
else
{
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
n
.
setData
(
'italic'
,
true
);
n
.
getTextShape
().
setAttr
(
'font-style'
,
'italic'
);
km
.
updateLayout
(
n
)
})
if
(
this
.
queryState
(
'italic'
)
==
1
)
{
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
n
.
setData
(
'italic'
);
n
.
getTextShape
().
setAttr
(
'font-style'
);
km
.
updateLayout
(
n
)
}
)
}
else
{
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
n
.
setData
(
'italic'
,
true
);
n
.
getTextShape
().
setAttr
(
'font-style'
,
'italic'
);
km
.
updateLayout
(
n
)
}
)
}
},
queryState
:
function
(
)
{
queryState
:
function
()
{
var
nodes
=
km
.
getSelectedNodes
(),
result
=
0
;
if
(
nodes
.
length
==
0
)
{
if
(
nodes
.
length
==
0
)
{
return
-
1
;
}
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
if
(
n
&&
n
.
getData
(
'italic'
)
)
{
utils
.
each
(
nodes
,
function
(
i
,
n
)
{
if
(
n
&&
n
.
getData
(
'italic'
)
)
{
result
=
1
;
return
false
;
}
});
}
);
return
result
;
}
}
)
...
...
@@ -81,12 +81,12 @@ KityMinder.registerModule( "basestylemodule", function () {
"events"
:
{
"beforeRenderNode"
:
function
(
e
)
{
//加粗
if
(
e
.
node
.
getData
(
'bold'
))
{
e
.
node
.
getTextShape
().
setAttr
(
'font-weight'
,
'bold'
);
if
(
e
.
node
.
getData
(
'bold'
)
)
{
e
.
node
.
getTextShape
().
setAttr
(
'font-weight'
,
'bold'
);
}
if
(
e
.
node
.
getData
(
'italic'
))
{
e
.
node
.
getTextShape
().
setAttr
(
'font-style'
,
'italic'
);
if
(
e
.
node
.
getData
(
'italic'
)
)
{
e
.
node
.
getTextShape
().
setAttr
(
'font-style'
,
'italic'
);
}
}
}
...
...
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