1var x=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var U=Object.prototype.hasOwnProperty;var v=(i,t)=>{for(var e in t)x(i,e,{get:t[e],enumerable:!0})},O=(i,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of S(t))!U.call(i,s)&&s!==e&&x(i,s,{get:()=>t[s],enumerable:!(o=w(t,s))||o.enumerable});return i},u=(i,t,e)=>(O(i,t,"default"),e&&O(e,t,"default"));var C={};v(C,{RedoCommand:()=>b,Undo:()=>R,UndoCommand:()=>B,UndoEditing:()=>y,UndoRedoBaseCommand:()=>_,UndoUI:()=>k});var d={};u(d,F);import*as F from"../../../frontend-editor-ckeditor-web/__liferay__/exports/@ckeditor$ckeditor5-core$dist$index.js.js";var m={};u(m,A);import*as A from"../../../frontend-editor-ckeditor-web/__liferay__/exports/@ckeditor$ckeditor5-engine$dist$index.js.js";var p={};u(p,E);import*as E from"../../../frontend-editor-ckeditor-web/__liferay__/exports/@ckeditor$ckeditor5-ui$dist$index.js.js";var h={};u(h,P);import*as P from"../../../frontend-editor-ckeditor-web/__liferay__/exports/@ckeditor$ckeditor5-icons$dist$index.js.js";var _=class extends d.Command{_stack=[];_createdBatches=new WeakSet;constructor(t){super(t),this.refresh(),this._isEnabledBasedOnSelection=!1,this.listenTo(t.data,"set",(e,o)=>{o[1]={...o[1]};let s=o[1];s.batchType||(s.batchType={isUndoable:!1})},{priority:"high"}),this.listenTo(t.data,"set",(e,o)=>{o[1].batchType.isUndoable||this.clearStack()})}refresh(){this.isEnabled=this._stack.length>0}get createdBatches(){return this._createdBatches}addBatch(t){let e=this.editor.model.document.selection,o={ranges:e.hasOwnRange?Array.from(e.getRanges()):[],isBackward:e.isBackward};this._stack.push({batch:t,selection:o}),this.refresh()}clearStack(){this._stack=[],this.refresh()}_restoreSelection(t,e,o){let s=this.editor.model,r=s.document,n=[],l=t.map(a=>a.getTransformedByOperations(o)),f=l.flat();for(let a of l){let g=a.filter(c=>c.root!=r.graveyard).filter(c=>!I(c,f));g.length&&(L(g),n.push(g[0]))}n.length&&s.change(a=>{a.setSelection(n,{backward:e})})}_undo(t,e){let o=this.editor.model,s=o.document;this._createdBatches.add(e);let r=t.operations.slice().filter(n=>n.isDocumentOperation);r.reverse();for(let n of r){let l=n.baseVersion+1,f=Array.from(s.history.getOperations(l)),g=(0,m.transformOperationSets)([n.getReversed()],f,{useRelations:!0,document:this.editor.model.document,padWithNoOps:!1,forceWeakRemove:!0}).operationsA;for(let c of g){let T=c.affectedSelectable;T&&!o.canEditAt(T)&&(c=new m.NoOperation(c.baseVersion)),e.addOperation(c),o.applyOperation(c),s.history.setOperationAsUndone(n,c)}}}};function L(i){i.sort((t,e)=>t.start.isBefore(e.start)?-1:1);for(let t=1;t<i.length;t++){let o=i[t-1].getJoined(i[t],!0);o&&(t--,i.splice(t,2,o))}}function I(i,t){return t.some(e=>e!==i&&e.containsRange(i,!0))}var B=class extends _{execute(t=null){let e=t?this._stack.findIndex(r=>r.batch==t):this._stack.length-1,o=this._stack.splice(e,1)[0],s=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(s,()=>{this._undo(o.batch,s);let r=this.editor.model.document.history.getOperations(o.batch.baseVersion);this._restoreSelection(o.selection.ranges,o.selection.isBackward,r)}),this.fire("revert",o.batch,s),this.refresh()}},b=class extends _{execute(){let t=this._stack.pop(),e=this.editor.model.createBatch({isUndo:!0});this.editor.model.enqueueChange(e,()=>{let s=t.batch.operations[t.batch.operations.length-1].baseVersion+1,r=this.editor.model.document.history.getOperations(s);this._restoreSelection(t.selection.ranges,t.selection.isBackward,r),this._undo(t.batch,e)}),this.refresh()}},y=class extends d.Plugin{_undoCommand;_redoCommand;_batchRegistry=new WeakSet;static get pluginName(){return"UndoEditing"}static get isOfficialPlugin(){return!0}init(){let t=this.editor,e=t.t;this._undoCommand=new B(t),this._redoCommand=new b(t),t.commands.add("undo",this._und
1oCommand),t.commands.add("redo",this._redoCommand),this.listenTo(t.model,"applyOperation",(o,s)=>{let r=s[0];if(!r.isDocumentOperation)return;let n=r.batch,l=this._redoCommand.createdBatches.has(n),f=this._undoCommand.createdBatches.has(n);this._batchRegistry.has(n)||(this._batchRegistry.add(n),n.isUndoable&&(l?this._undoCommand.addBatch(n):f||(this._undoCommand.addBatch(n),this._redoCommand.clearStack())))},{priority:"highest"}),this.listenTo(this._undoCommand,"revert",(o,s,r)=>{this._redoCommand.addBatch(r)}),t.keystrokes.set("CTRL+Z","undo"),t.keystrokes.set("CTRL+Y","redo"),t.keystrokes.set("CTRL+SHIFT+Z","redo"),t.accessibility.addKeystrokeInfos({keystrokes:[{label:e("Undo"),keystroke:"CTRL+Z"},{label:e("Redo"),keystroke:[["CTRL+Y"],["CTRL+SHIFT+Z"]]}]})}},k=class extends d.Plugin{static get pluginName(){return"UndoUI"}static get isOfficialPlugin(){return!0}init(){let t=this.editor,e=t.locale,o=t.t,s=e.uiLanguageDirection=="ltr"?h.IconUndo:h.IconRedo,r=e.uiLanguageDirection=="ltr"?h.IconRedo:h.IconUndo;this._addButtonsToFactory("undo",o("Undo"),"CTRL+Z",s),this._addButtonsToFactory("redo",o("Redo"),"CTRL+Y",r)}_addButtonsToFactory(t,e,o,s){let r=this.editor;r.ui.componentFactory.add(t,()=>{let n=this._createButton(p.ButtonView,t,e,o,s);return n.set({tooltip:!0}),n}),r.ui.componentFactory.add("menuBar:"+t,()=>this._createButton(p.MenuBarMenuListItemButtonView,t,e,o,s))}_createButton(t,e,o,s,r){let n=this.editor,l=n.locale,f=n.commands.get(e),a=new t(l);return a.set({label:o,icon:r,keystroke:s}),a.bind("isEnabled").to(f,"isEnabled"),this.listenTo(a,"execute",()=>{n.execute(e),n.editing.view.focus()}),a}},R=class extends d.Plugin{static get requires(){return[y,k]}static get pluginName(){return"Undo"}static get isOfficialPlugin(){return!0}};var{RedoCommand:q,Undo:z,UndoCommand:M,UndoEditing:Y,UndoRedoBaseCommand:G,UndoUI:H,__esModule:j}=C;export{q as RedoCommand,z as Undo,M as UndoCommand,Y as UndoEditing,G as UndoRedoBaseCommand,H as UndoUI,j as __esModule}; 2/*! Bundled license information: 3 4@ckeditor/ckeditor5-undo/dist/index.js: 5 (** 6 * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved. 7 * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options 8 *) 9*/ 10//# sourceMappingURL=@ckeditor$ckeditor5-undo$dist$index.js.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.