npm.io
1.0.0 • Published 6 years ago

editorjs-social-post-plugin

Licence
ISC
Version
1.0.0
Deps
1
Size
78 kB
Vulns
0
Weekly
0

Social Post Plugin for Editor.js

An Editor.js plugin to add Uploaded Posts from different Social Media Platforms such as:

  • Twitter
  • Facebook
  • Instagram

Screenshots

Twitter Example Facebook Example
Twitter Example Facebook Example
Instagram 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
  1. Download folder dist from repository
  2. Add dist folder to your page.
  3. Import main.js file inside the dist 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"
  }
}

Keywords