Commit e9e452d6 authored by GoshaZotov's avatar GoshaZotov

add start_paste/end_paste

parent 951aafa6
...@@ -793,7 +793,10 @@ CHistory.prototype._sendCanUndoRedo = function() ...@@ -793,7 +793,10 @@ CHistory.prototype._sendCanUndoRedo = function()
this.workbook.handlers.trigger("setCanUndo", this.Can_Undo()); this.workbook.handlers.trigger("setCanUndo", this.Can_Undo());
this.workbook.handlers.trigger("setCanRedo", this.Can_Redo()); this.workbook.handlers.trigger("setCanRedo", this.Can_Redo());
this.workbook.handlers.trigger("setDocumentModified", this.Have_Changes()); this.workbook.handlers.trigger("setDocumentModified", this.Have_Changes());
this.workbook.handlers.trigger("hideSpecialPasteOptions"); if(!window["Asc"]["editor"].wb.clipboard.pasteStart)
{
this.workbook.handlers.trigger("hideSpecialPasteOptions");
}
}; };
CHistory.prototype.SetSelection = function(range) CHistory.prototype.SetSelection = function(range)
{ {
......
...@@ -243,6 +243,8 @@ ...@@ -243,6 +243,8 @@
this.pasteProcessor = new PasteProcessorExcel(); this.pasteProcessor = new PasteProcessorExcel();
this.specialPasteProps = null; this.specialPasteProps = null;
//TODO возможно стоит перенести в clipboard_base
this.pasteStart = false;//если true - осуществляется вставка. false выставляется только по полному окончанию вставки(загрузки картинок и тд)
return this; return this;
} }
...@@ -328,6 +330,8 @@ ...@@ -328,6 +330,8 @@
var t = this; var t = this;
t.pasteProcessor.clean(); t.pasteProcessor.clean();
window["Asc"]["editor"].wb.clipboard.start_paste();
if(!bIsSpecialPaste) if(!bIsSpecialPaste)
{ {
window['AscCommon'].g_clipboardBase.specialPasteData.activeRange = ws.model.selectionRange.clone(ws.model); window['AscCommon'].g_clipboardBase.specialPasteData.activeRange = ws.model.selectionRange.clone(ws.model);
...@@ -344,6 +348,7 @@ ...@@ -344,6 +348,7 @@
if(text) if(text)
{ {
window["Asc"]["editor"].wb.cellEditor.pasteText(text); window["Asc"]["editor"].wb.cellEditor.pasteText(text);
window["Asc"]["editor"].wb.clipboard.end_paste();
} }
} }
else else
...@@ -368,6 +373,7 @@ ...@@ -368,6 +373,7 @@
if(text) if(text)
{ {
window["Asc"]["editor"].wb.cellEditor.pasteText(text); window["Asc"]["editor"].wb.cellEditor.pasteText(text);
window["Asc"]["editor"].wb.clipboard.end_paste();
} }
} }
else else
...@@ -384,6 +390,7 @@ ...@@ -384,6 +390,7 @@
if(data1) if(data1)
{ {
window["Asc"]["editor"].wb.cellEditor.pasteText(data1); window["Asc"]["editor"].wb.cellEditor.pasteText(data1);
window["Asc"]["editor"].wb.clipboard.end_paste();
} }
} }
else else
...@@ -402,6 +409,18 @@ ...@@ -402,6 +409,18 @@
window['AscCommon'].g_clipboardBase.specialPasteData.data2 = data2; window['AscCommon'].g_clipboardBase.specialPasteData.data2 = data2;
window['AscCommon'].g_clipboardBase.specialPasteData.text_data = text_data; window['AscCommon'].g_clipboardBase.specialPasteData.text_data = text_data;
} }
},
start_paste: function()
{
this.pasteStart = true;
console.log(this.pasteStart);
},
end_paste: function()
{
this.pasteStart = false;
console.log(this.pasteStart);
} }
}; };
...@@ -1088,6 +1107,7 @@ ...@@ -1088,6 +1107,7 @@
{ {
t._insertBinaryIntoShapeContent(worksheet, [docContent]); t._insertBinaryIntoShapeContent(worksheet, [docContent]);
} }
window["Asc"]["editor"].wb.clipboard.end_paste();
}; };
worksheet.objectRender.controller.checkSelectedObjectsAndCallback2(callback); worksheet.objectRender.controller.checkSelectedObjectsAndCallback2(callback);
...@@ -1127,6 +1147,7 @@ ...@@ -1127,6 +1147,7 @@
{ {
t._insertBinaryIntoShapeContent(worksheet, pasteData.content, true); t._insertBinaryIntoShapeContent(worksheet, pasteData.content, true);
} }
window["Asc"]["editor"].wb.clipboard.end_paste();
}; };
worksheet.objectRender.controller.checkSelectedObjectsAndCallback2(callback); worksheet.objectRender.controller.checkSelectedObjectsAndCallback2(callback);
...@@ -1163,6 +1184,7 @@ ...@@ -1163,6 +1184,7 @@
if(isCellEditMode) if(isCellEditMode)
{ {
var text = this._getTextFromWord(docContent); var text = this._getTextFromWord(docContent);
window["Asc"]["editor"].wb.clipboard.end_paste();
return text; return text;
} }
else if(isIntoShape) else if(isIntoShape)
...@@ -1171,8 +1193,9 @@ ...@@ -1171,8 +1193,9 @@
{ {
if(isSuccess) if(isSuccess)
{ {
t._insertBinaryIntoShapeContent(worksheet, docContent) t._insertBinaryIntoShapeContent(worksheet, docContent);
} }
window["Asc"]["editor"].wb.clipboard.end_paste();
}; };
worksheet.objectRender.controller.checkSelectedObjectsAndCallback2(callback); worksheet.objectRender.controller.checkSelectedObjectsAndCallback2(callback);
...@@ -1571,6 +1594,9 @@ ...@@ -1571,6 +1594,9 @@
ws.objectRender.controller.getGraphicObjectProps(); ws.objectRender.controller.getGraphicObjectProps();
}); });
} }
window["Asc"]["editor"].wb.clipboard.end_paste();
}, },
_insertImagesFromBinaryWord: function(ws, data, aImagesSync) _insertImagesFromBinaryWord: function(ws, data, aImagesSync)
...@@ -1780,6 +1806,8 @@ ...@@ -1780,6 +1806,8 @@
{ {
if(isSuccess) if(isSuccess)
t._pasteInShape(worksheet, node, isIntoShape); t._pasteInShape(worksheet, node, isIntoShape);
window["Asc"]["editor"].wb.clipboard.end_paste();
}; };
worksheet.objectRender.controller.checkSelectedObjectsAndCallback2(callback); worksheet.objectRender.controller.checkSelectedObjectsAndCallback2(callback);
...@@ -2482,6 +2510,8 @@ ...@@ -2482,6 +2510,8 @@
else else
isIntoShape.Paragraph_Add(new ParaText(_char)); isIntoShape.Paragraph_Add(new ParaText(_char));
} }
window["Asc"]["editor"].wb.clipboard.end_paste();
}; };
worksheet.objectRender.controller.checkSelectedObjectsAndCallback2(callback); worksheet.objectRender.controller.checkSelectedObjectsAndCallback2(callback);
......
...@@ -8773,8 +8773,12 @@ ...@@ -8773,8 +8773,12 @@
this.model.selectionRange = specialPasteData.activeRange.clone(this.model); this.model.selectionRange = specialPasteData.activeRange.clone(this.model);
} }
window["Asc"]["editor"].wb.clipboard.start_paste();
//откатываем данные в ячейках //откатываем данные в ячейках
api.wb.clipboard.pasteProcessor.pasteFromBinary(this, preSpecialPasteData.data); api.wb.clipboard.pasteProcessor.pasteFromBinary(this, preSpecialPasteData.data);
window["Asc"]["editor"].wb.clipboard.start_paste();
//удаляем вставленные изображения //удаляем вставленные изображения
if(preSpecialPasteData.images) if(preSpecialPasteData.images)
{ {
...@@ -8787,6 +8791,7 @@ ...@@ -8787,6 +8791,7 @@
oObject.setBDeleted(true); oObject.setBDeleted(true);
} }
} }
window["Asc"]["editor"].wb.clipboard.end_paste();
} }
//далее специальная вставка //далее специальная вставка
...@@ -8962,6 +8967,7 @@ ...@@ -8962,6 +8967,7 @@
if(fromBinary) if(fromBinary)
{ {
t._pasteData(isLargeRange, fromBinary, pasteContent, bIsUpdate, canChangeColWidth); t._pasteData(isLargeRange, fromBinary, pasteContent, bIsUpdate, canChangeColWidth);
window["Asc"]["editor"].wb.clipboard.end_paste();
} }
else else
{ {
...@@ -9004,6 +9010,8 @@ ...@@ -9004,6 +9010,8 @@
t._pasteData( isLargeRange, fromBinary, pasteContent, bIsUpdate, canChangeColWidth ); t._pasteData( isLargeRange, fromBinary, pasteContent, bIsUpdate, canChangeColWidth );
api.wb.clipboard.pasteProcessor._insertImagesFromBinaryWord( t, pasteContent, oImageMap ); api.wb.clipboard.pasteProcessor._insertImagesFromBinaryWord( t, pasteContent, oImageMap );
window["Asc"]["editor"].wb.clipboard.end_paste();
isEndTransaction = true; isEndTransaction = true;
} }
else else
...@@ -9015,6 +9023,7 @@ ...@@ -9015,6 +9023,7 @@
AscCommon.ResetNewUrls( data, oObjectsForDownload.aUrls, oObjectsForDownload.aBuilderImagesByUrl, oImageMap ); AscCommon.ResetNewUrls( data, oObjectsForDownload.aUrls, oObjectsForDownload.aBuilderImagesByUrl, oImageMap );
t._pasteData( isLargeRange, fromBinary, pasteContent, bIsUpdate, canChangeColWidth ); t._pasteData( isLargeRange, fromBinary, pasteContent, bIsUpdate, canChangeColWidth );
api.wb.clipboard.pasteProcessor._insertImagesFromBinaryWord( t, pasteContent, oImageMap ); api.wb.clipboard.pasteProcessor._insertImagesFromBinaryWord( t, pasteContent, oImageMap );
window["Asc"]["editor"].wb.clipboard.end_paste();
isEndTransaction = true; isEndTransaction = true;
} }
...@@ -9026,6 +9035,7 @@ ...@@ -9026,6 +9035,7 @@
AscCommon.ResetNewUrls( data, oObjectsForDownload.aUrls, oObjectsForDownload.aBuilderImagesByUrl, oImageMap ); AscCommon.ResetNewUrls( data, oObjectsForDownload.aUrls, oObjectsForDownload.aBuilderImagesByUrl, oImageMap );
t._pasteData( isLargeRange, fromBinary, pasteContent, bIsUpdate, canChangeColWidth ); t._pasteData( isLargeRange, fromBinary, pasteContent, bIsUpdate, canChangeColWidth );
api.wb.clipboard.pasteProcessor._insertImagesFromBinaryWord( t, pasteContent, oImageMap ); api.wb.clipboard.pasteProcessor._insertImagesFromBinaryWord( t, pasteContent, oImageMap );
window["Asc"]["editor"].wb.clipboard.end_paste();
//закрываем транзакцию, поскольку в setSelectionInfo она не закроется //закрываем транзакцию, поскольку в setSelectionInfo она не закроется
History.EndTransaction(); History.EndTransaction();
...@@ -9037,6 +9047,7 @@ ...@@ -9037,6 +9047,7 @@
else else
{ {
t._pasteData( isLargeRange, fromBinary, pasteContent, bIsUpdate, canChangeColWidth ); t._pasteData( isLargeRange, fromBinary, pasteContent, bIsUpdate, canChangeColWidth );
window["Asc"]["editor"].wb.clipboard.end_paste();
isEndTransaction = true; isEndTransaction = true;
} }
......
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