brosua/ckeditor-placeholder
Composer 安装命令:
composer require brosua/ckeditor-placeholder
包简介
Add placeholders to CKEditor in TYPO3 CMS
README 文档
README
This extension adds a placeholder wizard to CKEditor.
Installation
- Install the extension with composer from
composer req brosua/ckeditor-placeholder
- Add a preset for rte_ckeditor or override the default one (as below). Add the placeholder plugin to the toolbar and configure the options.
<?php // EXT:my_ext/ext_localconf.php` $GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['default'] = 'EXT:my_ext/Configuration/RTE/Default.yaml';
# EXT:my_ext/Configuration/RTE/Default.yaml imports: # Import default RTE config (for example) - { resource: "EXT:rte_ckeditor/Configuration/RTE/Default.yaml" } # Import the placeholder plugin configuration - { resource: 'EXT:ckeditor_placeholder/Configuration/RTE/PlaceholderPlugin.yaml' } editor: config: toolbar: items: - '|' - placeholder placeholder: options: - label: 'Placeholder foo' value: 'bar'
- Enable RTE config preset (e.g.
default)
# Page TSConfig
RTE.default.preset = default
-
Include extension typscript
-
Create a event listener to add custom placeholders
<?php declare(strict_types=1); namespace Vendor\MyExt\EventListener; use Brosua\CkeditorPlaceholder\Event\RteReplacePlaceholderEvent; use TYPO3\CMS\Core\Attribute\AsEventListener; #[AsEventListener( identifier: 'my-ext/rte-replace-placeholder', )] class RteReplacePlaceholderListener { public function __invoke(RteReplacePlaceholderEvent $event): void { $key = $event->getPlaceholderKey(); if ($key === 'bar') { $event->setContent('My custom content'); } } }
Warning
You have to deal with caching issues yourself, e.g. when using the logged in user name as placeholder value.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2026-07-10