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
b1c5afa1
Commit
b1c5afa1
authored
Aug 08, 2017
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ability to view the original and final files for reviewing.
parent
7a3d838b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
123 additions
and
22 deletions
+123
-22
word/Editor/Document.js
word/Editor/Document.js
+78
-4
word/Editor/History.js
word/Editor/History.js
+37
-9
word/Private/TrackRevisions.js
word/Private/TrackRevisions.js
+6
-6
word/api.js
word/api.js
+2
-3
No files found.
word/Editor/Document.js
View file @
b1c5afa1
...
...
@@ -1548,6 +1548,11 @@ function CDocument(DrawingDocument, isMainLogicDocument)
// Нужно ли проверять тип лока у ContentControl при проверке залоченности выделенных объектов
this
.
CheckContentControlsLock
=
true
;
this
.
ViewModeInReview
=
{
mode
:
0
,
// -1 - исходный, 0 - со всеми изменениями, 1 - результат
isFastCollaboration
:
false
};
// Класс для работы со сносками
this
.
Footnotes
=
new
CFootnotesController
(
this
);
this
.
LogicDocumentController
=
new
CLogicDocumentController
(
this
);
...
...
@@ -6829,7 +6834,7 @@ CDocument.prototype.OnKeyDown = function(e)
}
else
if
(
e
.
KeyCode
==
83
&&
false
===
this
.
IsViewMode
()
&&
true
===
e
.
CtrlKey
)
// Ctrl + S - save
{
this
.
DrawingDocument
.
m_oWordControl
.
m_o
Api
.
asc_Save
(
false
);
this
.
Api
.
asc_Save
(
false
);
bRetValue
=
keydownresult_PreventAll
;
}
else
if
(
e
.
KeyCode
==
85
&&
true
===
e
.
CtrlKey
)
// Ctrl + U - делаем текст подчеркнутым
...
...
@@ -6890,17 +6895,38 @@ CDocument.prototype.OnKeyDown = function(e)
}
else
if
(
e
.
KeyCode
===
112
&&
true
===
e
.
ShiftKey
)
{
this
.
Api
.
asc_AddContentControl
(
AscCommonWord
.
sdttype_InlineLevel
);
if
(
true
===
e
.
CtrlKey
)
{
this
.
BeginViewModeInReview
(
true
);
}
else
{
this
.
Api
.
asc_AddContentControl
(
AscCommonWord
.
sdttype_InlineLevel
);
}
bRetValue
=
keydownresult_PreventAll
;
}
else
if
(
e
.
KeyCode
===
113
&&
true
===
e
.
ShiftKey
)
{
this
.
Api
.
asc_AddContentControl
(
AscCommonWord
.
sdttype_BlockLevel
);
if
(
true
===
e
.
CtrlKey
)
{
this
.
BeginViewModeInReview
(
false
);
}
else
{
this
.
Api
.
asc_AddContentControl
(
AscCommonWord
.
sdttype_BlockLevel
);
}
bRetValue
=
keydownresult_PreventAll
;
}
else
if
(
e
.
KeyCode
===
114
&&
true
===
e
.
ShiftKey
)
{
this
.
Api
.
asc_RemoveContentControl
();
if
(
true
===
e
.
CtrlKey
)
{
this
.
EndViewModeInReview
();
}
else
{
this
.
Api
.
asc_RemoveContentControl
();
}
bRetValue
=
keydownresult_PreventAll
;
}
else
if
(
e
.
KeyCode
===
115
&&
true
===
e
.
ShiftKey
)
...
...
@@ -15470,6 +15496,54 @@ CDocument.prototype.OnEndLoadScript = function()
arrParagraphs
[
nIndex
].
Recalc_RunsCompiledPr
();
}
};
CDocument
.
prototype
.
BeginViewModeInReview
=
function
(
isResult
)
{
if
(
0
!==
this
.
ViewModeInReview
.
mode
)
this
.
EndViewModeInReview
();
this
.
ViewModeInReview
.
mode
=
isResult
?
1
:
-
1
;
this
.
ViewModeInReview
.
isFastCollaboration
=
this
.
CollaborativeEditing
.
Is_Fast
();
this
.
CollaborativeEditing
.
Set_Fast
(
false
);
this
.
History
.
SaveRedoPoints
();
if
(
isResult
)
this
.
Accept_AllRevisionChanges
(
true
);
else
this
.
Reject_AllRevisionChanges
(
true
);
this
.
CollaborativeEditing
.
Set_GlobalLock
(
true
);
};
CDocument
.
prototype
.
EndViewModeInReview
=
function
()
{
if
(
0
===
this
.
ViewModeInReview
.
mode
)
return
;
this
.
ViewModeInReview
.
mode
=
0
;
this
.
CollaborativeEditing
.
Set_GlobalLock
(
false
);
this
.
Document_Undo
();
this
.
History
.
Clear_Redo
();
this
.
History
.
PopRedoPoints
();
if
(
this
.
ViewModeInReview
.
isFastCollaboration
)
this
.
CollaborativeEditing
.
Set_Fast
(
true
);
};
CDocument
.
prototype
.
StartCollaborationEditing
=
function
()
{
this
.
CollaborativeEditing
.
Start_CollaborationEditing
();
this
.
DrawingDocument
.
Start_CollaborationEditing
();
this
.
EndViewModeInReview
();
};
CDocument
.
prototype
.
EndCollaborationEditing
=
function
()
{
this
.
CollaborativeEditing
.
End_CollaborationEditing
();
};
CDocument
.
prototype
.
IsViewModeInReview
=
function
()
{
return
0
!==
this
.
ViewModeInReview
.
mode
?
true
:
false
;
};
function
CDocumentSelectionState
()
{
...
...
word/Editor/History.js
View file @
b1c5afa1
...
...
@@ -78,6 +78,8 @@ function CHistory(Document)
// Параметры для специального сохранения для локальной версии редактора
this
.
UserSaveMode
=
false
;
this
.
UserSavedIndex
=
null
;
// Номер точки, на которой произошло последнее сохранение пользователем (не автосохранение)
this
.
StoredData
=
[];
}
CHistory
.
prototype
=
...
...
@@ -844,17 +846,20 @@ CHistory.prototype =
}
},
Have_Changes
:
function
(
IsNotUserSave
)
{
var
checkIndex
=
(
this
.
Is_UserSaveMode
()
&&
!
IsNotUserSave
)
?
this
.
UserSavedIndex
:
this
.
SavedIndex
;
if
(
-
1
===
this
.
Index
&&
null
===
checkIndex
&&
false
===
this
.
ForceSave
)
return
false
;
Have_Changes
:
function
(
IsNotUserSave
)
{
if
(
this
.
Document
.
IsViewModeInReview
())
return
false
;
if
(
this
.
Index
!=
checkIndex
||
true
===
this
.
ForceSave
)
return
true
;
var
checkIndex
=
(
this
.
Is_UserSaveMode
()
&&
!
IsNotUserSave
)
?
this
.
UserSavedIndex
:
this
.
SavedIndex
;
if
(
-
1
===
this
.
Index
&&
null
===
checkIndex
&&
false
===
this
.
ForceSave
)
return
false
;
return
false
;
},
if
(
this
.
Index
!=
checkIndex
||
true
===
this
.
ForceSave
)
return
true
;
return
false
;
},
Get_RecalcData
:
function
(
RecalcData
,
arrChanges
)
{
...
...
@@ -1221,6 +1226,29 @@ CHistory.prototype.SetRecalculateIndex = function(nIndex)
{
this
.
RecIndex
=
Math
.
min
(
this
.
Index
,
nIndex
);
};
CHistory
.
prototype
.
SaveRedoPoints
=
function
()
{
var
arrData
=
[];
this
.
StoredData
.
push
(
arrData
);
for
(
var
nIndex
=
this
.
Index
+
1
,
nCount
=
this
.
Points
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
arrData
.
push
(
this
.
Points
[
nIndex
]);
}
};
CHistory
.
prototype
.
PopRedoPoints
=
function
()
{
if
(
this
.
StoredData
.
length
<=
0
)
return
;
var
arrPoints
=
this
.
StoredData
[
this
.
StoredData
.
length
-
1
];
this
.
Points
.
length
=
this
.
Index
+
1
;
for
(
var
nIndex
=
0
,
nCount
=
arrPoints
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
this
.
Points
[
this
.
Index
+
nIndex
+
1
]
=
arrPoints
[
nIndex
];
}
this
.
StoredData
.
length
=
this
.
StoredData
.
length
-
1
;
};
function
CRC32
()
{
...
...
word/Private/TrackRevisions.js
View file @
b1c5afa1
...
...
@@ -473,10 +473,10 @@ CDocument.prototype.RejectRevisionChangesBySelection = function()
this
.
Get_NextRevisionChange
();
};
CDocument
.
prototype
.
Accept_AllRevisionChanges
=
function
()
CDocument
.
prototype
.
Accept_AllRevisionChanges
=
function
(
isSkipCheckLock
)
{
var
RelatedParas
=
this
.
TrackRevisionsManager
.
Get_AllChangesRelatedParagraphs
(
true
);
if
(
false
===
this
.
Document_Is_SelectionLocked
(
AscCommon
.
changestype_None
,
{
Type
:
changestype_2_ElementsArray_and_Type
,
Elements
:
RelatedParas
,
CheckType
:
AscCommon
.
changestype_Paragraph_Content
}))
if
(
true
===
isSkipCheckLock
||
false
===
this
.
Document_Is_SelectionLocked
(
AscCommon
.
changestype_None
,
{
Type
:
changestype_2_ElementsArray_and_Type
,
Elements
:
RelatedParas
,
CheckType
:
AscCommon
.
changestype_Paragraph_Content
}))
{
this
.
Create_NewHistoryPoint
(
AscDFH
.
historydescription_Document_AcceptAllRevisionChanges
);
var
LogicDocuments
=
this
.
TrackRevisionsManager
.
Get_AllChangesLogicDocuments
();
...
...
@@ -489,7 +489,7 @@ CDocument.prototype.Accept_AllRevisionChanges = function()
}
}
if
(
true
===
this
.
History
.
Is_LastPointEmpty
())
if
(
true
!==
isSkipCheckLock
&&
true
===
this
.
History
.
Is_LastPointEmpty
())
{
this
.
History
.
Remove_LastPoint
();
return
;
...
...
@@ -502,10 +502,10 @@ CDocument.prototype.Accept_AllRevisionChanges = function()
this
.
Document_UpdateInterfaceState
();
}
};
CDocument
.
prototype
.
Reject_AllRevisionChanges
=
function
()
CDocument
.
prototype
.
Reject_AllRevisionChanges
=
function
(
isSkipCheckLock
)
{
var
RelatedParas
=
this
.
TrackRevisionsManager
.
Get_AllChangesRelatedParagraphs
(
false
);
if
(
false
===
this
.
Document_Is_SelectionLocked
(
AscCommon
.
changestype_None
,
{
Type
:
changestype_2_ElementsArray_and_Type
,
Elements
:
RelatedParas
,
CheckType
:
AscCommon
.
changestype_Paragraph_Content
}))
if
(
true
===
isSkipCheckLock
||
false
===
this
.
Document_Is_SelectionLocked
(
AscCommon
.
changestype_None
,
{
Type
:
changestype_2_ElementsArray_and_Type
,
Elements
:
RelatedParas
,
CheckType
:
AscCommon
.
changestype_Paragraph_Content
}))
{
this
.
Create_NewHistoryPoint
(
AscDFH
.
historydescription_Document_RejectAllRevisionChanges
);
var
LogicDocuments
=
this
.
TrackRevisionsManager
.
Get_AllChangesLogicDocuments
();
...
...
@@ -518,7 +518,7 @@ CDocument.prototype.Reject_AllRevisionChanges = function()
}
}
if
(
true
===
this
.
History
.
Is_LastPointEmpty
())
if
(
true
!==
isSkipCheckLock
&&
true
===
this
.
History
.
Is_LastPointEmpty
())
{
this
.
History
.
Remove_LastPoint
();
return
;
...
...
word/api.js
View file @
b1c5afa1
...
...
@@ -1467,9 +1467,8 @@ background-repeat: no-repeat;\
}
if
(
t
.
ParcedDocument
)
{
if
(
isStartEvent
)
{
AscCommon
.
CollaborativeEditing
.
Start_
CollaborationEditing
();
t
.
WordControl
.
m_oLogicDocument
.
Start
CollaborationEditing
();
t
.
asc_setDrawCollaborationMarks
(
true
);
t
.
WordControl
.
m_oLogicDocument
.
DrawingDocument
.
Start_CollaborationEditing
();
if
(
window
[
'
AscCommon
'
].
g_clipboardBase
&&
AscCommon
.
CollaborativeEditing
.
m_bFast
){
window
[
'
AscCommon
'
].
g_clipboardBase
.
SpecialPasteButton_Hide
();
}
...
...
@@ -1491,7 +1490,7 @@ background-repeat: no-repeat;\
if
(
t
.
canUnlockDocument
)
{
t
.
canStartCoAuthoring
=
false
;
}
else
{
AscCommon
.
CollaborativeEditing
.
End_
CollaborationEditing
();
t
.
WordControl
.
m_oLogicDocument
.
End
CollaborationEditing
();
t
.
asc_setDrawCollaborationMarks
(
false
);
}
};
...
...
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