定制 3xw/cakephp-tinymce 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

3xw/cakephp-tinymce

最新稳定版本:4.2.2

Composer 安装命令:

composer require 3xw/cakephp-tinymce

包简介

CakePHP utils plugins

README 文档

README

Tinymce 4 for cakephp 4.x

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require 3xw/cakephp-tinymce

In your src/Application.php file

$this->addPlugin(\Trois\Tinymce\Plugin::class, ['boostrap' => true]);

Configuration

At the end of config/boostrap file

Configure::write('Trois/Tinymce.config', ['tinymce']);

With your own configuration, create file config/tinymce.php ex:

<?php
use Cake\Routing\Router;

return [
  'Trois/Tinymce'  => [
    'height' => '500',
    'language' => 'fr_FR',
    'language_url' => 'https://static.3xw.ch/tinymce/lang/fr_FR.js',
    'menubar' => false,
    'plugins' => ['advlist autolink lists link charmap print preview searchreplace visualblocks code fullscreen emoticons insertdatetime table contextmenu paste  code help wordcount'],
    'toolbar'  => 'attachment | insert | undo redo | formatselect | bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist | emoticons | code | removeformat ',
    'block_formats' => 'Paragraphe=p;Titre 1=h1;Titre 2=h2;Titre 3=h3',
    'formats' => [
      'bold' => ['inline'  => 'strong'],
      'italic' => ['inline'  => 'em'],
      'underline' => ['inline'  => 'u'],
      'strikethrough' => ['inline'  => 'del'],
      'lead' => ['block'  => 'p', 'classes'  => 'lead'],
    ],
    'valid_elements' => '*[style],p[style],strong,em,i,u,del,a[href|target],ul,ol,li[style],table,th,td[style],tr,img[src|style|class|alt|width|height]',
    'valid_styles' => ['*' => 'text-align,color'],
    'content_css' => []
  ]
];

Usage

In your view files:

echo $this->element('Trois/Tinymce.tinymce',[
  'field' => 'content',
  'value' => $post->content,
  'init' => [ // optional
    'some_settings' => 'coucou',
    'toolbar'  => 'code | removeformat ', // override settings and add only code & removeformat
]);

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: Vue

其他信息

  • 授权协议: Unknown
  • 更新时间: 2018-11-23