- Fix: Map extension click events to "mousedown" so they can be received

on touch devices (since `touch.js` changes `touchstart` to
    `mousedown`) (@ClemArt); closes #168
- Fix: Ensure extension `mouseup` events run on "zoom" and "select"
  modes (@iuyiuy); closes #159
This commit is contained in:
Brett Zamir
2018-10-19 20:38:18 +08:00
parent 253732025a
commit 8024304a96
11 changed files with 58 additions and 14 deletions

View File

@@ -3301,6 +3301,11 @@ editor.init = function () {
// Add given events to button
$.each(btn.events, function (name, func) {
if (name === 'click' && btn.type === 'mode') {
// `touch.js` changes `touchstart` to `mousedown`,
// so we must map extension click events as well
if (isTouch() && name === 'click') {
name = 'mousedown';
}
if (btn.includeWith) {
button.bind(name, func);
} else {
@@ -5248,6 +5253,8 @@ editor.init = function () {
btn = $(opts.sel);
if (!btn.length) { return true; } // Skip if markup does not exist
if (opts.evt) {
// `touch.js` changes `touchstart` to `mousedown`,
// so we must map tool button click events as well
if (isTouch() && opts.evt === 'click') {
opts.evt = 'mousedown';
}