Extend TMS WEB Core with JS Libraries with Andrew: Summernote vs. SunEditor showdown
Last time out, we had a good look at CodeMirror 5, a JavaScript text editor that, among many other things, can be used to edit native HTML. This time out, we’re going to tackle the general topic of editing HTML in TMS WEB Core projects using two very similar JS libraries that both provide a WYSIWYG HTML editing interface – Summernote and SunEditor. And if neither of those are to your liking, there’s also a section at the end about how to convert Markdown text into HTML, using Showdown. Three different ways to tackle the same problem. Motivation Why might you need a WYSIWYG HTML editor in the first place? There are at least a handful of places I can think of where it might (or has) come up in TMS WEB Core projects. RichEditor. As a replacement for any needs that have historically been addressed using typical Windows RichEdit controls. Places where you want users to enter information, but you also want them to be able to use different text colors, bold or italic text, lists, tables, images, links, and so on. While such RichEdit controls have included support for some or all of these kinds of features, a WYSIWYG HTML control can typically do all of this and more, and usually you’re turning off things rather than trying to add editing functionality. Forums. If you have an area within your project where users can discuss things, like in a forum-type environment, this is sometimes a useful thing to have. Markdown is also popular for this kind of thing, and is used to varying degrees in the TMS Support Center and on GitHub, keeping the UI as simple as possible. Documentation. For example, on a settings form, there might be a header at the top that describes some aspects about the settings that are specific to a client. This description is stored as an HTML object in the client’s database and is displayed, if available, instead of the description that might be used by default. Naturally, access to editing these descriptions would be restricted to appropriate people. Or even if it isn’t customer-specific, sometimes storing the documentation in a database like this makes it possible to update the documentation that might be static within the application, but without having to release a new code update to make changes. Landing Pages. Customized web pages that cater to particular customers or marketing events or advertising campaigns. These are just web pages that you track to see how much traffic is being generated by a particular campaign. Or maybe you use them to A/B test what gets more conversions for a particular product. Or something like that. By being able to edit HTML directly within the application, these pages can all be managed from within your application – no need to worry about file access or server configurations or anything like that. Other Content. Sometimes applications have a ‘news feed’ or an ‘about’ page or a ‘contact us page’ or maybe corporate profiles, that kind of thing. Having a built-in HTML editor makes it easy to keep this kind of content up-to-date and also secured in a way that would likely be more difficult if people were editing HTML files in some other application and then uploading them to your server, for […]
