Path: blob/master/src/packages/frontend/editors/slate/elements/hr/editable.tsx
1702 views
/*1* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.2* License: MS-RSL – see LICENSE.md for details3*/45import { FOCUSED_COLOR } from "../../util";6import { register } from "../register";7import { useFocused, useSelected } from "../hooks";89register({10slateType: "hr",1112Element: ({ attributes, children }) => {13const focused = useFocused();14const selected = useSelected();1516// The borderTop on the hr is just "fighting back" against a dumb thing17// that is imposed by bootstrap3... (it's in scaffolding.less). Someday18// we'll get rid of bootstrap css entirely!19return (20<div {...attributes}>21<div22contentEditable={false}23style={{24border: `2px solid ${25focused && selected ? FOCUSED_COLOR : "transparent"26}`,27}}28>29<hr style={{ borderTop: "1px solid #aaa" }} />30</div>31{children}32</div>33);34},3536fromSlate: () => "---\n\n",37});383940