import "./index.scss"; import * as React from "react"; import { Dispatch } from "redux"; import { FileCacheItem, getFileCacheItemDataUrl } from "fsbox"; import { TextPreview } from "./view.pc"; import { openTextEditorButtonClicked } from "../../../../../actions"; export type TextEditorProps = { fileCacheItem: FileCacheItem; dispatch: Dispatch; }; export class TextEditorWindow extends React.PureComponent { onOpenTextEditorButtonClick = () => { this.props.dispatch( openTextEditorButtonClicked(this.props.fileCacheItem.uri) ); }; render() { const { fileCacheItem } = this.props; const { onOpenTextEditorButtonClick } = this; const content = (
); return ( ); } } const formatText = (text: string) => { return text .replace(/&/g, "&") .replace(//g, ">") .replace(/\n/g, `
`) .replace(/\s/g, `  `) .replace(/\t/g, `    `) .replace(/"/g, """) .replace(/'/g, "'"); };