Show HN: A renderless and extendable rich-text editor for Vue.js
github.com
github.com
Every rich text editor I've tried so far, it's been a nightmare to add autocomplete for stuff like mentions and hashtags. I haven't integrated tiptap yet so maybe it's the same, but the code for the demo looks very promising.
Since this is the first public thread I've ready of at least one other person struggling with this (I'm sure there are others), I created this gist of my Vue component in case it helps anyone who want to use Quill instead of tiptap: https://gist.github.com/whatl3y/d1a9fb7bab75c2188b226e902c6f...
> What does renderless mean?
> With renderless components you'll have full control over markup and styling. tiptap doesn't tell you what a menu should look like or where it should be rendered in the DOM. That's all up to you.
I guess what I'm saying is if you're really interested in renderless components it's probably easier to just use React.
I don't agree at all. There are no naming/semantics for doing renderless in React. React has no analogue for "slots" because it's just naturally part of the framework. It's as simple as doing:
<LinkList renderLink={(linkProps) => <div>...</div>} />
No extra terminology to learn, no slot keys, extra attributes, or rendering magic, and definitely not something you need a whole article to explain. <link-list :render-link="(props) => ..." />
The whole idea of renderless is to move beyond this very limited and crude approach for library code where you might need to override only small bits of the logic or all of the logic, depending on your use case. At the moment I can't help but feel you've missed the core ideas of the article and we're discussing completely different points.> The whole idea of renderless is to move beyond this very limited and crude approach for library code where you might need to override only small bits of the logic or all of the logic, depending on your use case
Not at all. For example, react-select does this super seamlessly: https://react-select.com/components
I guess what I'm trying to say is I don't understand why it seems so complicated in Vue.
My current editor is monaco and the format is markdown. Monaco is too heavy, I want something closer to what Medium.com has. This renderless rich-text editor looks perfect. But my backend accepts only markdown ...
And I also need to support math equations ...
Sounds like a niche enough requirement that you'd be better off writing some form of transformation logic for your needs that can produce a markdown approximation from the JSON structure that the editor generates.
Added to the list of HTML editor: https://gist.github.com/manigandham/65543a0bc2bf7006a487
Web Components have definitely failed.
Sometimes I really, really dread this whole "frontend" related churn, tooling, javascript and it's quirks. I looked at Flutter recently wondering - maybe this is the answer? But this probably is just another turn of the wheel, it was attempted already in the past with adobe air/flex and many other projects.
Maybe reason for this is that programming and whole IT is very young craft, mere child's play compared to different industries like for example construction which has thousands years of history, trials, successes and errors.
We keep making this mistake of wanting to use what's available instead of coming together to build something better, so we waste MILLIONS of collective hours because we're dumb.
If such a "universal rich text edit" web component comes out, have web components then succeeded? Then failure isn't such a permanent state as your comment implies, rather an indication of work yet to be done.
Unless you'd like to clarify more, your comment seems to me like you're flinging mud without being able to back it up. What's the reason for that?
Of note, Trix has been using the `customElements` standard since forever: https://github.com/basecamp/trix/
There's also slate, the (old!) tinymce, umm... I know I've at least experimented with a good couple more I can't recall.
And, on the topic of components I wish existed (anywhere - react, vue, angular, etc - anything), I've been searching for a good rich multiselect for a long time! If you know of any please let me know :)
Select2 [1] has been around forever but it's always worked out pretty nicely for me.
It's a jQuery plugin, so it's somewhat out of vogue these days, but it's trivially easy to wrap it in a component to make it play nicely with Vue (in fact, the Vue documentation uses it as the example for writing wrapper components [2]). I imagine something similar can be done with React, Angular, etc., though I'm not too familiar with the process there.
I think (but this is my interpretation) that GP meant to assert by saying "Web Components failed" that no such component will ever come out, because Web Components cannot properly solve that use case. I haven't delved into it deeply, but my intuition is that, indeed, quite a lot of ceremony would be needed to integrate such a component into a larger web app, regardless of whether you use a framework or which one.
https://developer.snapappointments.com/bootstrap-select/exam...
It would also be nice to see details/summary entries and nothing in the toolbar that creates inline CSS things.
Out the box such an editor should create accessible HTML that can be easily styled, with structure to it that would result in a document outline.
I think such an editor could be what a lot of the web needs, to make people wonder why we ever had WYSIWYG backend editors that render nothing like the frontend, e.g. the things you get in Wordpress and other content editors.
WYSIWYG made sense in the 1990's when what you wanted was a printed 'dead tree' page, but we have responsive design now and lots of different screen sizes, so it is getting the structure right that matters more, not just for accessibility but SEO.
Would love details on browser support, though.
Draft JS lacks a few features, notably nested block support (tables) and a schema definition and sanitization. Slate is more focused on providing a nice plugin experience.
On the plus side Draft’s core is battle tested and has just picked up Android support, and has the excellent Draft JS Plugins resource.
Or is web components a third library that is so much better that you don’t need the other two libraries?
Is this the situation where there are too many standards and you can only solve the problem by creating another standard?
There is also a core package of Slate, so it's up to you to build a wrapper for Vue too. Slate is still in beta. That's why I chose to built on top of ProseMirror.