Commit da388bc8 authored by Igor.Zotov's avatar Igor.Zotov Committed by Alexander.Trofimov

рефакторинг

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56006 954022d7-b5bf-4e40-9824-e11837661b57
parent 27bac741
...@@ -1586,12 +1586,92 @@ ...@@ -1586,12 +1586,92 @@
return false; return false;
}, },
_pasteFromLocalStorage: function(worksheet, node, onlyFromLocalStorage)
{
var textNode, t = this;
//в случае вставки по нажатию на правую кнопку мыши
if(onlyFromLocalStorage)
{
if(t.lStorage)
{
if(t.copyText && t.copyText.isImage)
{
if(t._insertImages(worksheet,t.lStorage,onlyFromLocalStorage))
{
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
return true;
}
}
else
{
if(t.lStorage.htmlInShape)
{
return t.lStorage.htmlInShape;
}
else
{
worksheet.setSelectionInfo('paste',t,false,true);
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
return true;
}
}
}
}
//проверяем на равенство содержимому локального буфера
textNode = t._getTextFromTable(node);
if(t._isEqualText(textNode, node) && !onlyFromLocalStorage)
{
if(t.copyText.isImage)
{
if(t._insertImages(worksheet,t.lStorage,onlyFromLocalStorage))
{
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
return true;
}
}
else
{
if(t.lStorage.htmlInShape)
{
return t.lStorage.htmlInShape;
}
else
{
worksheet.setSelectionInfo('paste',t,false,true);
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
return true;
}
}
};
return false;
},
_pasteInShape: function(worksheet, node)
{
if(onlyFromLocalStorage)
{
if(t.lStorage && t.lStorage.htmlInShape)
worksheet.objectRender.controller.curState.textObject.txBody.insertHtml(t.lStorage.htmlInShape);
}
else
worksheet.objectRender.controller.curState.textObject.txBody.insertHtml(node);
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
},
_editorPasteExec: function (worksheet, node, isText,onlyFromLocalStorage) _editorPasteExec: function (worksheet, node, isText,onlyFromLocalStorage)
{ {
if(node == undefined) if(node == undefined)
return; return;
var aResult, binaryResult, textNode, pasteFragment = node, t = this; var aResult, binaryResult, pasteFragment = node, t = this, localStorageResult;
if(isOnlyLocalBufferSafari && navigator.userAgent.toLowerCase().indexOf('safari') > -1 && navigator.userAgent.toLowerCase().indexOf('mac')) if(isOnlyLocalBufferSafari && navigator.userAgent.toLowerCase().indexOf('safari') > -1 && navigator.userAgent.toLowerCase().indexOf('mac'))
onlyFromLocalStorage = true; onlyFromLocalStorage = true;
...@@ -1599,17 +1679,9 @@ ...@@ -1599,17 +1679,9 @@
//если находимся внутри шейпа //если находимся внутри шейпа
if(worksheet.objectRender.controller.curState.textObject && worksheet.objectRender.controller.curState.textObject.txBody) if(worksheet.objectRender.controller.curState.textObject && worksheet.objectRender.controller.curState.textObject.txBody)
{ {
if(onlyFromLocalStorage) this._pasteInShape(worksheet, node, onlyFromLocalStorage);
{
if(t.lStorage && t.lStorage.htmlInShape)
worksheet.objectRender.controller.curState.textObject.txBody.insertHtml(t.lStorage.htmlInShape);
}
else
worksheet.objectRender.controller.curState.textObject.txBody.insertHtml(node);
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
return; return;
} };
//****binary**** //****binary****
if(copyPasteUseBinary) if(copyPasteUseBinary)
...@@ -1628,67 +1700,15 @@ ...@@ -1628,67 +1700,15 @@
//local storage //local storage
if(activateLocalStorage) if(activateLocalStorage)
{ {
//в случае вставки по нажатию на правую кнопку мыши localStorageResult = this._pasteFromLocalStorage();
if(onlyFromLocalStorage)
{
if(t.lStorage)
{
if(t.copyText && t.copyText.isImage)
{
if(t._insertImages(worksheet,t.lStorage,onlyFromLocalStorage))
{
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
return;
}
}
else
{
if(t.lStorage.htmlInShape)
{
node = t.lStorage.htmlInShape;
pasteFragment = node;
}
else
{
worksheet.setSelectionInfo('paste',t,false,true);
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
return;
}
}
}
}
//проверяем на равенство содержимому локального буфера if(localStorageResult === true)
textNode = t._getTextFromTable(node); return;
if(t._isEqualText(textNode, node) && !onlyFromLocalStorage) else if(localStorageResult !== false && localStorageResult != undefined)
{ {
if(t.copyText.isImage) pasteFragment = localStorageResult;
{ node = localStorageResult;
if(t._insertImages(worksheet,t.lStorage,onlyFromLocalStorage)) };
{
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
return;
}
}
else
{
if(t.lStorage.htmlInShape)
{
node = t.lStorage.htmlInShape;
pasteFragment = node;
}
else
{
worksheet.setSelectionInfo('paste',t,false,true);
window.GlobalPasteFlag = false;
window.GlobalPasteFlagCounter = 0;
return;
}
}
}
}; };
//parse HTML //parse HTML
......
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