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,31 +425,35 @@ ColorManager.prototype =
};
g_oColorManager = new ColorManager();
/** @constructor */
function Fragment(val) {
this.text = null;
this.format = null;
this.sFormula = null;
this.sId = null;
if (null != val) {
this.set(val);
/** @constructor */
function Fragment(val) {
this.text = null;
this.format = null;
this.sFormula = null;
this.sId = null;
if (null != val) {
this.set(val);
}
}
}
Fragment.prototype = {
clone : function () {
Fragment.prototype.clone = function () {
return new Fragment(this);
},
set : function(oVal) {
if (null != oVal.text)
};
Fragment.prototype.set = function (oVal) {
if (null != oVal.text) {
this.text = oVal.text;
if (null != oVal.format)
}
if (null != oVal.format) {
this.format = oVal.format;
if (null != oVal.sFormula)
}
if (null != oVal.sFormula) {
this.sFormula = oVal.sFormula;
if (null != oVal.sId)
}
if (null != oVal.sId) {
this.sId = oVal.sId;
}
};
}
};
var g_oFontProperties = {
fn: 0,
scheme: 1,
......
......@@ -145,7 +145,7 @@
this.isSelectMode = c_oAscCellEditorSelectState.no;
this.hasCursor = false;
this.hasFocus = false;
this.newTextFormat = undefined;
this.newTextFormat = null;
this.selectionTimer = undefined;
this.enableKeyEvents = true;
this.isTopLineActive = false;
......@@ -769,7 +769,7 @@
this._cleanFragments( opt.fragments );
this.textRender.setString( opt.fragments, this.textFlags );
delete this.newTextFormat;
this.newTextFormat = null;
if ( opt.zoom > 0 ) {
this.overlayCtx.setFont( this.drawingCtx.getFont() );
......@@ -1725,7 +1725,7 @@
if (this.newTextFormat) {
var oNewObj = new Fragment({format: this.newTextFormat, text: str});
this._addFragments([oNewObj], pos);
delete this.newTextFormat;
this.newTextFormat = null;
} else {
f = this._findFragmentToInsertInto(pos);
if (f) {
......
......@@ -88,6 +88,11 @@
this.inputContext = null;
this.LastCopyBinary = null; // для вставки по кнопке, еогда браузер не позволяет
// images counter
this.PasteImagesCount = 0;
this.PasteImagesCounter = 0;
this.PasteImagesBody = "";
}
CClipboardBase.prototype =
......@@ -271,8 +276,63 @@
this.CommonIframe_PasteStart(sHtml);
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;
},
......
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