React JS:多行文字/图片输入

Background: When we write medium story (https://medium.com/new-story), it takes multi line input and each line can be either text or image.

我正在尝试编写类似的React组件,并且我有以下想法。

保留两个数组,一个用于图像,一个用于文本。数组中的每个元素都将包含行号和内容。 输入文本后,添加到文本数组中,否则添加到图像数组中。

在两条现有线之间插入线/图像时,请相应地调整两个数组。

让我知道你的想法吗?