Skip to content

Commit

Permalink
Content-Kit -> Mobiledoc Kit
Browse files Browse the repository at this point in the history
  • Loading branch information
mixonic committed Nov 10, 2015
1 parent aef72ba commit a3d31f6
Show file tree
Hide file tree
Showing 67 changed files with 211 additions and 199 deletions.
15 changes: 8 additions & 7 deletions CARDS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Content-Kit / Mobiledoc Cards
## Mobiledoc Cards

Cards are an API supported by
[Content-Kit](https://github.com/bustlelabs/content-kit-editor),
the [Mobiledoc format](https://github.com/bustlelabs/content-kit-editor/blob/master/MOBILEDOC.md),
[Mobiledoc Kit](https://github.com/bustlelabs/mobiledoc-kit),
the [Mobiledoc format](https://github.com/bustlelabs/mobiledoc-kit/blob/master/MOBILEDOC.md),
the [Mobiledoc DOM Renderer](https://github.com/bustlelabs/mobiledoc-dom-renderer)
and [Mobiledoc HTML Renderer](https://github.com/bustlelabs/mobiledoc-html-renderer).

Expand All @@ -23,18 +23,19 @@ In this minimally viable demo, a `display` hook is defined showing some text.
Given a Mobiledoc referencing `demo` as a card this text would render for that
name.

Cards are executed at runtime by Content-Kit and the renderers. This means
Cards are executed at runtime by a renderer. This means
you must pass any cards you want available to an editor or renderer. See the
documentation for each project on how to do this.

### Available hooks

Between [Content-Kit](https://github.com/bustlelabs/content-kit-editor),
Between the [Mobiledoc Kit](https://github.com/bustlelabs/mobiledoc-kit) provided
editor,
the [Mobiledoc DOM Renderer](https://github.com/bustlelabs/mobiledoc-dom-renderer)
and [Mobiledoc HTML Renderer](https://github.com/bustlelabs/mobiledoc-html-renderer)
there are several hooks a complete card should define.

|Hook|Used by Content-Kit|Used by DOM Renderer|Used by HTML Renderer|
|Hook|Used by Mobiledoc Kit|Used by DOM Renderer|Used by HTML Renderer|
|---|---|---|---|
|`display`||||
|`edit`||||
Expand Down Expand Up @@ -92,7 +93,7 @@ variants of a card in different situations.

### Card Lifecycle

Cards rendered by Content-Kit may move between `edit` and `display` hooks
Cards rendered by the Mobiledoc Kit editor may move between `edit` and `display` hooks
many times after being added (or loaded from a Mobiledoc). The can do this
by calling the functions passed to `env`.

Expand Down
2 changes: 1 addition & 1 deletion MOBILEDOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ prescription for output display.
## Usage

Often Mobiledoc will be used with the
[Content-Kit Editor](https://github.com/bustlelabs/content-kit-editor),
[Mobiledoc Kit](https://github.com/bustlelabs/mobiledoc-kit),
[Mobiledoc DOM Renderer](https://github.com/bustlelabs/mobiledoc-dom-renderer),
and/or [Mobiledoc HTML Renderer](https://github.com/bustlelabs/mobiledoc-html-renderer).

Expand Down
57 changes: 32 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,48 @@
## Mobiledoc-Kit [![Build Status](https://travis-ci.org/bustlelabs/mobiledoc-kit.svg?branch=master)](https://travis-ci.org/bustlelabs/mobiledoc-kit)
## Mobiledoc Kit [![Build Status](https://travis-ci.org/bustlelabs/mobiledoc-kit.svg?branch=master)](https://travis-ci.org/bustlelabs/mobiledoc-kit)

[![Join the chat at https://gitter.im/bustlelabs/content-kit-editor](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bustlelabs/content-kit-editor?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Join the chat at https://gitter.im/bustlelabs/mobiledoc-kit](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/bustlelabs/mobiledoc-kit?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

Content-Kit (WARNING: alpha!!) is a WYSIWYG editor supporting rich content via cards. Try a
demo at [bustlelabs.github.io/content-kit-editor/demo](http://bustlelabs.github.io/content-kit-editor/demo/).
Mobiledoc Kit (WARNING: beta!!) is a library for buildling WYSIWYG editors
supporting rich content via cards. Try a
demo at [bustlelabs.github.io/mobiledoc-kit/demo](http://bustlelabs.github.io/mobiledoc-kit/demo/).

* It makes limited use of Content Editable, the siren-song of doomed web editor
technologies.
* Content-Kit is designed for *rich* content. We call these sections of an
article "cards", and implementing a new one doesn't require an understanding
of Content-Kit internals. Adding a new card takes an afternoon, not several
days.
* Posts are serialized to a JSON payload called **Mobiledoc** instead of to
HTML. Mobiledoc can be rendered for the web, mobile web, or in theory on any
platform. Mobiledoc is portable and fast.
* The editor makes limited use of Content Editable, the siren-song of doomed
web editor technologies.
* Mobiledoc is designed for *rich* content. We call these sections of an
article "cards", and implementing a new one doesn't require an understanding
of Mobiledoc editor internals. Adding a new card takes an afternoon, not several
days.

To learn more about the ideas behind Mobiledoc and the editor (note that the
editor used to be named Content-Kit), see these blog posts:

To learn more about Content-Kit in the abstract,
[read this announcement blog post](http://madhatted.com/2015/7/31/announcing-content-kit-and-mobiledoc).
* [The Content-Kit announcement post](http://madhatted.com/2015/7/31/announcing-content-kit-and-mobiledoc).
* [Building the Content-Kit Editor on Content Editable](https://medium.com/@bantic/building-content-kit-editor-on-contenteditable-99a94871c951)
* [Content-Kit: Programmatic Editing](http://madhatted.com/2015/8/25/content-kit-programmatic-editing)

Content-Kit saves posts to
The Mobiledoc kit saves posts to
**[Mobiledoc](https://github.com/bustlelabs/content-kit-editor/blob/master/MOBILEDOC.md)**.

### Usage

The `ContentKit.Editor` class is invoked with an element to render into and
The `Mobiledoc.Editor` class is invoked with an element to render into and
optionally a Mobiledoc to load. For example:

```js
var simpleMobiledoc = {
version: "0.1",
sections: [[], [
[1, "p", [
[[], 0, "Welcome to Content-Kit"]
[[], 0, "Welcome to Mobiledoc"]
]]
]]
};
var element = document.querySelector('#editor');
var options = { mobiledoc: simpleMobiledoc };
var editor = new ContentKit.Editor(options);
var editor = new Mobiledoc.Editor(options);
editor.render(element);
```

Expand Down Expand Up @@ -105,7 +110,7 @@ The available lifecycle hooks are:

### Programmatic Post Editing

A major goal of Content-Kit is to allow complete customization of user
A major goal of the Mobiledoc kit is to allow complete customization of user
interfaces using the editing surface. The programmatic editing API allows
the creation of completely custom interfaces for buttons, hot-keys, and
other interactions.
Expand All @@ -120,18 +125,19 @@ editor.run(postEditor => {
```

It is important that you make changes to posts, sections, and markers through
the `run` and `postEditor` API. This API allows Content-Kit to conserve
the `run` and `postEditor` API. This API allows the Mobiledoc editor to conserve
and better understand changes being made to the post.

For more details on the API of `postEditor`, see the [API documentation](https://github.com/bustlelabs/content-kit-editor/blob/master/src/js/editor/post.js).
For more details on the API of `postEditor`, see the [API documentation](https://github.com/bustlelabs/mobiledoc-kit/blob/master/src/js/editor/post.js).

For more details on the API for the builder, required to create new sections
and markers, see the [builder API](https://github.com/bustlelabs/content-kit-editor/blob/master/src/js/models/post-node-builder.js).
and markers, see the [builder API](https://github.com/bustlelabs/mobiledoc-kit/blob/master/src/js/models/post-node-builder.js).

### Configuring hot keys

Content-Kit allows configuring hot keys and text expansions. For instance, the
hot-key command-B to make selected text bold, is registered internally as:
The Mobiledoc editor allows the configuration of hot keys and text expansions.
For instance, the hot-key command-B to make selected text bold, is registered
internally as:

```javascript
const boldKeyCommand = {
Expand Down Expand Up @@ -228,7 +234,8 @@ Or run headless tests via testem:

#### Demo

There is a demo app that uses content-kit and ember-content-kit in `demo/`. To run the demo:
There is a demo app that uses the Mobiledoc kit via the [ember-mobiledoc-editor](https://github.com/bustlelabs/ember-mobiledoc-editor)
in `demo/`. To run the demo:

* `cd demo/ && npm install && bower install`
* `ember serve` (shut down your broccoli server if it is already running on port 4200)
Expand All @@ -249,6 +256,6 @@ The demo website is hosted at github pages. To publish a new version:
* `npm run deploy-website` - Pushes the `website/` subtree to the `gh-pages`
branch of your `origin` at github

Visit [bustlelabs.github.io/content-kit-editor/demo](http://bustlelabs.github.io/content-kit-editor/demo).
Visit [bustlelabs.github.io/mobiledoc-kit/demo](http://bustlelabs.github.io/mobiledoc-kit/demo).

*Development of Content-Kit was generously funded by [Bustle Labs](http://www.bustle.com/labs). Bustle Labs is the tech team behind the editorial staff at [Bustle](http://www.bustle.com), a fantastic and successful feminist and women’s interest site based in NYC.*
*Development of Mobiledoc and the supporting libraries was generously funded by [Bustle Labs](http://www.bustle.com/labs). Bustle Labs is the tech team behind the editorial staff at [Bustle](http://www.bustle.com), a fantastic and successful feminist and women’s interest site based in NYC.*
2 changes: 1 addition & 1 deletion bin/build-website.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ cp -R demo/dist/* website/demo/
CURRENT_SHA="$(git rev-parse HEAD)"
git add website/
git commit -m "built website from $CURRENT_SHA"
echo "Deployed to http://bustlelabs.github.io/content-kit-editor/demo/"
echo "Deployed to http://bustlelabs.github.io/mobiledoc-kit/demo/"
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "content-kit-editor",
"name": "mobiledoc-kit",
"version": "0.0.0",
"homepage": "https://github.com/bustlelabs/content-kit-editor",
"homepage": "https://github.com/bustlelabs/mobiledoc-kit",
"moduleType": [
"amd",
"es6",
Expand Down
2 changes: 1 addition & 1 deletion broccoli/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = function() {

var srcDir = 'src/css',
mainFile = 'application.less',
outputFile = '/css/content-kit-editor.css';
outputFile = '/css/mobiledoc-kit.css';

tree = less(srcDir, mainFile, outputFile);
return tree;
Expand Down
2 changes: 1 addition & 1 deletion demo/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Content-kit-demo
# Mobiledoc-kit-demo

This README outlines the details of collaborating on this Ember application.
A short introduction of this app could easily go here.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Ember from 'ember';
import { cardsList } from '../mobiledoc-cards/index';

export function contentKitCardsList() {
export function mobiledocCardsList() {
return cardsList;
}

export default Ember.Helper.helper(contentKitCardsList);
export default Ember.Helper.helper(mobiledocCardsList);
6 changes: 3 additions & 3 deletions demo/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Content-Kit Demo</title>
<title>Mobiledoc Editor Demo</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{content-for 'head'}}

<link rel="stylesheet" href="assets/vendor.css">
<link href="http://fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic|Merriweather+Sans:700" rel="stylesheet">
<link rel="stylesheet" href="assets/content-kit-demo.css">
<link rel="stylesheet" href="assets/mobiledoc-kit.css">

{{content-for 'head-footer'}}
</head>
<body>
{{content-for 'body'}}

<script src="assets/vendor.js"></script>
<script src="assets/content-kit-demo.js"></script>
<script src="assets/mobiledoc-kit-demo.js"></script>

{{content-for 'body-footer'}}
</body>
Expand Down
2 changes: 1 addition & 1 deletion demo/app/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ hr {
color: #bf616a;
}

.content-kit-toolbar__button.active {
.mobiledoc-toolbar__button.active {
font-weight: bold;
background-color: aliceblue;
}
4 changes: 2 additions & 2 deletions demo/app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div class="section">
<h1>Content-Kit<span class="headline-note">alpha!</span></h1>
<p class="subheadline">A WYSIWYG editor for rich content</p>
<h1>Mobiledoc<span class="headline-note">beta!</span></h1>
<p class="subheadline">A web-friendly file format for WYSIWYG editors</p>
</div>
<hr>

Expand Down
18 changes: 9 additions & 9 deletions demo/app/templates/index.hbs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<div class="section">
<p>
Content-Kit is a publishing solution designed for both text and
dynamically rendered cards. Posts are serialized into <a href="https://github.com/bustlelabs/content-kit-editor/blob/master/MOBILEDOC.md">Mobiledoc</a>, and
Mobiledoc is a publishing solution designed for both text and
dynamically rendered cards. Posts are serialized into <a href="https://github.com/bustlelabs/mobiledoc-kit/blob/master/MOBILEDOC.md">Mobiledoc</a>, and
rendered to DOM in a reader's browser.
</p>
<p>
Read more on the <a href="https://github.com/bustlelabs/content-kit-editor">content-kit-editor</a>
GitHub repo, or on the <a href="http://madhatted.com/2015/7/31/announcing-content-kit-and-mobiledoc">announcement blog post</a>.
Read more on the <a href="https://github.com/bustlelabs/mobiledoc-kit">mobiledoc-kit</a>
GitHub repo.
</p>
</div>
<div class="section">
Expand All @@ -26,14 +26,14 @@
<option value='inputCard'>Card with Input</option>
<option value='selfieCard'>Selfie Card</option>
</select>
{{#content-kit-editor
{{#mobiledoc-editor
class='post-editor__editor'
mobiledoc=mobiledoc
cards=(content-kit-cards-list)
cards=(mobiledoc-cards-list)
on-change=(action 'didEdit')
as |contentKit|}}
{{content-kit-toolbar contentKit=contentKit}}
{{/content-kit-editor}}
as |editor|}}
{{mobiledoc-toolbar editor=editor}}
{{/mobiledoc-editor}}
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion demo/bower.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "content-kit-demo",
"name": "mobiledoc-kit-demo",
"dependencies": {
"ember": "1.13.7",
"ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3",
Expand Down
4 changes: 2 additions & 2 deletions demo/config/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module.exports = function(environment) {
var ENV = {
modulePrefix: 'content-kit-demo',
modulePrefix: 'mobiledoc-kit-demo',
environment: environment,
baseURL: '/',
locationType: 'auto',
Expand Down Expand Up @@ -40,7 +40,7 @@ module.exports = function(environment) {
}

if (environment === 'production') {
ENV.baseURL = '/content-kit-editor/demo/';
ENV.baseURL = '/mobiledoc-kit/demo/';
}

return ENV;
Expand Down
4 changes: 2 additions & 2 deletions demo/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "content-kit-demo",
"name": "mobiledoc-kit-demo",
"version": "0.0.0",
"description": "Small description for content-kit-demo goes here",
"private": true,
Expand Down Expand Up @@ -32,7 +32,7 @@
"ember-cli-release": "0.2.3",
"ember-cli-sri": "^1.0.3",
"ember-cli-uglify": "^1.2.0",
"ember-content-kit": "^0.1.10",
"ember-mobiledoc-editor": "^0.1.10",
"ember-disable-proxy-controllers": "^1.0.0",
"ember-export-application-global": "^1.0.3",
"mobiledoc-dom-renderer": "^0.1.13"
Expand Down
6 changes: 3 additions & 3 deletions demo/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>ContentKitDemo Tests</title>
<title>MobiledocKitDemo Tests</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

{{content-for 'head'}}
{{content-for 'test-head'}}

<link rel="stylesheet" href="assets/vendor.css">
<link rel="stylesheet" href="assets/content-kit-demo.css">
<link rel="stylesheet" href="assets/mobiledoc-kit-demo.css">
<link rel="stylesheet" href="assets/test-support.css">

{{content-for 'head-footer'}}
Expand All @@ -23,7 +23,7 @@
{{content-for 'test-body'}}
<script src="assets/vendor.js"></script>
<script src="assets/test-support.js"></script>
<script src="assets/content-kit-demo.js"></script>
<script src="assets/mobiledoc-kit-demo.js"></script>
<script src="testem.js"></script>
<script src="assets/test-loader.js"></script>

Expand Down
6 changes: 3 additions & 3 deletions demo/tests/unit/helpers/content-kit-cards-list-test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { contentKitCardsList } from '../../../helpers/content-kit-cards-list';
import { mobiledocCardsList } from '../../../helpers/mobiledoc-cards-list';
import { module, test } from 'qunit';

module('Unit | Helper | content kit cards list');
module('Unit | Helper | mobiledoc cards list');

// Replace this with your real tests.
test('it works', function(assert) {
var result = contentKitCardsList();
var result = mobiledocCardsList();
assert.ok(result instanceof Array);
});
Loading

0 comments on commit a3d31f6

Please sign in to comment.