editorjs-social-post-plugin
v1.0.0
Published
A tool for embedding posts from different social media platforms in Editor.js.
Maintainers
Readme
Social Post Plugin for Editor.js
An Editor.js plugin to add Uploaded Posts from different Social Media Platforms such as:
Screenshots
| Twitter Example | Facebook Example |
| --------------- | ---------------- |
|
|
|
| Instagram Example |
| ----------------- |
|
|
Features
- Add posts by pasting its URL and selecting the social media platform.
- Add an optional Caption giving more context about the post.
- A preview of the uploaded social media post is presented.
- Error is thrown if post URL is invalid.
Installation
Install via NPM
Get the package
npm i editorjs-social-post-pluginInclude module at your application
import Gist from 'editorjs-social-post-plugin';Other methods
Manual downloading and connecting
- Download folder
distfrom repository - Add
distfolder to your page. - Import
main.jsfile inside thedistfolder.
Usage
Add the plugin to the tools property of the Editor.js initial config as a new tool.
import SocialPost from 'editorjs-social-post-plugin';
var editor = EditorJS({
...
tools: {
...
socialPost: SocialPost
}
...
});Output data
This Plugin/Tool returns data with following format:
| Field | Type | Description |
| ----- | -------- | ------------------ |
| socialMediaPlatform | string | selected Social Media Platform |
| url | string | URL of the Social Media Post added |
| caption | string | Caption for the post |
Example:
{
"type": "socialPost",
"data": {
"socialMediaPlatform": "Instagram",
"url": "https://www.instagram.com/p/fA9uwTtkSN/",
"caption": "Cats are so cute! <3"
}
}