@kids-reporter/draft-editor 0.2.1 → 0.3.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/lib/block-renderer-fn.js +72 -0
- package/lib/block-renderers/atomic-block.js +5 -0
- package/lib/block-renderers/blockquote.js +94 -0
- package/lib/buttons/blockquote.js +167 -0
- package/lib/buttons/image.js +1 -1
- package/lib/buttons/selector/align-selector.js +1 -1
- package/lib/buttons/slideshow.js +1 -1
- package/lib/draft-editor.js +15 -11
- package/package.json +2 -2
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.atomicBlockRenderer = atomicBlockRenderer;
|
|
7
|
+
|
|
8
|
+
var _blockquote = require("./block-renderers/blockquote");
|
|
9
|
+
|
|
10
|
+
var _draftRenderer = require("@kids-reporter/draft-renderer");
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
EmbeddedCodeInArticleBody,
|
|
14
|
+
ImageInArticleBody,
|
|
15
|
+
InfoBoxBlock,
|
|
16
|
+
SlideshowInArticleBody
|
|
17
|
+
} = _draftRenderer.blockRenderers;
|
|
18
|
+
|
|
19
|
+
const AtomicBlock = props => {
|
|
20
|
+
const entity = props.contentState.getEntity(props.block.getEntityAt(0));
|
|
21
|
+
const entityType = entity.getType();
|
|
22
|
+
const entityData = entity.getData();
|
|
23
|
+
|
|
24
|
+
switch (entityType) {
|
|
25
|
+
case 'BLOCKQUOTE':
|
|
26
|
+
{
|
|
27
|
+
return (0, _blockquote.EditableBlockquote)(props);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
case 'IMAGE':
|
|
31
|
+
{
|
|
32
|
+
return ImageInArticleBody({
|
|
33
|
+
data: entityData
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
case 'SLIDESHOW':
|
|
38
|
+
{
|
|
39
|
+
return SlideshowInArticleBody({
|
|
40
|
+
data: entityData
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
case 'EMBEDDEDCODE':
|
|
45
|
+
{
|
|
46
|
+
return EmbeddedCodeInArticleBody({
|
|
47
|
+
data: entityData
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
case 'INFOBOX':
|
|
52
|
+
{
|
|
53
|
+
return InfoBoxBlock({
|
|
54
|
+
data: entityData
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return null;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
function atomicBlockRenderer(block) {
|
|
63
|
+
if (block.getType() === 'atomic') {
|
|
64
|
+
return {
|
|
65
|
+
component: AtomicBlock,
|
|
66
|
+
editable: false,
|
|
67
|
+
props: {}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EditableBlockquote = EditableBlockquote;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
|
|
10
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
11
|
+
|
|
12
|
+
var _blockquote = require("../buttons/blockquote");
|
|
13
|
+
|
|
14
|
+
var _draftRenderer = require("@kids-reporter/draft-renderer");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
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); }
|
|
19
|
+
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
BlockquoteInArticleBody
|
|
24
|
+
} = _draftRenderer.blockRenderers;
|
|
25
|
+
const StyledBlockquote = (0, _styledComponents.default)(BlockquoteInArticleBody)``;
|
|
26
|
+
const EditButton = _styledComponents.default.div`
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
display: none;
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: 50%;
|
|
31
|
+
left: 50%;
|
|
32
|
+
transform: translate(-50%, -50%);
|
|
33
|
+
`;
|
|
34
|
+
const EditableBlock = _styledComponents.default.div`
|
|
35
|
+
position: relative;
|
|
36
|
+
|
|
37
|
+
&:hover {
|
|
38
|
+
${StyledBlockquote} {
|
|
39
|
+
background-color: #f0f0f0;
|
|
40
|
+
opacity: 0.3;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
${EditButton} {
|
|
44
|
+
opacity: 1;
|
|
45
|
+
display: block;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
|
|
50
|
+
function EditableBlockquote(props) {
|
|
51
|
+
const [isInputOpen, setIsInputOpen] = (0, _react.useState)(false);
|
|
52
|
+
const {
|
|
53
|
+
block,
|
|
54
|
+
blockProps,
|
|
55
|
+
contentState
|
|
56
|
+
} = props;
|
|
57
|
+
const {
|
|
58
|
+
onEditStart,
|
|
59
|
+
onEditFinish
|
|
60
|
+
} = blockProps;
|
|
61
|
+
const entityKey = block.getEntityAt(0);
|
|
62
|
+
const entity = contentState.getEntity(entityKey);
|
|
63
|
+
const data = entity.getData();
|
|
64
|
+
|
|
65
|
+
const onInputChange = inputValue => {
|
|
66
|
+
// close `BlockquoteInput`
|
|
67
|
+
setIsInputOpen(false);
|
|
68
|
+
onEditFinish({
|
|
69
|
+
entityKey,
|
|
70
|
+
entityData: inputValue
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_blockquote.BlockquoteInput, {
|
|
75
|
+
isOpen: isInputOpen,
|
|
76
|
+
onCancel: () => {
|
|
77
|
+
setIsInputOpen(false);
|
|
78
|
+
onEditFinish();
|
|
79
|
+
},
|
|
80
|
+
onConfirm: onInputChange,
|
|
81
|
+
inputValue: data
|
|
82
|
+
}), /*#__PURE__*/_react.default.createElement(EditableBlock, null, /*#__PURE__*/_react.default.createElement(StyledBlockquote, {
|
|
83
|
+
data: data
|
|
84
|
+
}), /*#__PURE__*/_react.default.createElement(EditButton, {
|
|
85
|
+
onClick: () => {
|
|
86
|
+
// call `onEditStart` prop as we are trying to update the blockquote entity
|
|
87
|
+
onEditStart(); // open `BlockquoteInput`
|
|
88
|
+
|
|
89
|
+
setIsInputOpen(true);
|
|
90
|
+
}
|
|
91
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
92
|
+
className: "fa-solid fa-pen"
|
|
93
|
+
}), /*#__PURE__*/_react.default.createElement("span", null, "Modify"))));
|
|
94
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.BlockquoteButton = BlockquoteButton;
|
|
7
|
+
exports.BlockquoteInput = BlockquoteInput;
|
|
8
|
+
|
|
9
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
|
|
11
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
12
|
+
|
|
13
|
+
var _draftJs = require("draft-js");
|
|
14
|
+
|
|
15
|
+
var _modals = require("@keystone-ui/modals");
|
|
16
|
+
|
|
17
|
+
var _fields = require("@keystone-ui/fields");
|
|
18
|
+
|
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
20
|
+
|
|
21
|
+
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); }
|
|
22
|
+
|
|
23
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
|
+
|
|
25
|
+
const Label = _styledComponents.default.label`
|
|
26
|
+
display: block;
|
|
27
|
+
margin: 10px 0;
|
|
28
|
+
font-weight: 600;
|
|
29
|
+
`;
|
|
30
|
+
var BlockquoteType;
|
|
31
|
+
|
|
32
|
+
(function (BlockquoteType) {
|
|
33
|
+
BlockquoteType["borderLeft"] = "border_left";
|
|
34
|
+
BlockquoteType["quoteLeft"] = "quote_left";
|
|
35
|
+
})(BlockquoteType || (BlockquoteType = {}));
|
|
36
|
+
|
|
37
|
+
var BlockquoteLabel;
|
|
38
|
+
|
|
39
|
+
(function (BlockquoteLabel) {
|
|
40
|
+
BlockquoteLabel["borderLeft"] = "\u5DE6\u908A\u6846";
|
|
41
|
+
BlockquoteLabel["quoteLeft"] = "\u5DE6\u5F15\u865F";
|
|
42
|
+
})(BlockquoteLabel || (BlockquoteLabel = {}));
|
|
43
|
+
|
|
44
|
+
const TypeSelectBlock = _styledComponents.default.div`
|
|
45
|
+
margin: 10px 0;
|
|
46
|
+
`;
|
|
47
|
+
|
|
48
|
+
function TypeSelect({
|
|
49
|
+
type,
|
|
50
|
+
options,
|
|
51
|
+
onChange
|
|
52
|
+
}) {
|
|
53
|
+
return /*#__PURE__*/_react.default.createElement(TypeSelectBlock, null, /*#__PURE__*/_react.default.createElement(Label, {
|
|
54
|
+
htmlFor: "blockquoteType"
|
|
55
|
+
}, "\u7248\u578B"), /*#__PURE__*/_react.default.createElement(_fields.Select, {
|
|
56
|
+
value: options.find(option => option.value === type) || null,
|
|
57
|
+
options: options,
|
|
58
|
+
onChange: option => {
|
|
59
|
+
onChange(option.value);
|
|
60
|
+
}
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function BlockquoteInput({
|
|
65
|
+
isOpen,
|
|
66
|
+
onConfirm,
|
|
67
|
+
onCancel,
|
|
68
|
+
inputValue
|
|
69
|
+
}) {
|
|
70
|
+
const [inputValueState, setInputValueState] = (0, _react.useState)(inputValue);
|
|
71
|
+
|
|
72
|
+
const confirmInput = () => {
|
|
73
|
+
onConfirm(inputValueState);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
return /*#__PURE__*/_react.default.createElement(_modals.DrawerController, {
|
|
77
|
+
isOpen: isOpen
|
|
78
|
+
}, /*#__PURE__*/_react.default.createElement(_modals.Drawer, {
|
|
79
|
+
title: `Insert Embedded Code` //isOpen={toShowInput}
|
|
80
|
+
,
|
|
81
|
+
actions: {
|
|
82
|
+
cancel: {
|
|
83
|
+
label: 'Cancel',
|
|
84
|
+
action: onCancel
|
|
85
|
+
},
|
|
86
|
+
confirm: {
|
|
87
|
+
label: 'Confirm',
|
|
88
|
+
action: confirmInput
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}, /*#__PURE__*/_react.default.createElement(TypeSelect, {
|
|
92
|
+
type: inputValueState.type,
|
|
93
|
+
options: [{
|
|
94
|
+
label: BlockquoteLabel.borderLeft,
|
|
95
|
+
value: BlockquoteType.borderLeft
|
|
96
|
+
}, {
|
|
97
|
+
label: BlockquoteLabel.quoteLeft,
|
|
98
|
+
value: BlockquoteType.quoteLeft
|
|
99
|
+
}],
|
|
100
|
+
onChange: blockquoteType => {
|
|
101
|
+
setInputValueState({
|
|
102
|
+
type: blockquoteType,
|
|
103
|
+
text: inputValueState.text
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}), /*#__PURE__*/_react.default.createElement(_fields.TextArea, {
|
|
107
|
+
onChange: e => setInputValueState({
|
|
108
|
+
type: inputValueState.type,
|
|
109
|
+
text: e.target.value
|
|
110
|
+
}),
|
|
111
|
+
placeholder: "\u5F15\u8A00\u6587\u5B57",
|
|
112
|
+
type: "text",
|
|
113
|
+
value: inputValueState.text,
|
|
114
|
+
style: {
|
|
115
|
+
marginBottom: '30px'
|
|
116
|
+
}
|
|
117
|
+
})));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function BlockquoteButton(props) {
|
|
121
|
+
const {
|
|
122
|
+
editorState,
|
|
123
|
+
onChange,
|
|
124
|
+
className
|
|
125
|
+
} = props;
|
|
126
|
+
const [isInputOpen, setIsInputOpen] = (0, _react.useState)(false);
|
|
127
|
+
|
|
128
|
+
const promptForInput = () => {
|
|
129
|
+
setIsInputOpen(true);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
const onInputChange = inputValue => {
|
|
133
|
+
const contentState = editorState.getCurrentContent();
|
|
134
|
+
const contentStateWithEntity = contentState.createEntity('BLOCKQUOTE', 'IMMUTABLE', inputValue);
|
|
135
|
+
const entityKey = contentStateWithEntity.getLastCreatedEntityKey();
|
|
136
|
+
|
|
137
|
+
const newEditorState = _draftJs.EditorState.set(editorState, {
|
|
138
|
+
currentContent: contentStateWithEntity
|
|
139
|
+
}); // The third parameter here is a space string, not an empty string
|
|
140
|
+
// If you set an empty string, you will get an error: Unknown DraftEntity key: null
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
onChange(_draftJs.AtomicBlockUtils.insertAtomicBlock(newEditorState, entityKey, ' '));
|
|
144
|
+
setIsInputOpen(false);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
const onInputCancel = () => {
|
|
148
|
+
setIsInputOpen(false);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isInputOpen && /*#__PURE__*/_react.default.createElement(BlockquoteInput, {
|
|
152
|
+
isOpen: isInputOpen,
|
|
153
|
+
onConfirm: onInputChange,
|
|
154
|
+
onCancel: onInputCancel,
|
|
155
|
+
inputValue: {
|
|
156
|
+
type: BlockquoteType.borderLeft,
|
|
157
|
+
text: ''
|
|
158
|
+
}
|
|
159
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
160
|
+
onClick: () => {
|
|
161
|
+
promptForInput();
|
|
162
|
+
},
|
|
163
|
+
className: className
|
|
164
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
165
|
+
className: "fas fa-quote-left"
|
|
166
|
+
})));
|
|
167
|
+
}
|
package/lib/buttons/image.js
CHANGED
|
@@ -37,7 +37,7 @@ function ImageButton(props) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
const contentState = editorState.getCurrentContent();
|
|
40
|
-
const contentStateWithEntity = contentState.createEntity('
|
|
40
|
+
const contentStateWithEntity = contentState.createEntity('IMAGE', 'IMMUTABLE', { ...(selected === null || selected === void 0 ? void 0 : selected.image),
|
|
41
41
|
desc: selected === null || selected === void 0 ? void 0 : selected.desc,
|
|
42
42
|
alignment: align
|
|
43
43
|
});
|
|
@@ -59,7 +59,7 @@ function AlignSelector(props) {
|
|
|
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
65
|
onChange(option.value);
|
package/lib/buttons/slideshow.js
CHANGED
|
@@ -35,7 +35,7 @@ function SlideshowButton(props) {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
const contentState = editorState.getCurrentContent();
|
|
38
|
-
const contentStateWithEntity = contentState.createEntity('
|
|
38
|
+
const contentStateWithEntity = contentState.createEntity('SLIDESHOW', 'IMMUTABLE', {
|
|
39
39
|
alignment: align,
|
|
40
40
|
delay,
|
|
41
41
|
images: selected.map(ele => {
|
package/lib/draft-editor.js
CHANGED
|
@@ -18,10 +18,14 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
|
18
18
|
|
|
19
19
|
var _draftJs = require("draft-js");
|
|
20
20
|
|
|
21
|
+
var _blockRendererFn = require("./block-renderer-fn");
|
|
22
|
+
|
|
21
23
|
var _draftRenderer = require("@kids-reporter/draft-renderer");
|
|
22
24
|
|
|
23
25
|
var _annotation = require("./buttons/annotation");
|
|
24
26
|
|
|
27
|
+
var _blockquote = require("./buttons/blockquote");
|
|
28
|
+
|
|
25
29
|
var _embeddedCode = require("./buttons/embedded-code");
|
|
26
30
|
|
|
27
31
|
var _enlarge = require("./buttons/enlarge");
|
|
@@ -131,6 +135,9 @@ const CustomButton = _styledComponents.default.div`
|
|
|
131
135
|
const CustomAnnotationButton = (0, _styledComponents.default)(_annotation.AnnotationButton)`
|
|
132
136
|
${buttonStyle}
|
|
133
137
|
`;
|
|
138
|
+
const CustomBlockquoteButton = (0, _styledComponents.default)(_blockquote.BlockquoteButton)`
|
|
139
|
+
${buttonStyle}
|
|
140
|
+
`;
|
|
134
141
|
const CustomLinkButton = (0, _styledComponents.default)(_link.LinkButton)`
|
|
135
142
|
${buttonStyle}
|
|
136
143
|
`;
|
|
@@ -331,7 +338,7 @@ class RichTextEditor extends _react.default.Component {
|
|
|
331
338
|
});
|
|
332
339
|
};
|
|
333
340
|
blockRendererFn = block => {
|
|
334
|
-
const atomicBlockObj = (0,
|
|
341
|
+
const atomicBlockObj = (0, _blockRendererFn.atomicBlockRenderer)(block);
|
|
335
342
|
|
|
336
343
|
if (atomicBlockObj) {
|
|
337
344
|
const onEditStart = () => {
|
|
@@ -352,8 +359,8 @@ class RichTextEditor extends _react.default.Component {
|
|
|
352
359
|
const onEditFinish = ({
|
|
353
360
|
entityKey,
|
|
354
361
|
entityData
|
|
355
|
-
}) => {
|
|
356
|
-
if (entityKey) {
|
|
362
|
+
} = {}) => {
|
|
363
|
+
if (entityKey && entityData) {
|
|
357
364
|
const oldContentState = this.props.editorState.getCurrentContent();
|
|
358
365
|
const newContentState = oldContentState.replaceEntityData(entityKey, entityData);
|
|
359
366
|
this.onChange(_draftJs.EditorState.set(this.props.editorState, {
|
|
@@ -422,10 +429,6 @@ class RichTextEditor extends _react.default.Component {
|
|
|
422
429
|
href: "https://storage.googleapis.com/static-readr-tw-dev/cdn/draft-js/rich-editor.css",
|
|
423
430
|
rel: "stylesheet",
|
|
424
431
|
type: "text/css"
|
|
425
|
-
}), /*#__PURE__*/_react.default.createElement("link", {
|
|
426
|
-
href: "https://cdnjs.cloudflare.com/ajax/libs/draft-js/0.11.7/Draft.css",
|
|
427
|
-
rel: "stylesheet",
|
|
428
|
-
type: "text/css"
|
|
429
432
|
}), /*#__PURE__*/_react.default.createElement("link", {
|
|
430
433
|
href: "https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css",
|
|
431
434
|
rel: "stylesheet",
|
|
@@ -449,6 +452,11 @@ class RichTextEditor extends _react.default.Component {
|
|
|
449
452
|
editorState: editorState,
|
|
450
453
|
onChange: this.onChange,
|
|
451
454
|
readOnly: this.state.readOnly
|
|
455
|
+
}), /*#__PURE__*/_react.default.createElement(CustomBlockquoteButton, {
|
|
456
|
+
isDisabled: disabledButtons.includes(buttonNames.blockquote),
|
|
457
|
+
editorState: editorState,
|
|
458
|
+
onChange: this.onChange,
|
|
459
|
+
readOnly: this.state.readOnly
|
|
452
460
|
}), /*#__PURE__*/_react.default.createElement(CustomAnnotationButton, {
|
|
453
461
|
isDisabled: disabledButtons.includes(buttonNames.annotation),
|
|
454
462
|
isActive: entityType === 'ANNOTATION',
|
|
@@ -540,10 +548,6 @@ const blockStyles = [{
|
|
|
540
548
|
label: 'H4',
|
|
541
549
|
style: 'header-four',
|
|
542
550
|
icon: ''
|
|
543
|
-
}, {
|
|
544
|
-
label: 'Blockquote',
|
|
545
|
-
style: 'blockquote',
|
|
546
|
-
icon: 'fas fa-quote-right'
|
|
547
551
|
}, {
|
|
548
552
|
label: 'UL',
|
|
549
553
|
style: 'unordered-list-item',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kids-reporter/draft-editor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@kids-reporter/draft-renderer": "0.
|
|
26
|
+
"@kids-reporter/draft-renderer": "0.3.0",
|
|
27
27
|
"draft-js": "^0.11.7"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|