Steem Ultimate Editor poised to replace markdowns with simple buttons to create a post! Creating post shouldn't be so troublesome and requires a significant amount of time on trial and error. What if I tell you, there's a tool that allows you to just click buttons in order to perform some basic and even advance customization to the style of your post? Let's have a look what Steem Ultimate Editor brought to the table this time after an improvement over the last version. Which you can check out here.
** Notice the plus and minus sign indicating changes to texts. So we only need to store these changes and use steemapi.broadcast.comment to post it on top of the same post.
export function isHTML() {
const OPbody = oldPost.body;
var a = document.createElement('div');
a.innerHTML = OPbody;
for (var c = a.childNodes, i = c.length; i--;) {
if (c[i].nodeType == 1) return true;
}
return false;
}
And from here, you need to use any markdown parser to html. Steemit use remarkable but I prefer showdown. But both of them perform well.
Lets say an image regex will look something similar to this :
const imageRegex = />(https?:\/\/(?:[-a-zA-Z0-9._]*[-a-zA-Z0-9])(?::\d{2,5})?(?:[/?#](?:[^\s"'\][()]*[^\s"'\][().,])?(?:(?: \.(?:tiff?|jpe?g|gif|png|svg|ico)|ipfs\/[a-z\d]{40,}))))/gim;
video = /https?:\/\/(?:vimeo.com\/|player.vimeo.com\/video\/)([0-9]+)\/*/g
And then I need to convert it to something recognizable by my editor. For example, an image syntax for my editor will have figure tag and also contenteditable="false" . A link that is embedded will have div class of embed and etc. All changes that is needed to display a post with minimum error. This is of course oversimplification of what I've done. If you want to know more in details, do check out my github :)
Vuejs, HTML, Handlebars, Javascript
-Contact me personally on discord or comment below!