How I put ChatGPT into a WYSIWYG editor

This page summarizes the projects mentioned and recommended in the original post on dev.to

SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • vrite

    Open-source developer content platform

    The process basically came down to figuring out the position and size of the block node, given a selection of an entire top-level node or just its child node (source code):

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  • tiptap

    The headless rich text editor framework for web artisans.

    The buttons had to be absolutely positioned, which required both a custom TipTap extension and tapping deeper into the underlying ProseMirror (both libraries powering the Vrite editor).

  • openai-node

    The official Node.js / Typescript library for the OpenAI API

    Unfortunately, the official Node.js SDK doesn’t support streaming and requires you to use workarounds to get it working, resulting in much more code required, just to connect with the API (source code):

  • fetch-event-source

    A better API for making Event Source requests, with all the features of fetch()

    The EventSource Web API for handling SSEs (built into most modern browsers) unfortunately supports only GET requests, which was quite limiting when a POST request with larger body JSON data was required. As an alternative, you can use the Fetch API or a ready library like Microsoft’s Fetch Event Source.

  • ProseMirror

    The ProseMirror WYSIWYM editor

    The buttons had to be absolutely positioned, which required both a custom TipTap extension and tapping deeper into the underlying ProseMirror (both libraries powering the Vrite editor).

  • marked

    A markdown parser and compiler. Built for speed.

    Again, with streaming enabled, you’ll now receive new tokens as soon as they’re available. Given that OpenAI’s API uses Markdown in its response format, a full message will need to be put together from the incoming tokens and parsed to HTML, as accepted by the replaceContent function. For this purpose, I’ve used the Marked.js parser.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Word-like HTML inline edit with design mode

    1 project | news.ycombinator.com | 13 Oct 2024
  • Testing ViewComponent w/ Capybara

    1 project | dev.to | 20 Aug 2024
  • How to use Cloudflare R2 with Ruby on Rails Active Storage

    2 projects | dev.to | 26 Jun 2023
  • Formatting tags in reviews

    1 project | /r/TheStoryGraph | 22 Jun 2023
  • Managers want to build a Web Rich Text Editor from scratch - Seems like bad idea

    2 projects | /r/ExperiencedDevs | 20 Mar 2023