protected override void OnResizeEnd(Size newSize) { base.OnResizeEnd(newSize); if (newSize != _initialParentSize) { // Only do this if the size actually changed. newSize = UpdateHtmlForResize(newSize, true); CompactElementSize(newSize); PersistAllEditFields(); //commit the undo unit _resizeUndo.Commit(); } _resizeUndo.Dispose(); _resizeUndo = null; //notify listeners that the resize is complete. This allows the sidebar to synchronize //with the updated smart content state. if (_resizedListener != null) { _resizedListener(newSize, true); } }
// Token: 0x060071A7 RID: 29095 RVA: 0x00207BD4 File Offset: 0x00205DD4 public virtual void Add(IUndoUnit unit) { if (unit == null) { throw new ArgumentNullException("unit"); } IParentUndoUnit deepestOpenUnit = this.DeepestOpenUnit; if (deepestOpenUnit != null) { deepestOpenUnit.Add(unit); return; } if (this.IsInParentUnitChain(unit)) { throw new InvalidOperationException(SR.Get("UndoUnitCantBeAddedTwice")); } if (this.Locked) { throw new InvalidOperationException(SR.Get("UndoUnitLocked")); } if (!this.Merge(unit)) { this._units.Push(unit); if (this.LastUnit is IParentUndoUnit) { ((IParentUndoUnit)this.LastUnit).OnNextAdd(); } this.SetLastUnit(unit); } }
protected override void OnElementAttached() { base.OnElementAttached(); if (PostEditorSettings.AutomationMode) { //Test automation requires the element to be explicitly named in the accessibility tree, but //setting a title causes an annoying tooltip and focus rectangle, so we only show it in automation mode HTMLElement2.tabIndex = 0; HTMLElement.title = " Post Title"; } if (string.IsNullOrEmpty(HTMLElement.innerText)) { //set the default text for this editable region using (IUndoUnit undo = EditorContext.CreateInvisibleUndoUnit()) { HTMLElement.innerText = DefaultText; defaultedText = true; RegionBorderVisible = !Selected && defaultedText; undo.Commit(); } } //fix bug 403230: set the title style to block element so that it takes up the entire line. (HTMLElement as IHTMLElement2).runtimeStyle.display = "block"; }
private void imageDecoratorCommand_Execute(object sender, EventArgs e) { using (IUndoUnit undo = _editorContext.CreateUndoUnit()) { ImageDecorator imageDecorator = ((ImageDecorator)((Command)sender).Tag); //perform the execution so that the decorator is added to the list of active decorators imageDecorator.Command.PerformExecute(); //since this command was invoked explicitly via a command button, display the editor dialog. object state = null; if (imageDecorator.Id == CropDecorator.Id) { state = ImagePropertiesInfo.Image; } using (state as IDisposable) { DialogResult result = ImageDecoratorHelper.ShowImageDecoratorEditorDialog(imageDecorator, ImagePropertiesInfo, new ApplyDecoratorCallback(ApplyImageDecorations), _editorContext, state, _imageEditingContext, _imageEditingContext.DecoratorsManager.CommandManager); if (result == DialogResult.OK) { undo.Commit(); } } } }
/// <summary> /// Called when the ImagePropertiesInfo object has changed in order to sync the commands and decorators with /// the currently selected image. /// </summary> private void ManageCommands() { using (IUndoUnit undo = _editorContext.CreateInvisibleUndoUnit()) { if (_imageEditingContext != null) { for (int i = 0; i < _imageEditingContext.DecoratorsManager.ImageDecoratorGroups.Length; i++) { ImageDecoratorGroup imageDecoratorGroup = _imageEditingContext.DecoratorsManager.ImageDecoratorGroups[i]; foreach (ImageDecorator imageDecorator in imageDecoratorGroup.ImageDecorators) { if (_imagePropertiesInfo == null || _imagePropertiesInfo.IsEditableEmbeddedImage() || imageDecorator.IsWebImageSupported) { imageDecorator.Command.Enabled = true; } else { imageDecorator.Command.Enabled = false; } } } ResetCommands(); if (ImagePropertiesInfo != null) { RefreshCommands(); } } undo.Commit(); } }
/// <summary> /// Inserts the extended entry break into the editor. /// </summary> internal void InsertExtendedEntryBreak() { IHTMLDocument3 doc3 = (IHTMLDocument3)HTMLElement.document; IHTMLElement2 entryBreak = (IHTMLElement2)doc3.getElementById(EXTENDED_ENTRY_ID); if (entryBreak == null) { using (IUndoUnit undo = EditorContext.CreateUndoUnit()) { using (EditorContext.DamageServices.CreateDamageTracker(ElementRange.Clone(), true)) { MarkupPointer insertionPoint = EditorContext.MarkupServices.CreateMarkupPointer(EditorContext.Selection.SelectedMarkupRange.Start); //delete the parent block element of the insertion point if it is empty (bug 421500) DeleteInsertionTargetBlockIfEmpty(insertionPoint); IHTMLElement extendedEntryBreak = InsertExtendedEntryBreak(insertionPoint); //reselect the insertion point MarkupRange selection = EditorContext.MarkupServices.CreateMarkupRange(); insertionPoint.MoveAdjacentToElement(extendedEntryBreak, _ELEMENT_ADJACENCY.ELEM_ADJ_AfterEnd); MarkupPointerMoveHelper.MoveUnitBounded( insertionPoint, MarkupPointerMoveHelper.MoveDirection.RIGHT, MarkupPointerAdjacency.AfterEnterBlock | MarkupPointerAdjacency.BeforeText , HTMLElement); selection.Start.MoveToPointer(insertionPoint); selection.End.MoveToPointer(insertionPoint); selection.ToTextRange().select(); } undo.Commit(); } } }
private void marginCommand_MarginChanged(object sender, EventArgs e) { using (IUndoUnit undo = _editorContext.CreateUndoUnit()) { bool centered = _alignmentCommand.SelectedItem == Alignment.Center; if (!_marginCommand.IsZero()) { ImagePropertiesInfo.InlineImageMargin = new MarginStyle(_marginCommand.Top, _marginCommand.Right, _marginCommand.Bottom, _marginCommand.Left, StyleSizeUnit.PX); } else if (!centered) { ImagePropertiesInfo.InlineImageMargin = null; } // Changing the right or left margins on a center aligned image resets the alignment. if ((_marginCommand.Right > 0 || _marginCommand.Left > 0) && centered) { bool isImageSelected = ImagePropertiesInfo != null; bool isEditableEmbeddedImage = isImageSelected && ImagePropertiesInfo.IsEditableEmbeddedImage(); ResetAlignmentChunkCommands(isImageSelected, isEditableEmbeddedImage); } undo.Commit(); } }
private void SaveUndoInfo( bool forRedo, // forRedo == false for normal operations, true for 'undo' command bool purgeRedo, string label) { if (disposed) { Debug.Assert(false); throw new InvalidOperationException(); } IUndoUnit info = client.CaptureCurrentStateForUndo(); if (!forRedo) { undo.Push(new UndoUnit(info, label)); if (purgeRedo) { ClearRedo(); } } else { redo.Push(new UndoUnit(info, label)); } }
public void Add(IUndoUnit unit) { if (this.adding) { throw new InvalidOperationException(ExceptionStringTable.CannotNestAdds); } if (this.isEnabled) { if (this.openStackDepth <= 0) { throw new InvalidOperationException(ExceptionStringTable.CannotAddAtomicUnitToUndoManager); } this.adding = true; try { unit.Redo(); this.openStack.Peek().Add(unit); } finally { this.adding = false; } } else { unit.Redo(); } }
protected override void OnSelectedChanged() { base.OnSelectedChanged(); //Show the region border if the text is defaulted or empty //If the region is selected, clear any defaulted text using (IUndoUnit undo = EditorContext.CreateInvisibleUndoUnit()) { CheckForTitleEdits(); if (Selected) { if (defaultedText) { HTMLElement.innerText = null; RegionBorderVisible = true; defaultedText = false; } OnEditableRegionFocusChanged(null, new EditableRegionFocusChangedEventArgs(false)); } else { if (HTMLElement.innerText == null) { HTMLElement.innerText = DefaultText; defaultedText = true; RegionBorderVisible = true; } RegionBorderVisible = defaultedText; } undo.Commit(); } }
/// <summary> /// Initializes a new instance of the <see cref="UndoEventArgs"/> class. /// </summary> /// <exception cref="ArgumentNullException"> /// <para><paramref name="change"/> is <see langword="null"/>.</para> /// </exception> public UndoEventArgs(IUndoUnit change) { if (change == null) { throw new ArgumentNullException("change"); } _change = change; }
public void ExecuteCommand(object sender, EventArgs e) { using (IUndoUnit undo = _undoFactory.CreateUndoUnit()) { _commandHandler(sender, e); undo.Commit(); } }
private void _editor_ContentEdited(object source, EventArgs e) { using (IUndoUnit undo = _sidebarContext.CreateUndoUnit()) { _editableSmartContent.SaveEditedSmartContent(); undo.Commit(); } }
public void Redo() { IUndoUnit obj = _undoEngine.UseRedo(); if (obj != null) { obj.Apply(); OnHasUndoChange(); } }
public void Redo() { IUndoUnit obj = _undoEngine.UseRedo(); if (obj != null) { obj.Apply(); enableUndo(); } }
private void InvokeOrAddUndo(IUndoUnit undo) { if (this.undoService != null) { this.undoService.Add(undo); } else { undo.Redo(); } }
private void customSizeCommand_Execute(object sender, EventArgs args) { Command selectedCommand = (Command)sender; using (IUndoUnit undo = _editorContext.CreateUndoUnit()) { ImagePropertiesInfo.InlineImageSizeName = (ImageSizeName)selectedCommand.Tag; ApplyImageDecorations(); undo.Commit(); } }
void imageLinkOptionsCommand_Execute(object sender, EventArgs e) { using (new WaitCursor()) using (IUndoUnit undo = _editorContext.CreateUndoUnit()) { if (EditTargetOptions(ImagePropertiesInfo.LinkTarget) == DialogResult.OK) { ApplyImageDecorations(); undo.Commit(); } } }
public override UndoUnitMergeResult Merge(IUndoUnit otherUnit, out IUndoUnit mergedUnit) { SelectionSet <T, ListOfT> .SelectionChangeUndoUnit selectionChangeUndoUnit = otherUnit as SelectionSet <T, ListOfT> .SelectionChangeUndoUnit; if (selectionChangeUndoUnit != null && selectionChangeUndoUnit.selectionSet == this.selectionSet) { mergedUnit = (IUndoUnit) new SelectionSet <T, ListOfT> .SelectionChangeUndoUnit(this.selectionSet, this.selection, this.indexOfPrimarySelection); return(UndoUnitMergeResult.MergedIntoOneUnit); } mergedUnit = (IUndoUnit)null; return(UndoUnitMergeResult.CouldNotMerge); }
// Token: 0x060071A9 RID: 29097 RVA: 0x00207CA0 File Offset: 0x00205EA0 public virtual void OnNextAdd() { this._locked = true; foreach (object obj in this._units) { IUndoUnit undoUnit = (IUndoUnit)obj; if (undoUnit is IParentUndoUnit) { ((IParentUndoUnit)undoUnit).OnNextAdd(); } } }
/// <summary> /// Adds the last undo unit change to the current undo unit. /// </summary> /// <remarks>This is done to prevent every value change to get undone. /// Only the last value change in a series is remembered.</remarks> /// <param name="unit"></param> /// <returns></returns> public override bool TryMergeUnit(IUndoUnit unit) { if (unit is MyUndoUnit) { newValue = ((MyUndoUnit)unit).newValue; return(true); } else { return(false); } }
private void EditorContext_HandleClear(HtmlEditorSelectionOperationEventArgs ea) { if (Selected && MultipleCellsSelected && !EntireTableSelected) { using (IUndoUnit undoUnit = EditorContext.CreateUndoUnit()) { TableEditor.ClearCells(EditorContext); undoUnit.Commit(); } ea.Handled = true; } }
protected override void OnKeyDown(HtmlEventArgs e) { base.OnKeyDown(e); if (((Keys)e.htmlEvt.keyCode) == Keys.Back) { using (IUndoUnit undo = EditorContext.CreateUndoUnit()) { (HTMLElement as IHTMLDOMNode).removeNode(true); undo.Commit(); } e.Cancel(); } }
protected override void OnResizeStart(Size size, bool preserveAspectRatio) { _resizeUndo = EditorContext.CreateUndoUnit(); base.OnResizeStart(size, preserveAspectRatio); // save references _initialParentSize = size; _preserveAspectRatio = preserveAspectRatio; // initialize smart content string contentSourceId; string contentId; ContentSourceManager.ParseContainingElementId(HTMLElement.id, out contentSourceId, out contentId); // clone the smart content for resizing so that settings changes made during the resize //operation are undoable String newContentId = Guid.NewGuid().ToString(); SmartContent content = (SmartContent)_contentSourceContext.CloneSmartContent(contentId, newContentId); if (content == null) { Trace.WriteLine("Could not clone smart content for resize."); return; } HTMLElement.id = ContentSourceManager.MakeContainingElementId(contentSourceId, newContentId); // call sizer ResizeOptions resizeOptions = new ResizeOptions(); _contentSource.OnResizeStart(content, resizeOptions); // determine the target size IHTMLElement targetSizeElement = GetResizeTargetElement(resizeOptions.ResizeableElementId); _initialTargetSize = new Size(targetSizeElement.offsetWidth, targetSizeElement.offsetHeight); // Account for areas of the smart content that are not being scaled when preserving aspect ratio. // For example, in YouTube plugin, label text below the image. UpdateResizerAspectRatioOffset(_initialParentSize - _initialTargetSize); // determine the aspect ratio if (resizeOptions.AspectRatio > 0) { _aspectRatio = resizeOptions.AspectRatio; } else { _aspectRatio = ((double)_initialTargetSize.Width) / _initialTargetSize.Height; } }
private IUndoUnit PopUndoStack() { int undoCount = UndoCount - 1; IUndoUnit unit = (IUndoUnit)UndoStack[_topUndoIndex]; UndoStack[_topUndoIndex--] = null; if (_topUndoIndex < 0 && undoCount > 0) { Invariant.Assert(UndoLimit > 0); _topUndoIndex = UndoLimit - 1; // This should never be possible with an unlimited stack } return(unit); }
private void ApplyBlockStyle(_ELEMENT_TAG_ID styleTagId, MarkupRange selection, MarkupRange maximumBounds, MarkupRange postOpSelection) { Debug.Assert(selection != maximumBounds, "selection and maximumBounds must be distinct objects"); SelectionPositionPreservationCookie selectionPreservationCookie = null; //update the range cling and gravity so it will stick with the re-arranged block content selection.Start.PushCling(false); selection.Start.PushGravity(_POINTER_GRAVITY.POINTER_GRAVITY_Left); selection.End.PushCling(false); selection.End.PushGravity(_POINTER_GRAVITY.POINTER_GRAVITY_Right); try { if (selection.IsEmpty()) { //nothing is selected, so expand the selection to cover the entire parent block element IHTMLElementFilter stopFilter = ElementFilters.CreateCompoundElementFilter(ElementFilters.BLOCK_ELEMENTS, new IHTMLElementFilter(IsSplitStopElement)); MovePointerLeftUntilRegionBreak(selection.Start, stopFilter, maximumBounds.Start); MovePointerRightUntilRegionBreak(selection.End, stopFilter, maximumBounds.End); } using (IUndoUnit undo = _editor.CreateSelectionUndoUnit(selection)) { selectionPreservationCookie = SelectionPositionPreservationHelper.Save(_markupServices, postOpSelection, selection); if (selection.IsEmptyOfContent()) { ApplyBlockFormatToEmptySelection(selection, styleTagId, maximumBounds); } else { ApplyBlockFormatToContentSelection(selection, styleTagId, maximumBounds); } undo.Commit(); } } finally { selection.Start.PopCling(); selection.Start.PopGravity(); selection.End.PopCling(); selection.End.PopGravity(); } if (!SelectionPositionPreservationHelper.Restore(selectionPreservationCookie, selection, selection.Clone())) { selection.ToTextRange().select(); } }
public override UndoUnitMergeResult Merge(IUndoUnit otherUnit, out IUndoUnit mergedUnit) { mergedUnit = (IUndoUnit)null; SceneXamlDocument.PropertyDictionaryChangeUndoUnit dictionaryChangeUndoUnit = otherUnit as SceneXamlDocument.PropertyDictionaryChangeUndoUnit; if (dictionaryChangeUndoUnit == null || dictionaryChangeUndoUnit.node != this.node || dictionaryChangeUndoUnit.propertyKey != this.propertyKey) { return(UndoUnitMergeResult.CouldNotMerge); } if (SourceContextContainer <DocumentNode> .ContentReferenceEquals(dictionaryChangeUndoUnit.oldValue, this.newValue)) { return(UndoUnitMergeResult.MergedIntoNothing); } mergedUnit = (IUndoUnit) new SceneXamlDocument.PropertyDictionaryChangeUndoUnit(this.node, this.propertyKey, dictionaryChangeUndoUnit.oldValue, this.newValue); return(UndoUnitMergeResult.MergedIntoOneUnit); }
// Token: 0x06007338 RID: 29496 RVA: 0x00210C4C File Offset: 0x0020EE4C private IUndoUnit PopUndoStack() { int num = this.UndoCount - 1; IUndoUnit result = this.UndoStack[this._topUndoIndex]; List <IUndoUnit> undoStack = this.UndoStack; int topUndoIndex = this._topUndoIndex; this._topUndoIndex = topUndoIndex - 1; undoStack[topUndoIndex] = null; if (this._topUndoIndex < 0 && num > 0) { Invariant.Assert(this.UndoLimit > 0); this._topUndoIndex = this.UndoLimit - 1; } return(result); }
protected virtual void OnImagePropertyChanged(ImagePropertyEvent evt) { using (IUndoUnit undo = _editorContext.CreateUndoUnit()) { if (ImagePropertyChanged != null) { ImagePropertyChanged(this, evt); } undo.Commit(); } switch (evt.PropertyType) { case ImagePropertyType.Decorators: { RefreshSizeChunkCommands(); RefreshStylesChunkCommands(); RefreshPropertiesChunkCommands(); break; } case ImagePropertyType.InlineSize: RefreshSizeChunkCommands(); break; case ImagePropertyType.Source: RefreshPropertiesChunkCommands(); break; default: RefreshCommands(); break; } // If this is a reset, then handle alignment/margins if (evt.InvocationSource == ImageDecoratorInvocationSource.Reset) { // Reset margins and alignments bool isImageSelected = ImagePropertiesInfo != null; bool isEditableEmbeddedImage = isImageSelected && ImagePropertiesInfo.IsEditableEmbeddedImage(); ResetAlignmentChunkCommands(isImageSelected, isEditableEmbeddedImage); ResetMarginsChunkCommands(isImageSelected, isEditableEmbeddedImage); } }
internal void ClearDefaultText() { Debug.Assert(_undoRedoCheck != null, "Clearing default text on an unmanaged inline edit field"); if (IsDefaultText && (!_undoRedoCheck.UndoRedoExecuting())) { using (IUndoUnit undo = _editorContext.CreateInvisibleUndoUnit()) { _element.innerHTML = ""; if (!string.IsNullOrEmpty(TextColor)) { _element.style.color = TextColor; } IsDefaultText = false; undo.Commit(); } } }
/// <summary> /// Adds an undo unit to the deepest open parent unit's collection. /// </summary> /// <param name="unit"> /// IUndoUnit to add /// </param> /// <returns> /// TRUE if unit successfully added, FALSE otherwise /// </returns> /// <exception cref="ArgumentNullException"> /// Thrown if unit is null /// </exception> /// <exception cref="InvalidOperationException"> /// Thrown if: /// unit being added is already open /// unit being added to is locked /// </exception> public virtual void Add(IUndoUnit unit) { IParentUndoUnit parentUndoUnit; if (unit == null) { throw new ArgumentNullException("unit"); } parentUndoUnit = DeepestOpenUnit; // If we have an open unit, call Add on it if (parentUndoUnit != null) { parentUndoUnit.Add(unit); return; } if (IsInParentUnitChain(unit)) { throw new InvalidOperationException(SR.Get(SRID.UndoUnitCantBeAddedTwice)); } if (Locked) { throw new InvalidOperationException(SR.Get(SRID.UndoUnitLocked)); } if (!Merge(unit)) { _units.Push(unit); if (LastUnit is IParentUndoUnit) { ((IParentUndoUnit)LastUnit).OnNextAdd(); } SetLastUnit(unit); } }
protected override void OnResizeStart(Size size, bool preserveAspectRatio) { _resizeUndo = EditorContext.CreateUndoUnit(); base.OnResizeStart(size, preserveAspectRatio); // save references _initialParentSize = size; _preserveAspectRatio = preserveAspectRatio; // initialize smart content string contentSourceId; string contentId; ContentSourceManager.ParseContainingElementId(HTMLElement.id, out contentSourceId, out contentId); // clone the smart content for resizing so that settings changes made during the resize //operation are undoable String newContentId = Guid.NewGuid().ToString(); SmartContent content = (SmartContent)_contentSourceContext.CloneSmartContent(contentId, newContentId); if (content == null) { Trace.WriteLine("Could not clone smart content for resize."); return; } HTMLElement.id = ContentSourceManager.MakeContainingElementId(contentSourceId, newContentId); // call sizer ResizeOptions resizeOptions = new ResizeOptions(); _contentSource.OnResizeStart(content, resizeOptions); // determine the target size IHTMLElement targetSizeElement = GetResizeTargetElement(resizeOptions.ResizeableElementId); _initialTargetSize = new Size(targetSizeElement.offsetWidth, targetSizeElement.offsetHeight); // Account for areas of the smart content that are not being scaled when preserving aspect ratio. // For example, in YouTube plugin, label text below the image. UpdateResizerAspectRatioOffset(_initialParentSize - _initialTargetSize); // determine the aspect ratio if (resizeOptions.AspectRatio > 0) _aspectRatio = resizeOptions.AspectRatio; else _aspectRatio = ((double)_initialTargetSize.Width) / _initialTargetSize.Height; }
public ImageDecoratorUndoUnitAdapter(IUndoUnit undo) { _undo = undo; }
// Called by the undo manager. TextContainer undo units never merge. public bool Merge(IUndoUnit unit) { Invariant.Assert(unit != null); return false; }
/// <summary> /// Set LastUnit /// </summary> /// <param name="value"> /// IUndoUnit to which LastUnit is to be set /// </param> protected void SetLastUnit(IUndoUnit value) { _lastUnit = value; }
/// <summary> /// Adds an undo unit to the undo/redo stack, depending on current state. /// </summary> /// <param name="unit"> /// IUndoUnit to add /// </param> /// <exception cref="InvalidOperationException"> /// Thrown if: /// UndoManager is disabled /// unit is not IParentUndoUnit and there is no open IParentUndoUnit /// </exception> /// <exception cref="ArgumentNullException"> /// Thrown if unit is null /// </exception> internal void Add(IUndoUnit unit) { IParentUndoUnit parent; if (!IsEnabled) { throw new InvalidOperationException(SR.Get(SRID.UndoServiceDisabled)); } if (unit == null) { throw new ArgumentNullException("unit"); } parent = DeepestOpenUnit; if (parent != null) { parent.Add(unit); } else if (unit is IParentUndoUnit) { ((IParentUndoUnit)unit).Container = this; if (LastUnit is IParentUndoUnit) { ((IParentUndoUnit)LastUnit).OnNextAdd(); } SetLastUnit(unit); if (State == UndoState.Normal || State == UndoState.Redo) { if (++_topUndoIndex == UndoLimit) { _topUndoIndex = 0; } if (!(_topUndoIndex < UndoStack.Count && PeekUndoStack() == null) // Non-null topmost stack item && (UndoLimit == -1 || UndoStack.Count < UndoLimit)) { UndoStack.Add(unit); } else { if (PeekUndoStack() != null) { if (++_bottomUndoIndex == UndoLimit) { _bottomUndoIndex = 0; } } UndoStack[_topUndoIndex] = unit; } } else if (State == UndoState.Undo) { RedoStack.Push(unit); } else if (State == UndoState.Rollback) { // do nothing, throwing out the unit } } else { throw new InvalidOperationException(SR.Get(SRID.UndoNoOpenParentUnit)); } }
//------------------------------------------------------ // // Private Methods // //------------------------------------------------------ #region Private Methods /// <summary> /// Walk up the parent undo unit chain and make sure none of the parent units /// in that chain are the same as the given unit. /// </summary> /// <param name="unit"> /// Unit to search for in the parent chain /// </param> /// <returns> /// true if the unit is already in the parent chain, false otherwise /// </returns> bool IsInParentUnitChain(IUndoUnit unit) { if (unit is IParentUndoUnit) { IParentUndoUnit parent; parent = this; do { if (parent == unit) { return true; } parent = parent.Container as IParentUndoUnit; } while (parent != null); } return false; }
public EditorUndoUnit(IBlogPostHtmlEditor editor, bool invisible) { if (editor is HtmlEditorControl) { if (invisible) { undoUnit = (editor as IHtmlEditorComponentContext).CreateInvisibleUndoUnit(); } else { undoUnit = (editor as IHtmlEditorComponentContext).CreateUndoUnit(); } } }
protected override void OnResizeEnd(Size newSize) { base.OnResizeEnd(newSize); if (newSize != _initialParentSize) { // Only do this if the size actually changed. newSize = UpdateHtmlForResize(newSize, true); CompactElementSize(newSize); PersistAllEditFields(); //commit the undo unit _resizeUndo.Commit(); } _resizeUndo.Dispose(); _resizeUndo = null; //notify listeners that the resize is complete. This allows the sidebar to synchronize //with the updated smart content state. if (_resizedListener != null) _resizedListener(newSize, true); }