Path: blob/master/src/packages/frontend/editors/slate/edit-bar/component.tsx
1697 views
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import React from "react";67import { SlateEditor } from "../editable-markdown";8import { LinkEdit } from "./link-edit";9import { ListProperties } from "./list";10import { ListEdit } from "./list-edit";11import { Marks } from "./marks";12import { MarksBar } from "./marks-bar";1314interface Props {15Search: React.JSX.Element;16isCurrent?: boolean;17marks: Marks;18linkURL: string | undefined;19listProperties: ListProperties | undefined;20editor: SlateEditor;21style?: React.CSSProperties;22hideSearch?: boolean; // often on SMALL docs, e.g., when embedding in chat, it's pointless to have our own find.23}2425const HEIGHT = "25px";2627export const EditBar: React.FC<Props> = (props: Props) => {28const {29isCurrent,30Search,31marks,32linkURL,33listProperties,34editor,35style,36hideSearch,37} = props;3839function renderContent() {40return (41<>42<MarksBar marks={marks} editor={editor} />43<LinkEdit linkURL={linkURL} editor={editor} />44<ListEdit listProperties={listProperties} editor={editor} />45{!hideSearch && (46<div style={{ flex: 1, maxWidth: "50ex", marginRight: "15px" }}>47{Search}48</div>49)}50</>51);52}5354return (55<div56style={{57borderBottom: isCurrent58? "1px solid lightgray"59: "1px solid transparent",60height: HEIGHT,61display: "flex",62flexDirection: "row",63overflow: "hidden",64...style,65}}66>67{isCurrent && renderContent()}68</div>69);70};717273