From f6d8f10a4ddd92f11d17d78bae9f2bdabb09851f Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Thu, 21 Sep 2017 15:38:42 +0200 Subject: [PATCH] Prevent propagation with toolbar buttons --- src/dom_components/view/ToolbarButtonView.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/dom_components/view/ToolbarButtonView.js b/src/dom_components/view/ToolbarButtonView.js index 252ce4dd9..af9fc41b8 100644 --- a/src/dom_components/view/ToolbarButtonView.js +++ b/src/dom_components/view/ToolbarButtonView.js @@ -14,15 +14,18 @@ module.exports = Backbone.View.extend({ }, handleClick(event) { - var opts = {event}; - var command = this.model.get('command'); + event.preventDefault(); + event.stopPropagation(); + const opts = {event}; + const command = this.model.get('command'); + const editor = this.editor; if (typeof command === 'function') { - command(this.editor, null, opts); + command(editor, null, opts); } if (typeof command === 'string') { - this.editor.runCommand(command, opts); + editor.runCommand(command, opts); } },