Files
talk/plugins/talk-plugin-rich-text-pell/README.md
T
2018-03-08 19:58:48 -07:00

50 lines
1.8 KiB
Markdown

---
title: talk-plugin-rich-text-pell
permalink: /plugin/talk-plugin-rich-text-pell/
layout: plugin
plugin:
name: talk-plugin-rich-text-pell
depends:
- name: talk-plugin-rich-text
provides:
- Client
---
Enables rich text support client-side by using [Pell](https://github.com/jaredreich/pell).
## Installation
Add `"talk-plugin-rich-text-pell"` to the `plugins.json` in your Talk
installation. Remember to add this in the `client` property since this plugin
only covers the client side. To add server support, please use
[talk-plugin-rich-text](/talk/plugin/talk-plugin-rich-text).
_Note: Ensure that you don't have any other plugins utilizing the
`commentContent` slot, as it would result in duplicate comments._
## How does this work?
This plugin contains 2 important components:
- The Editor (`./components/Editor.js`)
- The Comment Content Renderer (`./components/CommentContent.js`)
The editor component contains the rich text editor. For this particular plugin
we chose [Pell](https://github.com/jaredreich/pell). Pell is the simplest and
smallest WYSIWYG text editor with no dependencies that we could find.
If you check our `index.js` you will notice that we inject this editor in the
`commentBox` slot. We do this to replace the core comment box with this one.
Now, in order to render the new styled comments we need a comment renderer. For
this task we will have to replace our core comment renderer by using the
`commentContent` slot.
If you are not familiar with GraphQL `client/index.js` will look complicated,
but fear not! With those functions we specify what to expect from the server
schema, how to perform optimistic updates and how keep the client store updated
with the latest changes.
We encourage you to see the files and check how easy is to build plugins! If you
have any feedback, please let us know.