AKASHAorg / Community

Community
https://akasha.world
124 stars 9 forks source link

If the first paragraph is an image, an extra empty block is prepended to the entry #84

Open karalabe opened 6 years ago

karalabe commented 6 years ago

The floating market entry from natgeo contains the following draft-part0 (QmTk5JTrZsqDfDzF24P72fxLVaCj7WpYpDNEM3X6AExHnn). The first block here is (imho) useless and a bug that it is added.

{
    "blocks": [
        {
            "data": {},
            "depth": 0,
            "entityRanges": [],
            "inlineStyleRanges": [],
            "key": "59vka",
            "text": "",
            "type": "unstyled"
        },
        {
            "data": {
                "caption": "PHOTOGRAPH BY SINA FALKER, NATIONAL GEOGRAPHIC YOUR SHOT",
                "files": {
                    "md": {
                        "height": 466,
                        "src": "QmaStcwSrk2NufscZSXdF7JnEfPEcRfNwApCM7CCkgnSUf",
                        "width": 700
                    },
                    "sm": {
                        "height": 426,
                        "src": "QmTsWMwbQNwWonEAfgXmjsgJ6VimyipvmgHakCJHWn4m1U",
                        "width": 640
                    },
                    "xl": {
                        "height": 853,
                        "src": "QmbgB1SVBiR7tdPjcYCQ63xC2B81ibdkn2inQDDVKzrUdx",
                        "width": 1280
                    },
                    "xs": {
                        "height": 213,
                        "src": "QmW1i3a3KAMYEPUNZVfNL8i9Qmm79XrherHEP74zMZf7D6",
                        "width": 320
                    },
                    "xxl": {
                        "height": 1279,
                        "src": "QmWobYBtDVRKcwTNZJVysTxZkTfmoKoGe4mksq7pVq52zN",
                        "width": 1920
                    }
                },
                "imgId": "8f6226c1-e01f-4c0c-b272-1d48fc23606b",
                "licence": "CC BY",
                "media": "md",
                "termsAccepted": true,
                "type": "image"
            },
            "depth": 0,
            "entityRanges": [],
            "inlineStyleRanges": [],
            "key": "dtnj6",
            "text": "",
            "type": "atomic"
        },
        {
            "data": {},
            "depth": 0,
            "entityRanges": [],
            "inlineStyleRanges": [],
            "key": "5k9hu",
            "text": "At the Lok Baintan Floating Market in Indonesia, as many as one hundred boats meet up before sunrise, as they have for 500 years. While the boats float down the river, the women steering them trade products like fresh fruit, vegetables, cakes and meat.",
            "type": "unstyled"
        },
        {
            "data": {},
            "depth": 0,
            "entityRanges": [],
            "inlineStyleRanges": [],
            "key": "88nsv",
            "text": "https://www.nationalgeographic.com/photography/photo-of-the-day/2017/12/indonesia-floating-market-boats/",
            "type": "unstyled"
        }
    ],
    "entityMap": {}
}
kenshyx commented 6 years ago

This is generated from draft-js editor.

karalabe commented 6 years ago

That's some funky messed up format ;P Wouldn't it make more sense to use an editor that can generate markdown, so the final content is semi usable from other applications too?

kenshyx commented 6 years ago

We can use something like https://github.com/sstur/draft-js-utils/tree/master/packages/draft-js-export-markdown to generate the markdown from draft-js