Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
node_modules/
dist/
coverage/
public/
csp.json
env.json
.env.local
Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@commercetools-uikit/data-table": "^18.4.0",
"@commercetools-uikit/date-input": "^18.4.0",
"@commercetools-uikit/date-time-input": "^18.4.0",
"@commercetools-uikit/dropdown-menu": "^20.0.0",
"@commercetools-uikit/flat-button": "^18.4.0",
"@commercetools-uikit/grid": "^18.4.0",
"@commercetools-uikit/hooks": "^18.4.0",
Expand All @@ -65,6 +66,14 @@
"@dnd-kit/sortable": "^10.0.0",
"@formatjs/cli": "^6.2.7",
"@jest/types": "27.5.1",
"@lexical/code": "^0.32.1",
"@lexical/history": "^0.32.1",
"@lexical/html": "^0.32.1",
"@lexical/link": "^0.32.1",
"@lexical/list": "^0.32.1",
"@lexical/markdown": "^0.32.1",
"@lexical/react": "^0.32.1",
"@lexical/rich-text": "^0.32.1",
"@manypkg/cli": "^0.21.3",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "12.1.5",
Expand All @@ -80,6 +89,7 @@
"jest": "27.5.1",
"jest-runner-eslint": "^2.2.0",
"jest-watch-typeahead": "1.1.0",
"lexical": "^0.32.1",
"lodash": "^4.17.21",
"lodash.omit": "4.5.0",
"msw": "^2.2.3",
Expand Down
4 changes: 4 additions & 0 deletions public/assets/icons/arrow-clockwise.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/assets/icons/arrow-counterclockwise.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/assets/icons/chat-square-quote.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/icons/chevron-down.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/icons/code.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/assets/icons/journal-code.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions public/assets/icons/journal-text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/icons/justify.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/assets/icons/link.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/assets/icons/list-ol.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/icons/list-ul.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/icons/pencil-fill.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/icons/text-center.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/icons/text-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/icons/text-paragraph.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/icons/text-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/icons/type-bold.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/icons/type-h1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/icons/type-h2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/icons/type-h3.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/icons/type-italic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/icons/type-strikethrough.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/assets/icons/type-underline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/components/container-form/attribute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ const typeOptions = [
label: <FormattedMessage {...messages.referenceLabel} />,
value: TYPES.Reference,
},
{
label: <FormattedMessage {...messages.richTextLabel} />,
value: TYPES.RichText,
},
];

type Props = {
Expand Down
5 changes: 5 additions & 0 deletions src/components/container-form/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,4 +187,9 @@ export default defineMessages({
description: 'The error message for required fields',
defaultMessage: 'This field is required. Provide a value.',
},
richTextLabel: {
id: 'Container.form.type.label.richText',
description: 'Label for attributes rich text value',
defaultMessage: 'Rich Text',
},
});
22 changes: 22 additions & 0 deletions src/components/custom-object-form/attribute-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import Spacings from '@commercetools-uikit/spacings';
import { TYPES } from '../../constants';
import nestedStyles from '../container-form/nested-attributes.module.css';
import AttributeField from './attribute-field'; // eslint-disable-line import/no-cycle
import LexicalEditorField from './lexical-editor-field';

type Props = {
type: string;
Expand Down Expand Up @@ -254,6 +255,27 @@ const AttributeInput: FC<Props> = ({
);
}

case TYPES.RichText:
return (
<Spacings.Stack scale="xs">
<LexicalEditorField
name={name}
initialValue={value}
onChange={(fieldName, newValue) => {
onChange({ target: { name: fieldName, value: newValue } });
}}
onBlur={() => {
if (onBlur) {
onBlur({ target: { name } });
}
}}
/>
{touched && errors && (
<ErrorMessage data-testid="field-error-richtext">{errors}</ErrorMessage>
)}
</Spacings.Stack>
);

case TYPES.Object:
return (
<div className={`${nestedStyles.nested}`}>
Expand Down
Loading
Loading