Skip to content

A PHP implementation of Facebook's Draft.js library.

License

Notifications You must be signed in to change notification settings

thesnews/draft-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Draft.php

A simple library to handle the content state of Draft.js in the backend.

Latest Version on Packagist Software License HHVM Status Build Status Total Downloads

Usage

use Draft\ContentState;
use Draft\Encoding;

$rawState = json_decode('{"entityMap":{"0":{"type":"LINK","mutability":"MUTABLE","data":{"url":"/","rel":null,"title":"hi","extra":"foo"}}},"blocks":[{"key":"8r91j","text":"a","type":"unstyled","depth":0,"inlineStyleRanges":[{"offset":0,"length":1,"style":"ITALIC"}],"entityRanges":[{"offset":0,"length":1,"key":0}]}]}', true);

$contentBlocks = Encoding::convertFromRaw($rawState);
$contentState = ContentState::createFromBlockArray($contentBlocks);

var_dump($contentState);

Inspiration

Many thanks to the Draft.js team for the initial inspiration that became the groundworks for the library.

About

A PHP implementation of Facebook's Draft.js library.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages