editorjs-social-post-plugin
v1.0.0
Published
A tool for embedding posts from different social media platforms in Editor.js.
Downloads
857
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-plugin
Include module at your application
import Gist from 'editorjs-social-post-plugin';
Other methods
Manual downloading and connecting
- Download folder
dist
from repository - Add
dist
folder to your page. - Import
main.js
file inside thedist
folder.
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"
}
}