/* * Copyright (c) 2016 * * This file is licensed under the Affero General Public License version 3 * or later. * * See the COPYING-README file. * */ import {getSyntaxMode} from "./SyntaxMode"; import importAce from './ImportAce'; /** @type array[] supportedMimeTypes */ const supportedMimeTypes = require('./supported_mimetypes.json'); export class SidebarPreview { attach (manager) { const handler = this.handlePreview.bind(this); supportedMimeTypes.forEach(value => manager.addPreviewHandler(value, handler)); } handlePreview (model, $thumbnailDiv, $thumbnailContainer, fallback) { const previewWidth = $thumbnailContainer.parent().width() + 50; // 50px for negative margins const previewHeight = previewWidth / (16 / 9); this.getFileContent(model.getFullPath()).then(function (content) { content = content.filecontents; $thumbnailDiv.removeClass('icon-loading icon-32'); $thumbnailContainer.addClass('large'); $thumbnailContainer.addClass('text'); const $editorDiv = $("