Server IP : 66.29.146.62 / Your IP : 216.73.216.2 Web Server : LiteSpeed System : Linux premium231.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64 User : dokkdzvi ( 925) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/dokkdzvi/morraa-ksa.store/controlPanel/assets/plugins/summernote/src/js/editing/ |
Upload File : |
define(['summernote/core/range'], function (range) { /** * @class editing.History * * Editor History * */ var History = function ($editable) { var stack = [], stackOffset = -1; var editable = $editable[0]; var makeSnapshot = function () { var rng = range.create(); var emptyBookmark = {s: {path: [], offset: 0}, e: {path: [], offset: 0}}; return { contents: $editable.html(), bookmark: (rng ? rng.bookmark(editable) : emptyBookmark) }; }; var applySnapshot = function (snapshot) { if (snapshot.contents !== null) { $editable.html(snapshot.contents); } if (snapshot.bookmark !== null) { range.createFromBookmark(editable, snapshot.bookmark).select(); } }; /** * undo */ this.undo = function () { // Create snap shot if not yet recorded if ($editable.html() !== stack[stackOffset].contents) { this.recordUndo(); } if (0 < stackOffset) { stackOffset--; applySnapshot(stack[stackOffset]); } }; /** * redo */ this.redo = function () { if (stack.length - 1 > stackOffset) { stackOffset++; applySnapshot(stack[stackOffset]); } }; /** * recorded undo */ this.recordUndo = function () { stackOffset++; // Wash out stack after stackOffset if (stack.length > stackOffset) { stack = stack.slice(0, stackOffset); } // Create new snapshot and push it to the end stack.push(makeSnapshot()); }; // Create first undo stack this.recordUndo(); }; return History; });