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
72d25261
Commit
72d25261
authored
May 23, 2016
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
переделал отсылку сообщений
parent
4749a48c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
20 deletions
+81
-20
common/plugins.js
common/plugins.js
+78
-19
word/Editor/GraphicObjects/GraphicObjects.js
word/Editor/GraphicObjects/GraphicObjects.js
+3
-1
No files found.
common/plugins.js
View file @
72d25261
(
function
(
window
,
undefined
){
function
CPluginData
()
{
this
.
privateData
=
{};
}
CPluginData
.
prototype
=
{
setAttribute
:
function
(
name
,
value
)
{
this
.
privateData
[
name
]
=
value
;
},
getAttribute
:
function
(
name
)
{
return
this
.
privateData
[
name
];
},
serialize
:
function
()
{
var
_data
=
""
;
try
{
_data
=
JSON
.
stringify
(
this
.
privateData
);
}
catch
(
err
)
{
_data
=
"
{
\"
data
\"
:
\"\"
}
"
;
}
return
_data
;
},
deserialize
:
function
(
_data
)
{
try
{
this
.
privateData
=
JSON
.
parse
(
_data
);
}
catch
(
err
)
{
this
.
privateData
=
{
"
data
"
:
""
};
}
}
};
function
CPluginsManager
(
api
)
{
this
.
plugins
=
[];
...
...
@@ -7,8 +50,7 @@
this
.
path
=
""
;
this
.
api
=
null
;
this
.
startData
=
""
;
this
.
startData
=
null
;
this
.
runAndCloseData
=
null
;
}
...
...
@@ -41,13 +83,16 @@
if
(
this
.
plugins
[
i
].
guid
==
guid
)
{
this
.
current
=
this
.
plugins
[
i
];
break
;
}
}
if
(
this
.
current
==
null
)
return
false
;
this
.
startData
=
(
data
==
null
)
?
""
:
data
;
this
.
startData
=
(
data
==
null
||
data
==
""
)
?
new
CPluginData
()
:
data
;
this
.
startData
.
setAttribute
(
"
guid
"
,
guid
)
this
.
correctData
(
this
.
startData
);
this
.
show
();
},
runResize
:
function
(
guid
,
data
,
width
,
height
)
...
...
@@ -98,13 +143,16 @@
var
_iframe
=
document
.
getElementById
(
"
plugin_iframe
"
);
if
(
_iframe
)
{
_iframe
.
contentWindow
.
postMessage
(
this
.
current
.
guid
+
"
;button;
"
+
id
,
"
*
"
);
var
pluginData
=
new
CPluginData
();
pluginData
.
setAttribute
(
"
guid
"
,
this
.
current
.
guid
);
pluginData
.
setAttribute
(
"
type
"
,
"
button
"
);
pluginData
.
setAttribute
(
"
button
"
,
""
+
id
);
_iframe
.
contentWindow
.
postMessage
(
pluginData
.
serialize
(),
"
*
"
);
}
},
init
:
function
()
{
var
_data
=
""
;
switch
(
this
.
current
.
variations
[
0
].
initDataType
)
{
case
Asc
.
EPluginDataType
.
text
:
...
...
@@ -115,12 +163,12 @@
};
this
.
api
.
asc_CheckCopy
(
text_data
,
1
);
_data
=
text_data
.
data
;
this
.
startData
.
setAttribute
(
"
data
"
,
text_data
.
data
)
;
break
;
}
case
Asc
.
EPluginDataType
.
ole
:
{
_data
=
this
.
startData
;
// теперь выше задается
break
;
}
}
...
...
@@ -128,8 +176,22 @@
var
_iframe
=
document
.
getElementById
(
"
plugin_iframe
"
);
if
(
_iframe
)
{
_iframe
.
contentWindow
.
postMessage
(
this
.
current
.
guid
+
"
;init;
"
+
_data
,
"
*
"
);
this
.
startData
.
setAttribute
(
"
type
"
,
"
init
"
);
_iframe
.
contentWindow
.
postMessage
(
this
.
startData
.
serialize
(),
"
*
"
);
}
},
correctData
:
function
(
pluginData
)
{
pluginData
.
setAttribute
(
"
editorType
"
,
this
.
api
.
_editorNameById
());
var
_mmToPx
=
AscCommon
.
g_dKoef_mm_to_pix
;
if
(
this
.
api
.
WordControl
&&
this
.
api
.
WordControl
.
m_nZoomValue
)
_mmToPx
*=
this
.
api
.
WordControl
.
m_nZoomValue
/
100
;
pluginData
.
setAttribute
(
"
mmToPx
"
,
_mmToPx
);
if
(
undefined
==
pluginData
.
getAttribute
(
"
data
"
))
pluginData
.
setAttribute
(
"
data
"
,
""
);
}
};
...
...
@@ -140,20 +202,16 @@
if
(
typeof
(
event
.
data
)
==
"
string
"
)
{
var
i1
=
event
.
data
.
indexOf
(
"
;
"
);
if
(
-
1
==
i1
)
return
;
var
pluginData
=
new
CPluginData
();
pluginData
.
deserialize
(
event
.
data
);
var
guid
=
event
.
data
.
substr
(
0
,
i1
);
if
(
guid
!=
window
.
g_asc_plugins
.
current
.
guid
)
return
;
var
guid
=
pluginData
.
getAttribute
(
"
guid
"
);
var
i2
=
event
.
data
.
indexOf
(
"
;
"
,
i1
+
1
);
if
(
-
1
==
i2
)
if
(
guid
!=
window
.
g_asc_plugins
.
current
.
guid
)
return
;
var
name
=
event
.
data
.
substr
(
i1
+
1
,
i2
-
i1
-
1
);
var
value
=
event
.
data
.
substr
(
i2
+
1
);
var
name
=
pluginData
.
getAttribute
(
"
type
"
);
var
value
=
pluginData
.
getAttribute
(
"
data
"
);
if
(
"
initialize
"
==
name
)
{
...
...
@@ -162,7 +220,7 @@
}
else
if
(
"
close
"
==
name
)
{
if
(
value
!=
""
)
if
(
value
&&
value
!=
""
)
{
try
{
...
...
@@ -201,6 +259,7 @@
return
window
.
g_asc_plugins
;
};
window
[
"
Asc
"
].
CPluginData
=
CPluginData
;
})(
window
,
undefined
);
// потом удалить!!!
...
...
word/Editor/GraphicObjects/GraphicObjects.js
View file @
72d25261
...
...
@@ -1222,7 +1222,9 @@ CGraphicObjects.prototype =
{
if
(
false
===
this
.
document
.
Document_Is_SelectionLocked
(
changestype_Drawing_Props
))
{
editor
.
asc_pluginRun
(
oleObject
.
m_sApplicationId
,
0
,
oleObject
.
m_sData
);
var
pluginData
=
new
Asc
.
CPluginData
();
pluginData
.
setAttribute
(
"
data
"
,
oleObject
.
m_sData
);
editor
.
asc_pluginRun
(
oleObject
.
m_sApplicationId
,
0
,
pluginData
);
}
this
.
changeCurrentState
(
new
AscFormat
.
NullState
(
this
));
this
.
document
.
OnMouseUp
(
e
,
x
,
y
,
pageIndex
);
...
...
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