import { WarningOutlined } from '@ant-design/icons'; import React from 'react'; import { IconBtn } from '../../Components'; import { ELTYPE } from '../../config'; import { BlockIconButton } from '../../StaticToolbar/buttons'; import './index.less'; import { alignToggle, colorChoice } from '../../HoveringToolbar'; import { Editor, Node, Range, Transforms } from '@src/components/slate-packages/slate'; import { insertCodeBlock } from '../../CodeBlock'; import storage from '@src/utils/storage'; import { insertOl } from '../../OLULList/OlList'; import { toggleBlock } from '../../block'; import { insertDivide } from '../../Divide'; import { newTable } from '../../table/newTable'; import { getCache } from '@src/utils/cacheUtils'; import { css, cx } from '@emotion/css'; import { ReactEditor } from '@src/components/slate-packages/slate-react'; import { f } from '@src/resource/string'; function ColorBtn(props: any) { const { editor, format, color, key, callback } = props; return (
{ e.preventDefault(); const selection = getCache(editor.docId, 'selection'); console.log('icon', format, color, selection); if (!selection) return; Transforms.select(editor, selection); Editor.addMark(editor, format, color); console.log(Editor.fragment(editor, selection)); callback(); }} >
); } export default function (props: any) { const { setShowCard, editor, docWidth, docId } = props; const selection = getCache(docId, 'selection'); const colorArray = [ 'rgb(0, 0, 0)', 'rgb(224, 102, 102)', 'rgb(246, 178, 107)', 'rgb(255, 217, 102)', 'rgb(147, 196, 125)', 'rgb(111, 168, 220)', 'rgb(142, 124, 195)', 'rgb(217, 217, 217)', 'rgb(255, 255, 255)', ]; return (
{ setShowCard(false); }} >
{ e.preventDefault(); e.stopPropagation(); }} >
{f('colorAndLingth')}
{f('fontColor')}
{colorArray.map((colorItem: string, index: number) => ( setShowCard(false)} /> ))}
{f('bgColor')}
{colorArray.map((colorItem: string, index: number) => ( setShowCard(false)} /> ))}
); }