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
97a50d3e
Commit
97a50d3e
authored
Nov 18, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分享页面备注查看支持
parent
64b8dbcf
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
94 additions
and
55 deletions
+94
-55
import.js
import.js
+2
-0
expand.js
src/module/expand.js
+2
-1
axss.js
ui/axss.js
+22
-0
contextmenu.js
ui/contextmenu.js
+4
-2
note.js
ui/ribbon/idea/note.js
+1
-52
notepreview.js
ui/ribbon/idea/notepreview.js
+63
-0
No files found.
import.js
View file @
97a50d3e
...
...
@@ -139,6 +139,7 @@
{
path
:
'ui/eve.js'
,
pack
:
'edit|share|m-share'
},
{
path
:
'ui/memory.js'
,
pack
:
'edit|share|m-share'
},
{
path
:
'ui/fuix.js'
,
pack
:
'edit|share|m-share'
},
{
path
:
'ui/axss.js'
,
pack
:
'edit|share|m-share'
},
{
path
:
'ui/fiox.js'
,
pack
:
'edit'
},
/* UI 组件 */
...
...
@@ -212,6 +213,7 @@
{
path
:
'ui/ribbon/idea/link.js'
,
pack
:
'edit'
},
{
path
:
'ui/ribbon/idea/image.js'
,
pack
:
'edit'
},
{
path
:
'ui/ribbon/idea/note.js'
,
pack
:
'edit'
},
{
path
:
'ui/ribbon/idea/notepreview.js'
,
pack
:
'edit|share'
},
{
path
:
'ui/ribbon/idea/priority.js'
,
pack
:
'edit'
},
{
path
:
'ui/ribbon/idea/progress.js'
,
pack
:
'edit'
},
{
path
:
'ui/ribbon/idea/resource.js'
,
pack
:
'edit'
},
...
...
src/module/expand.js
View file @
97a50d3e
...
...
@@ -72,7 +72,8 @@ KityMinder.registerModule('Expand', function() {
if
(
node
.
getLevel
()
==
level
)
node
.
collapse
();
});
km
.
refresh
(
100
);
}
},
enableReadOnly
:
true
});
var
Expander
=
kity
.
createClass
(
'Expander'
,
{
...
...
ui/axss.js
0 → 100644
View file @
97a50d3e
/**
* @fileOverview
*
* XSS Protection
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder
.
registerUI
(
'axss'
,
function
()
{
function
axss
(
value
)
{
var
div
=
document
.
createElement
(
'div'
);
div
.
innerHTML
=
value
;
$
(
div
).
find
(
'script, iframe, link'
).
remove
();
for
(
var
name
in
div
)
{
if
(
name
.
indexOf
(
'on'
)
===
0
)
{
div
.
removeAttribute
(
name
);
}
}
return
div
.
innerHTML
;
}
return
axss
;
});
\ No newline at end of file
ui/contextmenu.js
View file @
97a50d3e
...
...
@@ -66,8 +66,10 @@ KityMinder.registerUI('contextmenu', function(minder) {
var
lastDivider
=
true
;
ctxmenu
.
forEach
(
function
(
item
)
{
if
(
item
.
query
&&
!
item
.
query
())
return
;
if
(
item
.
command
&&
minder
.
queryCommandState
(
item
.
command
)
===
0
)
{
var
query
=
item
.
query
||
function
()
{
return
item
.
command
&&
minder
.
queryCommandState
(
item
.
command
)
===
0
;
};
if
(
query
())
{
var
label
=
minder
.
getLang
(
'ui.command.'
+
item
.
command
);
...
...
ui/ribbon/idea/note.js
View file @
97a50d3e
...
...
@@ -8,6 +8,7 @@
*/
/* global marked: true */
KityMinder
.
registerUI
(
'ribbon/idea/note'
,
function
(
minder
)
{
var
axss
=
minder
.
getUI
(
'axss'
);
marked
.
setOptions
({
gfm
:
true
,
...
...
@@ -48,8 +49,6 @@ KityMinder.registerUI('ribbon/idea/note', function(minder) {
var
$editor
=
$
(
'<div class="note-editor"></div>'
).
appendTo
(
$notePanel
);
var
$preview
=
$
(
'<div class="note-preview"></div>'
).
appendTo
(
$notePanel
);
var
$previewer
=
$
(
'<div id="note-previewer"></div>'
).
appendTo
(
'#content-wrapper'
);
var
noteVisible
=
false
;
$editor
.
on
(
'keydown keyup keypress mouedown mouseup click contextmenu'
,
function
(
e
)
{
...
...
@@ -69,18 +68,6 @@ KityMinder.registerUI('ribbon/idea/note', function(minder) {
var
visible
=
false
;
var
selectedNode
=
null
;
function
axss
(
value
)
{
var
div
=
document
.
createElement
(
'div'
);
div
.
innerHTML
=
value
;
$
(
div
).
find
(
'script'
).
remove
();
for
(
var
name
in
div
)
{
if
(
name
.
indexOf
(
'on'
)
===
0
)
{
div
.
removeAttribute
(
name
);
}
}
return
div
.
innerHTML
;
}
function
updateEditorView
()
{
if
(
noteVisible
&&
selectedNode
!=
minder
.
getSelectedNode
())
{
selectedNode
=
minder
.
getSelectedNode
();
...
...
@@ -112,48 +99,10 @@ KityMinder.registerUI('ribbon/idea/note', function(minder) {
$noteButtonMenu
.
bindCommandState
(
minder
,
'note'
);
$noteButtonMenu
.
on
(
'buttonclick'
,
show
);
minder
.
on
(
'editnoterequest'
,
show
);
minder
.
on
(
'shownoterequest'
,
preview
);
$
(
'#kityminder'
).
after
(
$notePanel
);
hide
();
var
previewLive
=
false
;
$
(
'#kityminder'
).
on
(
'mousedown mousewheel DOMMouseScroll'
,
function
()
{
if
(
!
previewLive
)
return
;
$previewer
.
fadeOut
();
previewLive
=
false
;
});
$previewer
.
hide
();
function
preview
(
e
)
{
var
icon
=
e
.
icon
;
var
node
=
e
.
node
;
var
b
=
icon
.
getRenderBox
(
'screen'
);
var
note
=
node
.
getData
(
'note'
);
$previewer
.
html
(
axss
(
marked
(
note
)));
var
cw
=
$
(
'#content-wrapper'
).
width
();
var
ch
=
$
(
'#content-wrapper'
).
height
();
var
pw
=
$previewer
.
outerWidth
();
var
ph
=
$previewer
.
outerHeight
();
var
x
=
b
.
cx
-
pw
/
2
;
var
y
=
b
.
bottom
+
10
;
if
(
x
<
0
)
x
=
10
;
if
(
x
+
pw
>
cw
)
x
=
cw
-
pw
-
10
;
if
(
y
+
ph
>
ch
)
y
=
b
.
top
-
ph
-
10
;
$previewer
.
css
({
left
:
Math
.
round
(
x
),
top
:
Math
.
round
(
y
)
});
$previewer
.
show
();
previewLive
=
true
;
}
var
activeTabClass
=
'active-tab'
;
function
editMode
()
{
...
...
ui/ribbon/idea/notepreview.js
0 → 100644
View file @
97a50d3e
/**
* @fileOverview
*
* 节点笔记支持
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
/* global marked: true */
KityMinder
.
registerUI
(
'ribbon/idea/note'
,
function
(
minder
)
{
var
axss
=
minder
.
getUI
(
'axss'
);
marked
.
setOptions
({
gfm
:
true
,
breaks
:
true
});
var
$previewer
=
$
(
'<div id="note-previewer"></div>'
).
appendTo
(
'#content-wrapper'
);
var
visible
=
false
;
var
selectedNode
=
null
;
minder
.
on
(
'shownoterequest'
,
preview
);
var
previewLive
=
false
;
$
(
'#kityminder'
).
on
(
'mousedown mousewheel DOMMouseScroll'
,
function
()
{
if
(
!
previewLive
)
return
;
$previewer
.
fadeOut
();
previewLive
=
false
;
});
$previewer
.
hide
();
function
preview
(
e
)
{
var
icon
=
e
.
icon
;
var
node
=
e
.
node
;
var
b
=
icon
.
getRenderBox
(
'screen'
);
var
note
=
node
.
getData
(
'note'
);
$previewer
[
0
].
scrollTop
=
0
;
$previewer
.
html
(
axss
(
marked
(
note
)));
var
cw
=
$
(
'#content-wrapper'
).
width
();
var
ch
=
$
(
'#content-wrapper'
).
height
();
var
pw
=
$previewer
.
outerWidth
();
var
ph
=
$previewer
.
outerHeight
();
var
x
=
b
.
cx
-
pw
/
2
;
var
y
=
b
.
bottom
+
10
;
if
(
x
<
0
)
x
=
10
;
if
(
x
+
pw
>
cw
)
x
=
cw
-
pw
-
10
;
if
(
y
+
ph
>
ch
)
y
=
b
.
top
-
ph
-
10
;
$previewer
.
css
({
left
:
Math
.
round
(
x
),
top
:
Math
.
round
(
y
)
});
$previewer
.
show
();
previewLive
=
true
;
}
});
\ 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