Merge pull request #16818 from calixteman/no_cancelled_stamp_in_unod
[Editor] Avoid to add a cancelled added image in the undo/redo stack
This commit is contained in:
		
						commit
						f66072b658
					
				@ -38,6 +38,8 @@ class StampEditor extends AnnotationEditor {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  #isSvg = false;
 | 
					  #isSvg = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  #hasBeenAddedInUndoStack = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  static _type = "stamp";
 | 
					  static _type = "stamp";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor(params) {
 | 
					  constructor(params) {
 | 
				
			||||||
@ -178,7 +180,6 @@ class StampEditor extends AnnotationEditor {
 | 
				
			|||||||
  /** @inheritdoc */
 | 
					  /** @inheritdoc */
 | 
				
			||||||
  onceAdded() {
 | 
					  onceAdded() {
 | 
				
			||||||
    this._isDraggable = true;
 | 
					    this._isDraggable = true;
 | 
				
			||||||
    this.parent.addUndoableEditor(this);
 | 
					 | 
				
			||||||
    this.div.focus();
 | 
					    this.div.focus();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -263,6 +264,10 @@ class StampEditor extends AnnotationEditor {
 | 
				
			|||||||
    this.#drawBitmap(width, height);
 | 
					    this.#drawBitmap(width, height);
 | 
				
			||||||
    this.#createObserver();
 | 
					    this.#createObserver();
 | 
				
			||||||
    div.classList.remove("loading");
 | 
					    div.classList.remove("loading");
 | 
				
			||||||
 | 
					    if (!this.#hasBeenAddedInUndoStack) {
 | 
				
			||||||
 | 
					      this.parent.addUndoableEditor(this);
 | 
				
			||||||
 | 
					      this.#hasBeenAddedInUndoStack = true;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user