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
c5b52c29
Commit
c5b52c29
authored
Nov 13, 2017
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gadget mode changes
parent
c95c52d8
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
385 additions
and
786 deletions
+385
-786
cell/Local/api.js
cell/Local/api.js
+61
-149
cell/api.js
cell/api.js
+1
-0
common/Drawings/Externals.js
common/Drawings/Externals.js
+2
-10
common/GlobalLoaders.js
common/GlobalLoaders.js
+1
-1
common/Local/common.js
common/Local/common.js
+191
-400
common/editorscommon.js
common/editorscommon.js
+53
-1
common/externs/global.js
common/externs/global.js
+17
-0
slide/Local/api.js
slide/Local/api.js
+28
-101
slide/api.js
slide/api.js
+1
-0
word/Local/api.js
word/Local/api.js
+29
-124
word/api.js
word/api.js
+1
-0
No files found.
cell/Local/api.js
View file @
c5b52c29
This diff is collapsed.
Click to expand it.
cell/api.js
View file @
c5b52c29
...
...
@@ -1625,6 +1625,7 @@ var editor;
// Обновляем состояние возможности сохранения документа
t
.
onUpdateDocumentModified
(
History
.
Have_Changes
());
t
.
jio_save
();
if
(
undefined
!==
window
[
"
AscDesktopEditor
"
])
{
window
[
"
AscDesktopEditor
"
][
"
OnSave
"
]();
}
...
...
common/Drawings/Externals.js
View file @
c5b52c29
...
...
@@ -424,9 +424,9 @@ function CFontFileLoader(id)
g_fontNamesEncoder
=
new
ZBase32Encoder
();
//var _name = this.Id;
var
_name
=
g_fontNamesEncoder
.
Encode
(
this
.
Id
)
+
"
.
js
"
;
var
_name
=
g_fontNamesEncoder
.
Encode
(
this
.
Id
)
+
"
.
ttf
"
;
xhr
.
open
(
'
GET
'
,
basePath
+
"
od
ttf/
"
+
_name
,
true
);
// TODO:
xhr
.
open
(
'
GET
'
,
basePath
+
"
ttf/
"
+
_name
,
true
);
// TODO:
if
(
typeof
ArrayBuffer
!==
'
undefined
'
&&
!
window
.
opera
)
xhr
.
responseType
=
'
arraybuffer
'
;
...
...
@@ -482,14 +482,6 @@ function CFontFileLoader(id)
oThis
.
SetStreamIndex
(
__font_data_idx
);
}
// decode
var
guidOdttf
=
[
0xA0
,
0x66
,
0xD6
,
0x20
,
0x14
,
0x96
,
0x47
,
0xfa
,
0x95
,
0x69
,
0xB8
,
0x50
,
0xB0
,
0x41
,
0x49
,
0x48
];
var
_stream
=
g_fonts_streams
[
g_fonts_streams
.
length
-
1
];
var
_data
=
_stream
.
data
;
var
_count_decode
=
Math
.
min
(
32
,
_stream
.
size
);
for
(
var
i
=
0
;
i
<
_count_decode
;
++
i
)
_data
[
i
]
^=
guidOdttf
[
i
%
16
];
};
xhr
.
send
(
null
);
...
...
common/GlobalLoaders.js
View file @
c5b52c29
...
...
@@ -51,7 +51,7 @@
this
.
fonts_streams
=
[];
// теперь вся информация о всех возможных шрифтах. Они во всех редакторах должны быть одни и те же
this
.
fontFilesPath
=
"
../../../..
/fonts/
"
;
this
.
fontFilesPath
=
"
onlyoffice
/fonts/
"
;
this
.
fontFiles
=
AscFonts
.
g_font_files
;
this
.
fontInfos
=
AscFonts
.
g_font_infos
;
this
.
map_font_index
=
AscFonts
.
g_map_font_index
;
...
...
common/Local/common.js
View file @
c5b52c29
This diff is collapsed.
Click to expand it.
common/editorscommon.js
View file @
c5b52c29
...
...
@@ -2826,13 +2826,65 @@
function
loadSdk
(
sdkName
,
callback
)
{
var
config_file
;
function
loadScriptPromise
(
src
)
{
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
var
s
;
s
=
document
.
createElement
(
'
script
'
);
s
.
src
=
src
;
s
.
onload
=
resolve
;
s
.
onerror
=
reject
;
document
.
head
.
appendChild
(
s
);
});
}
if
(
window
[
'
AscNotLoadAllScript
'
])
{
callback
();
}
else
{
loadScript
(
'
./../../../../sdkjs/
'
+
sdkName
+
'
/sdk-all.js
'
,
callback
);
if
(
!
Common
.
Gateway
.
props
.
binary_loader
)
{
switch
(
sdkName
)
{
case
'
word
'
:
config_file
=
"
webword.json
"
;
break
;
case
'
cell
'
:
config_file
=
"
webexcel.json
"
;
break
;
case
'
slide
'
:
config_file
=
"
webpowerpoint.json
"
;
break
;
}
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
jIO
.
util
.
ajax
({
type
:
"
GET
"
,
dataType
:
"
json
"
,
url
:
Common
.
Gateway
.
props
.
base_url
+
"
sdkjs/build/configs/
"
+
config_file
});
})
.
push
(
function
(
response
)
{
var
queue
=
new
RSVP
.
Queue
(),
sdk
=
response
.
target
.
response
.
compile
.
sdk
,
list
=
sdk
.
common
;
list
=
list
.
concat
(
sdk
.
private
);
list
.
concat
(
sdk
.
desktop
.
common
).
forEach
(
function
(
url
)
{
url
=
url
.
replace
(
'
../
'
,
Common
.
Gateway
.
props
.
base_url
+
'
sdkjs/
'
);
queue
.
push
(
function
()
{
return
loadScriptPromise
(
url
);
});
});
return
queue
;
})
.
push
(
callback
);
}
loadScript
(
Common
.
Gateway
.
props
.
base_url
+
'
/sdkjs/
'
+
sdkName
+
'
/sdk-all.js
'
,
callback
);
}
}
...
...
common/externs/global.js
View file @
c5b52c29
...
...
@@ -42,6 +42,23 @@ var AscCommon;
var
AscCommonWord
;
var
AscCommonExcel
;
var
AscCommonSlide
;
var
Common
=
{};
Common
.
Gateway
=
{
props
:
{
value
:
""
,
documentType
:
""
,
binary_loader
:
true
,
base_url
:
""
}
};
/**
* @param {String} doc_id
* @param {String} attach_id
* @return {Object}
*/
Common
.
Gateway
.
jio_getAttachment
=
function
(
doc_id
,
attach_id
)
{};
function
jq
(){}
function
DE
(){}
...
...
slide/Local/api.js
View file @
c5b52c29
This diff is collapsed.
Click to expand it.
slide/api.js
View file @
c5b52c29
...
...
@@ -1899,6 +1899,7 @@ background-repeat: no-repeat;\
// Обновляем состояние возможности сохранения документа
t
.
_onUpdateDocumentCanSave
();
t
.
jio_save
();
if
(
undefined
!==
window
[
"
AscDesktopEditor
"
])
{
window
[
"
AscDesktopEditor
"
][
"
OnSave
"
]();
...
...
word/Local/api.js
View file @
c5b52c29
...
...
@@ -43,32 +43,25 @@ Asc['asc_docs_api'].prototype._OfflineAppDocumentStartLoad = function()
this
.
asc_registerCallback
(
'
asc_onDocumentContentReady
'
,
function
(){
DesktopOfflineUpdateLocalName
(
editor
);
setTimeout
(
function
(){
window
[
"
UpdateInstallPlugins
"
]();},
10
);
//
setTimeout(function(){window["UpdateInstallPlugins"]();}, 10);
});
AscCommon
.
History
.
UserSaveMode
=
true
;
window
[
"
AscDesktopEditor
"
][
"
LocalStartOpen
"
]
();
return
this
.
jio_open
();
};
Asc
[
'
asc_docs_api
'
].
prototype
.
_OfflineAppDocumentEndLoad
=
function
(
_url
,
_
data
,
_len
)
Asc
[
'
asc_docs_api
'
].
prototype
.
_OfflineAppDocumentEndLoad
=
function
(
_url
,
_
binary
)
{
AscCommon
.
g_oIdCounter
.
m_sUserId
=
window
[
"
AscDesktopEditor
"
][
"
CheckUserId
"
]();
if
(
_
data
==
""
)
//
AscCommon.g_oIdCounter.m_sUserId = window["AscDesktopEditor"]["CheckUserId"]();
if
(
_
binary
==
""
)
{
this
.
sendEvent
(
"
asc_onError
"
,
c_oAscError
.
ID
.
ConvertationOpenError
,
c_oAscError
.
Level
.
Critical
);
return
;
}
var
_binary
=
getBinaryArray
(
_data
,
_len
);
var
_sign_len
=
AscCommon
.
c_oSerFormat
.
Signature
.
length
;
var
_signature
=
""
;
if
(
_binary
.
length
>=
_sign_len
)
{
for
(
var
i
=
0
;
i
<
_sign_len
;
i
++
)
{
_signature
+=
String
.
fromCharCode
(
_binary
[
i
]);
}
var
_signature
=
_binary
.
slice
(
0
,
_sign_len
);
if
(
typeof
_signature
!==
'
string
'
)
{
_signature
=
String
.
fromCharCode
.
apply
(
null
,
_signature
);
}
if
(
AscCommon
.
c_oSerFormat
.
Signature
!==
_signature
)
{
this
.
OpenDocument
(
_url
,
_binary
);
...
...
@@ -78,14 +71,9 @@ Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _data,
this
.
OpenDocument2
(
_url
,
_binary
);
this
.
WordControl
.
m_oLogicDocument
.
Set_FastCollaborativeEditing
(
false
);
}
this
.
WordControl
.
m_oLogicDocument
.
Set_FastCollaborativeEditing
(
false
);
DesktopOfflineUpdateLocalName
(
this
);
window
[
"
DesktopAfterOpen
"
](
this
);
};
window
[
"
DesktopOfflineAppDocumentEndLoad
"
]
=
function
(
_url
,
_data
,
_len
)
window
[
"
DesktopOfflineAppDocumentEndLoad
"
]
=
function
(
_url
,
_data
)
{
AscCommon
.
g_oDocumentUrls
.
documentUrl
=
_url
;
if
(
AscCommon
.
g_oDocumentUrls
.
documentUrl
.
indexOf
(
"
file:
"
)
!=
0
)
...
...
@@ -95,7 +83,7 @@ window["DesktopOfflineAppDocumentEndLoad"] = function(_url, _data, _len)
AscCommon
.
g_oDocumentUrls
.
documentUrl
=
"
file://
"
+
AscCommon
.
g_oDocumentUrls
.
documentUrl
;
}
editor
.
_OfflineAppDocumentEndLoad
(
_url
,
_data
,
_len
);
editor
.
_OfflineAppDocumentEndLoad
(
_url
,
_data
);
};
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_setAdvancedOptions
=
function
(
idOption
,
option
)
...
...
@@ -175,60 +163,8 @@ window["DesktopOfflineAppDocumentApplyChanges"] = function(_changes)
/////////////////////////////////////////////////////////
//////////////// SAVE //////////////////////
/////////////////////////////////////////////////////////
Asc
[
'
asc_docs_api
'
].
prototype
.
SetDocumentModified
=
function
(
bValue
)
window
[
"
DesktopOfflineAppDocumentStartSave
"
]
=
function
(
isSaveAs
)
{
this
.
isDocumentModify
=
bValue
;
this
.
sendEvent
(
"
asc_onDocumentModifiedChanged
"
);
if
(
undefined
!==
window
[
"
AscDesktopEditor
"
])
{
window
[
"
AscDesktopEditor
"
][
"
onDocumentModifiedChanged
"
](
AscCommon
.
History
?
AscCommon
.
History
.
Have_Changes
(
undefined
,
true
)
:
bValue
);
}
};
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_Save
=
function
(
isNoUserSave
,
isSaveAs
)
{
if
(
true
!==
isNoUserSave
)
this
.
IsUserSave
=
true
;
if
(
this
.
IsUserSave
)
{
this
.
LastUserSavedIndex
=
AscCommon
.
History
.
UserSavedIndex
;
}
if
(
true
===
this
.
canSave
&&
!
this
.
isLongAction
())
{
var
_isNaturalSave
=
this
.
IsUserSave
;
this
.
canSave
=
false
;
if
(
this
.
WordControl
.
m_oLogicDocument
!=
null
)
{
var
t
=
this
;
this
.
CoAuthoringApi
.
askSaveChanges
(
function
(
e
)
{
t
.
onSaveCallback
(
e
);
});
if
(
this
.
CoAuthoringApi
.
onUnSaveLock
)
this
.
CoAuthoringApi
.
onUnSaveLock
();
}
else
{
this
.
canSave
=
true
;
}
if
(
_isNaturalSave
===
true
)
window
[
"
DesktopOfflineAppDocumentStartSave
"
](
isSaveAs
);
}
};
window
[
"
DesktopOfflineAppDocumentStartSave
"
]
=
function
(
isSaveAs
,
password
,
isForce
)
{
window
.
doadssIsSaveAs
=
isSaveAs
;
if
(
true
!==
isForce
&&
window
.
g_asc_plugins
&&
window
.
g_asc_plugins
.
isRunned
(
"
asc.{F2402876-659F-47FB-A646-67B49F2B57D0}
"
))
{
window
.
g_asc_plugins
.
init
(
"
asc.{F2402876-659F-47FB-A646-67B49F2B57D0}
"
,
{
"
type
"
:
"
generatePassword
"
});
return
;
}
editor
.
sync_StartAction
(
Asc
.
c_oAscAsyncActionType
.
BlockInteraction
,
Asc
.
c_oAscAsyncAction
.
Save
);
var
_param
=
""
;
...
...
@@ -237,9 +173,9 @@ window["DesktopOfflineAppDocumentStartSave"] = function(isSaveAs, password, isFo
if
(
AscCommon
.
AscBrowser
.
isRetina
)
_param
+=
"
retina=true;
"
;
window
[
"
AscDesktopEditor
"
][
"
LocalFileSave
"
](
_param
,
password
);
window
[
"
AscDesktopEditor
"
][
"
LocalFileSave
"
](
_param
);
};
window
[
"
DesktopOfflineAppDocumentEndSave
"
]
=
function
(
error
,
hash
,
password
)
window
[
"
DesktopOfflineAppDocumentEndSave
"
]
=
function
(
error
)
{
editor
.
sync_EndAction
(
Asc
.
c_oAscAsyncActionType
.
BlockInteraction
,
Asc
.
c_oAscAsyncAction
.
Save
);
if
(
error
==
0
)
...
...
@@ -252,43 +188,12 @@ window["DesktopOfflineAppDocumentEndSave"] = function(error, hash, password)
if
(
2
==
error
)
editor
.
sendEvent
(
"
asc_onError
"
,
c_oAscError
.
ID
.
ConvertationSaveError
,
c_oAscError
.
Level
.
NoCritical
);
if
(
0
==
error
)
{
if
(
window
.
SaveQuestionObjectBeforeSign
)
{
var
_obj
=
window
.
SaveQuestionObjectBeforeSign
;
editor
.
sendEvent
(
"
asc_onSignatureClick
"
,
_obj
.
guid
,
_obj
.
width
,
_obj
.
height
);
window
.
SaveQuestionObjectBeforeSign
=
null
;
}
}
if
(
hash
!==
null
&&
hash
!==
undefined
&&
hash
!=
""
)
{
if
(
window
.
g_asc_plugins
&&
window
.
g_asc_plugins
.
isRunned
(
"
asc.{F2402876-659F-47FB-A646-67B49F2B57D0}
"
))
{
window
.
g_asc_plugins
.
init
(
"
asc.{F2402876-659F-47FB-A646-67B49F2B57D0}
"
,
{
"
type
"
:
"
setPasswordByFile
"
,
"
hash
"
:
hash
,
"
password
"
:
password
});
}
}
};
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_DownloadAs
=
function
(
typeFile
,
bIsDownloadEvent
)
{
this
.
asc_Save
(
false
,
true
);
};
Asc
[
'
asc_docs_api
'
].
prototype
.
AddImageUrl
=
function
(
url
,
imgProp
)
{
var
_url
=
window
[
"
AscDesktopEditor
"
][
"
LocalFileGetImageUrl
"
](
url
);
this
.
AddImageUrlAction
(
AscCommon
.
g_oDocumentUrls
.
getImageUrl
(
_url
),
imgProp
);
};
Asc
[
'
asc_docs_api
'
].
prototype
.
AddImage
=
function
()
{
window
[
"
AscDesktopEditor
"
][
"
LocalFileGetImageUrlFromOpenFileDialog
"
]();
};
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_addImage
=
function
()
{
window
[
"
AscDesktopEditor
"
][
"
LocalFileGetImageUrlFromOpenFileDialog
"
]();
};
Asc
[
'
asc_docs_api
'
].
prototype
.
asc_isOffline
=
function
()
{
return
true
;
...
...
word/api.js
View file @
c5b52c29
...
...
@@ -2278,6 +2278,7 @@ background-repeat: no-repeat;\
// Обновляем состояние возможности сохранения документа
t
.
_onUpdateDocumentCanSave
();
t
.
jio_save
();
if
(
undefined
!==
window
[
"
AscDesktopEditor
"
])
{
window
[
"
AscDesktopEditor
"
][
"
OnSave
"
]();
...
...
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