Commit f4552010 authored by Alexey Golubev's avatar Alexey Golubev

Merge branch 'hotfix/v4.1.1'

parents 035dde9d ae2af012
[![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
......
......@@ -423,7 +423,6 @@ DrawingObjectsController.prototype.addImageFromParams = function(rasterImageId,
};
DrawingObjectsController.prototype.addOleObjectFromParams = function(fPosX, fPosY, fWidth, fHeight, nWidthPix, nHeightPix, sLocalUrl, sData, sApplicationId){
History.Create_NewPoint();
var oOleObject = this.createOleObject(sData, sApplicationId, sLocalUrl, fPosX, fPosY, fWidth, fHeight, nWidthPix, nHeightPix);
this.resetSelection();
oOleObject.setWorksheet(this.drawingObjects.getWorksheetModel());
......@@ -436,9 +435,6 @@ DrawingObjectsController.prototype.addOleObjectFromParams = function(fPosX, fPos
};
DrawingObjectsController.prototype.editOleObjectFromParams = function(oOleObject, sData, sImageUrl, nPixWidth, nPixHeight, bResize){
if(!bResize){
History.Create_NewPoint();
}
oOleObject.setData(sData);
var _blipFill = new AscFormat.CBlipFill();
_blipFill.RasterImageId = sImageUrl;
......
......@@ -729,7 +729,7 @@ CImageShape.prototype.Undo = function(data)
}
case AscDFH.historyitem_ImageShapeSetApplicationId:
{
this.m_sData = data.oldId;
this.m_sApplicationId = data.oldId;
break;
}
case AscDFH.historyitem_ImageShapeSetPixSizes:
......@@ -853,7 +853,7 @@ CImageShape.prototype.Redo = function(data)
}
case AscDFH.historyitem_ImageShapeSetApplicationId:
{
this.m_sData = data.newId;
this.m_sApplicationId = data.newId;
break;
}
......
......@@ -626,7 +626,7 @@
ElemToSelect = document.createElement("div");
ElemToSelect.id = this.CommonDivId;
ElemToSelect.className = this.CommonDivClassName;
ElemToSelect.style.position = "absolute";
ElemToSelect.style.position = "fixed";
ElemToSelect.style.left = '0px';
ElemToSelect.style.top = '-100px';
ElemToSelect.style.width = '10000px';
......
(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
......@@ -385,9 +385,19 @@
var name = pluginData.getAttribute("type");
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;
}
else if ("close" == name || "command" == name)
......
......@@ -3701,11 +3701,7 @@ background-repeat: no-repeat;\
var _image = this.ImageLoader.LoadImage(AscCommon.getFullImageSrc2(sLocalUrl), 1);
if (null != _image)//картинка уже должна быть загружена
{
if (false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Drawing_Props))
{
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_AddOleObject);
this.WordControl.m_oLogicDocument.Add_OleObject(fWidth, fHeight, nWidthPix, nHeightPix, sLocalUrl, sData, sApplicationId);
}
this.WordControl.m_oLogicDocument.Add_OleObject(fWidth, fHeight, nWidthPix, nHeightPix, sLocalUrl, sData, sApplicationId);
}
};
......@@ -3713,17 +3709,8 @@ background-repeat: no-repeat;\
{
if (oOleObject)
{
if (!bResize)
{
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_EditOleObject);
this.WordControl.m_oLogicDocument.Edit_OleObject(oOleObject, sData, sImageUrl, nPixWidth, nPixHeight);
this.WordControl.m_oLogicDocument.Recalculate();
}
else
{
this.WordControl.m_oLogicDocument.Edit_OleObject(oOleObject, sData, sImageUrl, nPixWidth, nPixHeight);
this.WordControl.m_oLogicDocument.Recalculate();
}
this.WordControl.m_oLogicDocument.Edit_OleObject(oOleObject, sData, sImageUrl, nPixWidth, nPixHeight);
this.WordControl.m_oLogicDocument.Recalculate();
}
};
......
......@@ -5580,11 +5580,7 @@ background-repeat: no-repeat;\
var _image = this.ImageLoader.LoadImage(AscCommon.getFullImageSrc2(sLocalUrl), 1);
if (null != _image)//картинка уже должна быть загружена
{
if (false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content))
{
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_AddOleObject);
this.WordControl.m_oLogicDocument.Add_OleObject(fWidth, fHeight, nWidthPix, nHeightPix, sLocalUrl, sData, sApplicationId);
}
this.WordControl.m_oLogicDocument.Add_OleObject(fWidth, fHeight, nWidthPix, nHeightPix, sLocalUrl, sData, sApplicationId);
}
};
......@@ -5592,22 +5588,9 @@ background-repeat: no-repeat;\
{
if (oOleObject)
{
if (!bResize)
{
if (false === this.WordControl.m_oLogicDocument.Document_Is_SelectionLocked(changestype_Paragraph_Content))
{
this.WordControl.m_oLogicDocument.Create_NewHistoryPoint(AscDFH.historydescription_Document_EditOleObject);
this.WordControl.m_oLogicDocument.Edit_OleObject(oOleObject, sData, sImageUrl, nPixWidth, nPixHeight);
this.WordControl.m_oLogicDocument.Recalculate();
this.WordControl.m_oLogicDocument.Document_UpdateInterfaceState();
}
}
else
{
this.WordControl.m_oLogicDocument.Edit_OleObject(oOleObject, sData, sImageUrl, nPixWidth, nPixHeight);
this.WordControl.m_oLogicDocument.Recalculate();
this.WordControl.m_oLogicDocument.Document_UpdateInterfaceState();
}
this.WordControl.m_oLogicDocument.Edit_OleObject(oOleObject, sData, sImageUrl, nPixWidth, nPixHeight);
this.WordControl.m_oLogicDocument.Recalculate();
this.WordControl.m_oLogicDocument.Document_UpdateInterfaceState();
}
};
//-----------------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment