From 43d378f2e84d7c0f4e5abb40cec44e0fcec6b966 Mon Sep 17 00:00:00 2001 From: Nicolas Lempereur Date: Fri, 14 Aug 2015 15:35:45 +0200 Subject: [PATCH] summernote: add hasUndo and hasRedo method for pre/next buttons Since the stack offset of the editing history is hidden, it was not possible to have next (CTRL+Y) and previous (CTRL+Z) buttons. --- .../static/lib/summernote/src/js/editing/History.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/website/static/lib/summernote/src/js/editing/History.js b/addons/website/static/lib/summernote/src/js/editing/History.js index ef8dd6016f1..d6893cdd941 100644 --- a/addons/website/static/lib/summernote/src/js/editing/History.js +++ b/addons/website/static/lib/summernote/src/js/editing/History.js @@ -40,6 +40,14 @@ define(['summernote/core/range'], function (range) { } }; + this.hasUndo = function () { + return 1 < stackOffset; + }; + + this.hasRedo = function () { + return stack.length - 1 > stackOffset; + }; + this.recordUndo = function () { stackOffset++;