Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
7b71afd2
Commit
7b71afd2
authored
Nov 15, 2016
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug 33377
add copy comments with move range
parent
23e9cd4f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
67 deletions
+77
-67
cell/model/CellComment.js
cell/model/CellComment.js
+61
-51
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+16
-16
No files found.
cell/model/CellComment.js
View file @
7b71afd2
...
...
@@ -357,40 +357,45 @@ asc_CCommentData.prototype = {
}
};
function
CompositeCommentData
()
{
this
.
commentBefore
=
null
;
this
.
commentAfter
=
null
;
function
CompositeCommentData
()
{
this
.
commentBefore
=
null
;
this
.
commentAfter
=
null
;
this
.
Properties
=
{
commentBefore
:
0
,
commentAfter
:
1
};
}
CompositeCommentData
.
prototype
=
{
// For collaborative editing
getType
:
function
()
{
this
.
Properties
=
{
commentBefore
:
0
,
commentAfter
:
1
};
}
CompositeCommentData
.
prototype
.
getType
=
function
()
{
return
AscCommonExcel
.
UndoRedoDataTypes
.
CompositeCommentData
;
}
,
}
;
getProperties
:
function
()
{
CompositeCommentData
.
prototype
.
getProperties
=
function
()
{
return
this
.
Properties
;
}
,
}
;
getProperty
:
function
(
nType
)
{
CompositeCommentData
.
prototype
.
getProperty
=
function
(
nType
)
{
switch
(
nType
)
{
case
this
.
Properties
.
commentBefore
:
return
this
.
commentBefore
;
break
;
case
this
.
Properties
.
commentAfter
:
return
this
.
commentAfter
;
break
;
case
this
.
Properties
.
commentBefore
:
return
this
.
commentBefore
;
break
;
case
this
.
Properties
.
commentAfter
:
return
this
.
commentAfter
;
break
;
}
return
null
;
}
,
}
;
setProperty
:
function
(
nType
,
value
)
{
CompositeCommentData
.
prototype
.
setProperty
=
function
(
nType
,
value
)
{
switch
(
nType
)
{
case
this
.
Properties
.
commentBefore
:
this
.
commentBefore
=
value
;
break
;
case
this
.
Properties
.
commentAfter
:
this
.
commentAfter
=
value
;
break
;
case
this
.
Properties
.
commentBefore
:
this
.
commentBefore
=
value
;
break
;
case
this
.
Properties
.
commentAfter
:
this
.
commentAfter
=
value
;
break
;
}
}
};
};
/** @constructor */
function
CCellCommentator
(
currentSheet
)
{
...
...
@@ -419,7 +424,6 @@ CCellCommentator.sStartCommentId = 'comment_';
CCellCommentator
.
prototype
.
isViewerMode
=
function
()
{
return
this
.
worksheet
.
handlers
.
trigger
(
"
getViewerMode
"
);
};
CCellCommentator
.
prototype
.
isLockedComment
=
function
(
oComment
,
callbackFunc
)
{
var
objectGuid
=
oComment
.
asc_getId
();
if
(
objectGuid
)
{
...
...
@@ -454,37 +458,43 @@ CCellCommentator.prototype.isLockedComment = function(oComment, callbackFunc) {
}
};
CCellCommentator
.
prototype
.
moveRangeComments
=
function
(
rangeFrom
,
rangeTo
)
{
if
(
rangeFrom
&&
rangeTo
)
{
var
colOffset
=
rangeTo
.
c1
-
rangeFrom
.
c1
;
var
rowOffset
=
rangeTo
.
r1
-
rangeFrom
.
r1
;
this
.
model
.
workbook
.
handlers
.
trigger
(
"
asc_onHideComment
"
);
var
aComments
=
this
.
model
.
aComments
;
for
(
var
i
=
0
;
i
<
aComments
.
length
;
i
++
)
{
var
comment
=
aComments
[
i
];
if
(
rangeFrom
.
contains
(
comment
.
nCol
,
comment
.
nRow
))
{
CCellCommentator
.
prototype
.
moveRangeComments
=
function
(
rangeFrom
,
rangeTo
,
copy
)
{
if
(
rangeFrom
&&
rangeTo
)
{
var
colOffset
=
rangeTo
.
c1
-
rangeFrom
.
c1
;
var
rowOffset
=
rangeTo
.
r1
-
rangeFrom
.
r1
;
var
commentBefore
=
new
asc_CCommentData
(
comment
);
this
.
model
.
workbook
.
handlers
.
trigger
(
"
asc_onHideComment
"
);
var
aComments
=
this
.
model
.
aComments
;
comment
.
nCol
+=
colOffset
;
comment
.
nRow
+=
rowOffset
;
this
.
model
.
workbook
.
handlers
.
trigger
(
"
asc_onChangeCommentData
"
,
comment
.
asc_getId
(),
comment
);
var
commentAfter
=
new
asc_CCommentData
(
comment
);
var
compositeComment
=
new
CompositeCommentData
();
compositeComment
.
commentBefore
=
commentBefore
;
compositeComment
.
commentAfter
=
commentAfter
;
History
.
Create_NewPoint
();
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoComment
,
AscCH
.
historyitem_Comment_Change
,
this
.
model
.
getId
(),
null
,
compositeComment
);
for
(
var
i
=
0
;
i
<
aComments
.
length
;
i
++
)
{
var
comment
=
aComments
[
i
];
if
(
rangeFrom
.
contains
(
comment
.
nCol
,
comment
.
nRow
))
{
if
(
copy
)
{
var
newComment
=
new
asc_CCommentData
(
comment
);
newComment
.
nCol
+=
colOffset
;
newComment
.
nRow
+=
rowOffset
;
newComment
.
setId
();
this
.
addComment
(
newComment
,
true
);
}
else
{
var
commentBefore
=
new
asc_CCommentData
(
comment
);
comment
.
nCol
+=
colOffset
;
comment
.
nRow
+=
rowOffset
;
this
.
model
.
workbook
.
handlers
.
trigger
(
"
asc_onChangeCommentData
"
,
comment
.
asc_getId
(),
comment
);
var
commentAfter
=
new
asc_CCommentData
(
comment
);
var
compositeComment
=
new
CompositeCommentData
();
compositeComment
.
commentBefore
=
commentBefore
;
compositeComment
.
commentAfter
=
commentAfter
;
History
.
Create_NewPoint
();
History
.
Add
(
AscCommonExcel
.
g_oUndoRedoComment
,
AscCH
.
historyitem_Comment_Change
,
this
.
model
.
getId
(),
null
,
compositeComment
);
}
}
}
}
}
};
};
CCellCommentator
.
prototype
.
deleteCommentsRange
=
function
(
range
)
{
if
(
range
)
{
...
...
cell/view/WorksheetView.js
View file @
7b71afd2
...
...
@@ -8167,7 +8167,7 @@
x
*=
asc_getcvt
(
0
/*px*/
,
1
/*pt*/
,
this
.
_getPPIX
());
y
*=
asc_getcvt
(
0
/*px*/
,
1
/*pt*/
,
this
.
_getPPIY
());
var
ar
=
(
0
==
targetInfo
.
targetArr
?
this
.
arrActiveFormulaRanges
[
indexFormulaRange
]
:
this
.
arrActiveChartRanges
[
indexFormulaRange
]).
getLast
().
clone
();
this
.
arrActiveChartRanges
[
indexFormulaRange
]).
getLast
().
clone
();
// Колонка по X и строка по Y
var
colByX
=
this
.
_findColUnderCursor
(
x
,
/*canReturnNull*/
false
,
/*dX*/
false
).
col
;
...
...
@@ -8178,7 +8178,7 @@
if
((
targetInfo
.
cursor
==
kCurNEResize
||
targetInfo
.
cursor
==
kCurSEResize
))
{
this
.
startCellMoveResizeRange
=
ar
.
clone
(
true
);
this
.
startCellMoveResizeRange2
=
new
asc_Range
(
targetInfo
.
col
,
targetInfo
.
row
,
targetInfo
.
col
,
targetInfo
.
row
,
true
);
new
asc_Range
(
targetInfo
.
col
,
targetInfo
.
row
,
targetInfo
.
col
,
targetInfo
.
row
,
true
);
}
else
{
this
.
startCellMoveResizeRange
=
ar
.
clone
(
true
);
if
(
colByX
<
ar
.
c1
)
{
...
...
@@ -8319,21 +8319,21 @@
}
else
if
(
resmove
===
-
1
)
{
var
t
=
this
;
this
.
model
.
workbook
.
handlers
.
trigger
(
"
asc_onConfirmAction
"
,
Asc
.
c_oAscConfirm
.
ConfirmReplaceRange
,
function
(
can
)
{
if
(
can
)
{
t
.
moveRangeHandle
(
arnFrom
,
arnTo
,
ctrlKey
);
}
else
{
t
.
_cleanSelectionMoveRange
();
}
});
function
(
can
)
{
if
(
can
)
{
t
.
moveRangeHandle
(
arnFrom
,
arnTo
,
ctrlKey
);
}
else
{
t
.
_cleanSelectionMoveRange
();
}
});
}
else
{
this
.
moveRangeHandle
(
arnFrom
,
arnTo
,
ctrlKey
);
}
};
WorksheetView
.
prototype
.
applyMoveResizeRangeHandle
=
function
(
target
)
{
if
(
-
1
==
target
.
targetArr
&&
!
this
.
startCellMoveResizeRange
.
isEqual
(
this
.
moveRangeDrawingObjectTo
)
)
{
this
.
objectRender
.
moveRangeDrawingObject
(
this
.
startCellMoveResizeRange
,
this
.
moveRangeDrawingObjectTo
);
WorksheetView
.
prototype
.
applyMoveResizeRangeHandle
=
function
(
target
)
{
if
(
-
1
==
target
.
targetArr
&&
!
this
.
startCellMoveResizeRange
.
isEqual
(
this
.
moveRangeDrawingObjectTo
)
)
{
this
.
objectRender
.
moveRangeDrawingObject
(
this
.
startCellMoveResizeRange
,
this
.
moveRangeDrawingObjectTo
);
}
this
.
startCellMoveResizeRange
=
null
;
...
...
@@ -8367,7 +8367,7 @@
t
.
model
.
autoFilters
.
_preMoveAutoFilters
(
arnFrom
,
arnTo
,
copyRange
);
t
.
model
.
_moveRange
(
arnFrom
,
arnTo
,
copyRange
);
t
.
cellCommentator
.
moveRangeComments
(
arnFrom
,
arnTo
);
t
.
cellCommentator
.
moveRangeComments
(
arnFrom
,
arnTo
,
copyRange
);
t
.
objectRender
.
moveRangeDrawingObject
(
arnFrom
,
arnTo
);
// Вызываем функцию пересчета для заголовков форматированной таблицы
...
...
@@ -8392,15 +8392,15 @@
t
.
_updateSelectionNameAndInfo
();
if
(
null
!==
t
.
model
.
getRange3
(
arnTo
.
r1
,
arnTo
.
c1
,
arnTo
.
r2
,
arnTo
.
c2
).
hasMerged
()
&&
false
!==
t
.
model
.
autoFilters
.
_intersectionRangeWithTableParts
(
arnTo
))
{
false
!==
t
.
model
.
autoFilters
.
_intersectionRangeWithTableParts
(
arnTo
))
{
t
.
model
.
autoFilters
.
unmergeTablesAfterMove
(
arnTo
);
t
.
_updateCellsRange
(
arnTo
,
false
,
true
);
t
.
_recalculateAfterUpdate
([
arnFrom
,
arnTo
]);
//не делаем действий в asc_onConfirmAction, потому что во время диалога может выполниться autosave и новые измения добавятся в точку, которую уже отправили
//тем более результат диалога ни на что не влияет
t
.
model
.
workbook
.
handlers
.
trigger
(
"
asc_onConfirmAction
"
,
Asc
.
c_oAscConfirm
.
ConfirmPutMergeRange
,
function
()
{
});
function
()
{
});
}
};
...
...
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