diff --git a/word/Drawing/Rulers.js b/word/Drawing/Rulers.js index 3868b57227..7195ccdfb0 100644 --- a/word/Drawing/Rulers.js +++ b/word/Drawing/Rulers.js @@ -1218,13 +1218,15 @@ function CHorRuler() if (newVal > _margin_right) newVal = _margin_right; } - this.m_dIndentRight = _margin_right - newVal; word_control.UpdateHorRulerBack(); var pos = left + (_margin_right - this.m_dIndentRight) * dKoef_mm_to_pix; word_control.m_oOverlayApi.VertLine(pos); + // if (!this.SimpleChanges.IsSimple) + // this.SetPrProperties(true); + break; } case 7: @@ -2270,18 +2272,35 @@ function CHorRuler() } } - this.SetPrProperties = function() + this.SetPrProperties = function(isTemporary) { - if (false === this.m_oWordControl.m_oLogicDocument.Document_Is_SelectionLocked(AscCommon.changestype_Paragraph_Properties)) + let left = this.m_dIndentLeft; + let right = this.m_dIndentRight; + let firstLine = this.m_dIndentLeftFirst - this.m_dIndentLeft; + + let logicDocument = this.m_oWordControl.m_oLogicDocument; + if (logicDocument.IsSelectionLocked(AscCommon.changestype_Paragraph_Properties)) + return; + + isTemporary = isTemporary && logicDocument.IsDocumentEditor(); + + if (isTemporary) + logicDocument.TurnOff_InterfaceEvents(); + + logicDocument.StartAction(AscDFH.historydescription_Document_SetParagraphIndentFromRulers); + logicDocument.SetParagraphIndent({ + Left : left, + Right : right, + FirstLine : firstLine + }); + logicDocument.UpdateInterface(); + logicDocument.Recalculate(); + logicDocument.FinalizeAction(); + + if (isTemporary) { - this.m_oWordControl.m_oLogicDocument.StartAction(AscDFH.historydescription_Document_SetParagraphIndentFromRulers); - this.m_oWordControl.m_oLogicDocument.SetParagraphIndent({ - Left : this.m_dIndentLeft, - Right : this.m_dIndentRight, - FirstLine : (this.m_dIndentLeftFirst - this.m_dIndentLeft) - }); - this.m_oWordControl.m_oLogicDocument.Document_UpdateInterfaceState(); - this.m_oWordControl.m_oLogicDocument.FinalizeAction(); + AscCommon.History.SetLastPointTemporary(); + logicDocument.TurnOn_InterfaceEvents(); } } this.SetMarginProperties = function() diff --git a/word/Editor/Document.js b/word/Editor/Document.js index 1d410029e8..9f1d2530ac 100644 --- a/word/Editor/Document.js +++ b/word/Editor/Document.js @@ -12333,7 +12333,11 @@ CDocument.prototype.SetWatermarkProps = function(oProps) */ CDocument.prototype.TurnOff_InterfaceEvents = function() { + if (this.TurnOffInterfaceEvents) + return false; + this.TurnOffInterfaceEvents = true; + return true; }; /** * Включаем отсылку сообщений в интерфейс. diff --git a/word/Editor/History.js b/word/Editor/History.js index 0bc6576bfd..b152a4f823 100644 --- a/word/Editor/History.js +++ b/word/Editor/History.js @@ -312,7 +312,9 @@ CHistory.prototype = { if ( 0 !== this.TurnOffHistory ) return false; - + + this.RemoveLastTemporaryPoint(); + if (this.Document && this.Document.ClearListsCache) this.Document.ClearListsCache(); @@ -337,6 +339,7 @@ CHistory.prototype = Items : Items, // Массив изменений, начиная с текущего момента Time : Time, // Текущее время Additional : {}, // Дополнительная информация + Temporary : false, Description: nDescription }; @@ -1094,6 +1097,27 @@ CHistory.prototype = if (this.Points[this.Index] && this.Points[this.Index].Additional.FormFilling) delete this.Points[this.Index].Additional.FormFilling; }; + CHistory.prototype.SetLastPointTemporary = function() + { + if (this.Index < 0) + return; + + this.Points[this.Index].Temporary = true; + }; + CHistory.prototype.RemoveLastTemporaryPoint = function() + { + if (this.Index < 0 + || !this.Document.IsDocumentEditor() + || !this.Points[this.Index].Temporary) + return; + + let needOn = this.Document.TurnOff_InterfaceEvents(); + let changes = this.Undo(); + this.Document.UpdateAfterUndoRedo(changes); + + if (needOn) + this.Document.TurnOn_InterfaceEvents(); + }; CHistory.prototype.ClearAdditional = function() { if (this.Index >= 0) diff --git a/word/Editor/Paragraph/TextHyphenator.js b/word/Editor/Paragraph/TextHyphenator.js index 3222e06d42..f9babcae4e 100644 --- a/word/Editor/Paragraph/TextHyphenator.js +++ b/word/Editor/Paragraph/TextHyphenator.js @@ -49,8 +49,6 @@ } CTextHyphenator.prototype.Hyphenate = function(paragraph) { - console.log(`Start hyphenate paragraph ${paragraph.GetId()}`); - let self = this; paragraph.CheckRunContent(function(run, startPos, endPos) { diff --git a/word/Editor/Paragraph_Recalculate.js b/word/Editor/Paragraph_Recalculate.js index 63c3dfdc38..0533c66cc7 100644 --- a/word/Editor/Paragraph_Recalculate.js +++ b/word/Editor/Paragraph_Recalculate.js @@ -3413,7 +3413,6 @@ CParagraphRecalculateStateWrap.prototype = if (!this.LastHyphenItem) return; - console.log("Reset "); this.LastHyphenItem.SetTemporaryHyphenAfter(false); this.LastHyphenItem = null; }, @@ -3431,7 +3430,6 @@ CParagraphRecalculateStateWrap.prototype = if (X + hyphenWidth > XEnd) return; - console.log("Check " + String.fromCodePoint(item.GetCodePoint())); this.LastHyphenItem = item; item.SetTemporaryHyphenAfter(true); },