Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidMount() {
// Sync fullscreen exit in case exited by ESC.
// IDEA: This is not efficient as there will be as many event listeners as
// there are frames.
document.addEventListener(
screenfull.raw.fullscreenchange,
this.syncFullscreenExit,
);
}
componentDidMount() {
// Sync fullscreen exit in case exited by ESC.
// IDEA: This is not efficient as there will be as many event listeners as
// there are frames.
document.addEventListener(
screenfull.raw.fullscreenchange,
this.syncFullscreenExit,
);
}
React.useEffect(() => {
const callback = () => setFullscreen(screenfull.isFullscreen);
document.addEventListener(screenfull.raw.fullscreenchange, callback);
return () =>
document.removeEventListener(
screenfull.raw.fullscreenchange,
callback,
);
});
remove(){
this.domElement.removeEventListener('click', this.__onClick);
document.removeEventListener(screenfull.raw.fullscreenchanged, this.__onChangeFullscreen);
super.remove();
}
/*
Set up change event handler
*/
this.codemirror.on('change', this.updateStorage.bind(this));
/*
Set up focus and blur event handlers
*/
this.codemirror.on('focus', this.attachFocusStyles.bind(this));
this.codemirror.on('blur', this.detachFocusStyles.bind(this));
/*
Set up fullscreen mode change event handler
*/
$(document).bind(Screenfull.raw.fullscreenchange, this.changeFullscreenModeHandler.bind(this));
/**
* Make the editor field accept Kirby typical
* file/page drag and drop events.
*
* @since 1.0.0
*/
this.$wrapper.droppable({
hoverClass: 'markdownfield-wrapper-over',
accept: this.$draggable,
drop: function (event, element) {
this.editor.insert(element.draggable.data('text'));
}
});
/**
return () =>
document.removeEventListener(
screenfull.raw.fullscreenchange,
callback,
);
});
addEventListeners() {
Emitter.on( EXP_TOGGLE_PAUSE_GAME, this.onTogglePauseGame );
Emitter.on( TOOLBAR_TOGGLE, this.onToolbarToggle );
Emitter.on( TOOLBAR_HIDE_PLAY, this.onToolbarHidePlay );
document.addEventListener(screenfull.raw.fullscreenchange, this.onFullscreenChange);
}
function controller ($log, $timeout, $element) {
const $ctrl = this;
const chart = new SunburstChart();
if (screenfull.enabled) {
document.addEventListener(screenfull.raw.fullscreenchange, event => {
$log.debug('screenfull.raw.fullscreenerror');
angular.element(event.target).toggleClass('fullscreen', screenfull.isFullscreen);
draw();
});
}
return Object.assign($ctrl, {
editorOptions: {
data: $ctrl.dataPackage,
enableSvgDownload: true,
enablePngDownload: false,
onChange: draw
},
draw,
$onInit () {
$timeout(draw, 0);
enableFullScreen: function() {
if (Fullscreen.enabled) {
this.state.isFullScreenSupported = true;
document.addEventListener(Fullscreen.raw.fullscreenchange, this.onFullscreenChanged.bind(this));
}
},
componentDidMount() {
if (screenfull.enabled) {
document.addEventListener(screenfull.raw.fullscreenchange,
this.props.closeFullScreenListener);
}
this.requestFullScreen();
},
componentDidUpdate(prevProps) {