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
06920d1e
Commit
06920d1e
authored
Nov 17, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xss protection
parent
35145a18
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
4 deletions
+21
-4
note.js
ui/ribbon/idea/note.js
+21
-4
No files found.
ui/ribbon/idea/note.js
View file @
06920d1e
...
...
@@ -6,8 +6,13 @@
* @author: techird
* @copyright: Baidu FEX, 2014
*/
/* global marked: true */
KityMinder
.
registerUI
(
'ribbon/idea/note'
,
function
(
minder
)
{
marked
.
setOptions
({
breaks
:
true
});
var
$attachment
=
minder
.
getUI
(
'ribbon/idea/attachment'
);
var
$noteButtonMenu
=
new
FUI
.
ButtonMenu
({
...
...
@@ -58,11 +63,23 @@ KityMinder.registerUI('ribbon/idea/note', function(minder) {
minder
.
on
(
'uiready'
,
function
()
{
editor
.
setSize
(
'100%'
,
'100%'
);
})
})
;
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
();
...
...
@@ -114,7 +131,7 @@ KityMinder.registerUI('ribbon/idea/note', function(minder) {
var
b
=
icon
.
getRenderBox
(
'screen'
);
var
note
=
node
.
getData
(
'note'
);
$previewer
.
html
(
marked
(
note
));
$previewer
.
html
(
marked
(
axss
(
note
)
));
var
cw
=
$
(
'#content-wrapper'
).
width
();
var
ch
=
$
(
'#content-wrapper'
).
height
();
...
...
@@ -140,7 +157,7 @@ KityMinder.registerUI('ribbon/idea/note', function(minder) {
function
editMode
()
{
if
(
$editTab
.
hasClass
(
activeTabClass
))
return
;
$preview
.
hide
()
$preview
.
hide
()
;
$previewTab
.
removeClass
(
activeTabClass
);
$editor
.
show
().
addClass
(
activeTabClass
);
...
...
@@ -152,7 +169,7 @@ KityMinder.registerUI('ribbon/idea/note', function(minder) {
$editor
.
hide
();
$editTab
.
removeClass
(
activeTabClass
);
$preview
.
html
(
marked
(
editor
.
getValue
(
))).
show
();
$preview
.
html
(
marked
(
axss
(
editor
.
getValue
()
))).
show
();
$previewTab
.
addClass
(
activeTabClass
);
}
...
...
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