Skip to content

Commit

Permalink
Merge pull request #106 from Zextras/fix-composer
Browse files Browse the repository at this point in the history
fix: integration composer
  • Loading branch information
gnekoz authored Aug 2, 2022
2 parents a9386a8 + ed0ad0f commit 384cfe7
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/store/integrations/composer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,25 +65,16 @@ const Composer: FC<ComposerProps> = ({
initialValue,
...rest
}) => {
const [content, setContent] = useState(initialValue);

const _onEditorChange = useCallback(
(newContent, editor) => {
setContent(newContent);
onEditorChange?.([
editor.getContent({ format: 'text' }),
editor.getContent({ format: 'html' })
]);
},
[setContent, onEditorChange]
[onEditorChange]
);

useEffect(() => {
if (value) {
setContent(value);
}
}, [value]);

return (
<Container
height="100%"
Expand All @@ -92,7 +83,8 @@ const Composer: FC<ComposerProps> = ({
style={{ overflowY: 'hidden' }}
>
<Editor
value={content}
initialValue={initialValue}
value={value}
init={{
skin_url: `${baseAssetsUrl}/tinymce/skins/ui/oxide`,
content_css: `${baseAssetsUrl}/tinymce/skins/content/default/content.css`,
Expand Down

0 comments on commit 384cfe7

Please sign in to comment.