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
4ba8a5a4
Commit
4ba8a5a4
authored
Oct 18, 2017
by
Alexey Golubev
Committed by
GitHub
Oct 18, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #187 from ONLYOFFICE/feature/onlypass
Feature/onlypass
parents
70ab3428
a6b602c7
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
495 additions
and
354 deletions
+495
-354
cell/Local/api.js
cell/Local/api.js
+18
-3
common/Local/common.js
common/Local/common.js
+74
-1
common/plugins.js
common/plugins.js
+58
-37
slide/Local/api.js
slide/Local/api.js
+18
-3
word/Editor/Document.js
word/Editor/Document.js
+2
-0
word/Local/api.js
word/Local/api.js
+325
-310
No files found.
cell/Local/api.js
View file @
4ba8a5a4
...
...
@@ -249,8 +249,15 @@ window["Asc"]['spreadsheet_api'].prototype.asc_isOffline = function()
return
true
;
};
window
[
"
DesktopOfflineAppDocumentStartSave
"
]
=
function
(
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
({
"
type
"
:
"
generatePassword
"
});
return
;
}
window
[
"
Asc
"
][
"
editor
"
].
sync_StartAction
(
Asc
.
c_oAscAsyncActionType
.
BlockInteraction
,
Asc
.
c_oAscAsyncAction
.
Save
);
var
_param
=
""
;
...
...
@@ -259,9 +266,9 @@ window["DesktopOfflineAppDocumentStartSave"] = function(isSaveAs)
if
(
AscCommon
.
AscBrowser
.
isRetina
)
_param
+=
"
retina=true;
"
;
window
[
"
AscDesktopEditor
"
][
"
LocalFileSave
"
](
_param
);
window
[
"
AscDesktopEditor
"
][
"
LocalFileSave
"
](
_param
,
password
);
};
window
[
"
DesktopOfflineAppDocumentEndSave
"
]
=
function
(
error
)
window
[
"
DesktopOfflineAppDocumentEndSave
"
]
=
function
(
error
,
hash
,
password
)
{
window
[
"
Asc
"
][
"
editor
"
].
sync_EndAction
(
Asc
.
c_oAscAsyncActionType
.
BlockInteraction
,
Asc
.
c_oAscAsyncAction
.
Save
);
if
(
0
==
error
)
...
...
@@ -284,6 +291,14 @@ window["DesktopOfflineAppDocumentEndSave"] = function(error)
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
});
}
}
};
window
[
"
Asc
"
][
'
spreadsheet_api
'
].
prototype
[
"
asc_addImageDrawingObject
"
]
=
window
[
"
Asc
"
][
'
spreadsheet_api
'
].
prototype
.
asc_addImageDrawingObject
;
...
...
common/Local/common.js
View file @
4ba8a5a4
...
...
@@ -209,6 +209,45 @@ window["UpdateInstallPlugins"] = function()
_editor
.
sendEvent
(
"
asc_onPluginsInit
"
,
_plugins
);
};
window
[
"
UpdateSystemPlugins
"
]
=
function
()
{
var
_plugins
=
JSON
.
parse
(
window
[
"
AscDesktopEditor
"
][
"
GetInstallPlugins
"
]());
_plugins
[
"
url
"
]
=
_plugins
[
"
url
"
].
replace
(
"
"
,
"
%20
"
);
var
_len
=
_plugins
[
"
pluginsData
"
].
length
;
for
(
var
i
=
0
;
i
<
_len
;
i
++
)
_plugins
[
"
pluginsData
"
][
i
][
"
baseUrl
"
]
=
_plugins
[
"
url
"
]
+
_plugins
[
"
pluginsData
"
][
i
][
"
guid
"
].
substring
(
4
)
+
"
/
"
;
var
_editor
=
window
[
"
Asc
"
][
"
editor
"
]
?
window
[
"
Asc
"
][
"
editor
"
]
:
window
.
editor
;
var
_array
=
[];
for
(
var
i
=
0
;
i
<
_len
;
i
++
)
{
var
_plugin
=
_plugins
[
"
pluginsData
"
][
i
];
for
(
var
j
=
0
;
j
<
_plugin
[
"
variations
"
].
length
;
j
++
)
{
var
_variation
=
_plugin
[
"
variations
"
][
j
];
if
(
_variation
[
"
initDataType
"
]
==
"
desktop
"
)
{
_array
.
push
(
_plugin
);
break
;
}
}
}
var
_arraySystem
=
[];
for
(
var
i
=
0
;
i
<
_array
.
length
;
i
++
)
{
var
plugin
=
new
Asc
.
CPlugin
();
plugin
.
deserialize
(
_array
[
i
]);
_arraySystem
.
push
(
plugin
);
}
window
.
g_asc_plugins
.
registerSystem
(
""
,
_arraySystem
);
window
.
g_asc_plugins
.
runAllSystem
();
};
AscCommon
.
InitDragAndDrop
=
function
(
oHtmlElement
,
callback
)
{
if
(
"
undefined
"
!=
typeof
(
FileReader
)
&&
null
!=
oHtmlElement
)
{
oHtmlElement
[
"
ondragover
"
]
=
function
(
e
)
{
...
...
@@ -232,9 +271,16 @@ AscCommon.InitDragAndDrop = function(oHtmlElement, callback) {
}
}
window
[
"
asc_initAdvancedOptions
"
]
=
function
(
_code
)
window
[
"
asc_initAdvancedOptions
"
]
=
function
(
_code
,
_file_hash
)
{
var
_editor
=
window
[
"
Asc
"
][
"
editor
"
]
?
window
[
"
Asc
"
][
"
editor
"
]
:
window
.
editor
;
if
((
_code
==
90
||
_code
==
91
)
&&
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
"
:
"
getPasswordByFile
"
,
"
hash
"
:
_file_hash
});
return
;
}
_editor
.
_onNeedParams
(
undefined
,
(
_code
==
90
||
_code
==
91
)
?
true
:
undefined
);
};
...
...
@@ -426,6 +472,33 @@ function getBinaryArray(_data, _len)
return
_array
;
}
// OnlyPass ----------------------------------
Asc
[
'
asc_docs_api
'
].
prototype
[
"
pluginMethod_OnlyPass
"
]
=
function
(
obj
)
{
switch
(
obj
.
type
)
{
case
"
generatePassword
"
:
{
window
[
"
DesktopOfflineAppDocumentStartSave
"
](
window
.
doadssIsSaveAs
,
obj
[
"
password
"
],
true
);
break
;
}
case
"
getPasswordByFile
"
:
{
if
(
""
!=
obj
[
"
password
"
])
{
var
_param
=
(
"
<m_sPassword>
"
+
AscCommon
.
CopyPasteCorrectString
(
obj
[
"
password
"
])
+
"
</m_sPassword>
"
);
window
[
"
AscDesktopEditor
"
][
"
SetAdvancedOptions
"
](
_param
);
}
else
{
this
.
_onNeedParams
(
undefined
,
true
);
}
break
;
}
}
};
// -------------------------------------------
// меняем среду
//AscBrowser.isSafari = false;
//AscBrowser.isSafariMacOs = false;
...
...
common/plugins.js
View file @
4ba8a5a4
...
...
@@ -150,6 +150,13 @@
this
.
pluginsMap
[
guid
]
=
{
isSystem
:
true
};
}
},
runAllSystem
:
function
()
{
for
(
var
i
=
0
;
i
<
this
.
systemPlugins
.
length
;
i
++
)
{
this
.
run
(
this
.
systemPlugins
[
i
].
guid
,
0
,
""
);
}
},
// pointer events methods -------------------
enablePointerEvents
:
function
()
{
...
...
@@ -212,6 +219,10 @@
}
return
false
;
},
isRunned
:
function
(
guid
)
{
return
(
undefined
!==
this
.
runnedPluginsMap
[
guid
]);
},
run
:
function
(
guid
,
variation
,
data
,
isNoUse_isNoSystemPluginsOnlyOne
)
{
if
(
this
.
runAndCloseData
)
// run only on close!!!
...
...
@@ -422,7 +433,7 @@
}
},
init
:
function
(
guid
)
init
:
function
(
guid
,
raw_data
)
{
var
plugin
=
this
.
getPluginByGuid
(
guid
);
var
runObject
=
this
.
runnedPluginsMap
[
guid
];
...
...
@@ -430,46 +441,53 @@
if
(
!
plugin
||
!
runObject
||
!
runObject
.
startData
)
return
;
switch
(
plugin
.
variations
[
runObject
.
currentVariation
].
initDataType
)
if
(
undefined
===
raw_data
)
{
case
Asc
.
EPluginDataType
.
text
:
switch
(
plugin
.
variations
[
runObject
.
currentVariation
].
initDataType
)
{
var
text_data
=
{
data
:
""
,
pushData
:
function
(
format
,
value
)
{
this
.
data
=
value
;
}
};
this
.
api
.
asc_CheckCopy
(
text_data
,
1
);
if
(
text_data
.
data
==
null
)
text_data
.
data
=
""
;
runObject
.
startData
.
setAttribute
(
"
data
"
,
text_data
.
data
);
break
;
}
case
Asc
.
EPluginDataType
.
html
:
{
var
text_data
=
{
data
:
""
,
pushData
:
function
(
format
,
value
)
{
this
.
data
=
value
;
}
};
this
.
api
.
asc_CheckCopy
(
text_data
,
2
);
if
(
text_data
.
data
==
null
)
text_data
.
data
=
""
;
runObject
.
startData
.
setAttribute
(
"
data
"
,
text_data
.
data
);
break
;
}
case
Asc
.
EPluginDataType
.
ole
:
{
// теперь выше задается
break
;
case
Asc
.
EPluginDataType
.
text
:
{
var
text_data
=
{
data
:
""
,
pushData
:
function
(
format
,
value
)
{
this
.
data
=
value
;
}
};
this
.
api
.
asc_CheckCopy
(
text_data
,
1
);
if
(
text_data
.
data
==
null
)
text_data
.
data
=
""
;
runObject
.
startData
.
setAttribute
(
"
data
"
,
text_data
.
data
);
break
;
}
case
Asc
.
EPluginDataType
.
html
:
{
var
text_data
=
{
data
:
""
,
pushData
:
function
(
format
,
value
)
{
this
.
data
=
value
;
}
};
this
.
api
.
asc_CheckCopy
(
text_data
,
2
);
if
(
text_data
.
data
==
null
)
text_data
.
data
=
""
;
runObject
.
startData
.
setAttribute
(
"
data
"
,
text_data
.
data
);
break
;
}
case
Asc
.
EPluginDataType
.
ole
:
{
// теперь выше задается
break
;
}
}
}
else
{
runObject
.
startData
.
setAttribute
(
"
data
"
,
raw_data
);
}
var
_iframe
=
document
.
getElementById
(
runObject
.
frameId
);
if
(
_iframe
)
...
...
@@ -865,6 +883,9 @@
});
if
(
window
[
"
AscDesktopEditor
"
]
&&
window
[
"
UpdateSystemPlugins
"
])
window
[
"
UpdateSystemPlugins
"
]();
return
window
.
g_asc_plugins
;
};
...
...
slide/Local/api.js
View file @
4ba8a5a4
...
...
@@ -179,8 +179,15 @@ Asc['asc_docs_api'].prototype.asc_Save = function (isNoUserSave, isSaveAs)
window
[
"
DesktopOfflineAppDocumentStartSave
"
](
isSaveAs
);
}
};
window
[
"
DesktopOfflineAppDocumentStartSave
"
]
=
function
(
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
=
""
;
...
...
@@ -189,9 +196,9 @@ window["DesktopOfflineAppDocumentStartSave"] = function(isSaveAs)
if
(
AscCommon
.
AscBrowser
.
isRetina
)
_param
+=
"
retina=true;
"
;
window
[
"
AscDesktopEditor
"
][
"
LocalFileSave
"
](
_param
);
window
[
"
AscDesktopEditor
"
][
"
LocalFileSave
"
](
_param
,
password
);
};
window
[
"
DesktopOfflineAppDocumentEndSave
"
]
=
function
(
error
)
window
[
"
DesktopOfflineAppDocumentEndSave
"
]
=
function
(
error
,
hash
,
password
)
{
editor
.
sync_EndAction
(
Asc
.
c_oAscAsyncActionType
.
BlockInteraction
,
Asc
.
c_oAscAsyncAction
.
Save
);
if
(
0
==
error
)
...
...
@@ -214,6 +221,14 @@ window["DesktopOfflineAppDocumentEndSave"] = function(error)
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
)
{
...
...
word/Editor/Document.js
View file @
4ba8a5a4
...
...
@@ -5515,6 +5515,8 @@ CDocument.prototype.SelectAll = function()
// Отдельно обрабатываем это событие, потому что внутри него идет проверка на this.Selection.Start !== true
this
.
Document_UpdateCopyCutState
();
this
.
private_UpdateCursorXY
(
true
,
true
);
};
CDocument
.
prototype
.
On_DragTextEnd
=
function
(
NearPos
,
bCopy
)
{
...
...
word/Local/api.js
View file @
4ba8a5a4
This diff is collapsed.
Click to expand it.
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