Skip to content
This repository has been archived by the owner on May 19, 2020. It is now read-only.

Commit

Permalink
Merge pull request #242 from accordproject/dl-update-transform-0.10.0
Browse files Browse the repository at this point in the history
chore(dep): update transform to 0.10.0
  • Loading branch information
DianaLease authored Feb 18, 2020
2 parents a975f46 + d0b7819 commit 6773eb0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 22 deletions.
10 changes: 7 additions & 3 deletions examples/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {

import ReactDOM from 'react-dom';
import { SlateTransformer } from '@accordproject/markdown-slate';
import { Value } from 'slate';

import './index.css';
import MarkdownAsInputEditor from '../../src/MarkdownAsInputEditor';
Expand Down Expand Up @@ -71,7 +72,9 @@ function Demo() {
/**
* Current Slate Value
*/
const [slateValue, setSlateValue] = useState(slateTransformer.fromMarkdown(defaultMarkdown));
const [slateValue, setSlateValue] = useState(
Value.fromJSON(slateTransformer.fromMarkdown(defaultMarkdown))
);
const [markdown, setMarkdown] = useState(defaultMarkdown);

/**
Expand All @@ -85,8 +88,9 @@ function Demo() {
* Called when the Slate Value changes
*/
const onSlateValueChange = useCallback((slateValue) => {
localStorage.setItem('slate-editor-value', JSON.stringify(slateValue.toJSON()));
const markdown = slateTransformer.toMarkdown(slateValue);
const slateJSON = slateValue.toJSON();
localStorage.setItem('slate-editor-value', JSON.stringify(slateJSON));
const markdown = slateTransformer.toMarkdown(slateJSON);
setSlateValue(slateValue);
setMarkdown(markdown);
}, []);
Expand Down
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@
"not op_mini all"
],
"dependencies": {
"@accordproject/markdown-html": "^0.9.10",
"@accordproject/markdown-slate": "^0.9.10",
"@accordproject/markdown-html": "^0.10.0",
"@accordproject/markdown-slate": "^0.10.0",
"@babel/runtime": "^7.8.4",
"css-loader": "^3.2.0",
"immutable": "^3.8.2",
Expand Down
2 changes: 1 addition & 1 deletion src/SlateAsInputEditor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ const SlateAsInputEditor = React.forwardRef((props, ref) => {
const slateTransformer = new SlateTransformer();
// @ts-ignore
const ciceroMark = htmlTransformer.toCiceroMark(transfer.html, 'json');
const { document } = slateTransformer.fromCiceroMark(ciceroMark);
const { document } = Value.fromJSON(slateTransformer.fromCiceroMark(ciceroMark));
editor.insertFragment(document);
return;
}
Expand Down

0 comments on commit 6773eb0

Please sign in to comment.