ueberdosis/prosemirror-php
最新稳定版本:0.3.0
Composer 安装命令:
composer require ueberdosis/prosemirror-php
包简介
Work with ProseMirror JSON in PHP.
关键字:
README 文档
README
🚨 We’ve done a rewrite that you probably want to check out: ueberdosis/tiptap-php
ProseMirror PHP
This package enables you to work with ProseMirror JSON in PHP. Convert it to HTML, or convert HTML to ProseMirror compatible JSON.
Installation
composer require ueberdosis/prosemirror-php
Usage
Convert HTML to ProseMirror JSON:
(new \ProseMirror\ProseMirror)->html('<p>Example Text</p>')->toJson();
or
\ProseMirror\ProseMirror::htmlToJson('<p>Example Text</p>');
Output:
{
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "Example Text"
}
]
}
]
}
Convert ProseMirror JSON to HTML:
(new \ProseMirror\ProseMirror)->json([ 'type' => 'doc', 'content' => [ [ 'type' => 'paragraph', 'content' => [ [ 'type' => 'text', 'text' => 'Example Text', ], ], ], ], ])->toHtml();
or
\ProseMirror\ProseMirror::jsonToHtml([ 'type' => 'doc', 'content' => [ [ 'type' => 'paragraph', 'content' => [ [ 'type' => 'text', 'text' => 'Example Text', ], ], ], ], ]);
Output:
<p>Example Text</p>
Contributing
Pull Requests are welcome.
Credits
Related Packages
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 65.33k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-26