aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/MainView.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/MainView.tsx')
-rw-r--r--src/client/views/MainView.tsx156
1 files changed, 68 insertions, 88 deletions
diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx
index fbe44cf7a..6c05db892 100644
--- a/src/client/views/MainView.tsx
+++ b/src/client/views/MainView.tsx
@@ -145,95 +145,75 @@ export class MainView extends React.Component {
componentDidMount() {
document.getElementById('root')?.addEventListener('scroll', e => (ele => (ele.scrollLeft = ele.scrollTop = 0))(document.getElementById('root')!));
const ele = document.getElementById('loader');
- console.log(PingManager.Instance);
-
- const wrapper = () => {
- const prog = document.getElementById('dash-progress');
- if (ele && prog) {
- // remove from DOM
- setTimeout(() => {
- //clearTimeout();
- prog.style.transition = '1s';
- prog.style.width = '100%';
- }, 0);
- setTimeout(() => (ele.outerHTML = ''), 1000);
- }
- this._sidebarContent.proto = undefined;
- if (!MainView.Live) {
- DocServer.setPlaygroundFields([
- 'dataTransition',
- 'viewTransition',
- 'treeViewOpen',
- 'showSidebar',
- 'itemIndex', // for changing slides in presentations
- 'sidebarWidthPercent',
- 'currentTimecode',
- 'timelineHeightPercent',
- 'presStatus',
- 'panX',
- 'panY',
- 'overlayX',
- 'overlayY',
- 'fitWidth',
- 'nativeWidth',
- 'nativeHeight',
- 'text-scrollHeight',
- 'text-height',
- 'hideMinimap',
- 'viewScale',
- 'scrollTop',
- 'hidden',
- 'curPage',
- 'viewType',
- 'chromeHidden',
- 'currentFrame',
- 'width',
- 'height',
- 'nativeWidth',
- ]); // can play with these fields on someone else's
- }
- DocServer.GetRefField('rtfProto').then(
- proto =>
- proto instanceof Doc &&
- reaction(
- () => StrCast(proto.BROADCAST_MESSAGE),
- msg => msg && alert(msg)
- )
- );
-
- const tag = document.createElement('script');
- tag.src = 'https://www.youtube.com/iframe_api';
- const firstScriptTag = document.getElementsByTagName('script')[0];
- firstScriptTag.parentNode!.insertBefore(tag, firstScriptTag);
- window.removeEventListener('keydown', KeyManager.Instance.handle);
- window.addEventListener('keydown', KeyManager.Instance.handle);
- window.removeEventListener('keyup', KeyManager.Instance.unhandle);
- window.addEventListener('keyup', KeyManager.Instance.unhandle);
- window.addEventListener('paste', KeyManager.Instance.paste as any);
- document.addEventListener('dash', (e: any) => {
- // event used by chrome plugin to tell Dash which document to focus on
- const id = FormattedTextBox.GetDocFromUrl(e.detail);
- DocServer.GetRefField(id).then(doc => (doc instanceof Doc ? DocumentManager.Instance.showDocument(doc, { willPan: false }) : null));
- });
- document.addEventListener('linkAnnotationToDash', Hypothesis.linkListener);
- this.initEventListeners();
- };
-
- if (PingManager.Instance.isBeating) {
- wrapper();
- } else {
- console.error('PingManager is not beating', new Date());
- const dispose = reaction(
- () => PingManager.Instance.isBeating,
- isBeating => {
- if (isBeating) {
- console.log('PingManager is beating', new Date());
- wrapper();
- dispose();
- }
- }
- );
+ const prog = document.getElementById('dash-progress');
+ if (ele && prog) {
+ // remove from DOM
+ setTimeout(() => {
+ //clearTimeout();
+ prog.style.transition = '1s';
+ prog.style.width = '100%';
+ }, 0);
+ setTimeout(() => (ele.outerHTML = ''), 1000);
}
+ this._sidebarContent.proto = undefined;
+ if (!MainView.Live) {
+ DocServer.setPlaygroundFields([
+ 'dataTransition',
+ 'viewTransition',
+ 'treeViewOpen',
+ 'showSidebar',
+ 'itemIndex', // for changing slides in presentations
+ 'sidebarWidthPercent',
+ 'currentTimecode',
+ 'timelineHeightPercent',
+ 'presStatus',
+ 'panX',
+ 'panY',
+ 'overlayX',
+ 'overlayY',
+ 'fitWidth',
+ 'nativeWidth',
+ 'nativeHeight',
+ 'text-scrollHeight',
+ 'text-height',
+ 'hideMinimap',
+ 'viewScale',
+ 'scrollTop',
+ 'hidden',
+ 'curPage',
+ 'viewType',
+ 'chromeHidden',
+ 'currentFrame',
+ 'width',
+ 'height',
+ 'nativeWidth',
+ ]); // can play with these fields on someone else's
+ }
+ DocServer.GetRefField('rtfProto').then(
+ proto =>
+ proto instanceof Doc &&
+ reaction(
+ () => StrCast(proto.BROADCAST_MESSAGE),
+ msg => msg && alert(msg)
+ )
+ );
+
+ const tag = document.createElement('script');
+ tag.src = 'https://www.youtube.com/iframe_api';
+ const firstScriptTag = document.getElementsByTagName('script')[0];
+ firstScriptTag.parentNode!.insertBefore(tag, firstScriptTag);
+ window.removeEventListener('keydown', KeyManager.Instance.handle);
+ window.addEventListener('keydown', KeyManager.Instance.handle);
+ window.removeEventListener('keyup', KeyManager.Instance.unhandle);
+ window.addEventListener('keyup', KeyManager.Instance.unhandle);
+ window.addEventListener('paste', KeyManager.Instance.paste as any);
+ document.addEventListener('dash', (e: any) => {
+ // event used by chrome plugin to tell Dash which document to focus on
+ const id = FormattedTextBox.GetDocFromUrl(e.detail);
+ DocServer.GetRefField(id).then(doc => (doc instanceof Doc ? DocumentManager.Instance.showDocument(doc, { willPan: false }) : null));
+ });
+ document.addEventListener('linkAnnotationToDash', Hypothesis.linkListener);
+ this.initEventListeners();
}
componentWillUnMount() {