1. Go to this page and download the library: Download craftcms/ckeditor library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
craftcms / ckeditor example snippets
use craft\htmlfield\events\ModifyPurifierConfigEvent;
use craft\ckeditor\Field;
use HTMLPurifier_Config;
use yii\base\Event;
Event::on(
Field::class,
Field::EVENT_MODIFY_PURIFIER_CONFIG,
function(ModifyPurifierConfigEvent $event) {
/** @var HTMLPurifier_Config $config */
$config = $event->config;
// ...
}
);
use craft\ckeditor\helpers\CkeditorConfig;
class Site extends BaseModule
{
public function init(): void
{
parent::init();
// Register a package with toolbar items and multiple plugins
CkeditorConfig::registerFirstPartyPackage(['SpecialCharacters', 'SpecialCharactersEssentials'], ['specialCharacters']);
// Register a package with a single plugin.
CkeditorConfig::registerFirstPartyPackage(['ImageResize']);
}
}
namespace mynamespace\web\assets\tokens;
use craft\ckeditor\web\assets\BaseCkeditorPackageAsset;
class TokensAsset extends BaseCkeditorPackageAsset
{
public $sourcePath = __DIR__ . '/build';
public string $namespace = '@craftcms/ckeditor5-tokens';
public $js = [
['tokens.js', 'type' => 'module']
];
public array $pluginNames = [
'Tokens',
];
public array $toolbarItems = [
'tokens',
];
}