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
bde47fd0
Commit
bde47fd0
authored
May 08, 2014
by
techird
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
view bug fix
parent
91eb21d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
29 deletions
+52
-29
kity
kity
+1
-1
social.js
social/social.js
+44
-23
view.js
src/module/view.js
+7
-5
No files found.
kity
@
84b8e320
Subproject commit
afbb101c5b3d7518080bac3886f16043a482b7c9
Subproject commit
84b8e320dc03c3070607d20c7a5f354168d48181
social/social.js
View file @
bde47fd0
...
@@ -79,7 +79,7 @@ $( function () {
...
@@ -79,7 +79,7 @@ $( function () {
minder
=
window
.
km
,
minder
=
window
.
km
,
// 草稿箱实例
// 草稿箱实例
draftManager
=
window
.
draftManager
||
(
window
.
draftManager
=
new
window
.
DraftManager
(
minder
)
)
,
draftManager
,
// 当前是否要检测文档内容是否变化的开关
// 当前是否要检测文档内容是否变化的开关
watchingChanges
=
true
,
watchingChanges
=
true
,
...
@@ -99,8 +99,8 @@ $( function () {
...
@@ -99,8 +99,8 @@ $( function () {
loadShare
();
loadShare
();
bindShortCuts
();
bindShortCuts
();
bindDraft
();
bindDraft
();
watchChanges
();
draftManager
&&
watchChanges
();
if
(
!
loadPath
()
&&
!
isShareLink
)
loadDraft
(
0
);
if
(
draftManager
&&
!
loadPath
()
&&
!
isShareLink
)
loadDraft
(
0
);
}
}
// 创建 UI
// 创建 UI
...
@@ -159,14 +159,16 @@ $( function () {
...
@@ -159,14 +159,16 @@ $( function () {
},
30
);
},
30
);
}
);
}
);
var
clip
=
new
window
.
ZeroClipboard
(
$copy_url_btn
,
{
if
(
window
.
ZeroClipboard
)
{
hoverClass
:
'hover'
,
var
clip
=
new
window
.
ZeroClipboard
(
$copy_url_btn
,
{
activeClass
:
'active'
hoverClass
:
'hover'
,
}
);
activeClass
:
'active'
clip
.
on
(
'dataRequested'
,
function
(
client
,
args
)
{
}
);
$copy_url_btn
.
loading
(
'已复制'
);
clip
.
on
(
'dataRequested'
,
function
(
client
,
args
)
{
clearTimeout
(
copyTrickTimer
);
$copy_url_btn
.
loading
(
'已复制'
);
}
);
clearTimeout
(
copyTrickTimer
);
}
);
}
}
}
// 初始化云平台 frontia
// 初始化云平台 frontia
...
@@ -207,11 +209,16 @@ $( function () {
...
@@ -207,11 +209,16 @@ $( function () {
$share_btn
.
loading
(
false
);
$share_btn
.
loading
(
false
);
return
notice
(
'加载分享内容失败!请确认分享链接正确。'
);
return
notice
(
'加载分享内容失败!请确认分享链接正确。'
);
}
}
var
draft
=
draftManager
.
openByPath
(
'share/'
+
shareId
);
if
(
draft
)
{
if
(
draftManager
)
{
draftManager
.
load
();
var
draft
=
draftManager
.
openByPath
(
'share/'
+
shareId
);
if
(
draft
)
{
draftManager
.
load
();
}
else
{
draftManager
.
create
(
'share/'
+
shareId
);
minder
.
importData
(
ret
.
result
[
0
].
obj
.
shareMinder
.
data
,
'json'
);
}
}
else
{
}
else
{
draftManager
.
create
(
'share/'
+
shareId
);
minder
.
importData
(
ret
.
result
[
0
].
obj
.
shareMinder
.
data
,
'json'
);
minder
.
importData
(
ret
.
result
[
0
].
obj
.
shareMinder
.
data
,
'json'
);
}
}
setRemotePath
(
null
,
false
);
setRemotePath
(
null
,
false
);
...
@@ -537,11 +544,14 @@ $( function () {
...
@@ -537,11 +544,14 @@ $( function () {
minder
.
importData
(
data
,
format
);
minder
.
importData
(
data
,
format
);
if
(
!
draftManager
.
openByPath
(
remotePath
)
)
{
if
(
draftManager
)
{
draftManager
.
create
();
if
(
!
draftManager
.
openByPath
(
remotePath
)
)
{
draftManager
.
create
();
}
draftManager
.
save
(
remotePath
);
draftManager
.
sync
();
}
}
draftManager
.
save
(
remotePath
);
draftManager
.
sync
();
minder
.
execCommand
(
'camera'
,
minder
.
getRoot
()
);
minder
.
execCommand
(
'camera'
,
minder
.
getRoot
()
);
$user_btn
.
loading
(
false
).
text
(
getFileName
(
remotePath
)
);
$user_btn
.
loading
(
false
).
text
(
getFileName
(
remotePath
)
);
...
@@ -570,13 +580,13 @@ $( function () {
...
@@ -570,13 +580,13 @@ $( function () {
// 点击文件菜单
// 点击文件菜单
function
openFile
(
e
)
{
function
openFile
(
e
)
{
var
path
=
$
(
this
).
data
(
'value'
);
var
path
=
$
(
this
).
data
(
'value'
);
var
draft
=
draftManager
.
getCurrent
();
var
draft
=
draftManager
&&
draftManager
.
getCurrent
();
if
(
draft
&&
draft
.
path
==
path
)
{
if
(
draft
&&
draft
.
path
==
path
)
{
if
(
!
draft
.
sync
&&
window
.
confirm
(
'“'
+
getFileName
(
path
)
+
'”在草稿箱包含未保存的更改,确定加载网盘版本覆盖草稿箱中的版本吗?'
)
)
{
if
(
!
draft
.
sync
&&
window
.
confirm
(
'“'
+
getFileName
(
path
)
+
'”在草稿箱包含未保存的更改,确定加载网盘版本覆盖草稿箱中的版本吗?'
)
)
{
setRemotePath
(
path
,
true
);
setRemotePath
(
path
,
true
);
loadRemote
();
loadRemote
();
}
}
}
else
{
}
else
if
(
draftManager
)
{
draft
=
draftManager
.
openByPath
(
path
);
draft
=
draftManager
.
openByPath
(
path
);
setRemotePath
(
path
,
!
draft
||
draft
.
sync
);
setRemotePath
(
path
,
!
draft
||
draft
.
sync
);
if
(
draft
)
{
if
(
draft
)
{
...
@@ -586,6 +596,9 @@ $( function () {
...
@@ -586,6 +596,9 @@ $( function () {
}
else
{
}
else
{
loadRemote
();
loadRemote
();
}
}
}
else
{
setRemotePath
(
path
,
true
);
loadRemote
();
}
}
}
}
...
@@ -625,8 +638,10 @@ $( function () {
...
@@ -625,8 +638,10 @@ $( function () {
addToRecentMenu
(
[
savedFile
]
);
addToRecentMenu
(
[
savedFile
]
);
}
}
setRemotePath
(
savedFile
.
path
,
true
);
setRemotePath
(
savedFile
.
path
,
true
);
draftManager
.
save
(
remotePath
);
if
(
draftManager
)
{
draftManager
.
sync
();
draftManager
.
save
(
remotePath
);
draftManager
.
sync
();
}
clearTimeout
(
timeout
);
clearTimeout
(
timeout
);
}
else
{
}
else
{
error
(
'保存到云盘失败,可能是网络问题导致!'
);
error
(
'保存到云盘失败,可能是网络问题导致!'
);
...
@@ -751,6 +766,12 @@ $( function () {
...
@@ -751,6 +766,12 @@ $( function () {
}
}
function
bindDraft
()
{
function
bindDraft
()
{
if
(
!
draftManager
)
{
if
(
window
.
DraftManager
)
{
draftManager
=
new
window
.
DraftManager
(
minder
);
}
}
$draft_menu
.
delegate
(
'a.delete'
,
'click'
,
function
(
e
)
{
$draft_menu
.
delegate
(
'a.delete'
,
'click'
,
function
(
e
)
{
var
$li
=
$
(
this
).
closest
(
'li.draft-item'
);
var
$li
=
$
(
this
).
closest
(
'li.draft-item'
);
draftManager
.
remove
(
+
$li
.
data
(
'draft-index'
)
);
draftManager
.
remove
(
+
$li
.
data
(
'draft-index'
)
);
...
...
src/module/view.js
View file @
bde47fd0
...
@@ -27,13 +27,14 @@ var ViewDragger = kity.createClass( "ViewDragger", {
...
@@ -27,13 +27,14 @@ var ViewDragger = kity.createClass( "ViewDragger", {
lastPosition
=
null
,
lastPosition
=
null
,
currentPosition
=
null
;
currentPosition
=
null
;
this
.
_minder
.
on
(
'normal.beforemousedown readonly.beforemousedown'
,
function
(
e
)
{
this
.
_minder
.
on
(
'normal.beforemousedown readonly.beforemousedown
readonly.beforetouchstart
'
,
function
(
e
)
{
// 点击未选中的根节点临时开启
// 点击未选中的根节点临时开启
if
(
e
.
getTargetNode
()
==
this
.
getRoot
()
&&
if
(
e
.
getTargetNode
()
==
this
.
getRoot
()
&&
(
!
this
.
getRoot
().
isSelected
()
||
!
this
.
isSingleSelect
()
)
)
{
(
!
this
.
getRoot
().
isSelected
()
||
!
this
.
isSingleSelect
()
)
)
{
lastPosition
=
e
.
getPosition
();
lastPosition
=
e
.
getPosition
();
dragger
.
setEnabled
(
true
);
dragger
.
setEnabled
(
true
);
isRootDrag
=
true
;
isRootDrag
=
true
;
e
.
originEvent
.
preventDefault
();
var
me
=
this
;
var
me
=
this
;
setTimeout
(
function
()
{
setTimeout
(
function
()
{
me
.
setStatus
(
'hand'
);
me
.
setStatus
(
'hand'
);
...
@@ -41,16 +42,15 @@ var ViewDragger = kity.createClass( "ViewDragger", {
...
@@ -41,16 +42,15 @@ var ViewDragger = kity.createClass( "ViewDragger", {
}
}
}
)
}
)
.
on
(
'hand.beforemousedown'
,
function
(
e
)
{
.
on
(
'hand.beforemousedown
hand.beforetouchend
'
,
function
(
e
)
{
// 已经被用户打开拖放模式
// 已经被用户打开拖放模式
if
(
dragger
.
isEnabled
()
)
{
if
(
dragger
.
isEnabled
()
)
{
lastPosition
=
e
.
getPosition
();
lastPosition
=
e
.
getPosition
();
e
.
stopPropagation
();
e
.
stopPropagation
();
e
.
originEvent
.
preventDefault
();
}
}
}
)
}
)
.
on
(
'hand.beforemousemove'
,
function
(
e
)
{
.
on
(
'hand.beforemousemove
hand.beforetouchmove
'
,
function
(
e
)
{
if
(
lastPosition
)
{
if
(
lastPosition
)
{
currentPosition
=
e
.
getPosition
();
currentPosition
=
e
.
getPosition
();
...
@@ -58,6 +58,8 @@ var ViewDragger = kity.createClass( "ViewDragger", {
...
@@ -58,6 +58,8 @@ var ViewDragger = kity.createClass( "ViewDragger", {
var
offset
=
kity
.
Vector
.
fromPoints
(
lastPosition
,
currentPosition
);
var
offset
=
kity
.
Vector
.
fromPoints
(
lastPosition
,
currentPosition
);
dragger
.
move
(
offset
);
dragger
.
move
(
offset
);
e
.
stopPropagation
();
e
.
stopPropagation
();
e
.
preventDefault
();
e
.
originEvent
.
preventDefault
();
lastPosition
=
currentPosition
;
lastPosition
=
currentPosition
;
}
}
}
)
}
)
...
@@ -102,7 +104,7 @@ KityMinder.registerModule( 'View', function () {
...
@@ -102,7 +104,7 @@ KityMinder.registerModule( 'View', function () {
base
:
Command
,
base
:
Command
,
execute
:
function
(
km
,
focusNode
)
{
execute
:
function
(
km
,
focusNode
)
{
var
viewport
=
km
.
getPaper
().
getViewPort
();
var
viewport
=
km
.
getPaper
().
getViewPort
();
var
offset
=
focusNode
.
getRenderContainer
().
getRenderBox
(
'
paper
'
);
var
offset
=
focusNode
.
getRenderContainer
().
getRenderBox
(
'
view
'
);
var
dx
=
viewport
.
center
.
x
-
offset
.
x
-
offset
.
width
/
2
,
var
dx
=
viewport
.
center
.
x
-
offset
.
x
-
offset
.
width
/
2
,
dy
=
viewport
.
center
.
y
-
offset
.
y
;
dy
=
viewport
.
center
.
y
-
offset
.
y
;
km
.
getRenderContainer
().
fxTranslate
(
dx
,
dy
,
1000
,
"easeOutQuint"
);
km
.
getRenderContainer
().
fxTranslate
(
dx
,
dy
,
1000
,
"easeOutQuint"
);
...
...
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