Improved preview
Some minor fixes and improvements of the file browser and preview functionality:
- the
FilePreview
component is moved to a separate file - code is refactored by introducing viewer objects, one for each file type we support. The viewer object stores constant information, like matching file extensions, maxSizeAutoPreview etc, plus a
render
function. - a viewer is introduced for json files (the same viewer used elsewhere).
- txt, yaml and yml files are automatically previewed with the text viewer
- error handling is added. If the viewer fails, we show a message and offers the user to view the file using the text viewer instead.
- optimizing the vertical file browser api calls, using the
include_entry_info
option instead of making a costly second api call. - Highlighting the current entry mainfile