Skip to content

Commit 2af9ee7

Browse files
committed
allow to prevent global context menu
SQUASHED: AUTO-COMMIT-src-client-lively.js,AUTO-COMMIT-src-client-reactive-components-rewritten-jumping-cubes.js,AUTO-COMMIT-src-client-utils-font-awesome-utils.js,
1 parent 662d523 commit 2af9ee7

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/client/lively.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,12 +1961,15 @@ export default class Lively {
19611961
if (!evt.shiftKey) { // evt.ctrlKey
19621962
evt.preventDefault();
19631963
evt.stopPropagation();
1964+
19641965
// #Hack #Workaround weired browser scrolling behavior
19651966
if (lively.lastScrollLeft || lively.lastScrollTop) {
19661967
document.scrollingElement.scrollTop = lively.lastScrollTop;
19671968
document.scrollingElement.scrollLeft = lively.lastScrollLeft;
19681969
}
19691970

1971+
if (self.__preventGlobalContextMenu__) { return; }
1972+
19701973
var link = Array.from(evt.composedPath()).find(ea => ea.localName == "a")
19711974
if (link) {
19721975
// #TODO can we shorten this or hide this context specific behavior,

src/client/reactive/components/rewritten/jumping-cubes.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import MCTS from './jumping-cubes-mcts.js';
88
import Matrix from './square-matrix.js';
99

1010
import { shake } from 'utils';
11+
import { fa4 } from 'src/client/utils/font-awesome-utils.js';
1112

1213
class Cube {
1314

@@ -588,10 +589,6 @@ export default class JumpingCubes extends Morph {
588589
evt.stopPropagation();
589590
evt.preventDefault();
590591

591-
function fa4(classes) {
592-
return '<i class="fa fa-' + classes + '" aria-hidden="true"></i>';
593-
}
594-
595592
const players = this.getConfig().players.map((player, index) => {
596593
function checkIcon(enabled) {
597594
return enabled ? fa4('check-square-o') : fa4('square-o');
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
export function fa4(classes) {
3+
return '<i class="fa fa-' + classes + '" aria-hidden="true"></i>';
4+
}

0 commit comments

Comments
 (0)