定制 brosua/ckeditor-placeholder 二次开发

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

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

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

  1. Install the extension with composer from
composer req brosua/ckeditor-placeholder
  1. 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'
  1. Enable RTE config preset (e.g. default)
# Page TSConfig
RTE.default.preset = default
  1. Include extension typscript

  2. 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
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: JavaScript

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-07-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固