Commit 4e531277 authored by Alexey Golubev's avatar Alexey Golubev Committed by GitHub

Merge pull request #135 from ONLYOFFICE/feature/bug35311

fix bug
parents a1771911 9b782d18
...@@ -691,6 +691,7 @@ function CDrawingCollaborativeTarget() ...@@ -691,6 +691,7 @@ function CDrawingCollaborativeTarget()
this.HtmlElementY = 0; this.HtmlElementY = 0;
this.Style = ""; this.Style = "";
this.IsInsertToDOM = false;
} }
CDrawingCollaborativeTarget.prototype = CDrawingCollaborativeTarget.prototype =
{ {
...@@ -844,6 +845,7 @@ CDrawingCollaborativeTarget.prototype = ...@@ -844,6 +845,7 @@ CDrawingCollaborativeTarget.prototype =
if (bIsHtmlElementCreate) if (bIsHtmlElementCreate)
{ {
_drawing_doc.m_oWordControl.m_oMainView.HtmlElement.appendChild(this.HtmlElement); _drawing_doc.m_oWordControl.m_oMainView.HtmlElement.appendChild(this.HtmlElement);
this.IsInsertToDOM = true;
} }
if (this.HtmlElement.style.display != "block") if (this.HtmlElement.style.display != "block")
...@@ -854,7 +856,11 @@ CDrawingCollaborativeTarget.prototype = ...@@ -854,7 +856,11 @@ CDrawingCollaborativeTarget.prototype =
Remove : function(_drawing_doc) Remove : function(_drawing_doc)
{ {
_drawing_doc.m_oWordControl.m_oMainView.HtmlElement.removeChild(this.HtmlElement); if (this.IsInsertToDOM)
{
_drawing_doc.m_oWordControl.m_oMainView.HtmlElement.removeChild(this.HtmlElement);
this.IsInsertToDOM = false;
}
}, },
Update : function(_drawing_doc) Update : function(_drawing_doc)
...@@ -3137,12 +3143,25 @@ function CDrawingDocument() ...@@ -3137,12 +3143,25 @@ function CDrawingDocument()
}; };
this.Collaborative_RemoveTarget = function(_id) this.Collaborative_RemoveTarget = function(_id)
{ {
for (var i = 0; i < this.CollaborativeTargets.length; i++) var i = 0;
for (i = 0; i < this.CollaborativeTargets.length; i++)
{ {
if (_id == this.CollaborativeTargets[i].Id) if (_id == this.CollaborativeTargets[i].Id)
{ {
this.CollaborativeTargets[i].Remove(this); this.CollaborativeTargets[i].Remove(this);
this.CollaborativeTargets.splice(i, 1); this.CollaborativeTargets.splice(i, 1);
i--;
}
}
var _len_tasks = this.CollaborativeTargetsUpdateTasks.length;
for (i = 0; i < _len_tasks; i++)
{
var _tmp = this.CollaborativeTargetsUpdateTasks[i];
if (_tmp[0] == _id)
{
this.CollaborativeTargetsUpdateTasks.splice(i, 1);
i--;
} }
} }
}; };
......
...@@ -1869,6 +1869,7 @@ function CDrawingCollaborativeTarget() ...@@ -1869,6 +1869,7 @@ function CDrawingCollaborativeTarget()
this.Color = null; this.Color = null;
this.Style = ""; this.Style = "";
this.IsInsertToDOM = false;
} }
CDrawingCollaborativeTarget.prototype = CDrawingCollaborativeTarget.prototype =
{ {
...@@ -2034,12 +2035,17 @@ CDrawingCollaborativeTarget.prototype = ...@@ -2034,12 +2035,17 @@ CDrawingCollaborativeTarget.prototype =
if (bIsHtmlElementCreate) if (bIsHtmlElementCreate)
{ {
_drawing_doc.m_oWordControl.m_oMainView.HtmlElement.appendChild(this.HtmlElement); _drawing_doc.m_oWordControl.m_oMainView.HtmlElement.appendChild(this.HtmlElement);
this.IsInsertToDOM = true;
} }
}, },
Remove: function (_drawing_doc) Remove: function (_drawing_doc)
{ {
_drawing_doc.m_oWordControl.m_oMainView.HtmlElement.removeChild(this.HtmlElement); if (this.IsInsertToDOM)
{
_drawing_doc.m_oWordControl.m_oMainView.HtmlElement.removeChild(this.HtmlElement);
this.IsInsertToDOM = false;
}
}, },
Update: function (_drawing_doc) Update: function (_drawing_doc)
...@@ -7319,12 +7325,25 @@ function CDrawingDocument() ...@@ -7319,12 +7325,25 @@ function CDrawingDocument()
}; };
this.Collaborative_RemoveTarget = function (_id) this.Collaborative_RemoveTarget = function (_id)
{ {
for (var i = 0; i < this.CollaborativeTargets.length; i++) var i = 0;
for (i = 0; i < this.CollaborativeTargets.length; i++)
{ {
if (_id == this.CollaborativeTargets[i].Id) if (_id == this.CollaborativeTargets[i].Id)
{ {
this.CollaborativeTargets[i].Remove(this); this.CollaborativeTargets[i].Remove(this);
this.CollaborativeTargets.splice(i, 1); this.CollaborativeTargets.splice(i, 1);
i--;
}
}
var _len_tasks = this.CollaborativeTargetsUpdateTasks.length;
for (i = 0; i < _len_tasks; i++)
{
var _tmp = this.CollaborativeTargetsUpdateTasks[i];
if (_tmp[0] == _id)
{
this.CollaborativeTargetsUpdateTasks.splice(i, 1);
i--;
} }
} }
}; };
......
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