froala / wysiwyg-cake
A beautiful WYSIWYG text editor based on HTML5 technology. Cross browser, with mobile support, high performance and Retina Ready modern design.
Installs: 8 537
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 7
Forks: 16
Open Issues: 6
Language:CSS
Type:cakephp-plugin
Requires
- php: >=5.5.9
- cakephp/cakephp: >=3.3.2 <4.0.0
- fortawesome/font-awesome: >=4.4.0
Requires (Dev)
- dev-master
- v4.3.1
- v4.3.0
- v4.2.2
- v4.2.1
- v4.2.0
- v4.1.4
- v4.1.3
- v4.1.2
- v4.1.1
- v4.1.0
- v4.0.19
- v4.0.18
- v4.0.17
- v4.0.16
- v4.0.15
- v4.0.14
- v4.0.13
- v4.0.12
- v4.0.11
- v4.0.10
- v4.0.9
- v4.0.8
- v4.0.7
- v4.0.6
- v4.0.5
- v4.0.4
- v4.0.3
- v4.0.2
- v4.0.1
- v4.0.0
- v3.2.7
- v3.2.6
- v3.2.5
- v3.2.3.x-dev
- v3.2.1
- v3.2.0
- v3.1.0
- v3.0.6
- 3.0.5
- 3.0.4
- 3.0.3
- 3.0.2
- 3.0.1
- 3.0.0
- 3.0.0-rc.2
- 3.0.0-rc.1
- 3.0.0-beta.2
- 3.0.0-beta.1
- v2.x-dev
- v2.9.8
- v2.9.7
- 2.9.5
- 2.9.4
- 2.9.3
- 2.9.2
- 2.9.1
- 2.9.0
- 2.8.5
- 2.8.2
- 2.8.1
- 2.8.0
- 2.7.6
- 2.7.5
- 2.7.4
- 2.7.3
- 2.7.2
- 2.7.0
- 2.6.6
- 2.6.5
- 2.6.4
- 2.6.2
- 2.6.1
- 2.6.0
- dev-QA2911
- dev-QA1810
- dev-QA291122
This package is auto-updated.
Last update: 2024-12-18 11:19:34 UTC
README
CakePHP Plugin for Froala Javascript WYSIWYG Text Editor. For CakePHP >=3.0.
See froala/wysiwyg-cake2 for CakePHP version 2.
About
The purpose of placing Froala WYSIWYG Editor in a plugin is to keep it separate from a themed view, the regular webroot or the app in general, which makes it easier to update and overall follows the idea of keeping the code clean and modular.
Installation
To use Froala WYSIWYG Editor you need to clone git repository:
git clone git://github.com/froala/wysiwyg-cake.git Plugin/Froala
Or if your CakePHP application is setup as a git repository, you can add it as a submodule:
git submodule add git://github.com/froala/wysiwyg-cake.git Plugin/Froala
Or open terminal/command prompt (windows) type composer require froala/wysiwyg-cake
Alternatively, you can download an archive from the master branch on Github and extract the contents to Froala plugin
.
Make sure that you load the plugin routes by adding to your bootstrap file(bootstrap.php) in config folder:
Plugin::loadAll(); or Plugin::load('Froala'); This will load all plugins at once or only the Froala plugin.
Usage
The Froala helper is basically just a convenience helper that allows you to use php and CakePHP conventions to generate the configuration for Froala and as an extra it allows you to load configs.
// Loads Froala Editor javascript also will load all the plugins and css for the plugins <?= $this->Froala->plugin();?> // Will target one specific html selector on which the editor will be init. // Second paramenter is mix can be array/object of options that the Froala Editor will take. <?= $this->Froala->editor('#froala', array('option' => value));?>
How to use the helper
Since CakePHP 3.0 it is necessary to activate the plugin in your application. To do so,
edit app/Config/bootstrap.php
and add the line CakePlugin::load('Froala');
at the
bottom. If you already have CakePlugin::loadAll();
to auto-load all plugins then you may skip this step.
Wherever you want to use it, load it in the controller
open AppController.php (your project/src/controller/AppController) Declare variable public $helpers = array('Froala.Froala');
class AppController extends Controller { ... public $helpers = array('Froala.Froala'); ... }
In the view page (template) add
<?= $this->Froala->editor('#froala-editor'');?>
This is a simple init example with no options for the Froala Editor. Include the below statement in your view template to integrate the plugins in your editor
$this->Froala->plugin(); $this->Froala->editor('selector');
This will instruct Froala to convert the matched element on the page to Froala editor.
A complete list of Froala configuration options are on the website.
Default options
If you want a quick way to configure default values for all the Froala Editors of an application, you could use the 'Froala.editorOptions' configuration.
Here is an example of a line you could have in bootstrap.php
:
Configure::write('Froala.editorOptions', array('height' => '300px'));
It will make all editors to have a 300px height and apply line braker tags. You may want to override this value for a single editor. To do so, just pass the option to the editor() method and it will override the default value.
Usage examples
Example of init using array of options
// '#comment' Represents the html element selector. // 'array()' Represents the list of options that are passed to the editor. $this->Froala->editor('#comment', array('minHeight => '200px', 'maxHeight' => '400px'));
Requirements
- PHP version: PHP 5.2+
License
The CakePHP Froala WYSIWYG Editor
project is under MIT license. However, in order to use WordPress Froala WYSIWYG Editor plugin you should purchase a license for it.
Froala Editor has 3 different licenses for commercial use. For details please see License Agreement.