Coder Social home page Coder Social logo

jammie / colonel-kurtz Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vigetlabs/colonel-kurtz

0.0 2.0 0.0 9.54 MB

A Block Editor

Home Page: http://colonel-kurtz.netlify.com/

License: MIT License

JavaScript 75.92% Makefile 0.77% CSS 23.03% HTML 0.28%

colonel-kurtz's Introduction

NPM


A block based content editor powered by React. Colonel Kurtz provides a front-end for building pages as a series of blocks, serializing to a JSON data structure.


CircleCI codecov


Colonel Kurtz

Colonel Kurtz is a content editor written in React. It forces content to be broken up into individual types, such as a photo or chunk of text, and provides a user interface for managing those "blocks" of content, reordering them, and even nesting them inside other content.

colonel

Comprehensive documentation can be found under the ./docs directory of this repo. However the content that follows should provide a high level overview:

Data format

Colonel Kurtz can be serialized down to JSON. This structure looks like:

[
  {
    "blocks": [],
    "content": {
      "html": "<p>This is introductory text.<br></p>",
      "text": "This is introductory text."
    },
    "type": "medium"
  },
  {
    "blocks": [
      {
        "blocks": [],
        "content": {
          "src": "http://fizbuz.com/image.jpg"
        },
        "type": "image"
      },
      {
        "blocks": [],
        "content": {
          "html": "<p>Sweet, sweet content.<br></p>",
          "text": "Sweet, sweet content."
        },
        "type": "medium"
      }
    ],
    "type": "section"
  },
  {
    "blocks": [],
    "content": {
      "html": "<p>This is footer text.<br></p>",
      "text": "This is footer text."
    },
    "type": "medium"
  }
]

A block has three important pieces of information:

  1. content: A map of information captured about a block. This could be display settings, rich text, etc.
  2. type: Blocks are created within a given block type (more on this later). This block type has an identifier which is stored at this key (type). This is used to communicate how content should be displayed and how the editor should expose the content for modification.
  3. blocks: A block can have child blocks, stored as an array. The structure of child blocks is exactly the same as top-level blocks.

Configuring

More thorough documentation can be found at ./docs/colonel.md however at a high level, Colonel Kurtz is installed with code loosely following:

import ColonelKurtz from 'colonel-kurtz'
import BlockType from './path/to/react/component'

var container = document.querySelector('#container')
var input = document.querySelector('#input')

var editor = new ColonelKurtz({
  el: container,
  blocks: JSON.parse(input.value),
  blockTypes: [
    {
      id: 'a-block',
      label: 'This is a block',
      component: BlockType
    }
  ]
})

Code At Viget

Visit code.viget.com to see more projects from Viget.

colonel-kurtz's People

Contributors

nhunzaker avatar cwmanning avatar brianjlandau avatar dce avatar h0tl33t avatar dbernheisel avatar dlederle avatar ryanmojo avatar

Watchers

Orang Utan avatar James Cloos avatar

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.