diff options
Diffstat (limited to 'src/client/views/nodes/button/FontIconBox.tsx')
-rw-r--r-- | src/client/views/nodes/button/FontIconBox.tsx | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/client/views/nodes/button/FontIconBox.tsx b/src/client/views/nodes/button/FontIconBox.tsx index 5ae7c3628..40d5ad819 100644 --- a/src/client/views/nodes/button/FontIconBox.tsx +++ b/src/client/views/nodes/button/FontIconBox.tsx @@ -26,12 +26,10 @@ import { SetActiveInkColor, ActiveFillColor, SetActiveFillColor, ActiveInkWidth, import { StyleProp } from '../../StyleProvider'; import { FieldView, FieldViewProps } from '.././FieldView'; import { RichTextMenu } from '../formattedText/RichTextMenu'; -import { TextButton } from './textButton'; -import { ToggleButton } from './toggleButton'; +import { Utils } from '../../../../Utils'; import { IButtonProps } from './ButtonInterface'; import { FontIconBadge } from './FontIconBadge'; import './FontIconBox.scss'; -import { undo } from 'prosemirror-history'; import { WebBox } from '../WebBox'; const FontIconSchema = createSchema({ icon: "string", @@ -333,15 +331,14 @@ export class FontIconBox extends DocComponent<ButtonProps, FontIconDocument>(Fon const scriptCheck: string = script + "(undefined, true)"; const boolResult = ScriptField.MakeScript(scriptCheck)?.script.run().result; - const showAlpha: boolean = script !== "setStrokeColor"; // bcz: ugh this should be changed to a field property on the button - const colorOptions: string[] = ['#D0021B', '#F5A623', '#F8E71C', '#8B572A', '#7ED321', '#417505', '#9013FE', '#4A90E2', '#50E3C2', '#B8E986', '#000000', '#4A4A4A', '#9B9B9B', '#FFFFFF', '#f1efeb', "transparent"]; const colorBox = (func: (color: ColorState) => void) => <SketchPicker - disableAlpha={!showAlpha} - onChange={func} color={boolResult ? boolResult : "#FFFFFF"} + disableAlpha={false} + onChange={func} + color={boolResult ? boolResult : "#FFFFFF"} presetColors={colorOptions} />; const label = !this.label || !Doc.UserDoc()._showLabel ? (null) : <div className="fontIconBox-label" style={{ color: color, backgroundColor: backgroundColor, position: "absolute" }}> @@ -356,7 +353,7 @@ export class FontIconBox extends DocComponent<ButtonProps, FontIconDocument>(Fon const click = (value: ColorState) => { const hex: string = value.hex; - const s = ScriptField.MakeScript(script + '("' + hex + '", false)'); + const s = ScriptField.MakeScript(script + '("' + Utils.colorString(value) + '", false)'); if (s) { undoBatch(() => s.script.run().result)(); } |