Code Monkey home page Code Monkey logo

contentful-wysiwyg-editor's Introduction

Contentful WYSIWYG Editor

https://www.contentful.com is a content management platform for web applications, mobile apps and connected devices. It allows you to create, edit & manage content in the cloud and publish it anywhere via powerful API. Contentful offers tools for managing editorial teams and enabling cooperation between organizations.

This extension provides a JSON form editor based on the Summernote library. You can use this extension with 'Text' and 'Symbol' field types.

Getting started with local development

Check you have the requirements needed to use our extensions and have the extensions SDK installed.

Install the dependencies needed with npm install.

Create the extension on Contentful:

contentful-extension create --space-id <space-id>

Serve on http://localhost:3000 using Gulp, automatically watching and reserving any changes:

gulp watch

The same constraints apply to loading unsafe scripts.

Change the Extension Name

If you wish to change the name of the extension that will appear in Contentful, you can do so by editing the extension.json file that is located in the root. If you open the file, you will see a few options like the example below.

{
  "id": "summerNoteEditor",
  "name": "Summernote WYSIWYG Editor",
  "srcdoc": "http://localhost:3000/",
  "fieldTypes": ["Symbol", "Text"]
}

Change the WYSIWYG Settings

You can change the settings of the WYSIWYG for what gets included in the toolbar. The options are available here: http://summernote.org/deep-dive/

The default settings are in /src/app.js as below:

$('.summernote').summernote({
     height: 300, // set editor height
     minHeight: null, // set minimum height of editor
     maxHeight: null, // set maximum height of editor
     focus: true,
     toolbar: [
          ['style', ['bold', 'italic', 'underline', 'clear']],
          ['font', ['strikethrough']],
          ['fontsize', ['fontsize']],
          ['insert',['picture', 'link']],
          ['color', ['color']],
          ['para', ['ul', 'ol', 'paragraph', 'style']],
          ['height', ['height']],
          ['code',['codeview']]
     ],

Using the extension in production

To minimize all dependencies and upload the extension to Contentful for the first time:

$ gulp bundle
# creates `dist` directory and outputs index.min.html in there
$ contentful-extension create --srcdoc ./dist/index.min.html --space-id <space-id>
# uploads the extension to contentful

For any subsequent updates, use this command:

$ gulp bundle
# *updates* `dist` directory and outputs index.min.html in there
$ contentful-extension update --srcdoc ./dist/index.min.html --force --space-id <space-id>
# uploads the extension in contentful

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.