Commit ddadec49 authored by alain's avatar alain 🐙
Browse files

update dependencies, replace wysiwyg editor

parent dca80515
{
"latest": "3.5.2",
"lastUpdateCheck": 1614871713090
}
\ No newline at end of file
import React from 'react';
import PropTypes from 'prop-types';
import CKEditor from '@ckeditor/ckeditor5-react';
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
import styled from 'styled-components';
const Wrapper = styled.div`
.ck-editor__main {
min-height: 200px;
> div {
min-height: 200px;
}
}
`;
const config = {
toolbar: ["undo", "redo", "|", "heading", "|", "bold", "italic", "link", "bulletedList", "numberedList", "|", "indent", "outdent", "|", "blockQuote", "insertTable"],
heading: {
options: [
{ model: "paragraph", title: "Paragraph", class: "ck-heading_paragraph" },
{ model: "heading1", view: "h1", title: "Heading 1", class: "ck-heading_heading1" },
{ model: "heading2", view: "h2", title: "Heading 2", class: "ck-heading_heading2" },
{ model: "heading3", view: "h3", title: "Heading 3", class: "ck-heading_heading3" },
{ model: "heading4", view: "h4", title: "Heading 4", class: "ck-heading_heading4" },
{ model: "small", view: "small", title: "Small", class: "ck-heading_small" }
]
}
}
const Editor = ({ onChange, name, value }) => {
return (
<Wrapper>
<CKEditor
editor={ClassicEditor}
config={config}
data={value}
onChange={(event, editor) => {
const data = editor.getData();
onChange({ target: { name, value: data } });
}}
/>
</Wrapper>
);
};
Editor.propTypes = {
onChange: PropTypes.func.isRequired,
name: PropTypes.string.isRequired,
value: PropTypes.string.isRequired,
};
export default Editor;
\ No newline at end of file
import React from 'react';
import PropTypes from 'prop-types';
import { isEmpty } from 'lodash';
import { Label, InputDescription, InputErrors } from 'strapi-helper-plugin';
import Editor from '../CKEditor';
const WysiwygWithErrors = ({
inputDescription,
errors,
label,
name,
noErrorsDescription,
onChange,
value,
}) => {
let spacer = !isEmpty(inputDescription) ? (
<div style={{ height: '.4rem' }} />
) : (
<div />
);
if (!noErrorsDescription && !isEmpty(errors)) {
spacer = <div />;
}
return (
<div
className="col-12"
style={{
marginBottom: '1.6rem',
fontSize: '1.3rem',
fontFamily: 'Lato',
}}
>
<Label htmlFor={name} message={label} style={{ marginBottom: 10 }} />
<Editor name={name} onChange={onChange} value={value} />
<InputDescription
message={inputDescription}
style={!isEmpty(inputDescription) ? { marginTop: '1.4rem' } : {}}
/>
<InputErrors
errors={(!noErrorsDescription && errors) || []}
name={name}
/>
{spacer}
</div>
);
};
WysiwygWithErrors.defaultProps = {
errors: [],
label: '',
noErrorsDescription: false,
};
WysiwygWithErrors.propTypes = {
errors: PropTypes.array,
inputDescription: PropTypes.oneOfType([
PropTypes.string,
PropTypes.func,
PropTypes.shape({
id: PropTypes.string,
params: PropTypes.object,
}),
]),
label: PropTypes.oneOfType([
PropTypes.string,
PropTypes.func,
PropTypes.shape({
id: PropTypes.string,
params: PropTypes.object,
}),
]),
name: PropTypes.string.isRequired,
noErrorsDescription: PropTypes.bool,
onChange: PropTypes.func.isRequired,
value: PropTypes.string.isRequired,
};
export default WysiwygWithErrors;
\ No newline at end of file
......@@ -11,20 +11,19 @@
},
"devDependencies": {},
"dependencies": {
"@ckeditor/ckeditor5-build-classic": "^21.0.0",
"@ckeditor/ckeditor5-react": "^2.1.0",
"knex": "<0.20.0",
"sqlite3": "latest",
"strapi": "3.1.4",
"strapi-admin": "3.1.4",
"strapi-connector-bookshelf": "3.1.4",
"strapi-plugin-content-manager": "3.1.4",
"strapi-plugin-content-type-builder": "3.1.4",
"strapi-plugin-email": "3.1.4",
"strapi-plugin-graphql": "3.1.4",
"strapi-plugin-upload": "3.1.4",
"strapi-plugin-users-permissions": "3.1.4",
"strapi-utils": "3.1.4"
"knex": "<0.22.0",
"sqlite3": "^5.0.2",
"strapi": "3.5.2",
"strapi-admin": "3.5.2",
"strapi-connector-bookshelf": "3.5.2",
"strapi-plugin-ckeditor5": "^1.7.0",
"strapi-plugin-content-manager": "3.5.2",
"strapi-plugin-content-type-builder": "3.5.2",
"strapi-plugin-email": "3.5.2",
"strapi-plugin-graphql": "3.5.2",
"strapi-plugin-upload": "3.5.2",
"strapi-plugin-users-permissions": "3.5.2",
"strapi-utils": "3.5.2"
},
"author": {
"name": "Alain Otjens | Waag"
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment