Commit 50c031ae authored by Oleg Korshul's avatar Oleg Korshul Committed by GitHub

Merge pull request #40 from ONLYOFFICE/release/v4.1.0

Release/v4.1.0
parents b407881f ebd9a87d
...@@ -425,8 +425,8 @@ ColorManager.prototype = ...@@ -425,8 +425,8 @@ ColorManager.prototype =
}; };
g_oColorManager = new ColorManager(); g_oColorManager = new ColorManager();
/** @constructor */ /** @constructor */
function Fragment(val) { function Fragment(val) {
this.text = null; this.text = null;
this.format = null; this.format = null;
this.sFormula = null; this.sFormula = null;
...@@ -434,22 +434,26 @@ function Fragment(val) { ...@@ -434,22 +434,26 @@ function Fragment(val) {
if (null != val) { if (null != val) {
this.set(val); this.set(val);
} }
} }
Fragment.prototype = {
clone : function () { Fragment.prototype.clone = function () {
return new Fragment(this); return new Fragment(this);
}, };
set : function(oVal) { Fragment.prototype.set = function (oVal) {
if (null != oVal.text) if (null != oVal.text) {
this.text = oVal.text; this.text = oVal.text;
if (null != oVal.format) }
if (null != oVal.format) {
this.format = oVal.format; this.format = oVal.format;
if (null != oVal.sFormula) }
if (null != oVal.sFormula) {
this.sFormula = oVal.sFormula; this.sFormula = oVal.sFormula;
if (null != oVal.sId) }
if (null != oVal.sId) {
this.sId = oVal.sId; this.sId = oVal.sId;
} }
}; };
var g_oFontProperties = { var g_oFontProperties = {
fn: 0, fn: 0,
scheme: 1, scheme: 1,
......
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
this.isSelectMode = c_oAscCellEditorSelectState.no; this.isSelectMode = c_oAscCellEditorSelectState.no;
this.hasCursor = false; this.hasCursor = false;
this.hasFocus = false; this.hasFocus = false;
this.newTextFormat = undefined; this.newTextFormat = null;
this.selectionTimer = undefined; this.selectionTimer = undefined;
this.enableKeyEvents = true; this.enableKeyEvents = true;
this.isTopLineActive = false; this.isTopLineActive = false;
...@@ -769,7 +769,7 @@ ...@@ -769,7 +769,7 @@
this._cleanFragments( opt.fragments ); this._cleanFragments( opt.fragments );
this.textRender.setString( opt.fragments, this.textFlags ); this.textRender.setString( opt.fragments, this.textFlags );
delete this.newTextFormat; this.newTextFormat = null;
if ( opt.zoom > 0 ) { if ( opt.zoom > 0 ) {
this.overlayCtx.setFont( this.drawingCtx.getFont() ); this.overlayCtx.setFont( this.drawingCtx.getFont() );
...@@ -1725,7 +1725,7 @@ ...@@ -1725,7 +1725,7 @@
if (this.newTextFormat) { if (this.newTextFormat) {
var oNewObj = new Fragment({format: this.newTextFormat, text: str}); var oNewObj = new Fragment({format: this.newTextFormat, text: str});
this._addFragments([oNewObj], pos); this._addFragments([oNewObj], pos);
delete this.newTextFormat; this.newTextFormat = null;
} else { } else {
f = this._findFragmentToInsertInto(pos); f = this._findFragmentToInsertInto(pos);
if (f) { if (f) {
......
...@@ -88,6 +88,11 @@ ...@@ -88,6 +88,11 @@
this.inputContext = null; this.inputContext = null;
this.LastCopyBinary = null; // для вставки по кнопке, еогда браузер не позволяет this.LastCopyBinary = null; // для вставки по кнопке, еогда браузер не позволяет
// images counter
this.PasteImagesCount = 0;
this.PasteImagesCounter = 0;
this.PasteImagesBody = "";
} }
CClipboardBase.prototype = CClipboardBase.prototype =
...@@ -271,8 +276,63 @@ ...@@ -271,8 +276,63 @@
this.CommonIframe_PasteStart(sHtml); this.CommonIframe_PasteStart(sHtml);
return false; return false;
} }
var items = _clipboard.items;
if (null != items && 0 != items.length)
{
g_clipboardBase.PasteImagesBody = "";
g_clipboardBase.PasteImagesCount = items.length;
g_clipboardBase.PasteImagesCounter = 0;
for (var i = 0; i < items.length; ++i)
{
if (items[i].kind == 'file' && items[i].type.indexOf('image/') !== -1)
{
var blob = items[i].getAsFile();
var reader = new FileReader();
reader.onload = function(e) {
g_clipboardBase.PasteImagesCounter++;
g_clipboardBase.PasteImagesBody += ("<img src=\"" + e.target.result + "\"/>");
if (g_clipboardBase.PasteImagesCounter == g_clipboardBase.PasteImagesCount)
{
g_clipboardBase.CommonIframe_PasteStart("<html><body>" + g_clipboardBase.PasteImagesBody + "</body></html>");
g_clipboardBase.PasteImagesBody = "";
g_clipboardBase.PasteImagesCounter = 0;
g_clipboardBase.PasteImagesCount = 0;
} }
};
reader.onabort = reader.onerror = function(e) {
g_clipboardBase.PasteImagesCounter++;
if (g_clipboardBase.PasteImagesCounter == g_clipboardBase.PasteImagesCount)
{
g_clipboardBase.CommonIframe_PasteStart("<html><body>" + g_clipboardBase.PasteImagesBody + "</body></html>");
g_clipboardBase.PasteImagesBody = "";
g_clipboardBase.PasteImagesCounter = 0;
g_clipboardBase.PasteImagesCount = 0;
}
};
reader.readAsDataURL(blob);
}
else
{
g_clipboardBase.PasteImagesCounter++;
}
}
if (g_clipboardBase.PasteImagesCounter == g_clipboardBase.PasteImagesCount)
g_clipboardBase.Paste_End();
return false;
}
}
g_clipboardBase.Paste_End();
return false; return false;
}, },
......
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