@mirrormedia/lilith-draft-editor 2.2.1 → 3.0.0
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/README.md +3 -9
- package/lib/draft-js/buttons/selector/video-selector.js +1 -2
- package/lib/hooks.js +34 -0
- package/lib/website/mirrordaily/README.md +3 -0
- package/lib/website/mirrordaily/block-renderer/background-image-block.js +93 -0
- package/lib/website/mirrordaily/block-renderer/background-video-block.js +93 -0
- package/lib/website/mirrordaily/block-renderer/color-box-block.js +86 -0
- package/lib/website/mirrordaily/block-renderer/embedded-code-block.js +88 -0
- package/lib/website/mirrordaily/block-renderer/image-block.js +108 -0
- package/lib/website/mirrordaily/block-renderer/info-box-block.js +86 -0
- package/lib/website/mirrordaily/block-renderer/side-index-block.js +90 -0
- package/lib/website/mirrordaily/block-renderer/slideshow-block.js +150 -0
- package/lib/website/mirrordaily/block-renderer/table-block.js +408 -0
- package/lib/website/mirrordaily/block-renderer-fn.js +151 -0
- package/lib/website/mirrordaily/draft-editor.js +972 -0
- package/lib/website/mirrordaily/entity-decorator.js +27 -0
- package/lib/website/mirrordaily/index.js +16 -0
- package/lib/website/mirrordaily/selector/align-selector.js +71 -0
- package/lib/website/mirrordaily/selector/audio-selector.js +283 -0
- package/lib/website/mirrordaily/selector/image-selector.js +451 -0
- package/lib/website/mirrordaily/selector/pagination.js +82 -0
- package/lib/website/mirrordaily/selector/post-selector.js +321 -0
- package/lib/website/mirrordaily/selector/search-box.js +46 -0
- package/lib/website/mirrordaily/selector/video-selector.js +326 -0
- package/lib/website/mirrordaily/shared-style/index.js +17 -0
- package/lib/website/mirrordaily/theme/index.js +28 -0
- package/lib/website/mirrormedia/draft-editor.js +1 -5
- package/lib/website/readr/draft-editor.js +126 -92
- package/lib/website/readr/selector/align-selector.js +3 -3
- package/lib/website/readr/selector/audio-selector.js +4 -2
- package/lib/website/readr/selector/image-selector.js +16 -9
- package/lib/website/readr/selector/post-selector.js +4 -2
- package/lib/website/readr/selector/video-selector.js +4 -2
- package/package.json +3 -2
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultMarginTop = exports.defaultMarginBottom = void 0;
|
|
7
|
+
|
|
8
|
+
var _styledComponents = require("styled-components");
|
|
9
|
+
|
|
10
|
+
const defaultMarginTop = (0, _styledComponents.css)`
|
|
11
|
+
margin-top: 32px;
|
|
12
|
+
`;
|
|
13
|
+
exports.defaultMarginTop = defaultMarginTop;
|
|
14
|
+
const defaultMarginBottom = (0, _styledComponents.css)`
|
|
15
|
+
margin-bottom: 32px;
|
|
16
|
+
`;
|
|
17
|
+
exports.defaultMarginBottom = defaultMarginBottom;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.theme = exports.mediaSize = exports.default = void 0;
|
|
7
|
+
const mediaSize = {
|
|
8
|
+
xs: 0,
|
|
9
|
+
sm: 576,
|
|
10
|
+
md: 768,
|
|
11
|
+
lg: 960,
|
|
12
|
+
xl: 1200,
|
|
13
|
+
xxl: 1400
|
|
14
|
+
};
|
|
15
|
+
exports.mediaSize = mediaSize;
|
|
16
|
+
const theme = {
|
|
17
|
+
breakpoint: {
|
|
18
|
+
xs: `@media (min-width: ${mediaSize.xs}px)`,
|
|
19
|
+
sm: `@media (min-width: ${mediaSize.sm}px)`,
|
|
20
|
+
md: `@media (min-width: ${mediaSize.md}px)`,
|
|
21
|
+
lg: `@media (min-width: ${mediaSize.lg}px)`,
|
|
22
|
+
xl: `@media (min-width: ${mediaSize.xl}px)`,
|
|
23
|
+
xxl: `@media (min-width: ${mediaSize.xxl}px)`
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.theme = theme;
|
|
27
|
+
var _default = theme;
|
|
28
|
+
exports.default = _default;
|
|
@@ -547,7 +547,7 @@ class RichTextEditor extends _react.default.Component {
|
|
|
547
547
|
styles['backgroundColor'] = styleName.split(_const.CUSTOM_STYLE_PREFIX_BACKGROUND_COLOR)[1];
|
|
548
548
|
}
|
|
549
549
|
|
|
550
|
-
return styles
|
|
550
|
+
return styles;
|
|
551
551
|
}, {});
|
|
552
552
|
};
|
|
553
553
|
toggleEnlarge = () => {
|
|
@@ -697,10 +697,6 @@ class RichTextEditor extends _react.default.Component {
|
|
|
697
697
|
href: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css",
|
|
698
698
|
rel: "stylesheet",
|
|
699
699
|
type: "text/css"
|
|
700
|
-
}), /*#__PURE__*/_react.default.createElement("link", {
|
|
701
|
-
href: "https://storage.googleapis.com/static-readr-tw-dev/cdn/draft-js/rich-editor.css",
|
|
702
|
-
rel: "stylesheet",
|
|
703
|
-
type: "text/css"
|
|
704
700
|
}), /*#__PURE__*/_react.default.createElement("link", {
|
|
705
701
|
href: "https://cdnjs.cloudflare.com/ajax/libs/draft-js/0.11.7/Draft.css",
|
|
706
702
|
rel: "stylesheet",
|
|
@@ -120,42 +120,53 @@ const buttonStyle = (0, _styledComponents.css)`
|
|
|
120
120
|
align-items: center;
|
|
121
121
|
height: 40px;
|
|
122
122
|
|
|
123
|
-
cursor: ${
|
|
124
|
-
|
|
123
|
+
cursor: ${({
|
|
124
|
+
readOnly
|
|
125
|
+
}) => {
|
|
126
|
+
if (readOnly) {
|
|
125
127
|
return 'not-allowed';
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
return 'pointer';
|
|
129
131
|
}};
|
|
130
|
-
color: ${
|
|
131
|
-
|
|
132
|
+
color: ${({
|
|
133
|
+
readOnly,
|
|
134
|
+
isActive
|
|
135
|
+
}) => {
|
|
136
|
+
if (readOnly) {
|
|
132
137
|
return '#c1c7d0';
|
|
133
138
|
}
|
|
134
139
|
|
|
135
|
-
if (
|
|
140
|
+
if (isActive) {
|
|
136
141
|
return '#3b82f6';
|
|
137
142
|
}
|
|
138
143
|
|
|
139
144
|
return '#6b7280';
|
|
140
145
|
}};
|
|
141
146
|
border: solid 1px
|
|
142
|
-
${
|
|
143
|
-
|
|
147
|
+
${({
|
|
148
|
+
readOnly,
|
|
149
|
+
isActive
|
|
150
|
+
}) => {
|
|
151
|
+
if (readOnly) {
|
|
144
152
|
return '#c1c7d0';
|
|
145
153
|
}
|
|
146
154
|
|
|
147
|
-
if (
|
|
155
|
+
if (isActive) {
|
|
148
156
|
return '#3b82f6';
|
|
149
157
|
}
|
|
150
158
|
|
|
151
159
|
return '#6b7280';
|
|
152
160
|
}};
|
|
153
|
-
box-shadow: ${
|
|
154
|
-
|
|
161
|
+
box-shadow: ${({
|
|
162
|
+
readOnly,
|
|
163
|
+
isActive
|
|
164
|
+
}) => {
|
|
165
|
+
if (readOnly) {
|
|
155
166
|
return 'unset';
|
|
156
167
|
}
|
|
157
168
|
|
|
158
|
-
if (
|
|
169
|
+
if (isActive) {
|
|
159
170
|
return 'rgba(38, 132, 255, 20%) 0px 1px 4px ';
|
|
160
171
|
}
|
|
161
172
|
|
|
@@ -163,8 +174,10 @@ const buttonStyle = (0, _styledComponents.css)`
|
|
|
163
174
|
}};
|
|
164
175
|
transition: box-shadow 100ms linear;
|
|
165
176
|
|
|
166
|
-
display: ${
|
|
167
|
-
|
|
177
|
+
display: ${({
|
|
178
|
+
isDisabled
|
|
179
|
+
}) => {
|
|
180
|
+
if (isDisabled) {
|
|
168
181
|
return 'none';
|
|
169
182
|
}
|
|
170
183
|
|
|
@@ -173,35 +186,44 @@ const buttonStyle = (0, _styledComponents.css)`
|
|
|
173
186
|
`;
|
|
174
187
|
const longFormButtonStyle = (0, _styledComponents.css)`
|
|
175
188
|
${buttonStyle}
|
|
176
|
-
color: ${
|
|
177
|
-
|
|
189
|
+
color: ${({
|
|
190
|
+
readOnly,
|
|
191
|
+
isActive
|
|
192
|
+
}) => {
|
|
193
|
+
if (readOnly) {
|
|
178
194
|
return '#c1c7d0';
|
|
179
195
|
}
|
|
180
196
|
|
|
181
|
-
if (
|
|
197
|
+
if (isActive) {
|
|
182
198
|
return '#ED8B00';
|
|
183
199
|
}
|
|
184
200
|
|
|
185
201
|
return '#6b7280';
|
|
186
202
|
}};
|
|
187
203
|
border: solid 1px
|
|
188
|
-
${
|
|
189
|
-
|
|
204
|
+
${({
|
|
205
|
+
readOnly,
|
|
206
|
+
isActive
|
|
207
|
+
}) => {
|
|
208
|
+
if (readOnly) {
|
|
190
209
|
return '#c1c7d0';
|
|
191
210
|
}
|
|
192
211
|
|
|
193
|
-
if (
|
|
212
|
+
if (isActive) {
|
|
194
213
|
return '#ED8B00';
|
|
195
214
|
}
|
|
196
215
|
|
|
197
216
|
return '#FECC85';
|
|
198
217
|
}};
|
|
199
|
-
box-shadow: ${
|
|
200
|
-
|
|
218
|
+
box-shadow: ${({
|
|
219
|
+
readOnly,
|
|
220
|
+
isActive
|
|
221
|
+
}) => {
|
|
222
|
+
if (readOnly) {
|
|
201
223
|
return 'unset';
|
|
202
224
|
}
|
|
203
225
|
|
|
204
|
-
if (
|
|
226
|
+
if (isActive) {
|
|
205
227
|
return 'rgba(237, 139, 0, 0.5) 0px 1px 4px';
|
|
206
228
|
}
|
|
207
229
|
|
|
@@ -225,13 +247,14 @@ const CustomLinkButton = (0, _styledComponents.default)(_link.LinkButton)`
|
|
|
225
247
|
`;
|
|
226
248
|
|
|
227
249
|
function createButtonWithoutProps(referenceComponent, isLongForm = false, additionalCSS = ``) {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
250
|
+
const component = referenceComponent;
|
|
251
|
+
return isLongForm ? (0, _styledComponents.default)(component)`
|
|
252
|
+
${longFormButtonStyle}
|
|
253
|
+
${additionalCSS}
|
|
254
|
+
` : (0, _styledComponents.default)(component)`
|
|
255
|
+
${buttonStyle}
|
|
256
|
+
${additionalCSS}
|
|
257
|
+
`;
|
|
235
258
|
}
|
|
236
259
|
|
|
237
260
|
const CustomEnlargeButton = createButtonWithoutProps(_enlarge.EnlargeButton, false, `color: #999`);
|
|
@@ -342,7 +365,9 @@ const TextEditorWrapper = _styledComponents.default.div`
|
|
|
342
365
|
const DraftEditorContainer = _styledComponents.default.div`
|
|
343
366
|
position: relative;
|
|
344
367
|
margin-top: 4px;
|
|
345
|
-
${
|
|
368
|
+
${({
|
|
369
|
+
isEnlarged
|
|
370
|
+
}) => isEnlarged ? (0, _styledComponents.css)`
|
|
346
371
|
position: fixed;
|
|
347
372
|
width: 100%;
|
|
348
373
|
height: 100%;
|
|
@@ -354,7 +379,9 @@ const DraftEditorContainer = _styledComponents.default.div`
|
|
|
354
379
|
background: rgba(0, 0, 0, 0.5);
|
|
355
380
|
` : ''}
|
|
356
381
|
${DraftEditorWrapper} {
|
|
357
|
-
${
|
|
382
|
+
${({
|
|
383
|
+
isEnlarged
|
|
384
|
+
}) => isEnlarged ? (0, _styledComponents.css)`
|
|
358
385
|
width: 100%;
|
|
359
386
|
height: 100%;
|
|
360
387
|
padding: 0 1rem 0;
|
|
@@ -362,20 +389,26 @@ const DraftEditorContainer = _styledComponents.default.div`
|
|
|
362
389
|
` : ''}
|
|
363
390
|
}
|
|
364
391
|
${DraftEditorControls} {
|
|
365
|
-
${
|
|
392
|
+
${({
|
|
393
|
+
isEnlarged
|
|
394
|
+
}) => isEnlarged ? (0, _styledComponents.css)`
|
|
366
395
|
position: sticky;
|
|
367
396
|
top: 0;
|
|
368
397
|
z-index: 12;
|
|
369
398
|
` : ''}
|
|
370
399
|
}
|
|
371
400
|
${DraftEditorControlsWrapper} {
|
|
372
|
-
${
|
|
401
|
+
${({
|
|
402
|
+
isEnlarged
|
|
403
|
+
}) => isEnlarged ? (0, _styledComponents.css)`
|
|
373
404
|
overflow: auto;
|
|
374
405
|
padding-bottom: 0;
|
|
375
406
|
` : ''}
|
|
376
407
|
}
|
|
377
408
|
${TextEditorWrapper} {
|
|
378
|
-
${
|
|
409
|
+
${({
|
|
410
|
+
isEnlarged
|
|
411
|
+
}) => isEnlarged ? (0, _styledComponents.css)`
|
|
379
412
|
max-width: 100%;
|
|
380
413
|
min-height: 100vh;
|
|
381
414
|
padding-bottom: 0;
|
|
@@ -418,10 +451,10 @@ class RichTextEditor extends _react.default.Component {
|
|
|
418
451
|
|
|
419
452
|
if (newState) {
|
|
420
453
|
this.onChange(newState);
|
|
421
|
-
return
|
|
454
|
+
return 'handled';
|
|
422
455
|
}
|
|
423
456
|
|
|
424
|
-
return
|
|
457
|
+
return 'not-handled';
|
|
425
458
|
};
|
|
426
459
|
handleReturn = event => {
|
|
427
460
|
if (_draftJs.KeyBindingUtil.isSoftNewlineEvent(event)) {
|
|
@@ -447,7 +480,7 @@ class RichTextEditor extends _react.default.Component {
|
|
|
447
480
|
this.onChange(newEditorState);
|
|
448
481
|
}
|
|
449
482
|
|
|
450
|
-
return;
|
|
483
|
+
return null;
|
|
451
484
|
}
|
|
452
485
|
|
|
453
486
|
return (0, _draftJs.getDefaultKeyBinding)(e);
|
|
@@ -537,7 +570,7 @@ class RichTextEditor extends _react.default.Component {
|
|
|
537
570
|
break;
|
|
538
571
|
|
|
539
572
|
case 'atomic':
|
|
540
|
-
if ((_entity$getData = entity.getData()) !== null && _entity$getData !== void 0 && _entity$getData.alignment) {
|
|
573
|
+
if (entity !== null && entity !== void 0 && (_entity$getData = entity.getData()) !== null && _entity$getData !== void 0 && _entity$getData.alignment) {
|
|
541
574
|
// support all atomic block to set alignment
|
|
542
575
|
result += ' ' + entity.getData().alignment;
|
|
543
576
|
}
|
|
@@ -574,7 +607,7 @@ class RichTextEditor extends _react.default.Component {
|
|
|
574
607
|
entityKey,
|
|
575
608
|
entityData
|
|
576
609
|
}) => {
|
|
577
|
-
if (entityKey) {
|
|
610
|
+
if (entityKey && entityData) {
|
|
578
611
|
const oldContentState = this.props.editorState.getCurrentContent();
|
|
579
612
|
const newContentState = oldContentState.replaceEntityData(entityKey, entityData);
|
|
580
613
|
this.onChange(_draftJs.EditorState.set(this.props.editorState, {
|
|
@@ -594,19 +627,22 @@ class RichTextEditor extends _react.default.Component {
|
|
|
594
627
|
// and `props.blockProps.onEditFinish` in the custom block components.
|
|
595
628
|
|
|
596
629
|
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
630
|
+
const extendedAtomicBlockObj = Object.assign({}, atomicBlockObj, {
|
|
631
|
+
props: {
|
|
632
|
+
onEditStart,
|
|
633
|
+
onEditFinish,
|
|
634
|
+
getMainEditorReadOnly: () => this.state.readOnly,
|
|
635
|
+
renderBasicEditor: propsOfBasicEditor => {
|
|
636
|
+
return /*#__PURE__*/_react.default.createElement(RichTextEditor, _extends({}, propsOfBasicEditor, {
|
|
637
|
+
disabledButtons: disabledButtonsOnBasicEditor
|
|
638
|
+
}));
|
|
639
|
+
}
|
|
605
640
|
}
|
|
606
|
-
};
|
|
641
|
+
});
|
|
642
|
+
return extendedAtomicBlockObj;
|
|
643
|
+
} else {
|
|
644
|
+
return atomicBlockObj;
|
|
607
645
|
}
|
|
608
|
-
|
|
609
|
-
return atomicBlockObj;
|
|
610
646
|
};
|
|
611
647
|
|
|
612
648
|
render() {
|
|
@@ -637,15 +673,11 @@ class RichTextEditor extends _react.default.Component {
|
|
|
637
673
|
return /*#__PURE__*/_react.default.createElement(_styledComponents.ThemeProvider, {
|
|
638
674
|
theme: _theme.default
|
|
639
675
|
}, /*#__PURE__*/_react.default.createElement(DraftEditorContainer, {
|
|
640
|
-
isEnlarged: isEnlarged
|
|
676
|
+
isEnlarged: Boolean(isEnlarged)
|
|
641
677
|
}, /*#__PURE__*/_react.default.createElement(DraftEditorWrapper, null, /*#__PURE__*/_react.default.createElement("link", {
|
|
642
678
|
href: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css",
|
|
643
679
|
rel: "stylesheet",
|
|
644
680
|
type: "text/css"
|
|
645
|
-
}), /*#__PURE__*/_react.default.createElement("link", {
|
|
646
|
-
href: "https://storage.googleapis.com/static-readr-tw-dev/cdn/draft-js/rich-editor.css",
|
|
647
|
-
rel: "stylesheet",
|
|
648
|
-
type: "text/css"
|
|
649
681
|
}), /*#__PURE__*/_react.default.createElement("link", {
|
|
650
682
|
href: "https://cdnjs.cloudflare.com/ajax/libs/draft-js/0.11.7/Draft.css",
|
|
651
683
|
rel: "stylesheet",
|
|
@@ -655,30 +687,30 @@ class RichTextEditor extends _react.default.Component {
|
|
|
655
687
|
rel: "stylesheet",
|
|
656
688
|
type: "text/css"
|
|
657
689
|
}), /*#__PURE__*/_react.default.createElement(DraftEditorControls, null, /*#__PURE__*/_react.default.createElement(DraftEditorControlsWrapper, null, /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(BlockStyleControls, {
|
|
690
|
+
readOnly: readOnly,
|
|
658
691
|
disabledButtons: disabledButtons,
|
|
659
692
|
editorState: editorState,
|
|
660
|
-
onToggle: this.toggleBlockType
|
|
661
|
-
readOnly: this.state.readOnly
|
|
693
|
+
onToggle: this.toggleBlockType
|
|
662
694
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(InlineStyleControls, {
|
|
695
|
+
readOnly: readOnly,
|
|
663
696
|
disabledButtons: disabledButtons,
|
|
664
697
|
editorState: editorState,
|
|
665
|
-
onToggle: this.toggleInlineStyle
|
|
666
|
-
readOnly: this.state.readOnly
|
|
698
|
+
onToggle: this.toggleInlineStyle
|
|
667
699
|
})), /*#__PURE__*/_react.default.createElement(EnlargeButtonWrapper, null, /*#__PURE__*/_react.default.createElement(CustomEnlargeButton, {
|
|
668
700
|
onToggle: this.toggleEnlarge,
|
|
669
701
|
isEnlarged: isEnlarged
|
|
670
702
|
}))), /*#__PURE__*/_react.default.createElement(DraftEditorControlsWrapper, null, /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomLinkButton, {
|
|
671
703
|
isDisabled: disabledButtons.includes(buttonNames.link),
|
|
672
704
|
isActive: entityType === 'LINK',
|
|
705
|
+
readOnly: readOnly,
|
|
673
706
|
editorState: editorState,
|
|
674
|
-
onChange: this.onChange
|
|
675
|
-
readOnly: this.state.readOnly
|
|
707
|
+
onChange: this.onChange
|
|
676
708
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomFontColorButton, {
|
|
677
709
|
isDisabled: disabledButtons.includes(buttonNames.fontColor),
|
|
678
710
|
isActive: Object.prototype.hasOwnProperty.call(customStyle, 'color'),
|
|
711
|
+
readOnly: readOnly,
|
|
679
712
|
editorState: editorState,
|
|
680
|
-
onChange: this.onChange
|
|
681
|
-
readOnly: this.state.readOnly
|
|
713
|
+
onChange: this.onChange
|
|
682
714
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomDividerButton, {
|
|
683
715
|
isDisabled: disabledButtons.includes(buttonNames.divider),
|
|
684
716
|
editorState: editorState,
|
|
@@ -686,104 +718,104 @@ class RichTextEditor extends _react.default.Component {
|
|
|
686
718
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomAnnotationButton, {
|
|
687
719
|
isDisabled: disabledButtons.includes(buttonNames.annotation),
|
|
688
720
|
isActive: entityType === 'ANNOTATION',
|
|
721
|
+
readOnly: readOnly,
|
|
689
722
|
editorState: editorState,
|
|
690
723
|
onChange: this.onChange,
|
|
691
|
-
readOnly: this.state.readOnly,
|
|
692
724
|
renderBasicEditor: renderBasicEditor,
|
|
693
725
|
decorators: _entityDecorator.default
|
|
694
726
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomImageButton, {
|
|
695
727
|
isDisabled: disabledButtons.includes(buttonNames.image),
|
|
728
|
+
readOnly: readOnly,
|
|
696
729
|
editorState: editorState,
|
|
697
730
|
onChange: this.onChange,
|
|
698
|
-
readOnly: this.state.readOnly,
|
|
699
731
|
ImageSelector: _imageSelector.ImageSelector
|
|
700
732
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomVideoButton, {
|
|
701
733
|
isDisabled: disabledButtons.includes(buttonNames.video),
|
|
734
|
+
readOnly: readOnly,
|
|
702
735
|
editorState: editorState,
|
|
703
736
|
onChange: this.onChange,
|
|
704
|
-
readOnly: this.state.readOnly,
|
|
705
737
|
VideoSelector: _videoSelector.VideoSelector
|
|
706
738
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomAudioButton, {
|
|
707
739
|
isDisabled: disabledButtons.includes(buttonNames.audio),
|
|
740
|
+
readOnly: readOnly,
|
|
708
741
|
editorState: editorState,
|
|
709
742
|
onChange: this.onChange,
|
|
710
|
-
readOnly: this.state.readOnly,
|
|
711
743
|
AudioSelector: _audioSelector.AudioSelector
|
|
712
744
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomSlideshowButton, {
|
|
713
745
|
isDisabled: disabledButtons.includes(buttonNames.slideshow),
|
|
746
|
+
readOnly: readOnly,
|
|
714
747
|
editorState: editorState,
|
|
715
748
|
onChange: this.onChange,
|
|
716
|
-
readOnly: this.state.readOnly,
|
|
717
749
|
ImageSelector: _imageSelector.ImageSelector
|
|
718
750
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomInfoBoxButton, {
|
|
719
751
|
isDisabled: disabledButtons.includes(buttonNames.infoBox),
|
|
752
|
+
readOnly: readOnly,
|
|
720
753
|
editorState: editorState,
|
|
721
754
|
onChange: this.onChange,
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
decorators: _entityDecorator.default
|
|
755
|
+
renderBasicEditor: renderBasicEditor // decorators={decorators}
|
|
756
|
+
|
|
725
757
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomEmbeddedCodeButton, {
|
|
726
758
|
isDisabled: disabledButtons.includes(buttonNames.embed),
|
|
759
|
+
readOnly: readOnly,
|
|
727
760
|
editorState: editorState,
|
|
728
|
-
onChange: this.onChange
|
|
729
|
-
readOnly: this.state.readOnly
|
|
761
|
+
onChange: this.onChange
|
|
730
762
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomTableButton, {
|
|
731
763
|
isDisabled: disabledButtons.includes(buttonNames.table),
|
|
764
|
+
readOnly: readOnly,
|
|
732
765
|
editorState: editorState,
|
|
733
|
-
onChange: this.onChange
|
|
734
|
-
readOnly: this.state.readOnly
|
|
766
|
+
onChange: this.onChange
|
|
735
767
|
}))), /*#__PURE__*/_react.default.createElement(DraftEditorControlsWrapper, null, /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomAlignLeftButton, {
|
|
736
768
|
isDisabled: disabledButtons.includes(buttonNames.textAlign),
|
|
737
769
|
isActive: (0, _textAlign.getSelectionBlockData)(editorState, 'textAlign') === 'left',
|
|
770
|
+
readOnly: readOnly,
|
|
738
771
|
editorState: editorState,
|
|
739
|
-
onChange: this.onChange
|
|
740
|
-
readOnly: this.state.readOnly
|
|
772
|
+
onChange: this.onChange
|
|
741
773
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomAlignCenterButton, {
|
|
742
774
|
isDisabled: disabledButtons.includes(buttonNames.textAlign),
|
|
743
775
|
isActive: (0, _textAlign.getSelectionBlockData)(editorState, 'textAlign') === 'center',
|
|
776
|
+
readOnly: readOnly,
|
|
744
777
|
editorState: editorState,
|
|
745
|
-
onChange: this.onChange
|
|
746
|
-
readOnly: this.state.readOnly
|
|
778
|
+
onChange: this.onChange
|
|
747
779
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomColorBoxButton, {
|
|
748
780
|
isDisabled: disabledButtons.includes(buttonNames.colorBox),
|
|
781
|
+
readOnly: readOnly,
|
|
749
782
|
editorState: editorState,
|
|
750
783
|
onChange: this.onChange,
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
decorators: _entityDecorator.default
|
|
784
|
+
renderBasicEditor: renderBasicEditor // decorators={decorators}
|
|
785
|
+
|
|
754
786
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomBackgroundColorButton, {
|
|
755
787
|
isDisabled: disabledButtons.includes(buttonNames.backgroundColor),
|
|
756
788
|
isActive: Object.prototype.hasOwnProperty.call(customStyle, 'backgroundColor'),
|
|
789
|
+
readOnly: readOnly,
|
|
757
790
|
editorState: editorState,
|
|
758
|
-
onChange: this.onChange
|
|
759
|
-
readOnly: this.state.readOnly
|
|
791
|
+
onChange: this.onChange
|
|
760
792
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomBGImageButton, {
|
|
761
793
|
isDisabled: disabledButtons.includes(buttonNames.backgroundImage),
|
|
794
|
+
readOnly: readOnly,
|
|
762
795
|
editorState: editorState,
|
|
763
796
|
onChange: this.onChange,
|
|
764
|
-
readOnly: this.state.readOnly,
|
|
765
797
|
ImageSelector: _imageSelector.ImageSelector,
|
|
766
798
|
renderBasicEditor: renderBasicEditor,
|
|
767
799
|
decorators: _entityDecorator.default
|
|
768
800
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomBGVideoButton, {
|
|
769
801
|
isDisabled: disabledButtons.includes(buttonNames.backgroundVideo),
|
|
802
|
+
readOnly: readOnly,
|
|
770
803
|
editorState: editorState,
|
|
771
804
|
onChange: this.onChange,
|
|
772
|
-
readOnly: this.state.readOnly,
|
|
773
805
|
VideoSelector: _videoSelector.VideoSelector,
|
|
774
806
|
renderBasicEditor: renderBasicEditor,
|
|
775
807
|
decorators: _entityDecorator.default
|
|
776
808
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomRelatedPostButton, {
|
|
777
809
|
isDisabled: disabledButtons.includes(buttonNames.relatedPost),
|
|
810
|
+
readOnly: readOnly,
|
|
778
811
|
editorState: editorState,
|
|
779
812
|
onChange: this.onChange,
|
|
780
|
-
readOnly: this.state.readOnly,
|
|
781
813
|
PostSelector: _postSelector.PostSelector
|
|
782
814
|
})), /*#__PURE__*/_react.default.createElement(ButtonGroup, null, /*#__PURE__*/_react.default.createElement(CustomSideIndexButton, {
|
|
783
815
|
isDisabled: disabledButtons.includes(buttonNames.sideIndex),
|
|
816
|
+
readOnly: readOnly,
|
|
784
817
|
editorState: editorState,
|
|
785
|
-
onChange: this.onChange
|
|
786
|
-
readOnly: this.state.readOnly
|
|
818
|
+
onChange: this.onChange
|
|
787
819
|
})))), /*#__PURE__*/_react.default.createElement(TextEditorWrapper, {
|
|
788
820
|
onClick: () => {
|
|
789
821
|
var _this$refs$editor;
|
|
@@ -862,7 +894,9 @@ const blockStyles = [{
|
|
|
862
894
|
const BlockStyleControls = props => {
|
|
863
895
|
const {
|
|
864
896
|
editorState,
|
|
865
|
-
disabledButtons
|
|
897
|
+
disabledButtons,
|
|
898
|
+
onToggle,
|
|
899
|
+
readOnly
|
|
866
900
|
} = props;
|
|
867
901
|
const selection = editorState.getSelection();
|
|
868
902
|
const blockType = editorState.getCurrentContent().getBlockForKey(selection.getStartKey()).getType();
|
|
@@ -871,10 +905,10 @@ const BlockStyleControls = props => {
|
|
|
871
905
|
key: type.label,
|
|
872
906
|
active: type.style === blockType,
|
|
873
907
|
label: type.label,
|
|
874
|
-
onToggle:
|
|
908
|
+
onToggle: onToggle,
|
|
875
909
|
style: type.style,
|
|
876
910
|
icon: type.icon,
|
|
877
|
-
readOnly:
|
|
911
|
+
readOnly: readOnly
|
|
878
912
|
})));
|
|
879
913
|
};
|
|
880
914
|
|
|
@@ -54,15 +54,15 @@ function AlignSelector(props) {
|
|
|
54
54
|
onOpen();
|
|
55
55
|
}
|
|
56
56
|
}, [isOpen]);
|
|
57
|
-
return /*#__PURE__*/_react.default.createElement(_react.
|
|
57
|
+
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(Label, {
|
|
58
58
|
htmlFor: "alignment"
|
|
59
59
|
}, "\u5C0D\u9F4A"), /*#__PURE__*/_react.default.createElement(AlignSelect, {
|
|
60
60
|
id: "alignment" // default align === undefined
|
|
61
61
|
,
|
|
62
|
-
value: options.find(option => option.value === align),
|
|
62
|
+
value: options.find(option => option.value === align) ?? null,
|
|
63
63
|
options: options,
|
|
64
64
|
onChange: option => {
|
|
65
|
-
onChange(option.value);
|
|
65
|
+
onChange((option === null || option === void 0 ? void 0 : option.value) ?? '');
|
|
66
66
|
},
|
|
67
67
|
onMenuOpen: () => setIsOpen(true),
|
|
68
68
|
onMenuClose: () => setIsOpen(false),
|
|
@@ -226,7 +226,7 @@ function AudioSelector(props) {
|
|
|
226
226
|
}
|
|
227
227
|
}, [currentPage, searchText]);
|
|
228
228
|
|
|
229
|
-
let searchResult = /*#__PURE__*/_react.default.createElement(_react.
|
|
229
|
+
let searchResult = /*#__PURE__*/_react.default.createElement(_react.Fragment, null, /*#__PURE__*/_react.default.createElement(AudiosGrids, {
|
|
230
230
|
audios: audioFiles,
|
|
231
231
|
selected: selectedAudios,
|
|
232
232
|
onSelect: onAudiosGridSelect
|
|
@@ -244,7 +244,9 @@ function AudioSelector(props) {
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
if (error) {
|
|
247
|
-
|
|
247
|
+
var _AudiosQuery$loc;
|
|
248
|
+
|
|
249
|
+
searchResult = /*#__PURE__*/_react.default.createElement(ErrorWrapper, null, /*#__PURE__*/_react.default.createElement("h3", null, "Errors occurs in the `audios` query"), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement("b", null, "Message:"), /*#__PURE__*/_react.default.createElement("div", null, error.message), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement("b", null, "Stack:"), /*#__PURE__*/_react.default.createElement("div", null, error.stack), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement("b", null, "Query:"), /*#__PURE__*/_react.default.createElement("pre", null, (_AudiosQuery$loc = AudiosQuery.loc) === null || _AudiosQuery$loc === void 0 ? void 0 : _AudiosQuery$loc.source.body)));
|
|
248
250
|
}
|
|
249
251
|
|
|
250
252
|
return /*#__PURE__*/_react.default.createElement(_modals.DrawerController, {
|