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
63f3f49f
Commit
63f3f49f
authored
Sep 06, 2016
by
Oleg Korshul
Committed by
GitHub
Sep 06, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #61 from ONLYOFFICE/hotfix/v4.1.1
Hotfix/v4.1.1
parents
0e8ae6d5
84209cec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
150 additions
and
3 deletions
+150
-3
Readme.md
Readme.md
+1
-1
common/pluginBase.js
common/pluginBase.js
+137
-0
common/plugins.js
common/plugins.js
+12
-2
No files found.
Readme.md
View file @
63f3f49f
[
![License
](
https://img.shields.io/badge/License-GNU%20AGPL%20V3-green.svg?style=flat
)
](http://www.gnu.org/licenses/agpl-3.0.ru.html) !
[
Release
](
https://img.shields.io/badge/Release-v4.1.
0
-blue.svg?style=flat
)
[
![License
](
https://img.shields.io/badge/License-GNU%20AGPL%20V3-green.svg?style=flat
)
](http://www.gnu.org/licenses/agpl-3.0.ru.html) !
[
Release
](
https://img.shields.io/badge/Release-v4.1.
1
-blue.svg?style=flat
)
## Sdkjs
## Sdkjs
...
...
common/pluginBase.js
0 → 100644
View file @
63f3f49f
(
function
(
window
,
undefined
){
var
g_isMouseSendEnabled
=
false
;
// должны быть методы
// init(data);
// button(id)
window
.
plugin_sendMessage
=
function
sendMessage
(
data
)
{
window
.
parent
.
postMessage
(
data
,
"
*
"
);
};
window
.
plugin_onMessage
=
function
(
event
)
{
if
(
!
window
.
Asc
.
plugin
)
return
;
if
(
typeof
(
event
.
data
)
==
"
string
"
)
{
var
pluginData
=
{};
try
{
pluginData
=
JSON
.
parse
(
event
.
data
);
}
catch
(
err
)
{
pluginData
=
{};
}
if
(
pluginData
.
guid
!=
window
.
Asc
.
plugin
.
guid
)
return
;
var
type
=
pluginData
.
type
;
if
(
type
==
"
init
"
)
window
.
Asc
.
plugin
.
info
=
pluginData
;
switch
(
type
)
{
case
"
init
"
:
{
window
.
Asc
.
plugin
.
executeCommand
=
function
(
type
,
data
)
{
window
.
Asc
.
plugin
.
info
.
type
=
type
;
window
.
Asc
.
plugin
.
info
.
data
=
data
;
var
_message
=
""
;
try
{
_message
=
JSON
.
stringify
(
window
.
Asc
.
plugin
.
info
);
}
catch
(
err
)
{
_message
=
JSON
.
stringify
({
type
:
data
});
}
window
.
plugin_sendMessage
(
_message
);
};
window
.
Asc
.
plugin
.
resizeWindow
=
function
(
width
,
height
,
minW
,
minH
,
maxW
,
maxH
)
{
if
(
undefined
==
minW
)
minW
=
0
;
if
(
undefined
==
minH
)
minH
=
0
;
if
(
undefined
==
maxW
)
maxW
=
0
;
if
(
undefined
==
maxH
)
maxH
=
0
;
var
data
=
JSON
.
stringify
({
width
:
width
,
height
:
height
,
minw
:
minW
,
minh
:
minH
,
maxw
:
maxW
,
maxh
:
maxH
});
window
.
Asc
.
plugin
.
info
.
type
=
"
resize
"
;
window
.
Asc
.
plugin
.
info
.
data
=
data
;
var
_message
=
""
;
try
{
_message
=
JSON
.
stringify
(
window
.
Asc
.
plugin
.
info
);
}
catch
(
err
)
{
_message
=
JSON
.
stringify
({
type
:
data
});
}
window
.
plugin_sendMessage
(
_message
);
};
window
.
Asc
.
plugin
.
init
(
window
.
Asc
.
plugin
.
info
.
data
);
break
;
}
case
"
button
"
:
{
window
.
Asc
.
plugin
.
button
(
parseInt
(
pluginData
.
button
));
break
;
}
case
"
enableMouseEvent
"
:
{
g_isMouseSendEnabled
=
pluginData
.
isEnabled
;
break
;
}
case
"
onExternalMouseUp
"
:
{
if
(
window
.
Asc
.
plugin
.
onExternalMouseUp
)
window
.
Asc
.
plugin
.
onExternalMouseUp
();
break
;
}
default
:
break
;
}
}
}
window
.
onmousemove
=
function
(
e
)
{
if
(
!
g_isMouseSendEnabled
||
!
window
.
Asc
.
plugin
||
!
window
.
Asc
.
plugin
.
executeCommand
)
return
;
var
_x
=
(
undefined
===
e
.
clientX
)
?
e
.
pageX
:
e
.
clientX
;
var
_y
=
(
undefined
===
e
.
clientY
)
?
e
.
pageY
:
e
.
clientY
;
window
.
Asc
.
plugin
.
executeCommand
(
"
onmousemove
"
,
JSON
.
stringify
({
x
:
_x
,
y
:
_y
}));
};
window
.
onmouseup
=
function
(
e
)
{
if
(
!
g_isMouseSendEnabled
||
!
window
.
Asc
.
plugin
||
!
window
.
Asc
.
plugin
.
executeCommand
)
return
;
var
_x
=
(
undefined
===
e
.
clientX
)
?
e
.
pageX
:
e
.
clientX
;
var
_y
=
(
undefined
===
e
.
clientY
)
?
e
.
pageY
:
e
.
clientY
;
window
.
Asc
.
plugin
.
executeCommand
(
"
onmouseup
"
,
JSON
.
stringify
({
x
:
_x
,
y
:
_y
}));
};
window
.
plugin_sendMessage
(
JSON
.
stringify
({
guid
:
window
.
Asc
.
plugin
.
guid
,
type
:
"
initialize_internal
"
}));
})(
window
,
undefined
);
\ No newline at end of file
common/plugins.js
View file @
63f3f49f
...
@@ -385,9 +385,19 @@
...
@@ -385,9 +385,19 @@
var
name
=
pluginData
.
getAttribute
(
"
type
"
);
var
name
=
pluginData
.
getAttribute
(
"
type
"
);
var
value
=
pluginData
.
getAttribute
(
"
data
"
);
var
value
=
pluginData
.
getAttribute
(
"
data
"
);
if
(
"
initialize
"
==
name
)
if
(
"
initialize_internal
"
==
name
)
{
window
.
g_asc_plugins
.
init
();
}
else
if
(
"
initialize
"
==
name
)
{
{
window
.
g_asc_plugins
.
init
();
var
pluginData
=
new
CPluginData
();
pluginData
.
setAttribute
(
"
guid
"
,
guid
);
pluginData
.
setAttribute
(
"
type
"
,
"
plugin_init
"
);
pluginData
.
setAttribute
(
"
data
"
,
"
(function(n,t){var i=!1;n.plugin_sendMessage=function(t){n.parent.postMessage(t,
\"
*
\"
)};n.plugin_onMessage=function(r){var u,f;if(n.Asc.plugin&&typeof r.data==
\"
string
\"
){u={};try{u=JSON.parse(r.data)}catch(e){u={}}if(u.guid!=n.Asc.plugin.guid)return;f=u.type;f==
\"
init
\"
&&(n.Asc.plugin.info=u);switch(f){case
\"
init
\"
:n.Asc.plugin.executeCommand=function(t,i){n.Asc.plugin.info.type=t;n.Asc.plugin.info.data=i;var r=
\"\"
;try{r=JSON.stringify(n.Asc.plugin.info)}catch(u){r=JSON.stringify({type:i})}n.plugin_sendMessage(r)};n.Asc.plugin.resizeWindow=function(i,r,u,f,e,o){var h,s;t==u&&(u=0);t==f&&(f=0);t==e&&(e=0);t==o&&(o=0);h=JSON.stringify({width:i,height:r,minw:u,minh:f,maxw:e,maxh:o});n.Asc.plugin.info.type=
\"
resize
\"
;n.Asc.plugin.info.data=h;s=
\"\"
;try{s=JSON.stringify(n.Asc.plugin.info)}catch(c){s=JSON.stringify({type:h})}n.plugin_sendMessage(s)};n.Asc.plugin.init(n.Asc.plugin.info.data);break;case
\"
button
\"
:n.Asc.plugin.button(parseInt(u.button));break;case
\"
enableMouseEvent
\"
:i=u.isEnabled;break;case
\"
onExternalMouseUp
\"
:n.Asc.plugin.onExternalMouseUp&&n.Asc.plugin.onExternalMouseUp()}}};n.onmousemove=function(r){if(i&&n.Asc.plugin&&n.Asc.plugin.executeCommand){var u=t===r.clientX?r.pageX:r.clientX,f=t===r.clientY?r.pageY:r.clientY;n.Asc.plugin.executeCommand(
\"
onmousemove
\"
,JSON.stringify({x:u,y:f}))}};n.onmouseup=function(r){if(i&&n.Asc.plugin&&n.Asc.plugin.executeCommand){var u=t===r.clientX?r.pageX:r.clientX,f=t===r.clientY?r.pageY:r.clientY;n.Asc.plugin.executeCommand(
\"
onmouseup
\"
,JSON.stringify({x:u,y:f}))}};n.plugin_sendMessage(JSON.stringify({guid:n.Asc.plugin.guid,type:
\"
initialize_internal
\"
}))})(window,undefined);
"
);
var
_iframe
=
document
.
getElementById
(
"
plugin_iframe
"
);
if
(
_iframe
)
_iframe
.
contentWindow
.
postMessage
(
pluginData
.
serialize
(),
"
*
"
);
return
;
return
;
}
}
else
if
(
"
close
"
==
name
||
"
command
"
==
name
)
else
if
(
"
close
"
==
name
||
"
command
"
==
name
)
...
...
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