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
9bd882c3
Commit
9bd882c3
authored
Feb 24, 2014
by
campaign
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
by zhanyi
parent
7647a609
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
73 additions
and
13 deletions
+73
-13
contextmenu.js
src/adapter/contextmenu.js
+27
-8
layout.js
src/adapter/layout.js
+13
-0
editor.js
src/module/editor.js
+18
-1
layout.js
src/module/layout.js
+6
-0
dropmenu.js
src/ui/dropmenu.js
+9
-4
No files found.
src/adapter/contextmenu.js
View file @
9bd882c3
KM
.
registerUI
(
'contextmenu'
,
function
()
{
KM
.
registerUI
(
'contextmenu'
,
function
()
{
var
me
=
this
;
var
me
=
this
;
function
getItemByLabel
(
label
){
var
result
;
utils
.
each
(
me
.
getContextmenu
(),
function
(
i
,
item
){
if
(
item
.
label
==
label
){
result
=
item
;
return
false
;
}
});
return
result
;
}
var
$menu
=
$
.
kmuidropmenu
({
var
$menu
=
$
.
kmuidropmenu
({
click
:
function
(
e
,
v
){
click
:
function
(
e
,
v
,
l
){
me
.
execCommand
(
v
);
var
item
=
getItemByLabel
(
l
);
if
(
item
.
exec
){
item
.
exec
.
apply
(
km
)
}
else
{
me
.
execCommand
(
item
.
cmdName
);
}
this
.
hide
();
this
.
hide
();
}
}
});
});
...
@@ -10,23 +30,23 @@ KM.registerUI( 'contextmenu', function () {
...
@@ -10,23 +30,23 @@ KM.registerUI( 'contextmenu', function () {
me
.
on
(
'contextmenu'
,
function
(
e
){
me
.
on
(
'contextmenu'
,
function
(
e
){
var
items
=
me
.
getContextmenu
();
var
items
=
me
.
getContextmenu
();
var
data
=
[];
var
data
=
[];
utils
.
each
(
items
,
function
(
i
,
item
){
utils
.
each
(
items
,
function
(
i
,
item
){
if
(
me
.
queryCommandState
(
item
.
cmdName
)
!=-
1
){
if
(
me
.
queryCommandState
(
item
.
cmdName
)
!=-
1
){
data
.
push
({
data
.
push
({
label
:
item
.
label
,
label
:
item
.
label
,
value
:
item
.
cmdName
value
:
item
.
cmdName
})
})
}
}
});
});
if
(
data
.
length
){
if
(
data
.
length
){
var
offset
=
e
.
getPosition
();
$menu
.
kmui
().
setData
({
$menu
.
kmui
().
setData
({
data
:
data
data
:
data
}).
position
({
}).
position
(
e
.
getPosition
()).
show
();
left
:
offset
.
x
,
top
:
offset
.
y
}).
show
();
e
.
preventDefault
()
e
.
preventDefault
()
}
}
...
@@ -34,7 +54,6 @@ KM.registerUI( 'contextmenu', function () {
...
@@ -34,7 +54,6 @@ KM.registerUI( 'contextmenu', function () {
me
.
on
(
'click'
,
function
(){
me
.
on
(
'click'
,
function
(){
$menu
.
kmui
().
hide
();
$menu
.
kmui
().
hide
();
});
});
me
.
on
(
'beforemousedown'
,
function
(
e
){
me
.
on
(
'beforemousedown'
,
function
(
e
){
var
isRightMB
;
var
isRightMB
;
...
...
src/adapter/layout.js
View file @
9bd882c3
...
@@ -42,5 +42,18 @@ KM.registerToolbarUI( 'switchlayout', function ( name ) {
...
@@ -42,5 +42,18 @@ KM.registerToolbarUI( 'switchlayout', function ( name ) {
comboboxWidget
.
selectItemByLabel
(
value
);
comboboxWidget
.
selectItemByLabel
(
value
);
}
}
}
);
}
);
var
data
=
[];
utils
.
each
(
me
.
getLayoutStyleItems
(),
function
(
i
,
v
){
data
.
push
({
label
:
me
.
getLang
(
'tooltips.'
+
name
)
+
' '
+
v
,
cmdName
:
'switchlayout'
,
exec
:
function
(){
me
.
execCommand
(
'switchlayout'
,
v
);
}
})
});
me
.
addContextmenu
(
data
);
return
comboboxWidget
.
button
().
addClass
(
'kmui-combobox'
);
return
comboboxWidget
.
button
().
addClass
(
'kmui-combobox'
);
}
);
}
);
\ No newline at end of file
src/module/editor.js
View file @
9bd882c3
...
@@ -27,6 +27,18 @@ KityMinder.registerModule( "TextEditModule", function () {
...
@@ -27,6 +27,18 @@ KityMinder.registerModule( "TextEditModule", function () {
},
},
"events"
:
{
"events"
:
{
'beforemousedown'
:
function
(
e
){
'beforemousedown'
:
function
(
e
){
var
isRightMB
;
if
(
"which"
in
e
.
originEvent
)
// Gecko (Firefox), WebKit (Safari/Chrome) & Opera
isRightMB
=
e
.
originEvent
.
which
==
3
;
else
if
(
"button"
in
e
.
originEvent
)
// IE, Opera
isRightMB
=
e
.
originEvent
.
button
==
2
;
if
(
isRightMB
){
e
.
stopPropagationImmediately
();
return
;
}
sel
.
setHide
();
sel
.
setHide
();
var
node
=
e
.
getTargetNode
();
var
node
=
e
.
getTargetNode
();
if
(
!
node
){
if
(
!
node
){
...
@@ -68,7 +80,12 @@ KityMinder.registerModule( "TextEditModule", function () {
...
@@ -68,7 +80,12 @@ KityMinder.registerModule( "TextEditModule", function () {
'mouseup'
:
function
(
e
){
'mouseup'
:
function
(
e
){
if
(
mouseDownStatus
){
if
(
mouseDownStatus
){
if
(
!
sel
.
collapsed
){
if
(
!
sel
.
collapsed
){
receiver
.
updateRange
(
range
)
try
{
receiver
.
updateRange
(
range
)
}
catch
(
e
){
debugger
}
}
else
}
else
sel
.
setShow
()
sel
.
setShow
()
}
}
...
...
src/module/layout.js
View file @
9bd882c3
...
@@ -205,10 +205,16 @@ KityMinder.registerModule( "LayoutModule", function () {
...
@@ -205,10 +205,16 @@ KityMinder.registerModule( "LayoutModule", function () {
'contextmenu'
:[
'contextmenu'
:[
{
{
label
:
this
.
getLang
(
'node.appendsiblingnode'
),
label
:
this
.
getLang
(
'node.appendsiblingnode'
),
exec
:
function
(){
this
.
execCommand
(
'appendsiblingnode'
,
new
MinderNode
(
this
.
getLang
(
'topic'
)))
},
cmdName
:
'appendsiblingnode'
cmdName
:
'appendsiblingnode'
},
},
{
{
label
:
this
.
getLang
(
'node.appendchildnode'
),
label
:
this
.
getLang
(
'node.appendchildnode'
),
exec
:
function
(){
this
.
execCommand
(
'appendchildnode'
,
new
MinderNode
(
this
.
getLang
(
'topic'
)))
},
cmdName
:
'appendchildnode'
cmdName
:
'appendchildnode'
},
},
{
{
...
...
src/ui/dropmenu.js
View file @
9bd882c3
...
@@ -5,7 +5,7 @@ KM.ui.define('dropmenu', {
...
@@ -5,7 +5,7 @@ KM.ui.define('dropmenu', {
'</ul>'
,
'</ul>'
,
subTmpl
:
'<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>'
+
subTmpl
:
'<%if(data && data.length){for(var i=0,ci;ci=data[i++];){%>'
+
'<%if(ci.divider){%><li class="kmui-divider"></li><%}else{%>'
+
'<%if(ci.divider){%><li class="kmui-divider"></li><%}else{%>'
+
'<li <%if(ci.active||ci.disabled){%>class="<%= ci.active||
\'\'
%> <%=ci.disabled||
\'\'
%>" <%}%> data-value="<%= ci.value%>">'
+
'<li <%if(ci.active||ci.disabled){%>class="<%= ci.active||
\'\'
%> <%=ci.disabled||
\'\'
%>" <%}%> data-value="<%= ci.value%>"
data-label="<%= ci.label%>"
>'
+
'<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= ci.label%></a>'
+
'<a href="#" tabindex="-1"><em class="kmui-dropmenu-checkbox"><i class="kmui-icon-ok"></i></em><%= ci.label%></a>'
+
'</li><%}}%>'
+
'</li><%}}%>'
+
'<%}%>'
,
'<%}%>'
,
...
@@ -15,11 +15,16 @@ KM.ui.define('dropmenu', {
...
@@ -15,11 +15,16 @@ KM.ui.define('dropmenu', {
}
}
},
},
setData
:
function
(
items
){
setData
:
function
(
items
){
this
.
root
().
html
(
$
.
parseTmpl
(
this
.
subTmpl
,
items
));
this
.
root
().
html
(
$
.
parseTmpl
(
this
.
subTmpl
,
items
))
return
this
;
return
this
;
},
},
position
:
function
(
offset
){
position
:
function
(
offset
){
this
.
root
().
offset
(
offset
);
this
.
root
().
css
({
left
:
offset
.
x
,
top
:
offset
.
y
});
return
this
;
return
this
;
},
},
show
:
function
(){
show
:
function
(){
...
@@ -40,7 +45,7 @@ KM.ui.define('dropmenu', {
...
@@ -40,7 +45,7 @@ KM.ui.define('dropmenu', {
};
};
this
.
root
(
$
(
$
.
parseTmpl
(
this
.
tmpl
,
options
))).
on
(
'click'
,
'li[class!="kmui-disabled kmui-divider kmui-dropdown-submenu"]'
,
function
(
evt
)
{
this
.
root
(
$
(
$
.
parseTmpl
(
this
.
tmpl
,
options
))).
on
(
'click'
,
'li[class!="kmui-disabled kmui-divider kmui-dropdown-submenu"]'
,
function
(
evt
)
{
$
.
proxy
(
options
.
click
,
me
,
evt
,
$
(
this
).
data
(
'value'
),
$
(
this
))()
$
.
proxy
(
options
.
click
,
me
,
evt
,
$
(
this
).
data
(
'value'
),
$
(
this
)
.
data
(
'label'
),
$
(
this
)
)()
}).
find
(
'li'
).
each
(
function
(
i
,
el
)
{
}).
find
(
'li'
).
each
(
function
(
i
,
el
)
{
var
$this
=
$
(
this
);
var
$this
=
$
(
this
);
if
(
!
$this
.
hasClass
(
"kmui-disabled kmui-divider kmui-dropdown-submenu"
))
{
if
(
!
$this
.
hasClass
(
"kmui-disabled kmui-divider kmui-dropdown-submenu"
))
{
...
...
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