nterms/yii2-redactor-charts 问题修复 & 功能扩展

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

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

nterms/yii2-redactor-charts

Composer 安装命令:

composer require nterms/yii2-redactor-charts

包简介

An asset bundle to use chart.js plugin for Imperavi Redactor

README 文档

README

A Chart.js plugin for Imperavi Redactor WYSIWYG editor. This plugin enables creating and inserting Bar, Line and Radar type charts to the content edited with Redactor.

Latest Stable Version Total Downloads Latest Unstable Version License

Prerequisites

This plugin works only on Imperavi Redactor WYSIWYG editor. You may use Redactor by directly loading redactor.js and redactor.css or useing some Yii2 extension. There are few yii2 extensions developed for integrating Redactor with your Yii2 project. This plugin does not depend on any specific extension. Theoretically it should work with all of those extensions. Here is a list of yii2-redactor extension I could find. Its up to your choice to use one suits for you.

Please find the usage instructions for each of the above extensions below under Usage section.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist nterms/yii2-redactor-charts "*"

or add

"nterms/yii2-redactor-charts": "*"

to the require section of your composer.json file.

Usage

Register the asset bundle with your view. In case you register the asset bundle in your view file:

\nterms\redactor\charts\ChartsRedactorPluginAsset::register($this);

Now enable the charts plugin when you initialize Redactor. In JavaScript:

$('#textarea').redactor({
    plugins: ['charts'],
});

Use with asofter/yii2-imperavi-redactor - Tested

Register the ChartsRedactorPluginAsset asset bundle as shown above and enable the plugin:

yii\imperavi\Widget::widget([
    'options' => [
        'lang' => 'ru',
    ],
    'plugins' => [
        'charts',
    ]
]);

In case the plugin is not loaded. Check the order of the JavaScript files loded on your page. You can simply set the charts plugin related asset files load after the widget assets by adding following to your application configuration. On your web.php add:

'assetManager' => [
    'bundles' => [
        'nterms\redactor\charts\ChartsRedactorPluginAsset' => [
            'depends' => [
                'yii\imperavi\ImperaviRedactorAsset',
                'nterms\redactor\charts\ChartjsAsset',
            ],
        ],
    ],
],

This indicates that ChartsRedactorPluginAsset asset bundle depends on asset bundle of the widget, making it load assets in proper order. Make sure you add nterms\redactor\charts\ChartjsAsset to the list as this overwrites the original list.

Use with yiidoc/yii2-redactor - Not tested

Register the ChartsRedactorPluginAsset asset bundle as shown above and enable the plugin:

<?= \yii\redactor\widgets\Redactor::widget([
    'model' => $model,
    'attribute' => 'body',
    'plugins' => ['charts'],
]) ?>

In case the plugin is not loaded. Check the order of the JavaScript files loded on your page. You can simply set the charts plugin related asset files load after the widget assets by adding following to your application configuration. On your web.php add:

'assetManager' => [
    'bundles' => [
        'nterms\redactor\charts\ChartsRedactorPluginAsset' => [
            'depends' => [
                'yii\redactor\widgets\RedactorAsset',
                'nterms\redactor\charts\ChartjsAsset',
            ],
        ],
    ],
],

This indicates that ChartsRedactorPluginAsset asset bundle depends on asset bundle of the widget, making it load assets in proper order. Make sure you add nterms\redactor\charts\ChartjsAsset to the list as this overwrites the original list.

Use with vova07/yii2-imperavi-widget - Not tested

Register the ChartsRedactorPluginAsset asset bundle as shown above and enable the plugin:

echo \vova07\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'ru',
        'minHeight' => 200,
        'plugins' => [
            'charts',
        ]
    ]
]);

In case the plugin is not loaded. Check the order of the JavaScript files loded on your page. You can simply set the charts plugin related asset files load after the widget assets by adding following to your application configuration. On your web.php add:

'assetManager' => [
    'bundles' => [
        'nterms\redactor\charts\ChartsRedactorPluginAsset' => [
            'depends' => [
                'vova07\imperavi\Asset',
                'nterms\redactor\charts\ChartjsAsset',
            ],
        ],
    ],
],

This indicates that ChartsRedactorPluginAsset asset bundle depends on asset bundle of the widget, making it load assets in proper order. Make sure you add nterms\redactor\charts\ChartjsAsset to the list as this overwrites the original list.

Known Issues

This plugin is still at basic level and deliver only a limited set of features comes with Chart.js. And there are some missing UX features which I'm planing to develop soon. Here is list of known issues:

  • Does not support Pie and Doughnut graphs.
  • Generated charts are inserted into the Redactor in image format, hence once inserted charts cannot be edited.
  • Closing the modal box will clear the data entered so far.

License

MIT

nterms/yii2-redactor-charts 适用场景与选型建议

nterms/yii2-redactor-charts 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 27 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 10 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「extension」 「yii」 「Redactor」 「yii2」 「chartjs」 「yii 2」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 nterms/yii2-redactor-charts 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 nterms/yii2-redactor-charts 我们能提供哪些服务?
定制开发 / 二次开发

基于 nterms/yii2-redactor-charts 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-09