mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
585cf02f6c
This makes three main changes: * Adds a hook to transform download links. * Adds a hook to add an externally created ActiveDoc to a DocManager. * Rejiggers XLSX export code so it can be used without streaming, which is currently tricky in a browser. Regular usage with node continues to use streaming. With these changes, I have a POC in hand that updates grist-static to support downloading CSVs, XLSXs, and .grist files.
23 lines
561 B
TypeScript
23 lines
561 B
TypeScript
import { UrlTweaks } from 'app/common/gristUrls';
|
|
import { IAttrObj } from 'grainjs';
|
|
|
|
export interface IHooks {
|
|
iframeAttributes?: Record<string, any>,
|
|
fetch?: typeof fetch,
|
|
baseURI?: string,
|
|
urlTweaks?: UrlTweaks,
|
|
|
|
/**
|
|
* Modify the attributes of an <a> dom element.
|
|
* Convenient in grist-static to directly hook up a
|
|
* download link with the function that provides the data.
|
|
*/
|
|
maybeModifyLinkAttrs(attrs: IAttrObj): IAttrObj;
|
|
}
|
|
|
|
export const defaultHooks: IHooks = {
|
|
maybeModifyLinkAttrs(attrs: IAttrObj) {
|
|
return attrs;
|
|
}
|
|
};
|