Merge branch 'MDL-62319-master' of git://github.com/damyon/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2018-10-15 23:54:51 +02:00
commit bbfda3b9db
5 changed files with 158 additions and 3 deletions

View File

@ -35,6 +35,7 @@
position: absolute;
overflow: auto;
background-color: #ccc;
touch-action: none;
}
.assignfeedback_editpdf_widget {
@ -388,6 +389,7 @@ ul.assignfeedback_editpdf_menu {
position: relative;
margin-bottom: 1em;
top: 0;
max-height: 312px;
}
.assignfeedback_editpdf_widget .pageheader {

View File

@ -4046,6 +4046,8 @@ EDITOR.prototype = {
if (this.get('readonly')) {
return;
}
this.disable_touch_scroll();
// Setup the tool buttons.
Y.each(TOOLSELECTOR, function(selector, tool) {
toolnode = this.get_dialogue_element(selector);
@ -4139,6 +4141,7 @@ EDITOR.prototype = {
if (tool !== "comment" && tool !== "select" && tool !== "drag" && tool !== "stamp") {
this.lastannotationtool = tool;
}
this.refresh_button_state();
},
@ -4683,6 +4686,54 @@ EDITOR.prototype = {
for (i = 0; i < this.drawables.length; i++) {
this.drawables[i].scroll_update(x, y);
}
},
/**
* Test the browser support for options objects on event listeners.
* @return Boolean
*/
event_listener_options_supported: function() {
var passivesupported = false,
options,
testeventname = "testpassiveeventoptions";
// Options support testing example from:
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
try {
options = Object.defineProperty({}, "passive", {
get: function() {
passivesupported = true;
}
});
// We use an event name that is not likely to conflict with any real event.
document.addEventListener(testeventname, options, options);
// We remove the event listener as we have tested the options already.
document.removeEventListener(testeventname, options, options);
} catch(err) {
// It's already false.
passivesupported = false;
}
return passivesupported;
},
/**
* Disable Touch Move scrolling
*/
disable_touch_scroll: function() {
if (this.event_listener_options_supported()) {
document.addEventListener('touchmove', this.stop_touch_scroll, {passive: false});
}
},
/**
* Stop Touch Scrolling
* @param {Object} e
*/
stop_touch_scroll: function(e) {
e.stopPropagation();
e.preventDefault();
}
};

View File

@ -4046,6 +4046,8 @@ EDITOR.prototype = {
if (this.get('readonly')) {
return;
}
this.disable_touch_scroll();
// Setup the tool buttons.
Y.each(TOOLSELECTOR, function(selector, tool) {
toolnode = this.get_dialogue_element(selector);
@ -4139,6 +4141,7 @@ EDITOR.prototype = {
if (tool !== "comment" && tool !== "select" && tool !== "drag" && tool !== "stamp") {
this.lastannotationtool = tool;
}
this.refresh_button_state();
},
@ -4683,6 +4686,54 @@ EDITOR.prototype = {
for (i = 0; i < this.drawables.length; i++) {
this.drawables[i].scroll_update(x, y);
}
},
/**
* Test the browser support for options objects on event listeners.
* @return Boolean
*/
event_listener_options_supported: function() {
var passivesupported = false,
options,
testeventname = "testpassiveeventoptions";
// Options support testing example from:
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
try {
options = Object.defineProperty({}, "passive", {
get: function() {
passivesupported = true;
}
});
// We use an event name that is not likely to conflict with any real event.
document.addEventListener(testeventname, options, options);
// We remove the event listener as we have tested the options already.
document.removeEventListener(testeventname, options, options);
} catch(err) {
// It's already false.
passivesupported = false;
}
return passivesupported;
},
/**
* Disable Touch Move scrolling
*/
disable_touch_scroll: function() {
if (this.event_listener_options_supported()) {
document.addEventListener('touchmove', this.stop_touch_scroll, {passive: false});
}
},
/**
* Stop Touch Scrolling
* @param {Object} e
*/
stop_touch_scroll: function(e) {
e.stopPropagation();
e.preventDefault();
}
};

View File

@ -773,6 +773,8 @@ EDITOR.prototype = {
if (this.get('readonly')) {
return;
}
this.disable_touch_scroll();
// Setup the tool buttons.
Y.each(TOOLSELECTOR, function(selector, tool) {
toolnode = this.get_dialogue_element(selector);
@ -866,6 +868,7 @@ EDITOR.prototype = {
if (tool !== "comment" && tool !== "select" && tool !== "drag" && tool !== "stamp") {
this.lastannotationtool = tool;
}
this.refresh_button_state();
},
@ -1410,6 +1413,54 @@ EDITOR.prototype = {
for (i = 0; i < this.drawables.length; i++) {
this.drawables[i].scroll_update(x, y);
}
},
/**
* Test the browser support for options objects on event listeners.
* @return Boolean
*/
event_listener_options_supported: function() {
var passivesupported = false,
options,
testeventname = "testpassiveeventoptions";
// Options support testing example from:
// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
try {
options = Object.defineProperty({}, "passive", {
get: function() {
passivesupported = true;
}
});
// We use an event name that is not likely to conflict with any real event.
document.addEventListener(testeventname, options, options);
// We remove the event listener as we have tested the options already.
document.removeEventListener(testeventname, options, options);
} catch(err) {
// It's already false.
passivesupported = false;
}
return passivesupported;
},
/**
* Disable Touch Move scrolling
*/
disable_touch_scroll: function() {
if (this.event_listener_options_supported()) {
document.addEventListener('touchmove', this.stop_touch_scroll, {passive: false});
}
},
/**
* Stop Touch Scrolling
* @param {Object} e
*/
stop_touch_scroll: function(e) {
e.stopPropagation();
e.preventDefault();
}
};