easedevs/yii2-tinymce-widget

适用于 Yii2 的 TinyMCE 小部件。

安装次数: 1,974

依赖项: 0

建议者: 0

安全: 0

星标: 1

关注者: 0

分支: 48

语言:JavaScript

类型:yii2-extension

2.2.0 2024-03-30 02:55 UTC

This package is auto-updated.

Last update: 2024-08-30 17:19:59 UTC


README

Latest Version Software License Total Downloads

渲染一个 TinyMCE WYSIWYG 文本编辑器插件 小部件。

安装

安装此扩展的首选方式是通过 composer

运行以下命令:

composer require easedevs/yii2-tinymce-widget:~2.0

或者

"easedevs/yii2-tinymce-widget": "~2.0"

将以下内容添加到您的应用程序的 composer.json 文件的 require 部分中。

使用方法


use easedevs\tinymce\TinyMce;

<?= $form->field($model, 'text')->widget(TinyMce::className(), [
    'options' => ['rows' => 6],
    'language' => 'es',
    'clientOptions' => [
        'plugins' => [
            "advlist autolink lists link charmap print preview anchor",
            "searchreplace visualblocks code fullscreen",
            "insertdatetime media table contextmenu paste"
        ],
        'toolbar' => "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image"
    ]
]);?>

关于 ClientOptions

请记住,如果您需要向 js 插件的配置中添加javascript,并且需要纯JS,请使用 JsExpression 类。这个类是 Yii 为了这个特定目的而创建的。例如

// Having the following scenario
<script> 
    function jsFunctionToBeCalled() {
        // ...
    }
</script>

<?= $form->field($model, 'content')->widget(TinyMce::className(), [
    'options' => ['rows' => 16],
    'language' => 'en_GB',
    'clientOptions' => 
        // ...
        // this will render the function name without quotes on the configuration options of the plugin
        'file_picker_callback' => new JsExpression('jsFunctionToBeCalled'),
        // ...
    ]
]); ?>

测试

$ phpunit

更多信息

请查看 TinyMCE 插件站点 文档以获取有关其配置选项的更多信息。

贡献

请参阅 CONTRIBUTING 以获取详细信息。

致谢

许可证

The BSD License (BSD)。请参阅 许可证文件 获取更多信息。

2amigOS!
Web 开发从未如此有趣!
www.2amigos.us