scrumpy/html-to-prosemirror 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

scrumpy/html-to-prosemirror

最新稳定版本:1.5.0

Composer 安装命令:

composer require scrumpy/html-to-prosemirror

包简介

Takes HTML and outputs ProseMirror compatible JSON.

关键字:

README 文档

README

🚨 We’ve done a rewrite that you probably want to check out: ueberdosis/tiptap-php

HTML to ProseMirror

Integrate Sponsor

Takes HTML and outputs ProseMirror compatible JSON.

Installation

composer require ueberdosis/html-to-prosemirror

Usage

(new \HtmlToProseMirror\Renderer)->render('<p>Example Text</p>')

Output

{
    "type": "doc",
    "content": [
        {
            "type": "paragraph",
            "content": [
                {
                    "type": "text",
                    "text": "Example Text"
                }
            ]
        }
    ]
}

Supported nodes

Supported marks

Custom nodes

Define your custom nodes as PHP classes:

<?php

class CustomNode extends \HtmlToProseMirror\Nodes\Node
{
    protected $markType = 'custom';
    protected $tagName = 'marquee';
}

And register them:

$renderer->addNode(CustomNode::class);

Or overwrite the enabled nodes:

$renderer->withNodes([
    CustomNode::class,
]);

Or overwrite the enabled marks:

$renderer->withMarks([
    Bold::class,
]);

Or replace just one mark or node:

$renderer->replaceNode(
    CodeBlock::class, CustomCodeBlock::class
);

$renderer->replaceMark(
    Bold::class, CustomBold::class
);

Contributing

Pull Requests are welcome.

Credits

Related packages

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 94.72k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 63
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 63
  • Watchers: 5
  • Forks: 17
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-16