mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) updates from grist-core
This commit is contained in:
@@ -40,7 +40,6 @@ import { getOriginUrl } from 'app/common/urlUtils';
|
||||
import { GristAPI, RPC_GRISTAPI_INTERFACE } from 'app/plugin/GristAPI';
|
||||
import { RenderOptions, RenderTarget } from 'app/plugin/RenderOptions';
|
||||
import { checkers } from 'app/plugin/TypeCheckers';
|
||||
import { IpcMessageEvent } from 'electron';
|
||||
import { IMsgCustom, IMsgRpcCall, Rpc } from 'grain-rpc';
|
||||
import { Disposable } from './dispose';
|
||||
const G = getBrowserGlobals('document', 'window');
|
||||
@@ -316,7 +315,7 @@ class WebviewProcess extends ViewProcess {
|
||||
// TODO: find a way for keyboard events to play nice when webviews are non-modal.
|
||||
Mousetrap.setPaused(true);
|
||||
this.autoDisposeCallback(() => Mousetrap.setPaused(false));
|
||||
webview.addEventListener('ipc-message', (event: IpcMessageEvent) => {
|
||||
webview.addEventListener('ipc-message', (event: any /* IpcMessageEvent */) => {
|
||||
// The event object passed to the listener is missing proper documentation. In the examples
|
||||
// listed in https://electronjs.org/docs/api/ipc-main the arguments should be passed to the
|
||||
// listener after the event object, but this is not happening here. Only we know it is a
|
||||
|
||||
@@ -14,7 +14,6 @@ import {GristLoadConfig} from 'app/common/gristUrls';
|
||||
import {byteString, safeJsonParse} from 'app/common/gutil';
|
||||
import {FetchUrlOptions, UPLOAD_URL_PATH, UploadResult} from 'app/common/uploads';
|
||||
import {docUrl} from 'app/common/urlUtils';
|
||||
import {OpenDialogOptions} from 'electron';
|
||||
import noop = require('lodash/noop');
|
||||
import trimStart = require('lodash/trimStart');
|
||||
import {basename} from 'path'; // made available by webpack using path-browserify module.
|
||||
@@ -69,18 +68,18 @@ function getFileDialogOptions(options: SelectFileOptions): FileDialogOptions {
|
||||
}
|
||||
|
||||
// Helper to convert SelectFileOptions to electron's OpenDialogOptions.
|
||||
function getElectronOptions(options: SelectFileOptions): OpenDialogOptions {
|
||||
const resOptions: OpenDialogOptions = {
|
||||
filters: [],
|
||||
function getElectronOptions(options: SelectFileOptions) /*: OpenDialogOptions */ {
|
||||
const resOptions /*: OpenDialogOptions*/ = {
|
||||
filters: [] as Array<{name: string, extensions: any}>,
|
||||
properties: ['openFile'],
|
||||
};
|
||||
if (options.extensions) {
|
||||
// Electron does not expect leading period.
|
||||
const extensions = options.extensions.map(e => trimStart(e, '.'));
|
||||
resOptions.filters!.push({name: 'Select files', extensions});
|
||||
resOptions.filters.push({name: 'Select files', extensions});
|
||||
}
|
||||
if (options.multiple) {
|
||||
resOptions.properties!.push('multiSelections');
|
||||
resOptions.properties.push('multiSelections');
|
||||
}
|
||||
return resOptions;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user