@kids-reporter/draft-editor 1.0.1 → 1.0.3
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 +9 -23
- package/lib/block-renderers/blockquote.js +5 -8
- package/lib/block-renderers/embedded-code.js +5 -8
- package/lib/block-renderers/image.js +5 -8
- package/lib/block-renderers/info-box.js +5 -8
- package/lib/block-renderers/slideshow.js +5 -8
- package/lib/block-renderers/styled.js +10 -3
- package/lib/buttons/anchor.js +51 -0
- package/lib/buttons/annotation.js +2 -2
- package/lib/buttons/bg-color.js +1 -1
- package/lib/buttons/bt-names.js +2 -1
- package/lib/buttons/control-buttons.js +160 -0
- package/lib/buttons/index.js +54 -0
- package/lib/buttons/info-box.js +1 -1
- package/lib/buttons/inner-anchor.js +53 -0
- package/lib/buttons/link.js +1 -1
- package/lib/draft-editor.js +113 -452
- package/lib/entity-decorators/anchor.js +112 -0
- package/lib/entity-decorators/inner-anchor.js +110 -0
- package/lib/styled.js +104 -0
- package/package.json +2 -2
- package/lib/buttons/form/array-field.js +0 -30
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.editableAnchorDecorator = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
var _modals = require("@keystone-ui/modals");
|
|
10
|
+
var _fields = require("@keystone-ui/fields");
|
|
11
|
+
var _draftRenderer = require("@kids-reporter/draft-renderer");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
const AnchorWrapper = _styledComponents.default.span`
|
|
16
|
+
display: inline;
|
|
17
|
+
color: #8e8e8e;
|
|
18
|
+
&::before {
|
|
19
|
+
content: '[';
|
|
20
|
+
}
|
|
21
|
+
&::after {
|
|
22
|
+
content: ']';
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
const AnchorEditButton = _styledComponents.default.div`
|
|
26
|
+
display: inline;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
&::before {
|
|
29
|
+
content: '索引:${props => props.anchorLabel !== undefined ? `(${props.anchorLabel}) ` : ''}';
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const StyledTextInput = (0, _styledComponents.default)(_fields.TextInput)`
|
|
33
|
+
margin: 10px;
|
|
34
|
+
`;
|
|
35
|
+
const AnchorLabelEditor = props => {
|
|
36
|
+
const {
|
|
37
|
+
isOpen,
|
|
38
|
+
anchorLabelValue,
|
|
39
|
+
onConfirm,
|
|
40
|
+
onCancel
|
|
41
|
+
} = props;
|
|
42
|
+
const [anchorLabel, setTOCLabel] = (0, _react.useState)(anchorLabelValue);
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(_modals.AlertDialog, {
|
|
44
|
+
title: "\u7DE8\u8F2F\u7D22\u5F15\u986F\u793A\u6587\u5B57",
|
|
45
|
+
isOpen: isOpen,
|
|
46
|
+
actions: {
|
|
47
|
+
cancel: {
|
|
48
|
+
label: 'Cancel',
|
|
49
|
+
action: () => onCancel()
|
|
50
|
+
},
|
|
51
|
+
confirm: {
|
|
52
|
+
label: 'Confirm',
|
|
53
|
+
action: () => onConfirm(anchorLabel)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, /*#__PURE__*/_react.default.createElement(StyledTextInput, {
|
|
57
|
+
placeholder: "\u7D22\u5F15\u5728\u76EE\u9304\u5167\u986F\u793A\u6587\u5B57",
|
|
58
|
+
type: "text",
|
|
59
|
+
value: anchorLabel,
|
|
60
|
+
onChange: e => setTOCLabel(e.target.value)
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
63
|
+
const EditableAnchor = props => {
|
|
64
|
+
var _contentState$getEnti;
|
|
65
|
+
const {
|
|
66
|
+
children,
|
|
67
|
+
contentState,
|
|
68
|
+
entityKey
|
|
69
|
+
} = props;
|
|
70
|
+
const tocContent = props.decoratedText;
|
|
71
|
+
const [isModalOpen, setIsModalOpen] = (0, _react.useState)(false);
|
|
72
|
+
const [anchorLabel, setTOCLabel] = (0, _react.useState)(contentState === null || contentState === void 0 || (_contentState$getEnti = contentState.getEntity(entityKey)) === null || _contentState$getEnti === void 0 || (_contentState$getEnti = _contentState$getEnti.getData()) === null || _contentState$getEnti === void 0 ? void 0 : _contentState$getEnti.anchorLabel);
|
|
73
|
+
(0, _react.useEffect)(() => {
|
|
74
|
+
var _contentState$getEnti2;
|
|
75
|
+
setTOCLabel((_contentState$getEnti2 = contentState.getEntity(entityKey).getData()) === null || _contentState$getEnti2 === void 0 ? void 0 : _contentState$getEnti2.anchorLabel);
|
|
76
|
+
});
|
|
77
|
+
const onTOCLabelChange = labelValue => {
|
|
78
|
+
var _contentState$getEnti3;
|
|
79
|
+
setIsModalOpen(false);
|
|
80
|
+
setTOCLabel(labelValue);
|
|
81
|
+
props.onEditFinish({
|
|
82
|
+
entityKey,
|
|
83
|
+
entityData: {
|
|
84
|
+
anchorKey: contentState === null || contentState === void 0 || (_contentState$getEnti3 = contentState.getEntity(entityKey)) === null || _contentState$getEnti3 === void 0 || (_contentState$getEnti3 = _contentState$getEnti3.getData()) === null || _contentState$getEnti3 === void 0 ? void 0 : _contentState$getEnti3.anchorKey,
|
|
85
|
+
anchorLabel: labelValue
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isModalOpen && /*#__PURE__*/_react.default.createElement(AnchorLabelEditor, {
|
|
90
|
+
isOpen: isModalOpen,
|
|
91
|
+
anchorLabelValue: anchorLabel,
|
|
92
|
+
onConfirm: onTOCLabelChange,
|
|
93
|
+
onCancel: () => {
|
|
94
|
+
setIsModalOpen(false);
|
|
95
|
+
props.onEditFinish();
|
|
96
|
+
}
|
|
97
|
+
}), /*#__PURE__*/_react.default.createElement(AnchorWrapper, null, /*#__PURE__*/_react.default.createElement(AnchorEditButton, {
|
|
98
|
+
anchorLabel: anchorLabel !== tocContent ? anchorLabel : undefined,
|
|
99
|
+
onClick: e => {
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
setIsModalOpen(true);
|
|
102
|
+
props.onEditStart();
|
|
103
|
+
}
|
|
104
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
105
|
+
className: "fas fa-pen"
|
|
106
|
+
})), /*#__PURE__*/_react.default.createElement("span", null, children)));
|
|
107
|
+
};
|
|
108
|
+
const editableAnchorDecorator = {
|
|
109
|
+
strategy: _draftRenderer.findAnchorEntities,
|
|
110
|
+
component: EditableAnchor
|
|
111
|
+
};
|
|
112
|
+
exports.editableAnchorDecorator = editableAnchorDecorator;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.editableInnerAnchorDecorator = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
9
|
+
var _modals = require("@keystone-ui/modals");
|
|
10
|
+
var _fields = require("@keystone-ui/fields");
|
|
11
|
+
var _draftRenderer = require("@kids-reporter/draft-renderer");
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
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); }
|
|
14
|
+
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; }
|
|
15
|
+
const AnchorWrapper = _styledComponents.default.span`
|
|
16
|
+
display: inline;
|
|
17
|
+
color: #8e8e8e;
|
|
18
|
+
&::before {
|
|
19
|
+
content: '[';
|
|
20
|
+
}
|
|
21
|
+
&::after {
|
|
22
|
+
content: ']';
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
const AnchorEditButton = _styledComponents.default.div`
|
|
26
|
+
display: inline;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
&::before {
|
|
29
|
+
content: '索引:${props => props.anchorLabel !== undefined ? `(${props.anchorLabel}) ` : ''}';
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const StyledTextInput = (0, _styledComponents.default)(_fields.TextInput)`
|
|
33
|
+
margin: 10px;
|
|
34
|
+
`;
|
|
35
|
+
const AnchorLabelEditor = props => {
|
|
36
|
+
const {
|
|
37
|
+
isOpen,
|
|
38
|
+
anchorLabelValue,
|
|
39
|
+
onConfirm,
|
|
40
|
+
onCancel
|
|
41
|
+
} = props;
|
|
42
|
+
const [anchorLabel, setTOCLabel] = (0, _react.useState)(anchorLabelValue);
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(_modals.AlertDialog, {
|
|
44
|
+
title: "\u7DE8\u8F2F\u9328\u9EDE\u6587\u5B57(ID): \u6CE8\u610F\uFF01\u540C\u7BC7\u6587\u7AE0ID\u4E0D\u53EF\u91CD\u8907\uFF01",
|
|
45
|
+
isOpen: isOpen,
|
|
46
|
+
actions: {
|
|
47
|
+
cancel: {
|
|
48
|
+
label: 'Cancel',
|
|
49
|
+
action: () => onCancel()
|
|
50
|
+
},
|
|
51
|
+
confirm: {
|
|
52
|
+
label: 'Confirm',
|
|
53
|
+
action: () => onConfirm(anchorLabel)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, /*#__PURE__*/_react.default.createElement(StyledTextInput, {
|
|
57
|
+
placeholder: "\u9328\u9EDE\u6587\u5B57(ID)",
|
|
58
|
+
type: "text",
|
|
59
|
+
value: anchorLabel,
|
|
60
|
+
onChange: e => setTOCLabel(e.target.value)
|
|
61
|
+
}));
|
|
62
|
+
};
|
|
63
|
+
const EditableAnchor = props => {
|
|
64
|
+
var _contentState$getEnti;
|
|
65
|
+
const {
|
|
66
|
+
children,
|
|
67
|
+
contentState,
|
|
68
|
+
entityKey
|
|
69
|
+
} = props;
|
|
70
|
+
const tocContent = props.decoratedText;
|
|
71
|
+
const [isModalOpen, setIsModalOpen] = (0, _react.useState)(false);
|
|
72
|
+
const [anchorID, setAnchorID] = (0, _react.useState)(contentState === null || contentState === void 0 || (_contentState$getEnti = contentState.getEntity(entityKey)) === null || _contentState$getEnti === void 0 || (_contentState$getEnti = _contentState$getEnti.getData()) === null || _contentState$getEnti === void 0 ? void 0 : _contentState$getEnti.anchorID);
|
|
73
|
+
(0, _react.useEffect)(() => {
|
|
74
|
+
var _contentState$getEnti2;
|
|
75
|
+
setAnchorID((_contentState$getEnti2 = contentState.getEntity(entityKey).getData()) === null || _contentState$getEnti2 === void 0 ? void 0 : _contentState$getEnti2.anchorID);
|
|
76
|
+
});
|
|
77
|
+
const onAnchorIDChange = anchorID => {
|
|
78
|
+
setIsModalOpen(false);
|
|
79
|
+
setAnchorID(anchorID);
|
|
80
|
+
props.onEditFinish({
|
|
81
|
+
entityKey,
|
|
82
|
+
entityData: {
|
|
83
|
+
anchorID: anchorID
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, isModalOpen && /*#__PURE__*/_react.default.createElement(AnchorLabelEditor, {
|
|
88
|
+
isOpen: isModalOpen,
|
|
89
|
+
anchorLabelValue: anchorID,
|
|
90
|
+
onConfirm: onAnchorIDChange,
|
|
91
|
+
onCancel: () => {
|
|
92
|
+
setIsModalOpen(false);
|
|
93
|
+
props.onEditFinish();
|
|
94
|
+
}
|
|
95
|
+
}), /*#__PURE__*/_react.default.createElement(AnchorWrapper, null, /*#__PURE__*/_react.default.createElement(AnchorEditButton, {
|
|
96
|
+
anchorLabel: anchorID !== tocContent ? anchorID : undefined,
|
|
97
|
+
onClick: e => {
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
setIsModalOpen(true);
|
|
100
|
+
props.onEditStart();
|
|
101
|
+
}
|
|
102
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
103
|
+
className: "fas fa-pen"
|
|
104
|
+
})), /*#__PURE__*/_react.default.createElement("span", null, children)));
|
|
105
|
+
};
|
|
106
|
+
const editableInnerAnchorDecorator = {
|
|
107
|
+
strategy: _draftRenderer.findAnchorEntities,
|
|
108
|
+
component: EditableAnchor
|
|
109
|
+
};
|
|
110
|
+
exports.editableInnerAnchorDecorator = editableInnerAnchorDecorator;
|
package/lib/styled.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TextEditorWrapper = exports.EnlargeButtonWrapper = exports.DraftEditorWrapper = exports.DraftEditorControlsWrapper = exports.DraftEditorControls = exports.DraftEditorContainer = void 0;
|
|
7
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
8
|
+
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); }
|
|
9
|
+
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; }
|
|
10
|
+
const DraftEditorWrapper = _styledComponents.default.div`
|
|
11
|
+
/* Rich-editor default setting (.RichEditor-root)*/
|
|
12
|
+
background: #fff;
|
|
13
|
+
border: 1px solid #ddd;
|
|
14
|
+
font-family: 'Georgia', serif;
|
|
15
|
+
font-size: 14px;
|
|
16
|
+
padding: 15px;
|
|
17
|
+
|
|
18
|
+
/* Custom setting */
|
|
19
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
|
|
20
|
+
'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji',
|
|
21
|
+
'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
background: rgb(255, 255, 255);
|
|
25
|
+
border-radius: 6px;
|
|
26
|
+
padding: 0 1rem 1rem;
|
|
27
|
+
`;
|
|
28
|
+
exports.DraftEditorWrapper = DraftEditorWrapper;
|
|
29
|
+
const DraftEditorControls = _styledComponents.default.div`
|
|
30
|
+
padding-top: 1rem;
|
|
31
|
+
width: 100%;
|
|
32
|
+
background: rgb(255, 255, 255);
|
|
33
|
+
`;
|
|
34
|
+
exports.DraftEditorControls = DraftEditorControls;
|
|
35
|
+
const DraftEditorControlsWrapper = _styledComponents.default.div`
|
|
36
|
+
width: 100%;
|
|
37
|
+
position: relative;
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: row;
|
|
40
|
+
flex-wrap: wrap;
|
|
41
|
+
padding-right: 45px;
|
|
42
|
+
gap: 2px;
|
|
43
|
+
`;
|
|
44
|
+
exports.DraftEditorControlsWrapper = DraftEditorControlsWrapper;
|
|
45
|
+
const TextEditorWrapper = _styledComponents.default.div`
|
|
46
|
+
/* Rich-editor default setting (.RichEditor-editor)*/
|
|
47
|
+
border-top: 1px solid #ddd;
|
|
48
|
+
cursor: text;
|
|
49
|
+
font-size: 16px;
|
|
50
|
+
margin-top: 10px;
|
|
51
|
+
`;
|
|
52
|
+
exports.TextEditorWrapper = TextEditorWrapper;
|
|
53
|
+
const DraftEditorContainer = _styledComponents.default.div`
|
|
54
|
+
overflow-x: hidden;
|
|
55
|
+
position: relative;
|
|
56
|
+
margin-top: 4px;
|
|
57
|
+
${props => props.isEnlarged ? (0, _styledComponents.css)`
|
|
58
|
+
position: fixed;
|
|
59
|
+
width: 100%;
|
|
60
|
+
height: 100%;
|
|
61
|
+
top: 0;
|
|
62
|
+
left: 0;
|
|
63
|
+
z-index: 30;
|
|
64
|
+
padding-left: 3em;
|
|
65
|
+
padding-right: 3em;
|
|
66
|
+
background: rgba(0, 0, 0, 0.5);
|
|
67
|
+
` : ''}
|
|
68
|
+
${DraftEditorWrapper} {
|
|
69
|
+
${props => props.isEnlarged ? (0, _styledComponents.css)`
|
|
70
|
+
width: 100%;
|
|
71
|
+
height: 100%;
|
|
72
|
+
padding: 0 1rem 0;
|
|
73
|
+
overflow: scroll;
|
|
74
|
+
` : ''}
|
|
75
|
+
}
|
|
76
|
+
${DraftEditorControls} {
|
|
77
|
+
${props => props.isEnlarged ? (0, _styledComponents.css)`
|
|
78
|
+
position: sticky;
|
|
79
|
+
top: 0;
|
|
80
|
+
z-index: 12;
|
|
81
|
+
` : ''}
|
|
82
|
+
}
|
|
83
|
+
${DraftEditorControlsWrapper} {
|
|
84
|
+
${props => props.isEnlarged ? (0, _styledComponents.css)`
|
|
85
|
+
overflow: auto;
|
|
86
|
+
padding-bottom: 0;
|
|
87
|
+
` : ''}
|
|
88
|
+
}
|
|
89
|
+
${TextEditorWrapper} {
|
|
90
|
+
${props => props.isEnlarged ? (0, _styledComponents.css)`
|
|
91
|
+
max-width: 100%;
|
|
92
|
+
min-height: 100vh;
|
|
93
|
+
padding-bottom: 0;
|
|
94
|
+
` : ''}
|
|
95
|
+
}
|
|
96
|
+
`;
|
|
97
|
+
exports.DraftEditorContainer = DraftEditorContainer;
|
|
98
|
+
const EnlargeButtonWrapper = _styledComponents.default.div`
|
|
99
|
+
position: absolute;
|
|
100
|
+
top: 0;
|
|
101
|
+
right: 0;
|
|
102
|
+
margin: 0;
|
|
103
|
+
`;
|
|
104
|
+
exports.EnlargeButtonWrapper = EnlargeButtonWrapper;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kids-reporter/draft-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
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": "
|
|
26
|
+
"@kids-reporter/draft-renderer": "1.0.3",
|
|
27
27
|
"@twreporter/errors": "^1.1.2",
|
|
28
28
|
"draft-js": "^0.11.7"
|
|
29
29
|
},
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.ArrayField = void 0;
|
|
7
|
-
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _button = require("@keystone-ui/button");
|
|
9
|
-
var _fields = require("@keystone-ui/fields");
|
|
10
|
-
var _PlusCircleIcon = require("@keystone-ui/icons/icons/PlusCircleIcon");
|
|
11
|
-
var _core = require("@keystone-ui/core");
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
const ArrayField = function ({
|
|
14
|
-
label
|
|
15
|
-
}) {
|
|
16
|
-
return /*#__PURE__*/_react.default.createElement(_core.Stack, {
|
|
17
|
-
gap: "medium"
|
|
18
|
-
}, label && /*#__PURE__*/_react.default.createElement(_fields.FieldLabel, null, label), /*#__PURE__*/_react.default.createElement(_fields.TextInput, null), /*#__PURE__*/_react.default.createElement(_fields.TextInput, null), /*#__PURE__*/_react.default.createElement(_button.Button, {
|
|
19
|
-
onClick: () => {
|
|
20
|
-
//props.onChange([...props.elements.map(x => ({ key: x.key })), { key: undefined }]);
|
|
21
|
-
},
|
|
22
|
-
tone: "active"
|
|
23
|
-
}, /*#__PURE__*/_react.default.createElement(_core.Stack, {
|
|
24
|
-
gap: "small",
|
|
25
|
-
across: true
|
|
26
|
-
}, /*#__PURE__*/_react.default.createElement(_PlusCircleIcon.PlusCircleIcon, {
|
|
27
|
-
size: "smallish"
|
|
28
|
-
}), " ", /*#__PURE__*/_react.default.createElement("span", null, "Add"))));
|
|
29
|
-
};
|
|
30
|
-
exports.ArrayField = ArrayField;
|