2023-03-07 01:11:43 +00:00
|
|
|
import {CellValue} from "app/common/DocActions";
|
(core) Revamp attachment editor + preview UI, and support more types, including PDFs.
Summary:
- New UI for the modal look mostly following the design prepared previously.
- Use <object> for rendering PDFs (on a Mac works on Firefox, Chrome, Safari; needs checking on Windows)
- While we are at it, use <video> and <audio> for relevant files (object would
render them too, but without the option to disable autoplay).
- Use <object> for unknown types, except for text/html (unsafe) and other text
types (need more work to render well).
- Fix skipping save on Escape or when attachments are unsaved (previously a
noop action was emitted, creating surprises with undo).
- Display extension for files without preview, both in-cell and in the modal.
- Replace tiny "eye" icon to preview particular attachment with double-clicking.
- As an accidental feature, a particular attachment can be previewed by typing 1, 2, 3, etc into cell.
- Renamed PreviewsWidget/PreviewModel to AttachmentsWidget/AttachmentsEditor.
Test Plan: Unified old and new tests for attachments, added new test cases.
Reviewers: paulfitz
Reviewed By: paulfitz
Differential Revision: https://phab.getgrist.com/D2667
2020-11-20 02:05:55 +00:00
|
|
|
import * as commands from 'app/client/components/commands';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {dragOverClass} from 'app/client/lib/dom';
|
|
|
|
import {selectFiles, uploadFiles} from 'app/client/lib/uploads';
|
2022-08-08 13:32:50 +00:00
|
|
|
import {cssRow} from 'app/client/ui/RightPanelStyles';
|
2023-03-07 01:11:43 +00:00
|
|
|
import {colors, testId, vars} from 'app/client/ui2018/cssVars';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {NewAbstractWidget} from 'app/client/widgets/NewAbstractWidget';
|
|
|
|
import {encodeQueryParams} from 'app/common/gutil';
|
2023-03-07 01:11:43 +00:00
|
|
|
import {ViewFieldRec} from 'app/client/models/entities/ViewFieldRec';
|
|
|
|
import {DataRowModel} from 'app/client/models/DataRowModel';
|
2021-12-07 11:21:16 +00:00
|
|
|
import {MetaTableData} from 'app/client/models/TableData';
|
2023-03-07 01:11:43 +00:00
|
|
|
import { SingleCell } from 'app/common/TableData';
|
|
|
|
import {KoSaveableObservable} from 'app/client/models/modelUtil';
|
2020-10-02 15:10:00 +00:00
|
|
|
import {UploadResult} from 'app/common/uploads';
|
2023-03-07 01:11:43 +00:00
|
|
|
import { GristObjCode } from 'app/plugin/GristData';
|
|
|
|
import {Computed, dom, fromKo, input, onElem, styled} from 'grainjs';
|
(core) Revamp attachment editor + preview UI, and support more types, including PDFs.
Summary:
- New UI for the modal look mostly following the design prepared previously.
- Use <object> for rendering PDFs (on a Mac works on Firefox, Chrome, Safari; needs checking on Windows)
- While we are at it, use <video> and <audio> for relevant files (object would
render them too, but without the option to disable autoplay).
- Use <object> for unknown types, except for text/html (unsafe) and other text
types (need more work to render well).
- Fix skipping save on Escape or when attachments are unsaved (previously a
noop action was emitted, creating surprises with undo).
- Display extension for files without preview, both in-cell and in the modal.
- Replace tiny "eye" icon to preview particular attachment with double-clicking.
- As an accidental feature, a particular attachment can be previewed by typing 1, 2, 3, etc into cell.
- Renamed PreviewsWidget/PreviewModel to AttachmentsWidget/AttachmentsEditor.
Test Plan: Unified old and new tests for attachments, added new test cases.
Reviewers: paulfitz
Reviewed By: paulfitz
Differential Revision: https://phab.getgrist.com/D2667
2020-11-20 02:05:55 +00:00
|
|
|
import {extname} from 'path';
|
2020-10-02 15:10:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
(core) Revamp attachment editor + preview UI, and support more types, including PDFs.
Summary:
- New UI for the modal look mostly following the design prepared previously.
- Use <object> for rendering PDFs (on a Mac works on Firefox, Chrome, Safari; needs checking on Windows)
- While we are at it, use <video> and <audio> for relevant files (object would
render them too, but without the option to disable autoplay).
- Use <object> for unknown types, except for text/html (unsafe) and other text
types (need more work to render well).
- Fix skipping save on Escape or when attachments are unsaved (previously a
noop action was emitted, creating surprises with undo).
- Display extension for files without preview, both in-cell and in the modal.
- Replace tiny "eye" icon to preview particular attachment with double-clicking.
- As an accidental feature, a particular attachment can be previewed by typing 1, 2, 3, etc into cell.
- Renamed PreviewsWidget/PreviewModel to AttachmentsWidget/AttachmentsEditor.
Test Plan: Unified old and new tests for attachments, added new test cases.
Reviewers: paulfitz
Reviewed By: paulfitz
Differential Revision: https://phab.getgrist.com/D2667
2020-11-20 02:05:55 +00:00
|
|
|
* AttachmentsWidget - A widget for displaying attachments as image previews.
|
2020-10-02 15:10:00 +00:00
|
|
|
*/
|
(core) Revamp attachment editor + preview UI, and support more types, including PDFs.
Summary:
- New UI for the modal look mostly following the design prepared previously.
- Use <object> for rendering PDFs (on a Mac works on Firefox, Chrome, Safari; needs checking on Windows)
- While we are at it, use <video> and <audio> for relevant files (object would
render them too, but without the option to disable autoplay).
- Use <object> for unknown types, except for text/html (unsafe) and other text
types (need more work to render well).
- Fix skipping save on Escape or when attachments are unsaved (previously a
noop action was emitted, creating surprises with undo).
- Display extension for files without preview, both in-cell and in the modal.
- Replace tiny "eye" icon to preview particular attachment with double-clicking.
- As an accidental feature, a particular attachment can be previewed by typing 1, 2, 3, etc into cell.
- Renamed PreviewsWidget/PreviewModel to AttachmentsWidget/AttachmentsEditor.
Test Plan: Unified old and new tests for attachments, added new test cases.
Reviewers: paulfitz
Reviewed By: paulfitz
Differential Revision: https://phab.getgrist.com/D2667
2020-11-20 02:05:55 +00:00
|
|
|
export class AttachmentsWidget extends NewAbstractWidget {
|
2020-10-02 15:10:00 +00:00
|
|
|
|
2021-12-07 11:21:16 +00:00
|
|
|
private _attachmentsTable: MetaTableData<'_grist_Attachments'>;
|
2023-03-07 01:11:43 +00:00
|
|
|
private _height: KoSaveableObservable<string>;
|
2020-10-02 15:10:00 +00:00
|
|
|
|
2023-03-07 01:11:43 +00:00
|
|
|
constructor(field: ViewFieldRec) {
|
2020-10-02 15:10:00 +00:00
|
|
|
super(field);
|
|
|
|
|
|
|
|
// TODO: the Attachments table currently treated as metadata, and loaded on open,
|
|
|
|
// but should probably be loaded on demand as it contains user data, which may be large.
|
2021-12-07 11:21:16 +00:00
|
|
|
this._attachmentsTable = this._getDocData().getMetaTable('_grist_Attachments');
|
2020-10-02 15:10:00 +00:00
|
|
|
|
2023-03-07 01:11:43 +00:00
|
|
|
this._height = this.options.prop('height');
|
2020-10-02 15:10:00 +00:00
|
|
|
|
|
|
|
this.autoDispose(this._height.subscribe(() => {
|
|
|
|
this.field.viewSection().events.trigger('rowHeightChange');
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
|
2023-03-07 01:11:43 +00:00
|
|
|
public buildDom(row: DataRowModel) {
|
2020-10-02 15:10:00 +00:00
|
|
|
// NOTE: A cellValue of the correct type includes the list encoding designator 'L' as the
|
|
|
|
// first element.
|
2023-03-07 01:11:43 +00:00
|
|
|
const cellValue = row.cells[this.field.colId()];
|
2020-10-02 15:10:00 +00:00
|
|
|
const values = Computed.create(null, fromKo(cellValue), (use, _cellValue) =>
|
2023-03-07 01:11:43 +00:00
|
|
|
Array.isArray(_cellValue) ? _cellValue.slice(1) as number[] : []);
|
2020-10-02 15:10:00 +00:00
|
|
|
|
2022-07-06 22:36:09 +00:00
|
|
|
const colId = this.field.colId();
|
|
|
|
const tableId = this.field.column().table().tableId();
|
2023-03-07 01:11:43 +00:00
|
|
|
return cssAttachmentWidget(
|
2020-10-02 15:10:00 +00:00
|
|
|
dom.autoDispose(values),
|
|
|
|
|
2023-03-07 01:11:43 +00:00
|
|
|
dom.cls('field_clip'),
|
2020-10-02 15:10:00 +00:00
|
|
|
dragOverClass('attachment_drag_over'),
|
2023-03-07 01:11:43 +00:00
|
|
|
cssAttachmentIcon(
|
|
|
|
cssAttachmentIcon.cls('-hover', (use) => use(values).length > 0),
|
|
|
|
dom.on('click', () => this._selectAndSave(row, cellValue)),
|
|
|
|
testId('attachment-icon'),
|
2020-10-02 15:10:00 +00:00
|
|
|
),
|
2023-03-07 01:11:43 +00:00
|
|
|
dom.maybe<number>(row.id, rowId => {
|
2022-07-06 22:36:09 +00:00
|
|
|
return dom.forEach(values, (value: number) =>
|
|
|
|
isNaN(value) ? null : this._buildAttachment(value, values, {
|
|
|
|
rowId, colId, tableId,
|
|
|
|
}));
|
|
|
|
}),
|
2023-03-07 01:11:43 +00:00
|
|
|
dom.on('drop', ev => this._uploadAndSave(row, cellValue, ev.dataTransfer!.files)),
|
|
|
|
testId('attachment-widget'),
|
2020-10-02 15:10:00 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public buildConfigDom(): Element {
|
2022-10-14 10:07:19 +00:00
|
|
|
const options = this.field.config.options;
|
|
|
|
const height = options.prop('height');
|
|
|
|
const inputRange = input(
|
|
|
|
fromKo(height),
|
|
|
|
{onInput: true}, {
|
|
|
|
style: 'margin: 0 5px;',
|
|
|
|
type: 'range',
|
|
|
|
min: '16',
|
|
|
|
max: '96',
|
|
|
|
value: '36'
|
|
|
|
},
|
2023-03-07 01:11:43 +00:00
|
|
|
testId('pw-thumbnail-size'),
|
2022-10-14 10:07:19 +00:00
|
|
|
// When multiple columns are selected, we can only edit height when all
|
|
|
|
// columns support it.
|
|
|
|
dom.prop('disabled', use => use(options.disabled('height'))),
|
|
|
|
);
|
2020-10-02 15:10:00 +00:00
|
|
|
// Save the height on change event (when the user releases the drag button)
|
2023-03-07 01:11:43 +00:00
|
|
|
onElem(inputRange, 'change', (ev: Event) => {
|
|
|
|
height.setAndSave(inputRange.value).catch(reportError);
|
|
|
|
});
|
2020-10-02 15:10:00 +00:00
|
|
|
return cssRow(
|
2023-03-07 01:11:43 +00:00
|
|
|
cssSizeLabel('Size'),
|
2020-10-02 15:10:00 +00:00
|
|
|
inputRange
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-07-06 22:36:09 +00:00
|
|
|
protected _buildAttachment(value: number, allValues: Computed<number[]>, cell: SingleCell): Element {
|
2021-12-07 11:21:16 +00:00
|
|
|
const filename = this._attachmentsTable.getValue(value, 'fileName')!;
|
|
|
|
const fileIdent = this._attachmentsTable.getValue(value, 'fileIdent')!;
|
|
|
|
const height = this._attachmentsTable.getValue(value, 'imageHeight')!;
|
|
|
|
const width = this._attachmentsTable.getValue(value, 'imageWidth')!;
|
|
|
|
const hasPreview = Boolean(height);
|
|
|
|
const ratio = hasPreview ? (width / height) : 1;
|
2020-10-02 15:10:00 +00:00
|
|
|
|
2023-03-07 01:11:43 +00:00
|
|
|
return cssAttachmentPreview({title: filename}, // Add a filename tooltip to the previews.
|
2020-10-02 15:10:00 +00:00
|
|
|
dom.style('height', (use) => `${use(this._height)}px`),
|
|
|
|
dom.style('width', (use) => `${parseInt(use(this._height), 10) * ratio}px`),
|
|
|
|
// TODO: Update to legitimately determine whether a file preview exists.
|
|
|
|
hasPreview ? dom('img', {style: 'height: 100%; min-width: 100%; vertical-align: top;'},
|
2022-07-06 22:36:09 +00:00
|
|
|
dom.attr('src', this._getUrl(value, cell))
|
(core) Revamp attachment editor + preview UI, and support more types, including PDFs.
Summary:
- New UI for the modal look mostly following the design prepared previously.
- Use <object> for rendering PDFs (on a Mac works on Firefox, Chrome, Safari; needs checking on Windows)
- While we are at it, use <video> and <audio> for relevant files (object would
render them too, but without the option to disable autoplay).
- Use <object> for unknown types, except for text/html (unsafe) and other text
types (need more work to render well).
- Fix skipping save on Escape or when attachments are unsaved (previously a
noop action was emitted, creating surprises with undo).
- Display extension for files without preview, both in-cell and in the modal.
- Replace tiny "eye" icon to preview particular attachment with double-clicking.
- As an accidental feature, a particular attachment can be previewed by typing 1, 2, 3, etc into cell.
- Renamed PreviewsWidget/PreviewModel to AttachmentsWidget/AttachmentsEditor.
Test Plan: Unified old and new tests for attachments, added new test cases.
Reviewers: paulfitz
Reviewed By: paulfitz
Differential Revision: https://phab.getgrist.com/D2667
2020-11-20 02:05:55 +00:00
|
|
|
) : renderFileType(filename, fileIdent, this._height),
|
|
|
|
// Open editor as if with input, using it to tell it which of the attachments to show. We
|
|
|
|
// pass in a 1-based index. Hitting a key opens the cell, and this approach allows an
|
|
|
|
// accidental feature of opening e.g. second attachment by hitting "2".
|
|
|
|
dom.on('dblclick', () => commands.allCommands.input.run(String(allValues.get().indexOf(value) + 1))),
|
2023-03-07 01:11:43 +00:00
|
|
|
testId('pw-thumbnail'),
|
2020-10-02 15:10:00 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Returns the attachment download url.
|
2022-07-06 22:36:09 +00:00
|
|
|
private _getUrl(attId: number, cell: SingleCell): string {
|
|
|
|
const docComm = this._getDocComm();
|
|
|
|
return docComm.docUrl('attachment') + '?' + encodeQueryParams({
|
|
|
|
...docComm.getUrlParams(),
|
|
|
|
...cell,
|
|
|
|
attId,
|
|
|
|
name: this._attachmentsTable.getValue(attId, 'fileName')
|
|
|
|
});
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
|
2023-03-07 01:11:43 +00:00
|
|
|
private async _selectAndSave(row: DataRowModel, value: KoSaveableObservable<CellValue>): Promise<void> {
|
2020-10-02 15:10:00 +00:00
|
|
|
const uploadResult = await selectFiles({docWorkerUrl: this._getDocComm().docWorkerUrl,
|
|
|
|
multiple: true, sizeLimit: 'attachment'});
|
2023-03-07 01:11:43 +00:00
|
|
|
return this._save(row, value, uploadResult);
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
|
2023-03-07 01:11:43 +00:00
|
|
|
private async _uploadAndSave(row: DataRowModel, value: KoSaveableObservable<CellValue>,
|
|
|
|
files: FileList): Promise<void> {
|
2020-10-02 15:10:00 +00:00
|
|
|
const uploadResult = await uploadFiles(Array.from(files),
|
|
|
|
{docWorkerUrl: this._getDocComm().docWorkerUrl,
|
|
|
|
sizeLimit: 'attachment'});
|
2023-03-07 01:11:43 +00:00
|
|
|
return this._save(row, value, uploadResult);
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
|
2023-03-07 01:11:43 +00:00
|
|
|
private async _save(row: DataRowModel, value: KoSaveableObservable<CellValue>,
|
|
|
|
uploadResult: UploadResult|null
|
|
|
|
): Promise<void> {
|
2020-10-02 15:10:00 +00:00
|
|
|
if (!uploadResult) { return; }
|
|
|
|
const rowIds = await this._getDocComm().addAttachments(uploadResult.uploadId);
|
|
|
|
// Values should be saved with a leading "L" to fit Grist's list value encoding.
|
2023-03-07 01:11:43 +00:00
|
|
|
const formatted: CellValue = value() ? value() : [GristObjCode.List];
|
|
|
|
const newValue = (formatted as number[]).concat(rowIds) as CellValue;
|
|
|
|
|
|
|
|
// Move the cursor here (note that this may involve switching active section when dragging
|
|
|
|
// into a cell of an inactive section). Then send the 'input' command; it is normally used for
|
|
|
|
// key presses to open an editor; here the "typed text" is the new value. It is handled by
|
|
|
|
// AttachmentsEditor.skipEditor(), and makes the edit apply to editRow, which handles setting
|
|
|
|
// default values based on widget linking.
|
|
|
|
commands.allCommands.setCursor.run(row, this.field);
|
|
|
|
commands.allCommands.input.run(newValue);
|
2020-10-02 15:10:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
(core) Revamp attachment editor + preview UI, and support more types, including PDFs.
Summary:
- New UI for the modal look mostly following the design prepared previously.
- Use <object> for rendering PDFs (on a Mac works on Firefox, Chrome, Safari; needs checking on Windows)
- While we are at it, use <video> and <audio> for relevant files (object would
render them too, but without the option to disable autoplay).
- Use <object> for unknown types, except for text/html (unsafe) and other text
types (need more work to render well).
- Fix skipping save on Escape or when attachments are unsaved (previously a
noop action was emitted, creating surprises with undo).
- Display extension for files without preview, both in-cell and in the modal.
- Replace tiny "eye" icon to preview particular attachment with double-clicking.
- As an accidental feature, a particular attachment can be previewed by typing 1, 2, 3, etc into cell.
- Renamed PreviewsWidget/PreviewModel to AttachmentsWidget/AttachmentsEditor.
Test Plan: Unified old and new tests for attachments, added new test cases.
Reviewers: paulfitz
Reviewed By: paulfitz
Differential Revision: https://phab.getgrist.com/D2667
2020-11-20 02:05:55 +00:00
|
|
|
export function renderFileType(fileName: string, fileIdent: string, height?: ko.Observable<string>): HTMLElement {
|
|
|
|
// Prepend 'x' to ensure we return the extension even if the basename is empty (e.g. ".xls").
|
|
|
|
// Take slice(1) to strip off the leading period.
|
|
|
|
const extension = extname('x' + fileName).slice(1) || extname('x' + fileIdent).slice(1) || '?';
|
|
|
|
return cssFileType(extension.toUpperCase(),
|
|
|
|
height && cssFileType.cls((use) => {
|
|
|
|
const size = parseFloat(use(height));
|
|
|
|
return size < 28 ? '-small' : size < 60 ? '-medium' : '-large';
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
}
|
2020-10-02 15:10:00 +00:00
|
|
|
|
2023-03-07 01:11:43 +00:00
|
|
|
const cssAttachmentWidget = styled('div', `
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
white-space: pre-wrap;
|
|
|
|
|
|
|
|
&.attachment_drag_over {
|
|
|
|
outline: 2px dashed #ff9a00;
|
|
|
|
outline-offset: -2px;
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssAttachmentIcon = styled('div.glyphicon.glyphicon-paperclip', `
|
|
|
|
position: absolute;
|
|
|
|
top: 2px;
|
|
|
|
left: 2px;
|
|
|
|
padding: 2px;
|
|
|
|
background-color: #D0D0D0;
|
|
|
|
color: white;
|
|
|
|
border-radius: 2px;
|
|
|
|
border: none;
|
|
|
|
cursor: pointer;
|
|
|
|
box-shadow: 0 0 0 1px white;
|
|
|
|
z-index: 1;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
background-color: #3290BF;
|
|
|
|
}
|
|
|
|
|
|
|
|
&-hover {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
.${cssAttachmentWidget.className}:hover &-hover {
|
|
|
|
display: inline;
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssAttachmentPreview = styled('div', `
|
|
|
|
color: black;
|
|
|
|
background-color: white;
|
|
|
|
border: 1px solid #bbb;
|
|
|
|
margin: 0 2px 2px 0;
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
z-index: 0;
|
|
|
|
&:hover {
|
|
|
|
border-color: ${colors.lightGreen};
|
|
|
|
}
|
|
|
|
`);
|
|
|
|
|
|
|
|
const cssSizeLabel = styled('div', `
|
|
|
|
color: ${colors.slate};
|
|
|
|
margin-right: 9px;
|
|
|
|
`);
|
|
|
|
|
|
|
|
|
(core) Revamp attachment editor + preview UI, and support more types, including PDFs.
Summary:
- New UI for the modal look mostly following the design prepared previously.
- Use <object> for rendering PDFs (on a Mac works on Firefox, Chrome, Safari; needs checking on Windows)
- While we are at it, use <video> and <audio> for relevant files (object would
render them too, but without the option to disable autoplay).
- Use <object> for unknown types, except for text/html (unsafe) and other text
types (need more work to render well).
- Fix skipping save on Escape or when attachments are unsaved (previously a
noop action was emitted, creating surprises with undo).
- Display extension for files without preview, both in-cell and in the modal.
- Replace tiny "eye" icon to preview particular attachment with double-clicking.
- As an accidental feature, a particular attachment can be previewed by typing 1, 2, 3, etc into cell.
- Renamed PreviewsWidget/PreviewModel to AttachmentsWidget/AttachmentsEditor.
Test Plan: Unified old and new tests for attachments, added new test cases.
Reviewers: paulfitz
Reviewed By: paulfitz
Differential Revision: https://phab.getgrist.com/D2667
2020-11-20 02:05:55 +00:00
|
|
|
const cssFileType = styled('div', `
|
|
|
|
height: 100%;
|
|
|
|
width: 100%;
|
|
|
|
max-height: 80px;
|
|
|
|
max-width: 80px;
|
|
|
|
background-color: ${colors.slate};
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
font-size: ${vars.mediumFontSize};
|
|
|
|
font-weight: bold;
|
|
|
|
color: white;
|
|
|
|
overflow: hidden;
|
2020-10-02 15:10:00 +00:00
|
|
|
|
(core) Revamp attachment editor + preview UI, and support more types, including PDFs.
Summary:
- New UI for the modal look mostly following the design prepared previously.
- Use <object> for rendering PDFs (on a Mac works on Firefox, Chrome, Safari; needs checking on Windows)
- While we are at it, use <video> and <audio> for relevant files (object would
render them too, but without the option to disable autoplay).
- Use <object> for unknown types, except for text/html (unsafe) and other text
types (need more work to render well).
- Fix skipping save on Escape or when attachments are unsaved (previously a
noop action was emitted, creating surprises with undo).
- Display extension for files without preview, both in-cell and in the modal.
- Replace tiny "eye" icon to preview particular attachment with double-clicking.
- As an accidental feature, a particular attachment can be previewed by typing 1, 2, 3, etc into cell.
- Renamed PreviewsWidget/PreviewModel to AttachmentsWidget/AttachmentsEditor.
Test Plan: Unified old and new tests for attachments, added new test cases.
Reviewers: paulfitz
Reviewed By: paulfitz
Differential Revision: https://phab.getgrist.com/D2667
2020-11-20 02:05:55 +00:00
|
|
|
&-small { font-size: ${vars.xxsmallFontSize}; }
|
|
|
|
&-medium { font-size: ${vars.smallFontSize}; }
|
|
|
|
&-large { font-size: ${vars.mediumFontSize}; }
|
|
|
|
`);
|