Skip to content

Commit 65cef66

Browse files
committed
Fixes and release
1 parent 25c0ff7 commit 65cef66

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

dist/html-to-draftjs.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "html-to-draftjs",
3-
"version": "0.1.0-beta10",
3+
"version": "0.1.0-beta11",
44
"main": "dist/html-to-draftjs.js",
55
"repository": {
66
"type": "git",
@@ -12,7 +12,7 @@
1212
"babel-preset-stage-0": "^6.22.0",
1313
"chai": "^3.5.0",
1414
"draft-js": "^0.10.0",
15-
"draftjs-to-html": "^0.6.3",
15+
"draftjs-to-html": "^0.7.3",
1616
"react": "^15.4.2",
1717
"react-dom": "^15.4.2",
1818
"react-draft-wysiwyg": "^1.10.7",

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Playground extends Component {
2121
const html = '<p>123</p><p></p><img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSvGBbRtzgNfNaHPP9X28Gj6OQF0l6ZaiqgxJlujX5QsE5g35Or18WijxY3" alt="undefined" style="float:none;height: auto;width: auto"/><p>456</p>'
2222
const contentBlock = htmlToDraft(html);
2323
if (contentBlock) {
24-
const contentState = ContentState.createFromBlockArray(contentBlock.contentBlocks);
24+
const contentState = ContentState.createFromBlockArray(contentBlock.contentBlocks, contentBlock.entityMap);
2525
const inputEditorState = EditorState.createWithContent(contentState);
2626
this.state = {
2727
inputEditorState,

src/library/getEntityId.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const getEntityId = (node) => {
1616
entityConfig,
1717
);
1818
} else {
19-
entityConfig.url = node.href;
19+
entityConfig.url = node.getAttribute('href') || node.href;
2020
entityConfig.title = node.innerHTML;
2121
entityConfig.target = node.target;
2222
entityId = Entity.__create(

src/library/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ function genFragment(
4848
entityConfig.alt = node.alt;
4949
entityConfig.height = node.style.height;
5050
entityConfig.width = node.style.width;
51+
if (node.style.float) {
52+
entityConfig.alignment = node.style.float;
53+
}
5154
const entityId = Entity.__create(
5255
'IMAGE',
5356
'MUTABLE',

0 commit comments

Comments
 (0)