Skip to content

Commit

Permalink
Save state on blur. Fixes cloing windows (#4234)
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenRBS committed Nov 7, 2022
1 parent db9b4f4 commit e440abc
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions static/sharing.ts
Expand Up @@ -27,14 +27,15 @@ import * as Sentry from '@sentry/browser';
import GoldenLayout from 'golden-layout';
import _ from 'underscore';
import ClipboardJS from 'clipboard';
import {set as localStorageSet} from './local';
import {ga} from './analytics';
import * as url from './url';
import {options} from './options';

import ClickEvent = JQuery.ClickEvent;
import TriggeredEvent = JQuery.TriggeredEvent;
import {Settings, SiteSettings} from './settings';

const ga = require('./analytics').ga;
const options = require('./options').options;
const url = require('./url');
const cloneDeep = require('lodash.clonedeep');

enum LinkType {
Expand Down Expand Up @@ -121,6 +122,7 @@ export class Sharing {
});

$(window).on('blur', async () => {
localStorageSet('gl', JSON.stringify(this.layout.toConfig()));
if (this.settings.keepMultipleTabs) {
try {
const link = await this.getLinkOfType(LinkType.Full);
Expand Down Expand Up @@ -389,7 +391,7 @@ export class Sharing {

private static getEmbeddedHtml(config, root, isReadOnly, extraOptions): string {
const embedUrl = Sharing.getEmbeddedUrl(config, root, isReadOnly, extraOptions);
return `<iframe width="800px" height="200px" src="${embedUrl}"></iframe>`;
return `<iframe width='800px' height='200px' src='${embedUrl}'></iframe>`;
}

private static getEmbeddedUrl(config: any, root: string, readOnly: boolean, extraOptions: object): string {
Expand Down

0 comments on commit e440abc

Please sign in to comment.