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
8df37c07
Commit
8df37c07
authored
Oct 10, 2016
by
Alexey.Musinov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mobile-coautoring
parent
98c98d5b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
195 additions
and
60 deletions
+195
-60
cell/native/Graphics.js
cell/native/Graphics.js
+1
-1
cell/native/Overlay.js
cell/native/Overlay.js
+3
-3
cell/native/native.js
cell/native/native.js
+169
-36
common/editorscommon.js
common/editorscommon.js
+22
-20
No files found.
cell/native/Graphics.js
View file @
8df37c07
cell/native/Overlay.js
View file @
8df37c07
...
@@ -677,10 +677,10 @@ CAutoshapeTrack.prototype =
...
@@ -677,10 +677,10 @@ CAutoshapeTrack.prototype =
{
{
this
.
Native
[
"
PD_reset
"
]();
this
.
Native
[
"
PD_reset
"
]();
},
},
transform3
:
function
(
m
)
transform3
:
function
(
m
,
isNeedInvert
,
funcName
)
{
{
var
isNeedInvert
=
false
;
var
isNeedInvert
=
false
;
this
.
Native
[
"
PD_transform3
"
](
m
.
sx
,
m
.
shy
,
m
.
shx
,
m
.
sy
,
m
.
tx
,
m
.
ty
,
isNeedInvert
);
this
.
Native
[
funcName
?
funcName
:
"
PD_transform3
"
](
m
.
sx
,
m
.
shy
,
m
.
shx
,
m
.
sy
,
m
.
tx
,
m
.
ty
,
isNeedInvert
);
},
},
transform
:
function
(
sx
,
shy
,
shx
,
sy
,
tx
,
ty
)
transform
:
function
(
sx
,
shy
,
shx
,
sy
,
tx
,
ty
)
{
{
...
...
cell/native/native.js
View file @
8df37c07
...
@@ -3759,6 +3759,17 @@ function OfflineEditor () {
...
@@ -3759,6 +3759,17 @@ function OfflineEditor () {
this
.
openFile
=
function
(
settings
)
{
this
.
openFile
=
function
(
settings
)
{
window
[
"
NativeSupportTimeouts
"
]
=
true
;
try
{
throw
"
OpenFile
"
;
}
catch
(
e
)
{
}
this
.
initSettings
=
settings
;
this
.
initSettings
=
settings
;
this
.
beforeOpen
();
this
.
beforeOpen
();
...
@@ -3787,11 +3798,12 @@ function OfflineEditor () {
...
@@ -3787,11 +3798,12 @@ function OfflineEditor () {
this
.
registerEventsHandlers
();
this
.
registerEventsHandlers
();
if
(
this
.
initSettings
.
iscoauthoring
)
{
_api
.
asc_setAutoSaveGap
(
1
);
_api
.
asc_setAutoSaveGap
(
1
);
_api
.
_coAuthoringInit
();
_api
.
asc_nativeOpenFile
(
window
.
native
[
"
GetFileString
"
](),
undefined
,
true
);
_api
.
asc_SetFastCollaborative
(
true
);
_api
.
asc_SetFastCollaborative
(
true
);
}
else
{
_api
.
asc_nativeOpenFile
(
window
.
native
[
"
GetFileString
"
](),
undefined
,
true
);
this
.
asc_WriteAllWorksheets
(
true
);
this
.
asc_WriteAllWorksheets
(
true
);
...
@@ -3799,8 +3811,6 @@ function OfflineEditor () {
...
@@ -3799,8 +3811,6 @@ function OfflineEditor () {
_api
.
asc_ApplyColorScheme
(
false
);
_api
.
asc_ApplyColorScheme
(
false
);
_api
.
_applyFirstLoadChanges
();
_api
.
_applyFirstLoadChanges
();
window
[
"
NativeSupportTimeouts
"
]
=
true
;
var
ws
=
_api
.
wb
.
getWorksheet
();
var
ws
=
_api
.
wb
.
getWorksheet
();
_api
.
wb
.
showWorksheet
(
undefined
,
false
,
true
);
_api
.
wb
.
showWorksheet
(
undefined
,
false
,
true
);
...
@@ -3813,16 +3823,9 @@ function OfflineEditor () {
...
@@ -3813,16 +3823,9 @@ function OfflineEditor () {
// TODO: Implement frozen places
// TODO: Implement frozen places
// TODO: Implement Text Art Styles
// TODO: Implement Text Art Styles
}
this
.
offline_afteInit
();
this
.
offline_afteInit
();
setInterval
(
function
()
{
//checkAUtoSave();
//console.log("autosave");
_api
.
_autoSave
();
},
100
);
};
};
this
.
registerEventsHandlers
=
function
()
{
this
.
registerEventsHandlers
=
function
()
{
...
@@ -3930,6 +3933,12 @@ function OfflineEditor () {
...
@@ -3930,6 +3933,12 @@ function OfflineEditor () {
_api
.
CoAuthoringApi
.
auth
(
false
,
// this.getViewMode()
_api
.
CoAuthoringApi
.
auth
(
false
,
// this.getViewMode()
rData
);
rData
);
});
});
_api
.
asc_registerCallback
(
'
asc_onDocumentUpdateVersion
'
,
function
(
callback
)
{
var
me
=
this
;
me
.
needToUpdateVersion
=
true
;
if
(
callback
)
callback
.
call
(
me
);
});
};
};
this
.
updateFrozen
=
function
()
{
this
.
updateFrozen
=
function
()
{
var
ws
=
_api
.
wb
.
getWorksheet
();
var
ws
=
_api
.
wb
.
getWorksheet
();
...
@@ -5848,9 +5857,11 @@ function offline_cell_editor_close(x, y, width, height, ratio) {
...
@@ -5848,9 +5857,11 @@ function offline_cell_editor_close(x, y, width, height, ratio) {
if
(
cellEditor
.
close
(
true
))
{
if
(
cellEditor
.
close
(
true
))
{
_api
.
wb
.
getWorksheet
().
handlers
.
trigger
(
'
applyCloseEvent
'
,
e
);
_api
.
wb
.
getWorksheet
().
handlers
.
trigger
(
'
applyCloseEvent
'
,
e
);
console
.
log
(
"
_api.wb.getWorksheet().handlers.trigger('applyCloseEvent', e);
"
);
}
else
{
}
else
{
cellEditor
.
close
();
cellEditor
.
close
();
length
=
0
;
length
=
0
;
console
.
log
(
"
cellEditor.close();
"
);
}
}
_api
.
wb
.
_onWSSelectionChanged
(
null
);
_api
.
wb
.
_onWSSelectionChanged
(
null
);
...
@@ -7203,7 +7214,7 @@ function offline_apply_event(type,params) {
...
@@ -7203,7 +7214,7 @@ function offline_apply_event(type,params) {
var
dataObject
=
JSON
.
parse
(
params
);
var
dataObject
=
JSON
.
parse
(
params
);
// console.log(params + " :
" + dataObject['type']);
console
.
log
(
"
JS -
"
+
dataObject
[
'
type
'
]);
switch
(
dataObject
[
'
type
'
])
{
switch
(
dataObject
[
'
type
'
])
{
case
'
auth
'
:
case
'
auth
'
:
...
@@ -7264,3 +7275,125 @@ function offline_apply_event(type,params) {
...
@@ -7264,3 +7275,125 @@ function offline_apply_event(type,params) {
return
_return
;
return
_return
;
}
}
function
testLockedObjects
()
{
var
worksheet
=
_api
.
wb
.
getWorksheet
();
var
objectRender
=
worksheet
.
objectRender
;
var
aObjects
=
worksheet
.
model
.
Drawings
;
var
overlay
=
objectRender
.
getDrawingCanvas
().
autoShapeTrack
;
if
(
!
overlay
)
return
;
overlay
.
Native
[
"
PD_DrawLockedObjectsBegin
"
]();
for
(
var
i
=
0
;
i
<
aObjects
.
length
;
i
++
)
{
var
drawingObject
=
aObjects
[
i
];
if
(
drawingObject
.
isGraphicObject
())
{
var
drawingArea
=
objectRender
.
drawingArea
;
objectRender
.
drawingArea
.
reinitRanges
();
for
(
var
j
=
0
;
j
<
drawingArea
.
frozenPlaces
.
length
;
++
j
)
{
if
(
drawingArea
.
frozenPlaces
[
j
].
isObjectInside
(
drawingObject
))
{
//var canvas = _this.worksheet.objectRender.getDrawingCanvas();
// _this.setTransform(canvas.shapeCtx, canvas.shapeOverlayCtx, canvas.autoShapeTrack);
// _this.clip(canvas.shapeCtx);
//object.graphicObject.draw(canvas.shapeCtx);
// Lock
if
(
(
drawingObject
.
graphicObject
.
lockType
!=
undefined
)
&&
(
drawingObject
.
graphicObject
.
lockType
!=
AscCommon
.
c_oAscLockTypes
.
kLockTypeNone
)
)
{
//canvas.shapeCtx.SetIntegerGrid(false);
//canvas.shapeCtx.transform3(object.graphicObject.transform, false);
//canvas.shapeCtx.DrawLockObjectRect(object.graphicObject.lockType, 0, 0, object.graphicObject.extX, object.graphicObject.extY );
//canvas.shapeCtx.reset();
//canvas.shapeCtx.SetIntegerGrid(true);
overlay
.
transform3
(
drawingObject
.
graphicObject
.
transform
,
false
,
"
PD_LockObjectTransform
"
);
overlay
.
Native
[
"
PD_DrawLockObjectRect
"
](
drawingObject
.
graphicObject
.
lockType
,
0
,
0
,
drawingObject
.
graphicObject
.
extX
,
drawingObject
.
graphicObject
.
extY
);
console
.
log
(
"
lockType :
"
+
drawingObject
.
graphicObject
.
lockType
);
}
else
{
}
//_this.restore(canvas.shapeCtx);
}
}
}
}
overlay
.
Native
[
"
PD_DrawLockedObjectsEnd
"
]();
}
window
[
"
Asc
"
][
"
spreadsheet_api
"
].
prototype
.
openDocument
=
function
(
sData
)
{
//asc["editor"] = this;
var
t
=
this
;
setTimeout
(
function
()
{
console
.
log
(
"
JS - openDocument()
"
);
t
.
wbModel
=
t
.
_openDocument
(
sData
);
t
.
wb
=
new
AscCommonExcel
.
WorkbookView
(
t
.
wbModel
,
t
.
controller
,
t
.
handlers
,
window
[
"
_null_object
"
],
window
[
"
_null_object
"
],
t
,
t
.
collaborativeEditing
,
t
.
fontRenderingMode
);
t
.
DocumentLoadComplete
=
true
;
t
.
asc_CheckGuiControlColors
();
t
.
asc_SendThemeColorScheme
();
t
.
asc_ApplyColorScheme
(
false
);
t
.
sendStandartTextures
();
console
.
log
(
"
JS - applyFirstLoadChanges() before
"
);
// Применяем пришедшие при открытии изменения
t
.
_applyFirstLoadChanges
();
// Применяем все lock-и (ToDo возможно стоит пересмотреть вообще Lock-и)
for
(
var
i
=
0
;
i
<
t
.
arrPreOpenLocksObjects
.
length
;
++
i
)
{
t
.
arrPreOpenLocksObjects
[
i
]();
}
t
.
arrPreOpenLocksObjects
=
[];
// Меняем тип состояния (на никакое)
t
.
advancedOptionsAction
=
AscCommon
.
c_oAscAdvancedOptionsAction
.
None
// Были ошибки при открытии, посылаем предупреждение
if
(
0
<
t
.
wbModel
.
openErrors
.
length
)
{
t
.
sendEvent
(
'
asc_onError
'
,
c_oAscError
.
ID
.
OpenWarning
,
c_oAscError
.
Level
.
NoCritical
);
}
console
.
log
(
"
JS - applyFirstLoadChanges() after
"
);
setTimeout
(
function
()
{
t
.
wb
.
showWorksheet
(
undefined
,
false
,
true
);
console
.
log
(
"
JS - showWorksheet()
"
);
var
ws
=
t
.
wb
.
getWorksheet
();
console
.
log
(
"
JS - getWorksheet()
"
);
window
.
native
[
"
onEndLoadingFile
"
](
ws
.
headersWidth
,
ws
.
headersHeight
);
console
.
log
(
"
JS - onEndLoadingFile()
"
);
_s
.
asc_WriteAllWorksheets
(
true
);
setInterval
(
function
()
{
_api
.
_autoSave
();
testLockedObjects
();
},
100
);
console
.
log
(
"
JS - openDocument()
"
);
},
5
);
},
5
);
};
common/editorscommon.js
View file @
8df37c07
...
@@ -269,24 +269,7 @@ function openFileCommand(binUrl, changesUrl, Signature, callback) {
...
@@ -269,24 +269,7 @@ function openFileCommand(binUrl, changesUrl, Signature, callback) {
var
sFileUrl
=
binUrl
;
var
sFileUrl
=
binUrl
;
sFileUrl
=
sFileUrl
.
replace
(
/
\\
/g
,
"
/
"
);
sFileUrl
=
sFileUrl
.
replace
(
/
\\
/g
,
"
/
"
);
if
(
window
[
'
IS_NATIVE_EDITOR
'
])
{
if
(
!
window
[
'
IS_NATIVE_EDITOR
'
])
{
result
=
window
[
"
native
"
][
"
openFileCommand
"
](
sFileUrl
,
changesUrl
,
Signature
);
var
url
;
var
nIndex
=
sFileUrl
.
lastIndexOf
(
"
/
"
);
url
=
(
-
1
!==
nIndex
)
?
sFileUrl
.
substring
(
0
,
nIndex
+
1
)
:
sFileUrl
;
if
(
0
<
result
.
length
)
{
oResult
.
bSerFormat
=
Signature
===
result
.
substring
(
0
,
Signature
.
length
);
oResult
.
data
=
result
;
oResult
.
url
=
url
;
}
else
{
bError
=
true
;
}
bEndLoadFile
=
true
;
onEndOpen
();
}
else
{
asc_ajax
({
asc_ajax
({
url
:
sFileUrl
,
url
:
sFileUrl
,
dataType
:
"
text
"
,
dataType
:
"
text
"
,
...
@@ -335,8 +318,27 @@ function openFileCommand(binUrl, changesUrl, Signature, callback) {
...
@@ -335,8 +318,27 @@ function openFileCommand(binUrl, changesUrl, Signature, callback) {
}
else
{
}
else
{
bEndLoadChanges
=
true
;
bEndLoadChanges
=
true
;
}
}
}
function
sendCommand
(
editor
,
fCallback
,
rdata
,
dataContainer
)
{
if
(
window
[
'
IS_NATIVE_EDITOR
'
])
{
result
=
window
[
"
native
"
][
"
openFileCommand
"
](
sFileUrl
,
changesUrl
,
Signature
);
var
url
;
var
nIndex
=
sFileUrl
.
lastIndexOf
(
"
/
"
);
url
=
(
-
1
!==
nIndex
)
?
sFileUrl
.
substring
(
0
,
nIndex
+
1
)
:
sFileUrl
;
if
(
0
<
result
.
length
)
{
oResult
.
bSerFormat
=
Signature
===
result
.
substring
(
0
,
Signature
.
length
);
oResult
.
data
=
result
;
oResult
.
url
=
url
;
}
else
{
bError
=
true
;
}
bEndLoadFile
=
true
;
onEndOpen
();
}
}
function
sendCommand
(
editor
,
fCallback
,
rdata
,
dataContainer
)
{
//json не должен превышать размера 2097152, иначе при его чтении будет exception
//json не должен превышать размера 2097152, иначе при его чтении будет exception
var
docConnectionId
=
editor
.
CoAuthoringApi
.
getDocId
();
var
docConnectionId
=
editor
.
CoAuthoringApi
.
getDocId
();
if
(
docConnectionId
&&
docConnectionId
!==
rdata
[
"
id
"
])
{
if
(
docConnectionId
&&
docConnectionId
!==
rdata
[
"
id
"
])
{
...
...
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