Community icon indicating copy to clipboard operation
Community copied to clipboard

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

Open karalabe opened this issue 7 years ago • 3 comments

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": {}
}

karalabe avatar Jan 08 '18 19:01 karalabe

This is generated from draft-js editor.

kenshyx avatar Jan 08 '18 19:01 kenshyx

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?

karalabe avatar Jan 08 '18 20:01 karalabe

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

kenshyx avatar Jan 08 '18 20:01 kenshyx