@mirrormedia/lilith-draft-editor 3.0.6 → 3.0.8
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.
- package/lib/draft-js/buttons/annotation.js +3 -1
- package/lib/draft-js/buttons/embedded-code.js +3 -1
- package/lib/draft-js/buttons/image.js +18 -20
- package/lib/draft-js/buttons/info-box.js +3 -1
- package/lib/website/mirrordaily/selector/image-selector.js +5 -26
- package/lib/website/mirrordaily/selector/video-selector.js +7 -30
- package/lib/website/mirrormedia/draft-editor.js +312 -338
- package/package.json +1 -2
- package/lib/website/mirrordaily/selector/image-uploader.js +0 -247
- package/lib/website/mirrordaily/selector/video-uploader.js +0 -185
- package/lib/website/mirrordaily/utils/file-convert.js +0 -86
|
@@ -9,7 +9,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
11
11
|
|
|
12
|
-
var _theme =
|
|
12
|
+
var _theme = _interopRequireWildcard(require("./theme"));
|
|
13
13
|
|
|
14
14
|
var _draftJs = require("draft-js");
|
|
15
15
|
|
|
@@ -69,6 +69,8 @@ var _audioSelector = require("./selector/audio-selector");
|
|
|
69
69
|
|
|
70
70
|
var _sharedStyle = require("./shared-style");
|
|
71
71
|
|
|
72
|
+
var _hooks = require("../../hooks");
|
|
73
|
+
|
|
72
74
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
73
75
|
|
|
74
76
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -349,6 +351,7 @@ const DraftEditorControlsWrapper = _styledComponents.default.div`
|
|
|
349
351
|
flex-direction: row;
|
|
350
352
|
flex-wrap: wrap;
|
|
351
353
|
padding-right: 45px;
|
|
354
|
+
column-gap: 5px;
|
|
352
355
|
`;
|
|
353
356
|
const TextEditorWrapper = _styledComponents.default.div`
|
|
354
357
|
/* Rich-editor default setting (.RichEditor-editor)*/
|
|
@@ -433,76 +436,78 @@ const DraftEditorContainer = _styledComponents.default.div`
|
|
|
433
436
|
padding-bottom: 0;
|
|
434
437
|
` : ''}
|
|
435
438
|
}
|
|
436
|
-
`;
|
|
437
|
-
const ButtonGroup = _styledComponents.default.div`
|
|
438
|
-
margin: 0 10px 0 0;
|
|
439
|
+
`; // const ButtonGroup = styled.div``
|
|
439
440
|
|
|
440
|
-
${({
|
|
441
|
-
isDisabled
|
|
442
|
-
}) => isDisabled ? (0, _styledComponents.css)`
|
|
443
|
-
display: none;
|
|
444
|
-
` : ''}
|
|
445
|
-
`;
|
|
446
441
|
const EnlargeButtonWrapper = _styledComponents.default.div`
|
|
447
442
|
position: absolute;
|
|
448
443
|
top: 0;
|
|
449
444
|
right: 0;
|
|
450
445
|
margin: 0;
|
|
451
446
|
`;
|
|
447
|
+
const MOBILE_BOUNDARY = _theme.mediaSize.md;
|
|
452
448
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
CODE: {
|
|
463
|
-
backgroundColor: 'rgba(0, 0, 0, 0.05)',
|
|
464
|
-
fontFamily: '"Inconsolata", "Menlo", "Consolas", monospace',
|
|
465
|
-
fontSize: 16,
|
|
466
|
-
padding: 2
|
|
467
|
-
}
|
|
468
|
-
};
|
|
469
|
-
}
|
|
449
|
+
const RichTextEditor = ({
|
|
450
|
+
editorState: propEditorState,
|
|
451
|
+
onChange,
|
|
452
|
+
disabledButtons = [],
|
|
453
|
+
hideOnMobileButtons = []
|
|
454
|
+
}) => {
|
|
455
|
+
const [isEnlarged, setIsEnlarged] = _react.default.useState(false);
|
|
456
|
+
|
|
457
|
+
const [readOnly, setReadOnly] = _react.default.useState(false);
|
|
470
458
|
|
|
471
|
-
|
|
472
|
-
|
|
459
|
+
const editorRef = _react.default.useRef(null);
|
|
460
|
+
|
|
461
|
+
const checkIsDisabled = (0, _hooks.useButtonDisabledChecker)({
|
|
462
|
+
mobileBoundary: MOBILE_BOUNDARY,
|
|
463
|
+
disabledButtons,
|
|
464
|
+
hideOnMobileButtons
|
|
465
|
+
}); // Custom overrides for "code" style.
|
|
466
|
+
|
|
467
|
+
const customStyleMap = {
|
|
468
|
+
CODE: {
|
|
469
|
+
backgroundColor: 'rgba(0, 0, 0, 0.05)',
|
|
470
|
+
fontFamily: '"Inconsolata", "Menlo", "Consolas", monospace',
|
|
471
|
+
fontSize: 16,
|
|
472
|
+
padding: 2
|
|
473
|
+
}
|
|
473
474
|
};
|
|
474
|
-
|
|
475
|
+
let editorState = propEditorState;
|
|
476
|
+
|
|
477
|
+
if (!(editorState instanceof _draftJs.EditorState)) {
|
|
478
|
+
editorState = _draftJs.EditorState.createEmpty(_entityDecorator.default);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
const handleKeyCommand = (command, editorState) => {
|
|
475
482
|
const newState = _draftJs.RichUtils.handleKeyCommand(editorState, command);
|
|
476
483
|
|
|
477
484
|
if (newState) {
|
|
478
|
-
|
|
485
|
+
onChange(newState);
|
|
479
486
|
return 'handled';
|
|
480
487
|
}
|
|
481
488
|
|
|
482
489
|
return 'not-handled';
|
|
483
490
|
};
|
|
484
|
-
|
|
491
|
+
|
|
492
|
+
const handleReturn = event => {
|
|
485
493
|
if (_draftJs.KeyBindingUtil.isSoftNewlineEvent(event)) {
|
|
486
|
-
const {
|
|
487
|
-
onChange,
|
|
488
|
-
editorState
|
|
489
|
-
} = this.props;
|
|
490
494
|
onChange(_draftJs.RichUtils.insertSoftNewline(editorState));
|
|
491
495
|
return 'handled';
|
|
492
496
|
}
|
|
493
497
|
|
|
494
498
|
return 'not-handled';
|
|
495
499
|
};
|
|
496
|
-
|
|
500
|
+
|
|
501
|
+
const mapKeyToEditorCommand = e => {
|
|
497
502
|
if (e.keyCode === 9
|
|
498
503
|
/* TAB */
|
|
499
504
|
) {
|
|
500
|
-
const newEditorState = _draftJs.RichUtils.onTab(e,
|
|
505
|
+
const newEditorState = _draftJs.RichUtils.onTab(e, editorState, 4
|
|
501
506
|
/* maxDepth */
|
|
502
507
|
);
|
|
503
508
|
|
|
504
|
-
if (newEditorState !==
|
|
505
|
-
|
|
509
|
+
if (newEditorState !== editorState) {
|
|
510
|
+
onChange(newEditorState);
|
|
506
511
|
}
|
|
507
512
|
|
|
508
513
|
return null;
|
|
@@ -510,13 +515,16 @@ class RichTextEditor extends _react.default.Component {
|
|
|
510
515
|
|
|
511
516
|
return (0, _draftJs.getDefaultKeyBinding)(e);
|
|
512
517
|
};
|
|
513
|
-
|
|
514
|
-
|
|
518
|
+
|
|
519
|
+
const toggleBlockType = blockType => {
|
|
520
|
+
onChange(_draftJs.RichUtils.toggleBlockType(editorState, blockType));
|
|
515
521
|
};
|
|
516
|
-
|
|
517
|
-
|
|
522
|
+
|
|
523
|
+
const toggleInlineStyle = inlineStyle => {
|
|
524
|
+
onChange(_draftJs.RichUtils.toggleInlineStyle(editorState, inlineStyle));
|
|
518
525
|
};
|
|
519
|
-
|
|
526
|
+
|
|
527
|
+
const getEntityType = editorState => {
|
|
520
528
|
const contentState = editorState.getCurrentContent();
|
|
521
529
|
const selection = editorState.getSelection();
|
|
522
530
|
const startOffset = selection.getStartOffset();
|
|
@@ -543,8 +551,9 @@ class RichTextEditor extends _react.default.Component {
|
|
|
543
551
|
|
|
544
552
|
return entityType;
|
|
545
553
|
};
|
|
546
|
-
|
|
547
|
-
|
|
554
|
+
|
|
555
|
+
const getCustomStyle = style => {
|
|
556
|
+
return style.reduce((styles = {}, styleName) => {
|
|
548
557
|
if (styleName !== null && styleName !== void 0 && styleName.startsWith(_const.CUSTOM_STYLE_PREFIX_FONT_COLOR)) {
|
|
549
558
|
styles['color'] = styleName.split(_const.CUSTOM_STYLE_PREFIX_FONT_COLOR)[1];
|
|
550
559
|
}
|
|
@@ -556,21 +565,18 @@ class RichTextEditor extends _react.default.Component {
|
|
|
556
565
|
return styles;
|
|
557
566
|
}, {});
|
|
558
567
|
};
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
});
|
|
568
|
+
|
|
569
|
+
const customStyleFn = style => {
|
|
570
|
+
return getCustomStyle(style);
|
|
563
571
|
};
|
|
564
|
-
|
|
565
|
-
|
|
572
|
+
|
|
573
|
+
const toggleEnlarge = () => {
|
|
574
|
+
setIsEnlarged(!isEnlarged);
|
|
566
575
|
};
|
|
567
576
|
|
|
568
|
-
blockStyleFn
|
|
577
|
+
const blockStyleFn = block => {
|
|
569
578
|
var _entity$getData;
|
|
570
579
|
|
|
571
|
-
const {
|
|
572
|
-
editorState
|
|
573
|
-
} = this.props;
|
|
574
580
|
const entityKey = block.getEntityAt(0);
|
|
575
581
|
const entity = entityKey ? editorState.getCurrentContent().getEntity(entityKey) : null;
|
|
576
582
|
let result = '';
|
|
@@ -607,25 +613,30 @@ class RichTextEditor extends _react.default.Component {
|
|
|
607
613
|
}
|
|
608
614
|
|
|
609
615
|
return result;
|
|
610
|
-
}
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
const renderBasicEditor = propsOfBasicEditor => {
|
|
619
|
+
return /*#__PURE__*/_react.default.createElement(RichTextEditor, _extends({}, propsOfBasicEditor, {
|
|
620
|
+
disabledButtons: disabledButtonsOnBasicEditor,
|
|
621
|
+
hideOnMobileButtons: hideOnMobileButtons
|
|
622
|
+
}));
|
|
623
|
+
};
|
|
611
624
|
|
|
612
|
-
blockRendererFn = block => {
|
|
625
|
+
const blockRendererFn = block => {
|
|
613
626
|
const atomicBlockObj = (0, _blockRendererFn.atomicBlockRenderer)(block);
|
|
614
627
|
|
|
615
628
|
if (atomicBlockObj) {
|
|
616
629
|
const onEditStart = () => {
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
readOnly: true
|
|
628
|
-
});
|
|
630
|
+
// If custom block renderer requires mouse interaction,
|
|
631
|
+
// [Draft.js document](https://draftjs.org/docs/advanced-topics-block-components#recommendations-and-other-notes)
|
|
632
|
+
// suggests that we should temporarily set Editor
|
|
633
|
+
// to readOnly={true} during the interaction.
|
|
634
|
+
// In readOnly={true} condition, the user does not
|
|
635
|
+
// trigger any selection changes within the editor
|
|
636
|
+
// while interacting with custom block.
|
|
637
|
+
// If we don't set readOnly={true},
|
|
638
|
+
// it will cause some subtle bugs in InfoBox button.
|
|
639
|
+
setReadOnly(true);
|
|
629
640
|
};
|
|
630
641
|
|
|
631
642
|
const onEditFinish = ({
|
|
@@ -633,9 +644,9 @@ class RichTextEditor extends _react.default.Component {
|
|
|
633
644
|
entityData
|
|
634
645
|
}) => {
|
|
635
646
|
if (entityKey && entityData) {
|
|
636
|
-
const oldContentState =
|
|
647
|
+
const oldContentState = editorState.getCurrentContent();
|
|
637
648
|
const newContentState = oldContentState.replaceEntityData(entityKey, entityData);
|
|
638
|
-
|
|
649
|
+
onChange(_draftJs.EditorState.set(editorState, {
|
|
639
650
|
currentContent: newContentState
|
|
640
651
|
}));
|
|
641
652
|
} // Custom block interaction is finished.
|
|
@@ -643,9 +654,7 @@ class RichTextEditor extends _react.default.Component {
|
|
|
643
654
|
// make editor editable.
|
|
644
655
|
|
|
645
656
|
|
|
646
|
-
|
|
647
|
-
readOnly: false
|
|
648
|
-
});
|
|
657
|
+
setReadOnly(false);
|
|
649
658
|
}; // `onEditStart` and `onEditFinish` will be passed
|
|
650
659
|
// into custom block component.
|
|
651
660
|
// We can get them via `props.blockProps.onEditStart`
|
|
@@ -656,12 +665,8 @@ class RichTextEditor extends _react.default.Component {
|
|
|
656
665
|
props: {
|
|
657
666
|
onEditStart,
|
|
658
667
|
onEditFinish,
|
|
659
|
-
getMainEditorReadOnly: () =>
|
|
660
|
-
renderBasicEditor:
|
|
661
|
-
return /*#__PURE__*/_react.default.createElement(RichTextEditor, _extends({}, propsOfBasicEditor, {
|
|
662
|
-
disabledButtons: disabledButtonsOnBasicEditor
|
|
663
|
-
}));
|
|
664
|
-
}
|
|
668
|
+
getMainEditorReadOnly: () => readOnly,
|
|
669
|
+
renderBasicEditor: renderBasicEditor
|
|
665
670
|
}
|
|
666
671
|
});
|
|
667
672
|
return extendedAtomicBlockObj;
|
|
@@ -670,290 +675,248 @@ class RichTextEditor extends _react.default.Component {
|
|
|
670
675
|
}
|
|
671
676
|
};
|
|
672
677
|
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
678
|
+
const entityType = getEntityType(editorState);
|
|
679
|
+
const customStyle = getCustomStyle(editorState.getCurrentInlineStyle());
|
|
680
|
+
return /*#__PURE__*/_react.default.createElement(_styledComponents.ThemeProvider, {
|
|
681
|
+
theme: _theme.default
|
|
682
|
+
}, /*#__PURE__*/_react.default.createElement(DraftEditorContainer, {
|
|
683
|
+
isEnlarged: Boolean(isEnlarged)
|
|
684
|
+
}, /*#__PURE__*/_react.default.createElement(DraftEditorWrapper, null, /*#__PURE__*/_react.default.createElement("link", {
|
|
685
|
+
href: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css",
|
|
686
|
+
rel: "stylesheet",
|
|
687
|
+
type: "text/css"
|
|
688
|
+
}), /*#__PURE__*/_react.default.createElement("link", {
|
|
689
|
+
href: "https://cdnjs.cloudflare.com/ajax/libs/draft-js/0.11.7/Draft.css",
|
|
690
|
+
rel: "stylesheet",
|
|
691
|
+
type: "text/css"
|
|
692
|
+
}), /*#__PURE__*/_react.default.createElement("link", {
|
|
693
|
+
href: "https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css",
|
|
694
|
+
rel: "stylesheet",
|
|
695
|
+
type: "text/css"
|
|
696
|
+
}), /*#__PURE__*/_react.default.createElement(DraftEditorControls, null, /*#__PURE__*/_react.default.createElement(DraftEditorControlsWrapper, null, /*#__PURE__*/_react.default.createElement(BlockStyleControls, {
|
|
697
|
+
readOnly: readOnly,
|
|
698
|
+
disabledButtons: disabledButtons,
|
|
699
|
+
hideOnMobileButtons: hideOnMobileButtons,
|
|
700
|
+
editorState: editorState,
|
|
701
|
+
onToggle: toggleBlockType
|
|
702
|
+
}), /*#__PURE__*/_react.default.createElement(InlineStyleControls, {
|
|
703
|
+
readOnly: readOnly,
|
|
704
|
+
disabledButtons: disabledButtons,
|
|
705
|
+
hideOnMobileButtons: hideOnMobileButtons,
|
|
706
|
+
editorState: editorState,
|
|
707
|
+
onToggle: toggleInlineStyle
|
|
708
|
+
}), /*#__PURE__*/_react.default.createElement(EnlargeButtonWrapper, null, /*#__PURE__*/_react.default.createElement(CustomEnlargeButton, {
|
|
709
|
+
onToggle: toggleEnlarge,
|
|
710
|
+
isEnlarged: isEnlarged
|
|
711
|
+
}))), /*#__PURE__*/_react.default.createElement(DraftEditorControlsWrapper, null, /*#__PURE__*/_react.default.createElement(CustomLinkButton, {
|
|
712
|
+
isDisabled: checkIsDisabled(buttonNames.link),
|
|
713
|
+
isActive: entityType === 'LINK',
|
|
714
|
+
readOnly: readOnly,
|
|
715
|
+
editorState: editorState,
|
|
716
|
+
onChange: onChange
|
|
717
|
+
}), /*#__PURE__*/_react.default.createElement(CustomFontColorButton, {
|
|
718
|
+
isDisabled: checkIsDisabled(buttonNames.fontColor),
|
|
719
|
+
isActive: Object.prototype.hasOwnProperty.call(customStyle, 'color'),
|
|
720
|
+
readOnly: readOnly,
|
|
721
|
+
editorState: editorState,
|
|
722
|
+
onChange: onChange
|
|
723
|
+
}), /*#__PURE__*/_react.default.createElement(CustomDividerButton, {
|
|
724
|
+
isDisabled: checkIsDisabled(buttonNames.divider),
|
|
725
|
+
editorState: editorState,
|
|
726
|
+
onChange: onChange
|
|
727
|
+
}), /*#__PURE__*/_react.default.createElement(CustomAnnotationButton, {
|
|
728
|
+
isDisabled: checkIsDisabled(buttonNames.annotation),
|
|
729
|
+
isActive: entityType === 'ANNOTATION',
|
|
730
|
+
readOnly: readOnly,
|
|
731
|
+
editorState: editorState,
|
|
732
|
+
onChange: onChange,
|
|
733
|
+
renderBasicEditor: renderBasicEditor,
|
|
734
|
+
decorators: _entityDecorator.default
|
|
735
|
+
}), /*#__PURE__*/_react.default.createElement(CustomImageButton, {
|
|
736
|
+
isDisabled: checkIsDisabled(buttonNames.image),
|
|
737
|
+
readOnly: readOnly,
|
|
738
|
+
editorState: editorState,
|
|
739
|
+
onChange: onChange,
|
|
740
|
+
ImageSelector: _imageSelector.ImageSelector
|
|
741
|
+
}), /*#__PURE__*/_react.default.createElement(CustomVideoButton, {
|
|
742
|
+
isDisabled: checkIsDisabled(buttonNames.video),
|
|
743
|
+
readOnly: readOnly,
|
|
744
|
+
editorState: editorState,
|
|
745
|
+
onChange: onChange,
|
|
746
|
+
VideoSelector: _videoSelector.VideoSelector
|
|
747
|
+
}), /*#__PURE__*/_react.default.createElement(CustomYoutubeButton, {
|
|
748
|
+
isDisabled: checkIsDisabled(buttonNames.youtube),
|
|
749
|
+
readOnly: readOnly,
|
|
750
|
+
editorState: editorState,
|
|
751
|
+
onChange: onChange
|
|
752
|
+
}), /*#__PURE__*/_react.default.createElement(CustomAudioButton, {
|
|
753
|
+
isDisabled: checkIsDisabled(buttonNames.audio),
|
|
754
|
+
readOnly: readOnly,
|
|
755
|
+
editorState: editorState,
|
|
756
|
+
onChange: onChange,
|
|
757
|
+
AudioSelector: _audioSelector.AudioSelector
|
|
758
|
+
}), /*#__PURE__*/_react.default.createElement(CustomSlideshowButton, {
|
|
759
|
+
isDisabled: checkIsDisabled(buttonNames.slideshow),
|
|
760
|
+
readOnly: readOnly,
|
|
761
|
+
editorState: editorState,
|
|
762
|
+
onChange: onChange,
|
|
763
|
+
ImageSelector: _imageSelector.ImageSelector
|
|
764
|
+
}), /*#__PURE__*/_react.default.createElement(CustomInfoBoxButton, {
|
|
765
|
+
isDisabled: checkIsDisabled(buttonNames.infoBox),
|
|
766
|
+
readOnly: readOnly,
|
|
767
|
+
editorState: editorState,
|
|
768
|
+
onChange: onChange,
|
|
769
|
+
renderBasicEditor: renderBasicEditor // decorators={decorators}
|
|
770
|
+
|
|
771
|
+
}), /*#__PURE__*/_react.default.createElement(CustomEmbeddedCodeButton, {
|
|
772
|
+
isDisabled: checkIsDisabled(buttonNames.embed),
|
|
773
|
+
readOnly: readOnly,
|
|
774
|
+
editorState: editorState,
|
|
775
|
+
onChange: onChange
|
|
776
|
+
}), /*#__PURE__*/_react.default.createElement(CustomTableButton, {
|
|
777
|
+
isDisabled: checkIsDisabled(buttonNames.table),
|
|
778
|
+
readOnly: readOnly,
|
|
779
|
+
editorState: editorState,
|
|
780
|
+
onChange: onChange
|
|
781
|
+
})), /*#__PURE__*/_react.default.createElement(DraftEditorControlsWrapper, null, /*#__PURE__*/_react.default.createElement(CustomAlignLeftButton, {
|
|
782
|
+
isDisabled: checkIsDisabled(buttonNames.textAlign),
|
|
783
|
+
isActive: (0, _textAlign.getSelectionBlockData)(editorState, 'textAlign') === 'left',
|
|
784
|
+
readOnly: readOnly,
|
|
785
|
+
editorState: editorState,
|
|
786
|
+
onChange: onChange
|
|
787
|
+
}), /*#__PURE__*/_react.default.createElement(CustomAlignCenterButton, {
|
|
788
|
+
isDisabled: checkIsDisabled(buttonNames.textAlign),
|
|
789
|
+
isActive: (0, _textAlign.getSelectionBlockData)(editorState, 'textAlign') === 'center',
|
|
790
|
+
readOnly: readOnly,
|
|
791
|
+
editorState: editorState,
|
|
792
|
+
onChange: onChange
|
|
793
|
+
}), /*#__PURE__*/_react.default.createElement(CustomColorBoxButton, {
|
|
794
|
+
isDisabled: checkIsDisabled(buttonNames.colorBox),
|
|
795
|
+
readOnly: readOnly,
|
|
796
|
+
editorState: editorState,
|
|
797
|
+
onChange: onChange,
|
|
798
|
+
renderBasicEditor: renderBasicEditor // decorators={decorators}
|
|
799
|
+
|
|
800
|
+
}), /*#__PURE__*/_react.default.createElement(CustomBackgroundColorButton, {
|
|
801
|
+
isDisabled: checkIsDisabled(buttonNames.backgroundColor),
|
|
802
|
+
isActive: Object.prototype.hasOwnProperty.call(customStyle, 'backgroundColor'),
|
|
803
|
+
readOnly: readOnly,
|
|
804
|
+
editorState: editorState,
|
|
805
|
+
onChange: onChange
|
|
806
|
+
}), /*#__PURE__*/_react.default.createElement(CustomBGImageButton, {
|
|
807
|
+
isDisabled: checkIsDisabled(buttonNames.backgroundImage),
|
|
808
|
+
readOnly: readOnly,
|
|
809
|
+
editorState: editorState,
|
|
810
|
+
onChange: onChange,
|
|
811
|
+
ImageSelector: _imageSelector.ImageSelector,
|
|
812
|
+
renderBasicEditor: renderBasicEditor,
|
|
813
|
+
decorators: _entityDecorator.default
|
|
814
|
+
}), /*#__PURE__*/_react.default.createElement(CustomBGVideoButton, {
|
|
815
|
+
isDisabled: checkIsDisabled(buttonNames.backgroundVideo),
|
|
816
|
+
readOnly: readOnly,
|
|
817
|
+
editorState: editorState,
|
|
818
|
+
onChange: onChange,
|
|
819
|
+
VideoSelector: _videoSelector.VideoSelector,
|
|
820
|
+
renderBasicEditor: renderBasicEditor,
|
|
821
|
+
decorators: _entityDecorator.default
|
|
822
|
+
}), /*#__PURE__*/_react.default.createElement(CustomRelatedPostButton, {
|
|
823
|
+
isDisabled: checkIsDisabled(buttonNames.relatedPost),
|
|
824
|
+
readOnly: readOnly,
|
|
825
|
+
editorState: editorState,
|
|
826
|
+
onChange: onChange,
|
|
827
|
+
PostSelector: _postSelector.PostSelector
|
|
828
|
+
}), /*#__PURE__*/_react.default.createElement(CustomSideIndexButton, {
|
|
829
|
+
isDisabled: checkIsDisabled(buttonNames.sideIndex),
|
|
830
|
+
readOnly: readOnly,
|
|
831
|
+
editorState: editorState,
|
|
832
|
+
onChange: onChange
|
|
833
|
+
}))), /*#__PURE__*/_react.default.createElement(TextEditorWrapper, {
|
|
834
|
+
onClick: () => {
|
|
835
|
+
var _editorRef$current;
|
|
836
|
+
|
|
837
|
+
(_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 ? void 0 : _editorRef$current.focus();
|
|
683
838
|
}
|
|
839
|
+
}, /*#__PURE__*/_react.default.createElement(_draftJs.Editor, {
|
|
840
|
+
blockStyleFn: blockStyleFn,
|
|
841
|
+
blockRendererFn: blockRendererFn,
|
|
842
|
+
customStyleMap: customStyleMap,
|
|
843
|
+
customStyleFn: customStyleFn,
|
|
844
|
+
editorState: editorState,
|
|
845
|
+
handleKeyCommand: handleKeyCommand,
|
|
846
|
+
handleReturn: handleReturn,
|
|
847
|
+
keyBindingFn: mapKeyToEditorCommand,
|
|
848
|
+
onChange: onChange,
|
|
849
|
+
placeholder: "Tell a story...",
|
|
850
|
+
ref: editorRef,
|
|
851
|
+
spellCheck: true,
|
|
852
|
+
readOnly: readOnly
|
|
853
|
+
})))));
|
|
854
|
+
};
|
|
684
855
|
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
readOnly
|
|
688
|
-
} = this.state;
|
|
689
|
-
const entityType = this.getEntityType(editorState);
|
|
690
|
-
const customStyle = this.getCustomStyle(editorState.getCurrentInlineStyle());
|
|
691
|
-
|
|
692
|
-
const renderBasicEditor = propsOfBasicEditor => {
|
|
693
|
-
return /*#__PURE__*/_react.default.createElement(RichTextEditor, _extends({}, propsOfBasicEditor, {
|
|
694
|
-
disabledButtons: disabledButtonsOnBasicEditor
|
|
695
|
-
}));
|
|
696
|
-
};
|
|
697
|
-
|
|
698
|
-
return /*#__PURE__*/_react.default.createElement(_styledComponents.ThemeProvider, {
|
|
699
|
-
theme: _theme.default
|
|
700
|
-
}, /*#__PURE__*/_react.default.createElement(DraftEditorContainer, {
|
|
701
|
-
isEnlarged: Boolean(isEnlarged)
|
|
702
|
-
}, /*#__PURE__*/_react.default.createElement(DraftEditorWrapper, null, /*#__PURE__*/_react.default.createElement("link", {
|
|
703
|
-
href: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css",
|
|
704
|
-
rel: "stylesheet",
|
|
705
|
-
type: "text/css"
|
|
706
|
-
}), /*#__PURE__*/_react.default.createElement("link", {
|
|
707
|
-
href: "https://cdnjs.cloudflare.com/ajax/libs/draft-js/0.11.7/Draft.css",
|
|
708
|
-
rel: "stylesheet",
|
|
709
|
-
type: "text/css"
|
|
710
|
-
}), /*#__PURE__*/_react.default.createElement("link", {
|
|
711
|
-
href: "https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css",
|
|
712
|
-
rel: "stylesheet",
|
|
713
|
-
type: "text/css"
|
|
714
|
-
}), /*#__PURE__*/_react.default.createElement(DraftEditorControls, null, /*#__PURE__*/_react.default.createElement(DraftEditorControlsWrapper, null, /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(BlockStyleControls, {
|
|
715
|
-
readOnly: readOnly,
|
|
716
|
-
disabledButtons: disabledButtons,
|
|
717
|
-
editorState: editorState,
|
|
718
|
-
onToggle: this.toggleBlockType
|
|
719
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(InlineStyleControls, {
|
|
720
|
-
readOnly: readOnly,
|
|
721
|
-
disabledButtons: disabledButtons,
|
|
722
|
-
editorState: editorState,
|
|
723
|
-
onToggle: this.toggleInlineStyle
|
|
724
|
-
})), /*#__PURE__*/_react.default.createElement(EnlargeButtonWrapper, null, /*#__PURE__*/_react.default.createElement(CustomEnlargeButton, {
|
|
725
|
-
onToggle: this.toggleEnlarge,
|
|
726
|
-
isEnlarged: isEnlarged
|
|
727
|
-
}))), /*#__PURE__*/_react.default.createElement(DraftEditorControlsWrapper, null, /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
728
|
-
isDisabled: disabledButtons.includes(buttonNames.link)
|
|
729
|
-
}, /*#__PURE__*/_react.default.createElement(CustomLinkButton, {
|
|
730
|
-
isActive: entityType === 'LINK',
|
|
731
|
-
readOnly: readOnly,
|
|
732
|
-
editorState: editorState,
|
|
733
|
-
onChange: this.onChange
|
|
734
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
735
|
-
isDisabled: disabledButtons.includes(buttonNames.fontColor)
|
|
736
|
-
}, /*#__PURE__*/_react.default.createElement(CustomFontColorButton, {
|
|
737
|
-
isActive: Object.prototype.hasOwnProperty.call(customStyle, 'color'),
|
|
738
|
-
readOnly: readOnly,
|
|
739
|
-
editorState: editorState,
|
|
740
|
-
onChange: this.onChange
|
|
741
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
742
|
-
isDisabled: disabledButtons.includes(buttonNames.divider)
|
|
743
|
-
}, /*#__PURE__*/_react.default.createElement(CustomDividerButton, {
|
|
744
|
-
editorState: editorState,
|
|
745
|
-
onChange: this.onChange
|
|
746
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
747
|
-
isDisabled: disabledButtons.includes(buttonNames.annotation)
|
|
748
|
-
}, /*#__PURE__*/_react.default.createElement(CustomAnnotationButton, {
|
|
749
|
-
isActive: entityType === 'ANNOTATION',
|
|
750
|
-
readOnly: readOnly,
|
|
751
|
-
editorState: editorState,
|
|
752
|
-
onChange: this.onChange,
|
|
753
|
-
renderBasicEditor: renderBasicEditor,
|
|
754
|
-
decorators: _entityDecorator.default
|
|
755
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
756
|
-
isDisabled: disabledButtons.includes(buttonNames.image)
|
|
757
|
-
}, /*#__PURE__*/_react.default.createElement(CustomImageButton, {
|
|
758
|
-
readOnly: readOnly,
|
|
759
|
-
editorState: editorState,
|
|
760
|
-
onChange: this.onChange,
|
|
761
|
-
ImageSelector: _imageSelector.ImageSelector
|
|
762
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
763
|
-
isDisabled: disabledButtons.includes(buttonNames.video)
|
|
764
|
-
}, /*#__PURE__*/_react.default.createElement(CustomVideoButton, {
|
|
765
|
-
readOnly: readOnly,
|
|
766
|
-
editorState: editorState,
|
|
767
|
-
onChange: this.onChange,
|
|
768
|
-
VideoSelector: _videoSelector.VideoSelector
|
|
769
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
770
|
-
isDisabled: disabledButtons.includes(buttonNames.youtube)
|
|
771
|
-
}, /*#__PURE__*/_react.default.createElement(CustomYoutubeButton, {
|
|
772
|
-
readOnly: readOnly,
|
|
773
|
-
editorState: editorState,
|
|
774
|
-
onChange: this.onChange
|
|
775
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
776
|
-
isDisabled: disabledButtons.includes(buttonNames.audio)
|
|
777
|
-
}, /*#__PURE__*/_react.default.createElement(CustomAudioButton, {
|
|
778
|
-
readOnly: readOnly,
|
|
779
|
-
editorState: editorState,
|
|
780
|
-
onChange: this.onChange,
|
|
781
|
-
AudioSelector: _audioSelector.AudioSelector
|
|
782
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
783
|
-
isDisabled: disabledButtons.includes(buttonNames.slideshow)
|
|
784
|
-
}, /*#__PURE__*/_react.default.createElement(CustomSlideshowButton, {
|
|
785
|
-
readOnly: readOnly,
|
|
786
|
-
editorState: editorState,
|
|
787
|
-
onChange: this.onChange,
|
|
788
|
-
ImageSelector: _imageSelector.ImageSelector
|
|
789
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
790
|
-
isDisabled: disabledButtons.includes(buttonNames.infoBox)
|
|
791
|
-
}, /*#__PURE__*/_react.default.createElement(CustomInfoBoxButton, {
|
|
792
|
-
readOnly: readOnly,
|
|
793
|
-
editorState: editorState,
|
|
794
|
-
onChange: this.onChange,
|
|
795
|
-
renderBasicEditor: renderBasicEditor // decorators={decorators}
|
|
796
|
-
|
|
797
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
798
|
-
isDisabled: disabledButtons.includes(buttonNames.embed)
|
|
799
|
-
}, /*#__PURE__*/_react.default.createElement(CustomEmbeddedCodeButton, {
|
|
800
|
-
readOnly: readOnly,
|
|
801
|
-
editorState: editorState,
|
|
802
|
-
onChange: this.onChange
|
|
803
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
804
|
-
isDisabled: disabledButtons.includes(buttonNames.table)
|
|
805
|
-
}, /*#__PURE__*/_react.default.createElement(CustomTableButton, {
|
|
806
|
-
readOnly: readOnly,
|
|
807
|
-
editorState: editorState,
|
|
808
|
-
onChange: this.onChange
|
|
809
|
-
}))), /*#__PURE__*/_react.default.createElement(DraftEditorControlsWrapper, null, /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
810
|
-
isDisabled: disabledButtons.includes(buttonNames.textAlign)
|
|
811
|
-
}, /*#__PURE__*/_react.default.createElement(CustomAlignLeftButton, {
|
|
812
|
-
isActive: (0, _textAlign.getSelectionBlockData)(editorState, 'textAlign') === 'left',
|
|
813
|
-
readOnly: readOnly,
|
|
814
|
-
editorState: editorState,
|
|
815
|
-
onChange: this.onChange
|
|
816
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
817
|
-
isDisabled: disabledButtons.includes(buttonNames.textAlign)
|
|
818
|
-
}, /*#__PURE__*/_react.default.createElement(CustomAlignCenterButton, {
|
|
819
|
-
isActive: (0, _textAlign.getSelectionBlockData)(editorState, 'textAlign') === 'center',
|
|
820
|
-
readOnly: readOnly,
|
|
821
|
-
editorState: editorState,
|
|
822
|
-
onChange: this.onChange
|
|
823
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
824
|
-
isDisabled: disabledButtons.includes(buttonNames.colorBox)
|
|
825
|
-
}, /*#__PURE__*/_react.default.createElement(CustomColorBoxButton, {
|
|
826
|
-
readOnly: readOnly,
|
|
827
|
-
editorState: editorState,
|
|
828
|
-
onChange: this.onChange,
|
|
829
|
-
renderBasicEditor: renderBasicEditor // decorators={decorators}
|
|
830
|
-
|
|
831
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
832
|
-
isDisabled: disabledButtons.includes(buttonNames.backgroundColor)
|
|
833
|
-
}, /*#__PURE__*/_react.default.createElement(CustomBackgroundColorButton, {
|
|
834
|
-
isActive: Object.prototype.hasOwnProperty.call(customStyle, 'backgroundColor'),
|
|
835
|
-
readOnly: readOnly,
|
|
836
|
-
editorState: editorState,
|
|
837
|
-
onChange: this.onChange
|
|
838
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
839
|
-
isDisabled: disabledButtons.includes(buttonNames.backgroundImage)
|
|
840
|
-
}, /*#__PURE__*/_react.default.createElement(CustomBGImageButton, {
|
|
841
|
-
readOnly: readOnly,
|
|
842
|
-
editorState: editorState,
|
|
843
|
-
onChange: this.onChange,
|
|
844
|
-
ImageSelector: _imageSelector.ImageSelector,
|
|
845
|
-
renderBasicEditor: renderBasicEditor,
|
|
846
|
-
decorators: _entityDecorator.default
|
|
847
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
848
|
-
isDisabled: disabledButtons.includes(buttonNames.backgroundVideo)
|
|
849
|
-
}, /*#__PURE__*/_react.default.createElement(CustomBGVideoButton, {
|
|
850
|
-
readOnly: readOnly,
|
|
851
|
-
editorState: editorState,
|
|
852
|
-
onChange: this.onChange,
|
|
853
|
-
VideoSelector: _videoSelector.VideoSelector,
|
|
854
|
-
renderBasicEditor: renderBasicEditor,
|
|
855
|
-
decorators: _entityDecorator.default
|
|
856
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
857
|
-
isDisabled: disabledButtons.includes(buttonNames.relatedPost)
|
|
858
|
-
}, /*#__PURE__*/_react.default.createElement(CustomRelatedPostButton, {
|
|
859
|
-
readOnly: readOnly,
|
|
860
|
-
editorState: editorState,
|
|
861
|
-
onChange: this.onChange,
|
|
862
|
-
PostSelector: _postSelector.PostSelector
|
|
863
|
-
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, {
|
|
864
|
-
isDisabled: disabledButtons.includes(buttonNames.sideIndex)
|
|
865
|
-
}, /*#__PURE__*/_react.default.createElement(CustomSideIndexButton, {
|
|
866
|
-
readOnly: readOnly,
|
|
867
|
-
editorState: editorState,
|
|
868
|
-
onChange: this.onChange
|
|
869
|
-
})))), /*#__PURE__*/_react.default.createElement(TextEditorWrapper, {
|
|
870
|
-
onClick: () => {
|
|
871
|
-
var _this$refs$editor;
|
|
872
|
-
|
|
873
|
-
// eslint-disable-next-line prettier/prettier
|
|
874
|
-
(_this$refs$editor = this.refs.editor) === null || _this$refs$editor === void 0 ? void 0 : _this$refs$editor.focus();
|
|
875
|
-
}
|
|
876
|
-
}, /*#__PURE__*/_react.default.createElement(_draftJs.Editor, {
|
|
877
|
-
blockStyleFn: this.blockStyleFn.bind(this),
|
|
878
|
-
blockRendererFn: this.blockRendererFn,
|
|
879
|
-
customStyleMap: this.customStyleMap,
|
|
880
|
-
customStyleFn: this.customStyleFn,
|
|
881
|
-
editorState: editorState,
|
|
882
|
-
handleKeyCommand: this.handleKeyCommand,
|
|
883
|
-
handleReturn: this.handleReturn,
|
|
884
|
-
keyBindingFn: this.mapKeyToEditorCommand,
|
|
885
|
-
onChange: this.onChange,
|
|
886
|
-
placeholder: "Tell a story...",
|
|
887
|
-
ref: "editor",
|
|
888
|
-
spellCheck: true,
|
|
889
|
-
readOnly: readOnly
|
|
890
|
-
})))));
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
}
|
|
894
|
-
|
|
895
|
-
class StyleButton extends _react.default.Component {
|
|
896
|
-
onToggle = e => {
|
|
856
|
+
const StyleButton = props => {
|
|
857
|
+
const onToggle = e => {
|
|
897
858
|
e.preventDefault();
|
|
898
|
-
|
|
859
|
+
props.onToggle(props.style);
|
|
899
860
|
};
|
|
900
861
|
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
}
|
|
911
|
-
|
|
912
|
-
}
|
|
862
|
+
return /*#__PURE__*/_react.default.createElement(CustomButton, {
|
|
863
|
+
isDisabled: props.isDisabled,
|
|
864
|
+
isActive: props.isActive,
|
|
865
|
+
onMouseDown: onToggle,
|
|
866
|
+
readOnly: props.readOnly
|
|
867
|
+
}, props.icon && /*#__PURE__*/_react.default.createElement("i", {
|
|
868
|
+
className: props.icon
|
|
869
|
+
}), /*#__PURE__*/_react.default.createElement("span", null, !props.icon ? props.label : ''));
|
|
870
|
+
};
|
|
913
871
|
|
|
914
872
|
const blockStyles = [{
|
|
915
873
|
label: 'H2',
|
|
916
|
-
style:
|
|
874
|
+
style: buttonNames.h2,
|
|
917
875
|
icon: ''
|
|
918
876
|
}, {
|
|
919
877
|
label: 'H3',
|
|
920
|
-
style:
|
|
878
|
+
style: buttonNames.h3,
|
|
921
879
|
icon: ''
|
|
922
880
|
}, {
|
|
923
881
|
label: 'H4',
|
|
924
|
-
style:
|
|
882
|
+
style: buttonNames.h4,
|
|
925
883
|
icon: ''
|
|
926
884
|
}, {
|
|
927
885
|
label: 'Blockquote',
|
|
928
|
-
style:
|
|
886
|
+
style: buttonNames.blockquote,
|
|
929
887
|
icon: 'fas fa-quote-right'
|
|
930
888
|
}, {
|
|
931
889
|
label: 'UL',
|
|
932
|
-
style:
|
|
890
|
+
style: buttonNames.ul,
|
|
933
891
|
icon: 'fas fa-list-ul'
|
|
934
892
|
}, {
|
|
935
893
|
label: 'OL',
|
|
936
|
-
style:
|
|
894
|
+
style: buttonNames.ol,
|
|
937
895
|
icon: 'fas fa-list-ol'
|
|
938
896
|
}, {
|
|
939
897
|
label: 'Code Block',
|
|
940
|
-
style:
|
|
898
|
+
style: buttonNames.codeBlock,
|
|
941
899
|
icon: 'fas fa-code'
|
|
942
900
|
}];
|
|
943
901
|
|
|
944
|
-
const BlockStyleControls =
|
|
945
|
-
|
|
946
|
-
|
|
902
|
+
const BlockStyleControls = ({
|
|
903
|
+
editorState,
|
|
904
|
+
disabledButtons,
|
|
905
|
+
hideOnMobileButtons,
|
|
906
|
+
onToggle,
|
|
907
|
+
readOnly
|
|
908
|
+
}) => {
|
|
909
|
+
const checkIsDisabled = (0, _hooks.useButtonDisabledChecker)({
|
|
910
|
+
mobileBoundary: MOBILE_BOUNDARY,
|
|
947
911
|
disabledButtons,
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
} = props;
|
|
912
|
+
hideOnMobileButtons
|
|
913
|
+
});
|
|
951
914
|
const selection = editorState.getSelection();
|
|
952
915
|
const blockType = editorState.getCurrentContent().getBlockForKey(selection.getStartKey()).getType();
|
|
953
916
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, blockStyles.map(type => /*#__PURE__*/_react.default.createElement(StyleButton, {
|
|
954
|
-
isDisabled:
|
|
917
|
+
isDisabled: checkIsDisabled(type.style),
|
|
955
918
|
key: type.label,
|
|
956
|
-
|
|
919
|
+
isActive: type.style === blockType,
|
|
957
920
|
label: type.label,
|
|
958
921
|
onToggle: onToggle,
|
|
959
922
|
style: type.style,
|
|
@@ -980,17 +943,28 @@ const inlineStyles = [{
|
|
|
980
943
|
icon: 'fas fa-terminal'
|
|
981
944
|
}];
|
|
982
945
|
|
|
983
|
-
const InlineStyleControls =
|
|
984
|
-
|
|
946
|
+
const InlineStyleControls = ({
|
|
947
|
+
editorState,
|
|
948
|
+
disabledButtons,
|
|
949
|
+
hideOnMobileButtons,
|
|
950
|
+
onToggle,
|
|
951
|
+
readOnly
|
|
952
|
+
}) => {
|
|
953
|
+
const checkIsDisabled = (0, _hooks.useButtonDisabledChecker)({
|
|
954
|
+
mobileBoundary: MOBILE_BOUNDARY,
|
|
955
|
+
disabledButtons,
|
|
956
|
+
hideOnMobileButtons
|
|
957
|
+
});
|
|
958
|
+
const currentStyle = editorState.getCurrentInlineStyle();
|
|
985
959
|
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, inlineStyles.map(type => /*#__PURE__*/_react.default.createElement(StyleButton, {
|
|
986
|
-
isDisabled:
|
|
960
|
+
isDisabled: checkIsDisabled(type.style.toLowerCase()),
|
|
987
961
|
key: type.label,
|
|
988
|
-
|
|
962
|
+
isActive: currentStyle.has(type.style),
|
|
989
963
|
label: type.label,
|
|
990
|
-
onToggle:
|
|
964
|
+
onToggle: onToggle,
|
|
991
965
|
style: type.style,
|
|
992
966
|
icon: type.icon,
|
|
993
|
-
readOnly:
|
|
967
|
+
readOnly: readOnly
|
|
994
968
|
})));
|
|
995
969
|
};
|
|
996
970
|
|