@onesy/ui-react 1.0.96 → 1.0.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { ITextField } from '../TextField/TextField';
|
3
|
+
import { IPropsAny } from '../types';
|
3
4
|
export declare type ISmartTextField = ITextField & {
|
4
5
|
placeholder?: any;
|
5
6
|
edit?: boolean;
|
@@ -11,8 +12,10 @@ export declare type ISmartTextField = ITextField & {
|
|
11
12
|
addTag?: (value: any) => any;
|
12
13
|
}) => any;
|
13
14
|
additional?: any;
|
15
|
+
miniMenuExtended?: boolean;
|
14
16
|
pasteText?: boolean;
|
15
17
|
HelperTextProps?: any;
|
18
|
+
ColorTextFieldProps?: IPropsAny;
|
16
19
|
};
|
17
20
|
declare const SmartTextField: React.FC<ISmartTextField>;
|
18
21
|
export default SmartTextField;
|
@@ -18,6 +18,12 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
18
|
const react_1 = __importDefault(require("react"));
|
19
19
|
const utils_1 = require("@onesy/utils");
|
20
20
|
const style_react_1 = require("@onesy/style-react");
|
21
|
+
const IconMaterialFormatAlignLeftW100_1 = __importDefault(require("@onesy/icons-material-rounded-react/IconMaterialFormatAlignLeftW100"));
|
22
|
+
const IconMaterialFormatAlignCenterW100_1 = __importDefault(require("@onesy/icons-material-rounded-react/IconMaterialFormatAlignCenterW100"));
|
23
|
+
const IconMaterialFormatAlignRightW100_1 = __importDefault(require("@onesy/icons-material-rounded-react/IconMaterialFormatAlignRightW100"));
|
24
|
+
const IconMaterialFormatAlignJustifyW100_1 = __importDefault(require("@onesy/icons-material-rounded-react/IconMaterialFormatAlignJustifyW100"));
|
25
|
+
const IconMaterialFormatColorTextW100_1 = __importDefault(require("@onesy/icons-material-rounded-react/IconMaterialFormatColorTextW100"));
|
26
|
+
const IconMaterialFormatColorFillW100_1 = __importDefault(require("@onesy/icons-material-rounded-react/IconMaterialFormatColorFillW100"));
|
21
27
|
const IconMaterialSuperscriptW100_1 = __importDefault(require("@onesy/icons-material-rounded-react/IconMaterialSuperscriptW100"));
|
22
28
|
const IconMaterialSubscriptW100_1 = __importDefault(require("@onesy/icons-material-rounded-react/IconMaterialSubscriptW100"));
|
23
29
|
const IconMaterialFormatItalicW100_1 = __importDefault(require("@onesy/icons-material-rounded-react/IconMaterialFormatItalicW100"));
|
@@ -27,6 +33,7 @@ const IconMaterialFormatBoldW100_1 = __importDefault(require("@onesy/icons-mater
|
|
27
33
|
const IconMaterialAddLinkW100_1 = __importDefault(require("@onesy/icons-material-rounded-react/IconMaterialAddLinkW100"));
|
28
34
|
const IconMaterialLinkOffW100_1 = __importDefault(require("@onesy/icons-material-rounded-react/IconMaterialLinkOffW100"));
|
29
35
|
const IconMaterialFormatClearW100_1 = __importDefault(require("@onesy/icons-material-rounded-react/IconMaterialFormatClearW100"));
|
36
|
+
const ColorTextField_1 = __importDefault(require("../ColorTextField"));
|
30
37
|
const TextField_1 = __importDefault(require("../TextField/TextField"));
|
31
38
|
const Line_1 = __importDefault(require("../Line"));
|
32
39
|
const List_1 = __importDefault(require("../List"));
|
@@ -42,6 +49,7 @@ const ToggleButton_1 = __importDefault(require("../ToggleButton"));
|
|
42
49
|
const ClickListener_1 = __importDefault(require("../ClickListener"));
|
43
50
|
const ToggleButtons_1 = __importDefault(require("../ToggleButtons"));
|
44
51
|
const Menu_1 = __importDefault(require("../Menu"));
|
52
|
+
const Divider_1 = __importDefault(require("../Divider"));
|
45
53
|
const utils_2 = require("../utils");
|
46
54
|
const useStyle = (0, style_react_1.style)(theme => ({
|
47
55
|
root: {
|
@@ -124,7 +132,9 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
124
132
|
const ClickListener = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.ClickListener) || ClickListener_1.default; }, [theme]);
|
125
133
|
const ToggleButtons = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.ToggleButtons) || ToggleButtons_1.default; }, [theme]);
|
126
134
|
const Menu = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Menu) || Menu_1.default; }, [theme]);
|
127
|
-
const
|
135
|
+
const Divider = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.Divider) || Divider_1.default; }, [theme]);
|
136
|
+
const ColorTextField = react_1.default.useMemo(() => { var _a; return ((_a = theme === null || theme === void 0 ? void 0 : theme.elements) === null || _a === void 0 ? void 0 : _a.ColorTextField) || ColorTextField_1.default; }, [theme]);
|
137
|
+
const { tonal = true, color = 'default', version = 'text', size = 'regular', valueDefault, value: value_, inputProps, onChange, error: error_, name, placeholder, edit, mention, multiline, onChangeMention, optionsMention: optionsMention_, error, helperText, mentionLabel, onKeyDown: onKeyDown_, pasteText = true, readOnly, additional, miniMenuExtended, HelperTextProps, ColorTextFieldProps, className } = props, other = __rest(props, ["tonal", "color", "version", "size", "valueDefault", "value", "inputProps", "onChange", "error", "name", "placeholder", "edit", "mention", "multiline", "onChangeMention", "optionsMention", "error", "helperText", "mentionLabel", "onKeyDown", "pasteText", "readOnly", "additional", "miniMenuExtended", "HelperTextProps", "ColorTextFieldProps", "className"]);
|
128
138
|
const { classes } = useStyle();
|
129
139
|
const [value, setValue] = react_1.default.useState(valueDefault || '');
|
130
140
|
const [openMenu, setOpenMenu] = react_1.default.useState(false);
|
@@ -161,6 +171,23 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
161
171
|
linkAddInput: react_1.default.useRef(null),
|
162
172
|
linkRemove: react_1.default.useRef(null)
|
163
173
|
},
|
174
|
+
elements: {
|
175
|
+
color: react_1.default.useRef(null),
|
176
|
+
background: react_1.default.useRef(null),
|
177
|
+
linkAdd: react_1.default.useRef(null),
|
178
|
+
linkRemove: react_1.default.useRef(null),
|
179
|
+
quote: react_1.default.useRef(null),
|
180
|
+
image: react_1.default.useRef(null),
|
181
|
+
video: react_1.default.useRef(null),
|
182
|
+
videoYoutube: react_1.default.useRef(null),
|
183
|
+
table: react_1.default.useRef(null),
|
184
|
+
drawing: react_1.default.useRef(null),
|
185
|
+
drawingSvg: react_1.default.useRef(null),
|
186
|
+
drawingSize: react_1.default.useRef(null),
|
187
|
+
drawingSelect: react_1.default.useRef(null),
|
188
|
+
drawingPalette: react_1.default.useRef(null),
|
189
|
+
code: react_1.default.useRef(null)
|
190
|
+
},
|
164
191
|
textSelected: react_1.default.useRef(null),
|
165
192
|
textSelection: react_1.default.useRef(null),
|
166
193
|
rootDocument: react_1.default.useRef(null),
|
@@ -168,7 +195,8 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
168
195
|
edit: react_1.default.useRef(edit),
|
169
196
|
multiline: react_1.default.useRef(multiline),
|
170
197
|
readOnly: react_1.default.useRef(readOnly),
|
171
|
-
onChange: react_1.default.useRef(onChange)
|
198
|
+
onChange: react_1.default.useRef(onChange),
|
199
|
+
props: react_1.default.useRef(props)
|
172
200
|
};
|
173
201
|
refs.value.current = value;
|
174
202
|
refs.version.current = version;
|
@@ -183,6 +211,7 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
183
211
|
refs.multiline.current = multiline;
|
184
212
|
refs.readOnly.current = readOnly;
|
185
213
|
refs.onChange.current = onChange;
|
214
|
+
refs.props.current = props;
|
186
215
|
const rootDocument = (0, utils_1.isEnvironment)('browser') && (((_a = refs.root.current) === null || _a === void 0 ? void 0 : _a.ownerDocument) || window.document);
|
187
216
|
const rootWindow = rootDocument && (rootDocument.defaultView || window);
|
188
217
|
refs.rootDocument.current = rootDocument;
|
@@ -560,30 +589,58 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
560
589
|
case 'italic':
|
561
590
|
refs.rootDocument.current.execCommand('italic');
|
562
591
|
if (query('italic'))
|
563
|
-
setTextSelected(
|
592
|
+
setTextSelected(values => [...values, 'italic']);
|
564
593
|
else
|
565
|
-
setTextSelected(
|
594
|
+
setTextSelected(values => values.filter(item => item !== 'italic'));
|
566
595
|
break;
|
567
596
|
case 'underline':
|
568
597
|
refs.rootDocument.current.execCommand('underline');
|
569
598
|
if (query('underline'))
|
570
|
-
setTextSelected(
|
599
|
+
setTextSelected(values => [...values, 'underline']);
|
571
600
|
else
|
572
|
-
setTextSelected(
|
601
|
+
setTextSelected(values => values.filter(item => item !== 'underline'));
|
573
602
|
break;
|
574
603
|
case 'bold':
|
575
604
|
refs.rootDocument.current.execCommand('bold');
|
576
605
|
if (query('bold'))
|
577
|
-
setTextSelected(
|
606
|
+
setTextSelected(values => [...values, 'bold']);
|
578
607
|
else
|
579
|
-
setTextSelected(
|
608
|
+
setTextSelected(values => values.filter(item => item !== 'bold'));
|
580
609
|
break;
|
581
610
|
case 'strike-line':
|
582
611
|
refs.rootDocument.current.execCommand('strikeThrough');
|
583
612
|
if (query('strikeThrough'))
|
584
|
-
setTextSelected(
|
613
|
+
setTextSelected(values => [...values, 'strike-line']);
|
614
|
+
else
|
615
|
+
setTextSelected(values => values.filter(item => item !== 'strike-line'));
|
616
|
+
break;
|
617
|
+
case 'align-left':
|
618
|
+
refs.rootDocument.current.execCommand('justifyLeft');
|
619
|
+
if (query('justifyLeft'))
|
620
|
+
setTextSelected(values => [...values.filter(item => !item.includes('align')), 'align-left']);
|
621
|
+
else
|
622
|
+
setTextSelected(values => values.filter(item => item !== 'align-left'));
|
623
|
+
break;
|
624
|
+
case 'align-center':
|
625
|
+
refs.rootDocument.current.execCommand('justifyCenter');
|
626
|
+
if (query('justifyCenter'))
|
627
|
+
setTextSelected(values => [...values.filter(item => !item.includes('align')), 'align-center']);
|
585
628
|
else
|
586
|
-
setTextSelected(
|
629
|
+
setTextSelected(values => values.filter(item => item !== 'align-center'));
|
630
|
+
break;
|
631
|
+
case 'align-right':
|
632
|
+
refs.rootDocument.current.execCommand('justifyRight');
|
633
|
+
if (query('justifyRight'))
|
634
|
+
setTextSelected(values => [...values.filter(item => !item.includes('align')), 'align-right']);
|
635
|
+
else
|
636
|
+
setTextSelected(values => values.filter(item => item !== 'align-right'));
|
637
|
+
break;
|
638
|
+
case 'align-justify':
|
639
|
+
refs.rootDocument.current.execCommand('justifyFull');
|
640
|
+
if (query('justifyFull'))
|
641
|
+
setTextSelected(values => [...values.filter(item => !item.includes('align')), 'align-justify']);
|
642
|
+
else
|
643
|
+
setTextSelected(values => values.filter(item => item !== 'align-justify'));
|
587
644
|
break;
|
588
645
|
case 'superscript':
|
589
646
|
refs.rootDocument.current.execCommand('superscript');
|
@@ -599,12 +656,64 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
599
656
|
else
|
600
657
|
setTextSelected(values => values.filter(item => item !== 'subscript'));
|
601
658
|
break;
|
659
|
+
case 'indent':
|
660
|
+
refs.rootDocument.current.execCommand('indent');
|
661
|
+
break;
|
662
|
+
case 'outdent':
|
663
|
+
refs.rootDocument.current.execCommand('outdent');
|
664
|
+
break;
|
665
|
+
case 'font-version':
|
666
|
+
refs.rootDocument.current.execCommand('formatBlock', undefined, argument);
|
667
|
+
break;
|
668
|
+
case 'font-family':
|
669
|
+
refs.rootDocument.current.execCommand('styleWithCSS', true);
|
670
|
+
refs.rootDocument.current.execCommand('fontName', undefined, argument);
|
671
|
+
refs.rootDocument.current.execCommand('styleWithCSS', false);
|
672
|
+
break;
|
673
|
+
case 'font-size':
|
674
|
+
refs.rootDocument.current.execCommand('styleWithCSS', true);
|
675
|
+
refs.rootDocument.current.execCommand('fontSize', undefined, argument);
|
676
|
+
refs.rootDocument.current.execCommand('styleWithCSS', false);
|
677
|
+
break;
|
678
|
+
case 'font-color':
|
679
|
+
refs.rootDocument.current.execCommand('styleWithCSS', true);
|
680
|
+
refs.rootDocument.current.execCommand('foreColor', undefined, argument);
|
681
|
+
refs.rootDocument.current.execCommand('styleWithCSS', false);
|
682
|
+
break;
|
683
|
+
case 'font-background':
|
684
|
+
refs.rootDocument.current.execCommand('styleWithCSS', true);
|
685
|
+
refs.rootDocument.current.execCommand('backColor', undefined, argument);
|
686
|
+
refs.rootDocument.current.execCommand('styleWithCSS', false);
|
687
|
+
break;
|
688
|
+
case 'list-ordered':
|
689
|
+
refs.rootDocument.current.execCommand('insertOrderedList');
|
690
|
+
if (query('insertOrderedList'))
|
691
|
+
setTextSelected(values => [...values.filter(item => !item.includes('list')), 'list-ordered']);
|
692
|
+
else
|
693
|
+
setTextSelected(values => values.filter(item => item !== 'list-ordered'));
|
694
|
+
break;
|
695
|
+
case 'list-unordered':
|
696
|
+
refs.rootDocument.current.execCommand('insertUnorderedList');
|
697
|
+
if (query('insertUnorderedList'))
|
698
|
+
setTextSelected(values => [...values.filter(item => !item.includes('list')), 'list-unordered']);
|
699
|
+
else
|
700
|
+
setTextSelected(values => values.filter(item => item !== 'list-unordered'));
|
701
|
+
break;
|
702
|
+
case 'horizontal-rule':
|
703
|
+
refs.rootDocument.current.execCommand('insertHorizontalRule');
|
704
|
+
break;
|
602
705
|
case 'link-add':
|
603
706
|
refs.rootDocument.current.execCommand('createLink', undefined, argument);
|
604
707
|
break;
|
605
708
|
case 'link-remove':
|
606
709
|
refs.rootDocument.current.execCommand('unlink');
|
607
710
|
break;
|
711
|
+
case 'image':
|
712
|
+
refs.rootDocument.current.execCommand('insertImage', undefined, argument);
|
713
|
+
break;
|
714
|
+
case 'html':
|
715
|
+
refs.rootDocument.current.execCommand('insertHTML', undefined, argument);
|
716
|
+
break;
|
608
717
|
// actions
|
609
718
|
case 'copy':
|
610
719
|
refs.rootDocument.current.execCommand('copy');
|
@@ -648,6 +757,60 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
648
757
|
}
|
649
758
|
textQueryUpdate();
|
650
759
|
}, []);
|
760
|
+
const PaletteItem = react_1.default.useCallback((propsItem) => {
|
761
|
+
const { color: color_ } = propsItem, other_ = __rest(propsItem, ["color"]);
|
762
|
+
return ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: (0, style_react_1.classNames)([
|
763
|
+
(0, utils_2.staticClassName)('RichTextEditor', theme) && [
|
764
|
+
'onesy-RichTextEditor-palette-item'
|
765
|
+
],
|
766
|
+
classes.paletteItem
|
767
|
+
]), style: {
|
768
|
+
background: color_
|
769
|
+
} }, other_)));
|
770
|
+
}, []);
|
771
|
+
const Palette = react_1.default.useCallback(react_1.default.forwardRef((propsPalette, ref_) => {
|
772
|
+
const { version: version_, onUpdate: onUpdate_, onClose } = propsPalette, other_ = __rest(propsPalette, ["version", "onUpdate", "onClose"]);
|
773
|
+
return ((0, jsx_runtime_1.jsxs)(Line, Object.assign({ ref: ref_, gap: 1, direction: 'column', tonal: tonal, color: refs.props.current.color !== undefined ? refs.props.current.color : 'themed', Component: Surface, className: (0, style_react_1.classNames)([
|
774
|
+
(0, utils_2.staticClassName)('RichTextEditor', theme) && [
|
775
|
+
'onesy-RichTextEditor-palette'
|
776
|
+
],
|
777
|
+
classes.palette
|
778
|
+
]) }, other_, { children: [(0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0.5, onMouseUp: onMouseUp, onMouseDown: onMouseDown }, { children: [(0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0.5, direction: 'row', style: {
|
779
|
+
width: '100%'
|
780
|
+
} }, { children: [(0, jsx_runtime_1.jsx)(PaletteItem, { color: '#000000', onClick: () => {
|
781
|
+
onUpdate_('#000000');
|
782
|
+
onClose();
|
783
|
+
} }), (0, jsx_runtime_1.jsx)(PaletteItem, { color: '#ffffff', onClick: () => {
|
784
|
+
onUpdate_('#ffffff');
|
785
|
+
onClose();
|
786
|
+
} })] })), Object.keys(style_react_1.colors).filter(item => !['black', 'white'].includes(item)).map((item, index) => ((0, jsx_runtime_1.jsx)(Line, Object.assign({ gap: 0.5, direction: 'row', style: {
|
787
|
+
width: '100%'
|
788
|
+
} }, { children: Object.keys(style_react_1.colors[item]).map((item_, index_) => ((0, jsx_runtime_1.jsx)(PaletteItem, { color: style_react_1.colors[item][item_], onClick: () => {
|
789
|
+
if (refs.range.current) {
|
790
|
+
const selection_ = refs.rootWindow.current.getSelection();
|
791
|
+
selection_.removeAllRanges();
|
792
|
+
selection_.addRange(refs.range.current);
|
793
|
+
}
|
794
|
+
onUpdate_(style_react_1.colors[item][item_]);
|
795
|
+
onClose();
|
796
|
+
} }, index_))) }), index)))] })), (0, jsx_runtime_1.jsx)(Divider, {}), (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 0.5, direction: 'row', align: 'center', style: {
|
797
|
+
width: '100%'
|
798
|
+
} }, { children: [(0, jsx_runtime_1.jsx)(ColorTextField, Object.assign({ tonal: tonal, color: color, name: l('Custom color'), version: 'outlined', size: 'small', value: refs.inputValues.current[version_], onChange: valueNew => updateInputValues(version_, valueNew) }, ColorTextFieldProps, { className: (0, style_react_1.classNames)([
|
799
|
+
(0, utils_2.staticClassName)('RichTextEditor', theme) && [
|
800
|
+
'onesy-RichTextEditor-text-field-color'
|
801
|
+
],
|
802
|
+
ColorTextFieldProps === null || ColorTextFieldProps === void 0 ? void 0 : ColorTextFieldProps.className,
|
803
|
+
classes.textFieldColor
|
804
|
+
]) })), (0, jsx_runtime_1.jsx)(Button, Object.assign({ tonal: tonal, color: 'inherit', version: 'text', size: 'small', onClick: () => {
|
805
|
+
if (refs.range.current) {
|
806
|
+
const selection_ = refs.rootWindow.current.getSelection();
|
807
|
+
selection_.removeAllRanges();
|
808
|
+
selection_.addRange(refs.range.current);
|
809
|
+
}
|
810
|
+
onUpdate_(refs.inputValues.current[version_]);
|
811
|
+
onClose();
|
812
|
+
} }, { children: "Apply" }))] }))] })));
|
813
|
+
}), []);
|
651
814
|
const AppendProps = {
|
652
815
|
padding: [14, 14]
|
653
816
|
};
|
@@ -699,7 +862,7 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
699
862
|
'superscript': ((0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Superscript'), onClick: textMethod('superscript') }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({}, ToggleButtonProps, { selected: refs.textSelected.current.includes('superscript') }, { children: (0, jsx_runtime_1.jsx)(IconMaterialSuperscriptW100_1.default, Object.assign({}, IconProps)) })) }))),
|
700
863
|
'subscript': ((0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Subscript'), onClick: textMethod('subscript') }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({}, ToggleButtonProps, { selected: refs.textSelected.current.includes('subscript') }, { children: (0, jsx_runtime_1.jsx)(IconMaterialSubscriptW100_1.default, Object.assign({}, IconProps)) })) }))),
|
701
864
|
'strike-line': ((0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Strike Line'), onClick: textMethod('strike-line') }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({}, ToggleButtonProps, { selected: refs.textSelected.current.includes('strike-line') }, { children: (0, jsx_runtime_1.jsx)(IconMaterialStrikethroughSW100_1.default, Object.assign({}, IconProps)) })) }))),
|
702
|
-
'link-add': ((0, jsx_runtime_1.jsx)(WrapperAppend, Object.assign({ open: refs.open.current.linkMiniMenu, anchorElement: refs.miniMenuElements.linkAdd, element: ((0, jsx_runtime_1.jsx)(ClickListener, Object.assign({ onClickOutside: () => updateOpen('linkMiniMenu', false), include: [refs.miniMenuElements.linkAdd] }, { children: (0, jsx_runtime_1.jsx)(Input, { ref: refs.miniMenuElements.linkAddInput, name: l('Link'), labelButton: l('Add'), value: refs.inputValues.current.link, onChange: (valueNew) => updateInputValues('link', valueNew), onClick: () => {
|
865
|
+
'link-add': ((0, jsx_runtime_1.jsx)(WrapperAppend, Object.assign({ open: refs.open.current.linkMiniMenu, anchorElement: refs.miniMenuElements.linkAdd, element: ((0, jsx_runtime_1.jsx)(ClickListener, Object.assign({ onClickOutside: () => updateOpen('linkMiniMenu', false), include: [refs.miniMenuElements.linkAdd] }, { children: (0, jsx_runtime_1.jsx)(Input, { ref: refs.miniMenuElements.linkAddInput, name: l('Link'), labelButton: l('Add'), value: refs.inputValues.current.link, onChange: (valueNew) => updateInputValues('link', valueNew), placeholder: l('URL'), onClick: () => {
|
703
866
|
if (refs.range.current) {
|
704
867
|
const selection_ = refs.rootWindow.current.getSelection();
|
705
868
|
if (!selection_)
|
@@ -711,7 +874,15 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
711
874
|
updateOpen('linkMiniMenu', false);
|
712
875
|
updateInputValues('link', '');
|
713
876
|
}, className: classes.inputLink }) }))) }, { children: (0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Insert Link'), open: refs.open.current.linkMiniMenu ? false : undefined }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({ ref: refs.miniMenuElements.linkAdd }, ToggleButtonProps, { selected: refs.open.current.linkMiniMenu, onClick: () => updateOpen('linkMiniMenu', !refs.open.current.linkMiniMenu) }, { children: (0, jsx_runtime_1.jsx)(IconMaterialAddLinkW100_1.default, Object.assign({}, IconProps)) })) })) }))),
|
714
|
-
'link-remove': ((0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Remove Link') }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({}, ToggleButtonProps, { onClick: textMethod('link-remove') }, { children: (0, jsx_runtime_1.jsx)(IconMaterialLinkOffW100_1.default, Object.assign({}, IconProps)) })) })))
|
877
|
+
'link-remove': ((0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Remove Link') }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({}, ToggleButtonProps, { onClick: textMethod('link-remove') }, { children: (0, jsx_runtime_1.jsx)(IconMaterialLinkOffW100_1.default, Object.assign({}, IconProps)) })) }))),
|
878
|
+
'font-color': ((0, jsx_runtime_1.jsx)(WrapperAppend, Object.assign({ open: refs.open.current.color, anchorElement: refs.elements.color.current, element: ((0, jsx_runtime_1.jsx)(ClickListener, Object.assign({ onClickOutside: () => updateOpen('color', false), include: [refs.elements.color.current] }, { children: (0, jsx_runtime_1.jsx)(Palette, { version: 'font-color', onClose: () => updateOpen('color', false), onUpdate: textMethod('font-color') }) }))) }, { children: (0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Text Color'), open: refs.open.current.color ? false : undefined }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({ ref: refs.elements.color }, ToggleButtonProps, { selected: refs.open.current.color, onClick: () => updateOpen('color', !refs.open.current.color) }, { children: (0, jsx_runtime_1.jsx)(IconMaterialFormatColorTextW100_1.default, Object.assign({}, IconProps)) })) })) }))),
|
879
|
+
'font-color-mini-menu': ((0, jsx_runtime_1.jsx)(WrapperAppend, Object.assign({ open: refs.open.current.colorMiniMenu, anchorElement: refs.miniMenuElements.color, element: ((0, jsx_runtime_1.jsx)(ClickListener, Object.assign({ onClickOutside: () => updateOpen('colorMiniMenu', false), include: [refs.miniMenuElements.color] }, { children: (0, jsx_runtime_1.jsx)(Palette, { ref: refs.miniMenuElements.colorPalette, version: 'font-color', onClose: () => updateOpen('colorMiniMenu', false), onUpdate: textMethod('font-color') }) }))) }, { children: (0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Text Color'), open: refs.open.current.colorMiniMenu ? false : undefined }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({ ref: refs.miniMenuElements.color }, ToggleButtonProps, { selected: refs.open.current.colorMiniMenu, onClick: () => updateOpen('colorMiniMenu', !refs.open.current.colorMiniMenu) }, { children: (0, jsx_runtime_1.jsx)(IconMaterialFormatColorTextW100_1.default, Object.assign({}, IconProps)) })) })) }))),
|
880
|
+
'font-background': ((0, jsx_runtime_1.jsx)(WrapperAppend, Object.assign({ open: refs.open.current.background, anchorElement: refs.elements.background.current, element: ((0, jsx_runtime_1.jsx)(ClickListener, Object.assign({ onClickOutside: () => updateOpen('background', false), include: [refs.elements.background.current] }, { children: (0, jsx_runtime_1.jsx)(Palette, { version: 'font-background', onClose: () => updateOpen('background', false), onUpdate: textMethod('font-background') }) }))) }, { children: (0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Background Color'), open: refs.open.current.background ? false : undefined }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({ ref: refs.elements.background }, ToggleButtonProps, { selected: refs.open.current.background, onClick: () => updateOpen('background', !refs.open.current.background) }, { children: (0, jsx_runtime_1.jsx)(IconMaterialFormatColorFillW100_1.default, Object.assign({}, IconProps)) })) })) }))),
|
881
|
+
'font-background-mini-menu': ((0, jsx_runtime_1.jsx)(WrapperAppend, Object.assign({ open: refs.open.current.backgroundMiniMenu, anchorElement: refs.miniMenuElements.background, element: ((0, jsx_runtime_1.jsx)(ClickListener, Object.assign({ onClickOutside: () => updateOpen('backgroundMiniMenu', false), include: [refs.miniMenuElements.background] }, { children: (0, jsx_runtime_1.jsx)(Palette, { ref: refs.miniMenuElements.backgroundPalette, version: 'font-background', onClose: () => updateOpen('backgroundMiniMenu', false), onUpdate: textMethod('font-background') }) }))) }, { children: (0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Text Color'), open: refs.open.current.backgroundMiniMenu ? false : undefined }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({ ref: refs.miniMenuElements.background }, ToggleButtonProps, { selected: refs.open.current.backgroundMiniMenu, onClick: () => updateOpen('backgroundMiniMenu', !refs.open.current.backgroundMiniMenu) }, { children: (0, jsx_runtime_1.jsx)(IconMaterialFormatColorFillW100_1.default, Object.assign({}, IconProps)) })) })) }))),
|
882
|
+
'align-left': ((0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Align Left') }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({}, ToggleButtonProps, { selected: refs.textSelected.current.includes('align-left'), onClick: textMethod('align-left') }, { children: (0, jsx_runtime_1.jsx)(IconMaterialFormatAlignLeftW100_1.default, Object.assign({}, IconProps)) })) }))),
|
883
|
+
'align-center': ((0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Align Center') }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({}, ToggleButtonProps, { selected: refs.textSelected.current.includes('align-center'), onClick: textMethod('align-center') }, { children: (0, jsx_runtime_1.jsx)(IconMaterialFormatAlignCenterW100_1.default, Object.assign({}, IconProps)) })) }))),
|
884
|
+
'align-right': ((0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Align Right') }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({}, ToggleButtonProps, { selected: refs.textSelected.current.includes('align-right'), onClick: textMethod('align-right') }, { children: (0, jsx_runtime_1.jsx)(IconMaterialFormatAlignRightW100_1.default, Object.assign({}, IconProps)) })) }))),
|
885
|
+
'align-justify': ((0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Align Justify') }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({}, ToggleButtonProps, { selected: refs.textSelected.current.includes('align-justify'), onClick: textMethod('align-justify') }, { children: (0, jsx_runtime_1.jsx)(IconMaterialFormatAlignJustifyW100_1.default, Object.assign({}, IconProps)) })) })))
|
715
886
|
};
|
716
887
|
const actionElements = {
|
717
888
|
'clear': ((0, jsx_runtime_1.jsx)(WrapperToggleButton, Object.assign({ name: l('Clear') }, { children: (0, jsx_runtime_1.jsx)(ToggleButton, Object.assign({}, ToggleButtonProps, { onClick: textMethod('clear') }, { children: (0, jsx_runtime_1.jsx)(IconMaterialFormatClearW100_1.default, Object.assign({}, IconProps)) })) })))
|
@@ -738,7 +909,7 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
738
909
|
setTextSelection(null);
|
739
910
|
}, include: [refs.miniMenu, refs.miniMenu.current, refs.miniMenuElements.linkAddInput, refs.miniMenuElements.linkAddInput.current] }, { children: (0, jsx_runtime_1.jsxs)(Line, Object.assign({ gap: 2, direction: 'row', align: 'center', justify: 'flex-start', role: 'toolbar', color: 'themed', "aria-label": l('Mini menu'), Component: Surface, className: (0, style_react_1.classNames)([
|
740
911
|
classes.textMiniMenu
|
741
|
-
]) }, { children: [(0, jsx_runtime_1.jsxs)(ToggleButtons, Object.assign({}, ToggleButtonsProps, { children: [updateElements['italic'], updateElements['underline'], updateElements['bold'], updateElements['strike-line']] })), (0, jsx_runtime_1.jsxs)(ToggleButtons, Object.assign({}, ToggleButtonsProps, { children: [updateElements['superscript'], updateElements['subscript']] })), (0, jsx_runtime_1.jsxs)(ToggleButtons, Object.assign({}, ToggleButtonsProps, { children: [updateElements['link-add'], updateElements['link-remove']] })), (0, jsx_runtime_1.jsx)(ToggleButtons, Object.assign({}, ToggleButtonsProps, { children: actionElements['clear'] }))] })) })) })) })));
|
912
|
+
]) }, { children: [(0, jsx_runtime_1.jsxs)(ToggleButtons, Object.assign({}, ToggleButtonsProps, { children: [updateElements['italic'], updateElements['underline'], updateElements['bold'], updateElements['strike-line']] })), miniMenuExtended && ((0, jsx_runtime_1.jsxs)(ToggleButtons, Object.assign({}, ToggleButtonsProps, { children: [updateElements['font-color-mini-menu'], updateElements['font-background-mini-menu']] }))), miniMenuExtended && ((0, jsx_runtime_1.jsxs)(ToggleButtons, Object.assign({}, ToggleButtonsProps, { children: [updateElements['align-left'], updateElements['align-center'], updateElements['align-right'], updateElements['align-justify']] }))), miniMenuExtended && ((0, jsx_runtime_1.jsxs)(ToggleButtons, Object.assign({}, ToggleButtonsProps, { children: [updateElements['list-ordered'], updateElements['list-unordered']] }))), (0, jsx_runtime_1.jsxs)(ToggleButtons, Object.assign({}, ToggleButtonsProps, { children: [updateElements['superscript'], updateElements['subscript']] })), (0, jsx_runtime_1.jsxs)(ToggleButtons, Object.assign({}, ToggleButtonsProps, { children: [updateElements['link-add'], updateElements['link-remove']] })), (0, jsx_runtime_1.jsx)(ToggleButtons, Object.assign({}, ToggleButtonsProps, { children: actionElements['clear'] }))] })) })) })) })));
|
742
913
|
}, parent: refs.root.current, anchor: textSelection === null || textSelection === void 0 ? void 0 : textSelection.selection, portal: true, alignment: 'center', position: 'bottom', clearOnClose: true }, AppendProps)));
|
743
914
|
}, [open, textSelection, textSelected]);
|
744
915
|
const menu = react_1.default.useMemo(() => {
|
@@ -752,7 +923,7 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
752
923
|
ref.current = item;
|
753
924
|
}
|
754
925
|
refs.root.current = item;
|
755
|
-
}, version: 'text', size: size, minRows: 12, multiline: true, enabled: true, fullWidth: true, onInput: onInput, onKeyDown: onKeyDown, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, readOnly: readOnly, inputProps: Object.assign(Object.assign({ version: 'b2', contentEditable: true, spellCheck: false, onPaste: pasteText ? onPasteText : onPaste, onDrop,
|
926
|
+
}, color: color, tonal: tonal, version: 'text', size: size, minRows: 12, multiline: true, enabled: true, fullWidth: true, onInput: onInput, onKeyDown: onKeyDown, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, readOnly: readOnly, inputProps: Object.assign(Object.assign({ version: 'b2', contentEditable: true, spellCheck: false, onPaste: pasteText ? onPasteText : onPaste, onDrop,
|
756
927
|
onMouseUp,
|
757
928
|
onMouseDown, 'data-placeholder': placeholder !== undefined ? placeholder : name }, inputProps), { ref: (item) => {
|
758
929
|
refs.input.current = item;
|
@@ -787,7 +958,7 @@ const SmartTextField = react_1.default.forwardRef((props_, ref) => {
|
|
787
958
|
}
|
788
959
|
refs.root.current = item;
|
789
960
|
refs.input.current = item;
|
790
|
-
}, onInput: onInput, onKeyDown: onKeyDown, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, onPaste: pasteText ? onPasteText : onPaste, onDrop: onDrop, onMouseUp: onMouseUp, onMouseDown: onMouseDown, spellCheck: false, "data-placeholder": placeholder !== undefined ? placeholder : name }, inputProps, { contentEditable: !readOnly, className: (0, style_react_1.classNames)([
|
961
|
+
}, color: color, tonal: tonal, onInput: onInput, onKeyDown: onKeyDown, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, onPaste: pasteText ? onPasteText : onPaste, onDrop: onDrop, onMouseUp: onMouseUp, onMouseDown: onMouseDown, spellCheck: false, "data-placeholder": placeholder !== undefined ? placeholder : name }, inputProps, { contentEditable: !readOnly, className: (0, style_react_1.classNames)([
|
791
962
|
(0, utils_2.staticClassName)('SmartTextField', theme) && [
|
792
963
|
'onesy-SmartTextField-root',
|
793
964
|
`onesy-SmartTextField-version-${version}`,
|
@@ -1,15 +1,23 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
4
|
-
const _excluded = ["version", "size", "valueDefault", "value", "inputProps", "onChange", "error", "name", "placeholder", "edit", "mention", "multiline", "onChangeMention", "optionsMention", "error", "helperText", "mentionLabel", "onKeyDown", "pasteText", "readOnly", "additional", "HelperTextProps", "className"],
|
5
|
-
_excluded2 = ["
|
6
|
-
_excluded3 = ["
|
7
|
-
_excluded4 = ["
|
4
|
+
const _excluded = ["tonal", "color", "version", "size", "valueDefault", "value", "inputProps", "onChange", "error", "name", "placeholder", "edit", "mention", "multiline", "onChangeMention", "optionsMention", "error", "helperText", "mentionLabel", "onKeyDown", "pasteText", "readOnly", "additional", "miniMenuExtended", "HelperTextProps", "ColorTextFieldProps", "className"],
|
5
|
+
_excluded2 = ["color"],
|
6
|
+
_excluded3 = ["version", "onUpdate", "onClose"],
|
7
|
+
_excluded4 = ["label", "labelButton", "value", "onChange", "onClick", "InputComponent", "InputProps"],
|
8
|
+
_excluded5 = ["open", "element", "anchorElement", "onClose", "children"],
|
9
|
+
_excluded6 = ["open", "name", "children"];
|
8
10
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
9
11
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
10
12
|
import React from 'react';
|
11
13
|
import { hash, innerHTMLToText, is, isEnvironment, parse, stringToColor, textToInnerHTML } from '@onesy/utils';
|
12
|
-
import { classNames, style as styleMethod, useOnesyTheme } from '@onesy/style-react';
|
14
|
+
import { classNames, colors, style as styleMethod, useOnesyTheme } from '@onesy/style-react';
|
15
|
+
import IconMaterialFormatAlignLeft from '@onesy/icons-material-rounded-react/IconMaterialFormatAlignLeftW100';
|
16
|
+
import IconMaterialFormatAlignCenter from '@onesy/icons-material-rounded-react/IconMaterialFormatAlignCenterW100';
|
17
|
+
import IconMaterialFormatAlignRight from '@onesy/icons-material-rounded-react/IconMaterialFormatAlignRightW100';
|
18
|
+
import IconMaterialFormatAlignJustify from '@onesy/icons-material-rounded-react/IconMaterialFormatAlignJustifyW100';
|
19
|
+
import IconMaterialFormatColorText from '@onesy/icons-material-rounded-react/IconMaterialFormatColorTextW100';
|
20
|
+
import IconMaterialFormatColorFill from '@onesy/icons-material-rounded-react/IconMaterialFormatColorFillW100';
|
13
21
|
import IconMaterialSuperscript from '@onesy/icons-material-rounded-react/IconMaterialSuperscriptW100';
|
14
22
|
import IconMaterialSubscript from '@onesy/icons-material-rounded-react/IconMaterialSubscriptW100';
|
15
23
|
import IconMaterialFormatItalic from '@onesy/icons-material-rounded-react/IconMaterialFormatItalicW100';
|
@@ -19,6 +27,7 @@ import IconMaterialFormatBold from '@onesy/icons-material-rounded-react/IconMate
|
|
19
27
|
import IconMaterialAddLink from '@onesy/icons-material-rounded-react/IconMaterialAddLinkW100';
|
20
28
|
import IconMaterialLinkOff from '@onesy/icons-material-rounded-react/IconMaterialLinkOffW100';
|
21
29
|
import IconMaterialFormatClear from '@onesy/icons-material-rounded-react/IconMaterialFormatClearW100';
|
30
|
+
import ColorTextFieldElement from '../ColorTextField';
|
22
31
|
import TextFieldElement from '../TextField/TextField';
|
23
32
|
import LineElement from '../Line';
|
24
33
|
import ListElement from '../List';
|
@@ -34,6 +43,7 @@ import ToggleButtonElement from '../ToggleButton';
|
|
34
43
|
import ClickListenerElement from '../ClickListener';
|
35
44
|
import ToggleButtonsElement from '../ToggleButtons';
|
36
45
|
import MenuElement from '../Menu';
|
46
|
+
import DividerElement from '../Divider';
|
37
47
|
import { sanitize, caret, keyboardStyleCommands, staticClassName } from '../utils';
|
38
48
|
const useStyle = styleMethod(theme => ({
|
39
49
|
root: {
|
@@ -123,7 +133,11 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
123
133
|
const ClickListener = React.useMemo(() => theme?.elements?.ClickListener || ClickListenerElement, [theme]);
|
124
134
|
const ToggleButtons = React.useMemo(() => theme?.elements?.ToggleButtons || ToggleButtonsElement, [theme]);
|
125
135
|
const Menu = React.useMemo(() => theme?.elements?.Menu || MenuElement, [theme]);
|
136
|
+
const Divider = React.useMemo(() => theme?.elements?.Divider || DividerElement, [theme]);
|
137
|
+
const ColorTextField = React.useMemo(() => theme?.elements?.ColorTextField || ColorTextFieldElement, [theme]);
|
126
138
|
const {
|
139
|
+
tonal = true,
|
140
|
+
color = 'default',
|
127
141
|
version = 'text',
|
128
142
|
size = 'regular',
|
129
143
|
valueDefault,
|
@@ -145,7 +159,9 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
145
159
|
pasteText = true,
|
146
160
|
readOnly,
|
147
161
|
additional,
|
162
|
+
miniMenuExtended,
|
148
163
|
HelperTextProps,
|
164
|
+
ColorTextFieldProps,
|
149
165
|
className
|
150
166
|
} = props,
|
151
167
|
other = _objectWithoutProperties(props, _excluded);
|
@@ -187,6 +203,23 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
187
203
|
linkAddInput: React.useRef(null),
|
188
204
|
linkRemove: React.useRef(null)
|
189
205
|
},
|
206
|
+
elements: {
|
207
|
+
color: React.useRef(null),
|
208
|
+
background: React.useRef(null),
|
209
|
+
linkAdd: React.useRef(null),
|
210
|
+
linkRemove: React.useRef(null),
|
211
|
+
quote: React.useRef(null),
|
212
|
+
image: React.useRef(null),
|
213
|
+
video: React.useRef(null),
|
214
|
+
videoYoutube: React.useRef(null),
|
215
|
+
table: React.useRef(null),
|
216
|
+
drawing: React.useRef(null),
|
217
|
+
drawingSvg: React.useRef(null),
|
218
|
+
drawingSize: React.useRef(null),
|
219
|
+
drawingSelect: React.useRef(null),
|
220
|
+
drawingPalette: React.useRef(null),
|
221
|
+
code: React.useRef(null)
|
222
|
+
},
|
190
223
|
textSelected: React.useRef(null),
|
191
224
|
textSelection: React.useRef(null),
|
192
225
|
rootDocument: React.useRef(null),
|
@@ -194,7 +227,8 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
194
227
|
edit: React.useRef(edit),
|
195
228
|
multiline: React.useRef(multiline),
|
196
229
|
readOnly: React.useRef(readOnly),
|
197
|
-
onChange: React.useRef(onChange)
|
230
|
+
onChange: React.useRef(onChange),
|
231
|
+
props: React.useRef(props)
|
198
232
|
};
|
199
233
|
refs.value.current = value;
|
200
234
|
refs.version.current = version;
|
@@ -209,6 +243,7 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
209
243
|
refs.multiline.current = multiline;
|
210
244
|
refs.readOnly.current = readOnly;
|
211
245
|
refs.onChange.current = onChange;
|
246
|
+
refs.props.current = props;
|
212
247
|
const rootDocument = isEnvironment('browser') && (refs.root.current?.ownerDocument || window.document);
|
213
248
|
const rootWindow = rootDocument && (rootDocument.defaultView || window);
|
214
249
|
refs.rootDocument.current = rootDocument;
|
@@ -608,6 +643,22 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
608
643
|
refs.rootDocument.current.execCommand('strikeThrough');
|
609
644
|
if (query('strikeThrough')) setTextSelected(values => [...values, 'strike-line']);else setTextSelected(values => values.filter(item => item !== 'strike-line'));
|
610
645
|
break;
|
646
|
+
case 'align-left':
|
647
|
+
refs.rootDocument.current.execCommand('justifyLeft');
|
648
|
+
if (query('justifyLeft')) setTextSelected(values => [...values.filter(item => !item.includes('align')), 'align-left']);else setTextSelected(values => values.filter(item => item !== 'align-left'));
|
649
|
+
break;
|
650
|
+
case 'align-center':
|
651
|
+
refs.rootDocument.current.execCommand('justifyCenter');
|
652
|
+
if (query('justifyCenter')) setTextSelected(values => [...values.filter(item => !item.includes('align')), 'align-center']);else setTextSelected(values => values.filter(item => item !== 'align-center'));
|
653
|
+
break;
|
654
|
+
case 'align-right':
|
655
|
+
refs.rootDocument.current.execCommand('justifyRight');
|
656
|
+
if (query('justifyRight')) setTextSelected(values => [...values.filter(item => !item.includes('align')), 'align-right']);else setTextSelected(values => values.filter(item => item !== 'align-right'));
|
657
|
+
break;
|
658
|
+
case 'align-justify':
|
659
|
+
refs.rootDocument.current.execCommand('justifyFull');
|
660
|
+
if (query('justifyFull')) setTextSelected(values => [...values.filter(item => !item.includes('align')), 'align-justify']);else setTextSelected(values => values.filter(item => item !== 'align-justify'));
|
661
|
+
break;
|
611
662
|
case 'superscript':
|
612
663
|
refs.rootDocument.current.execCommand('superscript');
|
613
664
|
if (query('superscript')) setTextSelected(values => [...values, 'superscript']);else setTextSelected(values => values.filter(item => item !== 'superscript'));
|
@@ -616,12 +667,58 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
616
667
|
refs.rootDocument.current.execCommand('subscript');
|
617
668
|
if (query('subscript')) setTextSelected(values => [...values, 'subscript']);else setTextSelected(values => values.filter(item => item !== 'subscript'));
|
618
669
|
break;
|
670
|
+
case 'indent':
|
671
|
+
refs.rootDocument.current.execCommand('indent');
|
672
|
+
break;
|
673
|
+
case 'outdent':
|
674
|
+
refs.rootDocument.current.execCommand('outdent');
|
675
|
+
break;
|
676
|
+
case 'font-version':
|
677
|
+
refs.rootDocument.current.execCommand('formatBlock', undefined, argument);
|
678
|
+
break;
|
679
|
+
case 'font-family':
|
680
|
+
refs.rootDocument.current.execCommand('styleWithCSS', true);
|
681
|
+
refs.rootDocument.current.execCommand('fontName', undefined, argument);
|
682
|
+
refs.rootDocument.current.execCommand('styleWithCSS', false);
|
683
|
+
break;
|
684
|
+
case 'font-size':
|
685
|
+
refs.rootDocument.current.execCommand('styleWithCSS', true);
|
686
|
+
refs.rootDocument.current.execCommand('fontSize', undefined, argument);
|
687
|
+
refs.rootDocument.current.execCommand('styleWithCSS', false);
|
688
|
+
break;
|
689
|
+
case 'font-color':
|
690
|
+
refs.rootDocument.current.execCommand('styleWithCSS', true);
|
691
|
+
refs.rootDocument.current.execCommand('foreColor', undefined, argument);
|
692
|
+
refs.rootDocument.current.execCommand('styleWithCSS', false);
|
693
|
+
break;
|
694
|
+
case 'font-background':
|
695
|
+
refs.rootDocument.current.execCommand('styleWithCSS', true);
|
696
|
+
refs.rootDocument.current.execCommand('backColor', undefined, argument);
|
697
|
+
refs.rootDocument.current.execCommand('styleWithCSS', false);
|
698
|
+
break;
|
699
|
+
case 'list-ordered':
|
700
|
+
refs.rootDocument.current.execCommand('insertOrderedList');
|
701
|
+
if (query('insertOrderedList')) setTextSelected(values => [...values.filter(item => !item.includes('list')), 'list-ordered']);else setTextSelected(values => values.filter(item => item !== 'list-ordered'));
|
702
|
+
break;
|
703
|
+
case 'list-unordered':
|
704
|
+
refs.rootDocument.current.execCommand('insertUnorderedList');
|
705
|
+
if (query('insertUnorderedList')) setTextSelected(values => [...values.filter(item => !item.includes('list')), 'list-unordered']);else setTextSelected(values => values.filter(item => item !== 'list-unordered'));
|
706
|
+
break;
|
707
|
+
case 'horizontal-rule':
|
708
|
+
refs.rootDocument.current.execCommand('insertHorizontalRule');
|
709
|
+
break;
|
619
710
|
case 'link-add':
|
620
711
|
refs.rootDocument.current.execCommand('createLink', undefined, argument);
|
621
712
|
break;
|
622
713
|
case 'link-remove':
|
623
714
|
refs.rootDocument.current.execCommand('unlink');
|
624
715
|
break;
|
716
|
+
case 'image':
|
717
|
+
refs.rootDocument.current.execCommand('insertImage', undefined, argument);
|
718
|
+
break;
|
719
|
+
case 'html':
|
720
|
+
refs.rootDocument.current.execCommand('insertHTML', undefined, argument);
|
721
|
+
break;
|
625
722
|
|
626
723
|
// actions
|
627
724
|
case 'copy':
|
@@ -662,6 +759,107 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
662
759
|
}
|
663
760
|
textQueryUpdate();
|
664
761
|
}, []);
|
762
|
+
const PaletteItem = React.useCallback(propsItem => {
|
763
|
+
const {
|
764
|
+
color: color_
|
765
|
+
} = propsItem,
|
766
|
+
other_ = _objectWithoutProperties(propsItem, _excluded2);
|
767
|
+
return /*#__PURE__*/React.createElement("span", _extends({
|
768
|
+
className: classNames([staticClassName('RichTextEditor', theme) && ['onesy-RichTextEditor-palette-item'], classes.paletteItem]),
|
769
|
+
style: {
|
770
|
+
background: color_
|
771
|
+
}
|
772
|
+
}, other_));
|
773
|
+
}, []);
|
774
|
+
const Palette = React.useCallback(/*#__PURE__*/React.forwardRef((propsPalette, ref_) => {
|
775
|
+
const {
|
776
|
+
version: version_,
|
777
|
+
onUpdate: onUpdate_,
|
778
|
+
onClose
|
779
|
+
} = propsPalette,
|
780
|
+
other_ = _objectWithoutProperties(propsPalette, _excluded3);
|
781
|
+
return /*#__PURE__*/React.createElement(Line, _extends({
|
782
|
+
ref: ref_,
|
783
|
+
gap: 1,
|
784
|
+
direction: "column",
|
785
|
+
tonal: tonal,
|
786
|
+
color: refs.props.current.color !== undefined ? refs.props.current.color : 'themed',
|
787
|
+
Component: Surface,
|
788
|
+
className: classNames([staticClassName('RichTextEditor', theme) && ['onesy-RichTextEditor-palette'], classes.palette])
|
789
|
+
}, other_), /*#__PURE__*/React.createElement(Line, {
|
790
|
+
gap: 0.5,
|
791
|
+
onMouseUp: onMouseUp,
|
792
|
+
onMouseDown: onMouseDown
|
793
|
+
}, /*#__PURE__*/React.createElement(Line, {
|
794
|
+
gap: 0.5,
|
795
|
+
direction: "row",
|
796
|
+
style: {
|
797
|
+
width: '100%'
|
798
|
+
}
|
799
|
+
}, /*#__PURE__*/React.createElement(PaletteItem, {
|
800
|
+
color: "#000000",
|
801
|
+
onClick: () => {
|
802
|
+
onUpdate_('#000000');
|
803
|
+
onClose();
|
804
|
+
}
|
805
|
+
}), /*#__PURE__*/React.createElement(PaletteItem, {
|
806
|
+
color: "#ffffff",
|
807
|
+
onClick: () => {
|
808
|
+
onUpdate_('#ffffff');
|
809
|
+
onClose();
|
810
|
+
}
|
811
|
+
})), Object.keys(colors).filter(item => !['black', 'white'].includes(item)).map((item, index) => /*#__PURE__*/React.createElement(Line, {
|
812
|
+
key: index,
|
813
|
+
gap: 0.5,
|
814
|
+
direction: "row",
|
815
|
+
style: {
|
816
|
+
width: '100%'
|
817
|
+
}
|
818
|
+
}, Object.keys(colors[item]).map((item_, index_) => /*#__PURE__*/React.createElement(PaletteItem, {
|
819
|
+
key: index_,
|
820
|
+
color: colors[item][item_],
|
821
|
+
onClick: () => {
|
822
|
+
if (refs.range.current) {
|
823
|
+
const selection_ = refs.rootWindow.current.getSelection();
|
824
|
+
selection_.removeAllRanges();
|
825
|
+
selection_.addRange(refs.range.current);
|
826
|
+
}
|
827
|
+
onUpdate_(colors[item][item_]);
|
828
|
+
onClose();
|
829
|
+
}
|
830
|
+
}))))), /*#__PURE__*/React.createElement(Divider, null), /*#__PURE__*/React.createElement(Line, {
|
831
|
+
gap: 0.5,
|
832
|
+
direction: "row",
|
833
|
+
align: "center",
|
834
|
+
style: {
|
835
|
+
width: '100%'
|
836
|
+
}
|
837
|
+
}, /*#__PURE__*/React.createElement(ColorTextField, _extends({
|
838
|
+
tonal: tonal,
|
839
|
+
color: color,
|
840
|
+
name: l('Custom color'),
|
841
|
+
version: "outlined",
|
842
|
+
size: "small",
|
843
|
+
value: refs.inputValues.current[version_],
|
844
|
+
onChange: valueNew => updateInputValues(version_, valueNew)
|
845
|
+
}, ColorTextFieldProps, {
|
846
|
+
className: classNames([staticClassName('RichTextEditor', theme) && ['onesy-RichTextEditor-text-field-color'], ColorTextFieldProps?.className, classes.textFieldColor])
|
847
|
+
})), /*#__PURE__*/React.createElement(Button, {
|
848
|
+
tonal: tonal,
|
849
|
+
color: "inherit",
|
850
|
+
version: "text",
|
851
|
+
size: "small",
|
852
|
+
onClick: () => {
|
853
|
+
if (refs.range.current) {
|
854
|
+
const selection_ = refs.rootWindow.current.getSelection();
|
855
|
+
selection_.removeAllRanges();
|
856
|
+
selection_.addRange(refs.range.current);
|
857
|
+
}
|
858
|
+
onUpdate_(refs.inputValues.current[version_]);
|
859
|
+
onClose();
|
860
|
+
}
|
861
|
+
}, "Apply")));
|
862
|
+
}), []);
|
665
863
|
const AppendProps = {
|
666
864
|
padding: [14, 14]
|
667
865
|
};
|
@@ -691,7 +889,7 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
691
889
|
InputComponent = TextField,
|
692
890
|
InputProps
|
693
891
|
} = propsInput,
|
694
|
-
other_ = _objectWithoutProperties(propsInput,
|
892
|
+
other_ = _objectWithoutProperties(propsInput, _excluded4);
|
695
893
|
return /*#__PURE__*/React.createElement(Line, _extends({
|
696
894
|
ref: ref_,
|
697
895
|
gap: 1,
|
@@ -733,7 +931,7 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
733
931
|
onClose,
|
734
932
|
children: childrenWrapperAppend
|
735
933
|
} = propsWrapper,
|
736
|
-
other_ = _objectWithoutProperties(propsWrapper,
|
934
|
+
other_ = _objectWithoutProperties(propsWrapper, _excluded5);
|
737
935
|
return /*#__PURE__*/React.createElement(Append, _extends({
|
738
936
|
open: open_,
|
739
937
|
element: /*#__PURE__*/React.createElement("div", {
|
@@ -754,7 +952,7 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
754
952
|
name: nameWrapperToogleButton,
|
755
953
|
children: childrenWrapperToggleButton
|
756
954
|
} = propsWrapperToggleButton,
|
757
|
-
other_ = _objectWithoutProperties(propsWrapperToggleButton,
|
955
|
+
other_ = _objectWithoutProperties(propsWrapperToggleButton, _excluded6);
|
758
956
|
return /*#__PURE__*/React.createElement(Tooltip, _extends({
|
759
957
|
open: open_ !== undefined ? open_ : undefined,
|
760
958
|
name: nameWrapperToogleButton
|
@@ -809,6 +1007,7 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
809
1007
|
labelButton: l('Add'),
|
810
1008
|
value: refs.inputValues.current.link,
|
811
1009
|
onChange: valueNew => updateInputValues('link', valueNew),
|
1010
|
+
placeholder: l('URL'),
|
812
1011
|
onClick: () => {
|
813
1012
|
if (refs.range.current) {
|
814
1013
|
const selection_ = refs.rootWindow.current.getSelection();
|
@@ -835,7 +1034,113 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
835
1034
|
name: l('Remove Link')
|
836
1035
|
}, /*#__PURE__*/React.createElement(ToggleButton, _extends({}, ToggleButtonProps, {
|
837
1036
|
onClick: textMethod('link-remove')
|
838
|
-
}), /*#__PURE__*/React.createElement(IconMaterialLinkOff, IconProps)))
|
1037
|
+
}), /*#__PURE__*/React.createElement(IconMaterialLinkOff, IconProps))),
|
1038
|
+
'font-color': /*#__PURE__*/React.createElement(WrapperAppend, {
|
1039
|
+
open: refs.open.current.color,
|
1040
|
+
anchorElement: refs.elements.color.current,
|
1041
|
+
element: /*#__PURE__*/React.createElement(ClickListener, {
|
1042
|
+
onClickOutside: () => updateOpen('color', false),
|
1043
|
+
include: [refs.elements.color.current]
|
1044
|
+
}, /*#__PURE__*/React.createElement(Palette, {
|
1045
|
+
version: "font-color",
|
1046
|
+
onClose: () => updateOpen('color', false),
|
1047
|
+
onUpdate: textMethod('font-color')
|
1048
|
+
}))
|
1049
|
+
}, /*#__PURE__*/React.createElement(WrapperToggleButton, {
|
1050
|
+
name: l('Text Color'),
|
1051
|
+
open: refs.open.current.color ? false : undefined
|
1052
|
+
}, /*#__PURE__*/React.createElement(ToggleButton, _extends({
|
1053
|
+
ref: refs.elements.color
|
1054
|
+
}, ToggleButtonProps, {
|
1055
|
+
selected: refs.open.current.color,
|
1056
|
+
onClick: () => updateOpen('color', !refs.open.current.color)
|
1057
|
+
}), /*#__PURE__*/React.createElement(IconMaterialFormatColorText, IconProps)))),
|
1058
|
+
'font-color-mini-menu': /*#__PURE__*/React.createElement(WrapperAppend, {
|
1059
|
+
open: refs.open.current.colorMiniMenu,
|
1060
|
+
anchorElement: refs.miniMenuElements.color,
|
1061
|
+
element: /*#__PURE__*/React.createElement(ClickListener, {
|
1062
|
+
onClickOutside: () => updateOpen('colorMiniMenu', false),
|
1063
|
+
include: [refs.miniMenuElements.color]
|
1064
|
+
}, /*#__PURE__*/React.createElement(Palette, {
|
1065
|
+
ref: refs.miniMenuElements.colorPalette,
|
1066
|
+
version: "font-color",
|
1067
|
+
onClose: () => updateOpen('colorMiniMenu', false),
|
1068
|
+
onUpdate: textMethod('font-color')
|
1069
|
+
}))
|
1070
|
+
}, /*#__PURE__*/React.createElement(WrapperToggleButton, {
|
1071
|
+
name: l('Text Color'),
|
1072
|
+
open: refs.open.current.colorMiniMenu ? false : undefined
|
1073
|
+
}, /*#__PURE__*/React.createElement(ToggleButton, _extends({
|
1074
|
+
ref: refs.miniMenuElements.color
|
1075
|
+
}, ToggleButtonProps, {
|
1076
|
+
selected: refs.open.current.colorMiniMenu,
|
1077
|
+
onClick: () => updateOpen('colorMiniMenu', !refs.open.current.colorMiniMenu)
|
1078
|
+
}), /*#__PURE__*/React.createElement(IconMaterialFormatColorText, IconProps)))),
|
1079
|
+
'font-background': /*#__PURE__*/React.createElement(WrapperAppend, {
|
1080
|
+
open: refs.open.current.background,
|
1081
|
+
anchorElement: refs.elements.background.current,
|
1082
|
+
element: /*#__PURE__*/React.createElement(ClickListener, {
|
1083
|
+
onClickOutside: () => updateOpen('background', false),
|
1084
|
+
include: [refs.elements.background.current]
|
1085
|
+
}, /*#__PURE__*/React.createElement(Palette, {
|
1086
|
+
version: "font-background",
|
1087
|
+
onClose: () => updateOpen('background', false),
|
1088
|
+
onUpdate: textMethod('font-background')
|
1089
|
+
}))
|
1090
|
+
}, /*#__PURE__*/React.createElement(WrapperToggleButton, {
|
1091
|
+
name: l('Background Color'),
|
1092
|
+
open: refs.open.current.background ? false : undefined
|
1093
|
+
}, /*#__PURE__*/React.createElement(ToggleButton, _extends({
|
1094
|
+
ref: refs.elements.background
|
1095
|
+
}, ToggleButtonProps, {
|
1096
|
+
selected: refs.open.current.background,
|
1097
|
+
onClick: () => updateOpen('background', !refs.open.current.background)
|
1098
|
+
}), /*#__PURE__*/React.createElement(IconMaterialFormatColorFill, IconProps)))),
|
1099
|
+
'font-background-mini-menu': /*#__PURE__*/React.createElement(WrapperAppend, {
|
1100
|
+
open: refs.open.current.backgroundMiniMenu,
|
1101
|
+
anchorElement: refs.miniMenuElements.background,
|
1102
|
+
element: /*#__PURE__*/React.createElement(ClickListener, {
|
1103
|
+
onClickOutside: () => updateOpen('backgroundMiniMenu', false),
|
1104
|
+
include: [refs.miniMenuElements.background]
|
1105
|
+
}, /*#__PURE__*/React.createElement(Palette, {
|
1106
|
+
ref: refs.miniMenuElements.backgroundPalette,
|
1107
|
+
version: "font-background",
|
1108
|
+
onClose: () => updateOpen('backgroundMiniMenu', false),
|
1109
|
+
onUpdate: textMethod('font-background')
|
1110
|
+
}))
|
1111
|
+
}, /*#__PURE__*/React.createElement(WrapperToggleButton, {
|
1112
|
+
name: l('Text Color'),
|
1113
|
+
open: refs.open.current.backgroundMiniMenu ? false : undefined
|
1114
|
+
}, /*#__PURE__*/React.createElement(ToggleButton, _extends({
|
1115
|
+
ref: refs.miniMenuElements.background
|
1116
|
+
}, ToggleButtonProps, {
|
1117
|
+
selected: refs.open.current.backgroundMiniMenu,
|
1118
|
+
onClick: () => updateOpen('backgroundMiniMenu', !refs.open.current.backgroundMiniMenu)
|
1119
|
+
}), /*#__PURE__*/React.createElement(IconMaterialFormatColorFill, IconProps)))),
|
1120
|
+
'align-left': /*#__PURE__*/React.createElement(WrapperToggleButton, {
|
1121
|
+
name: l('Align Left')
|
1122
|
+
}, /*#__PURE__*/React.createElement(ToggleButton, _extends({}, ToggleButtonProps, {
|
1123
|
+
selected: refs.textSelected.current.includes('align-left'),
|
1124
|
+
onClick: textMethod('align-left')
|
1125
|
+
}), /*#__PURE__*/React.createElement(IconMaterialFormatAlignLeft, IconProps))),
|
1126
|
+
'align-center': /*#__PURE__*/React.createElement(WrapperToggleButton, {
|
1127
|
+
name: l('Align Center')
|
1128
|
+
}, /*#__PURE__*/React.createElement(ToggleButton, _extends({}, ToggleButtonProps, {
|
1129
|
+
selected: refs.textSelected.current.includes('align-center'),
|
1130
|
+
onClick: textMethod('align-center')
|
1131
|
+
}), /*#__PURE__*/React.createElement(IconMaterialFormatAlignCenter, IconProps))),
|
1132
|
+
'align-right': /*#__PURE__*/React.createElement(WrapperToggleButton, {
|
1133
|
+
name: l('Align Right')
|
1134
|
+
}, /*#__PURE__*/React.createElement(ToggleButton, _extends({}, ToggleButtonProps, {
|
1135
|
+
selected: refs.textSelected.current.includes('align-right'),
|
1136
|
+
onClick: textMethod('align-right')
|
1137
|
+
}), /*#__PURE__*/React.createElement(IconMaterialFormatAlignRight, IconProps))),
|
1138
|
+
'align-justify': /*#__PURE__*/React.createElement(WrapperToggleButton, {
|
1139
|
+
name: l('Align Justify')
|
1140
|
+
}, /*#__PURE__*/React.createElement(ToggleButton, _extends({}, ToggleButtonProps, {
|
1141
|
+
selected: refs.textSelected.current.includes('align-justify'),
|
1142
|
+
onClick: textMethod('align-justify')
|
1143
|
+
}), /*#__PURE__*/React.createElement(IconMaterialFormatAlignJustify, IconProps)))
|
839
1144
|
};
|
840
1145
|
const actionElements = {
|
841
1146
|
'clear': /*#__PURE__*/React.createElement(WrapperToggleButton, {
|
@@ -884,7 +1189,7 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
884
1189
|
"aria-label": l('Mini menu'),
|
885
1190
|
Component: Surface,
|
886
1191
|
className: classNames([classes.textMiniMenu])
|
887
|
-
}, /*#__PURE__*/React.createElement(ToggleButtons, ToggleButtonsProps, updateElements['italic'], updateElements['underline'], updateElements['bold'], updateElements['strike-line']), /*#__PURE__*/React.createElement(ToggleButtons, ToggleButtonsProps, updateElements['superscript'], updateElements['subscript']), /*#__PURE__*/React.createElement(ToggleButtons, ToggleButtonsProps, updateElements['link-add'], updateElements['link-remove']), /*#__PURE__*/React.createElement(ToggleButtons, ToggleButtonsProps, actionElements['clear'])))));
|
1192
|
+
}, /*#__PURE__*/React.createElement(ToggleButtons, ToggleButtonsProps, updateElements['italic'], updateElements['underline'], updateElements['bold'], updateElements['strike-line']), miniMenuExtended && /*#__PURE__*/React.createElement(ToggleButtons, ToggleButtonsProps, updateElements['font-color-mini-menu'], updateElements['font-background-mini-menu']), miniMenuExtended && /*#__PURE__*/React.createElement(ToggleButtons, ToggleButtonsProps, updateElements['align-left'], updateElements['align-center'], updateElements['align-right'], updateElements['align-justify']), miniMenuExtended && /*#__PURE__*/React.createElement(ToggleButtons, ToggleButtonsProps, updateElements['list-ordered'], updateElements['list-unordered']), /*#__PURE__*/React.createElement(ToggleButtons, ToggleButtonsProps, updateElements['superscript'], updateElements['subscript']), /*#__PURE__*/React.createElement(ToggleButtons, ToggleButtonsProps, updateElements['link-add'], updateElements['link-remove']), /*#__PURE__*/React.createElement(ToggleButtons, ToggleButtonsProps, actionElements['clear'])))));
|
888
1193
|
},
|
889
1194
|
parent: refs.root.current,
|
890
1195
|
anchor: textSelection?.selection,
|
@@ -913,6 +1218,8 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
913
1218
|
}
|
914
1219
|
refs.root.current = item;
|
915
1220
|
},
|
1221
|
+
color: color,
|
1222
|
+
tonal: tonal,
|
916
1223
|
version: "text",
|
917
1224
|
size: size,
|
918
1225
|
minRows: 12,
|
@@ -956,6 +1263,8 @@ const SmartTextField = /*#__PURE__*/React.forwardRef((props_, ref) => {
|
|
956
1263
|
refs.root.current = item;
|
957
1264
|
refs.input.current = item;
|
958
1265
|
},
|
1266
|
+
color: color,
|
1267
|
+
tonal: tonal,
|
959
1268
|
onInput: onInput,
|
960
1269
|
onKeyDown: onKeyDown,
|
961
1270
|
onKeyUp: onKeyUp,
|
package/esm/index.js
CHANGED