mirror of https://github.com/apache/druid.git
66 lines
2.1 KiB
TypeScript
66 lines
2.1 KiB
TypeScript
|
/*
|
||
|
* Licensed to the Apache Software Foundation (ASF) under one
|
||
|
* or more contributor license agreements. See the NOTICE file
|
||
|
* distributed with this work for additional information
|
||
|
* regarding copyright ownership. The ASF licenses this file
|
||
|
* to you under the Apache License, Version 2.0 (the
|
||
|
* "License"); you may not use this file except in compliance
|
||
|
* with the License. You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*/
|
||
|
|
||
|
import 'es6-shim/es6-shim';
|
||
|
import 'es7-shim'; // Webpack with automatically pick browser.js which does the shim()
|
||
|
import * as React from 'react';
|
||
|
import * as ReactDOM from 'react-dom';
|
||
|
import "./singletons/react-table-defaults";
|
||
|
import "./entry.scss";
|
||
|
|
||
|
import { ConsoleApplication } from './console-application';
|
||
|
|
||
|
const container = document.getElementsByClassName('app-container')[0];
|
||
|
if (!container) throw new Error('container not found');
|
||
|
|
||
|
ReactDOM.render(
|
||
|
React.createElement(
|
||
|
ConsoleApplication,
|
||
|
{
|
||
|
version: '0.0.1'
|
||
|
}
|
||
|
),
|
||
|
container
|
||
|
);
|
||
|
|
||
|
// ---------------------------------
|
||
|
// Taken from https://hackernoon.com/removing-that-ugly-focus-ring-and-keeping-it-too-6c8727fefcd2
|
||
|
|
||
|
let mode: 'mouse' | 'tab' = 'mouse';
|
||
|
|
||
|
function handleTab(e: KeyboardEvent) {
|
||
|
if (e.keyCode !== 9) return;
|
||
|
if (mode === 'tab') return;
|
||
|
mode = 'tab';
|
||
|
document.body.classList.remove('mouse-mode');
|
||
|
document.body.classList.add('tab-mode');
|
||
|
window.removeEventListener('keydown', handleTab);
|
||
|
window.addEventListener('mousedown', handleMouseDown);
|
||
|
}
|
||
|
|
||
|
function handleMouseDown() {
|
||
|
if (mode === 'mouse') return;
|
||
|
mode = 'mouse';
|
||
|
document.body.classList.remove('tab-mode');
|
||
|
document.body.classList.add('mouse-mode');
|
||
|
window.removeEventListener('mousedown', handleMouseDown);
|
||
|
window.addEventListener('keydown', handleTab);
|
||
|
}
|
||
|
|
||
|
window.addEventListener('keydown', handleTab);
|