承接 violet88/silverstripe-tinymce-premium 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

violet88/silverstripe-tinymce-premium

最新稳定版本:1.1.1

Composer 安装命令:

composer require violet88/silverstripe-tinymce-premium

包简介

A SilverStripe module for integrating the TinyMCE premium plugins in SilverStripe, including adding JavaScript functions as config options.

README 文档

README

This module provides a way to use your own TinyMCE Cloud API key with SilverStripe TinyMCE fields including the use of using JavaScript as config values.

Requirements

Installation

Install the module using composer.

composer require violet88/silverstripe-tinymce-premium

Configuration

TinyMCE

The module requires a TinyMCE Cloud API key to be configured. Make sure to approve your domains before using the API key. Your API key can be found in the TinyMCE Cloud dashboard.

SilverStripe

Configuration File

Your cloud API key can be configured in the tinymce.yml file.

---
name: tinymce-premium
---

Violet88\TinyMCE\TinyMCEPremiumHandler:
    api_key: # Your TinyMCE Cloud API key

Additionally, you can configure the TinyMCE Premium plugin options in the tinymce.yml file. Don't do this if you don't know what you're doing, the default options are configured to work with SilverStripe 4.

Violet88\TinyMCE\TinyMCEPremiumHandler:
    tinymce_version: 4                      # TinyMCE version
    tinymce_cdn: "https://cdn.tiny.cloud/1" # TinyMCE CDN

Environment Variables

Additionally, you can configure all of the above using environment variables. This is useful if you want to use the same configuration across multiple environments. The environment variables are prefixed with TINYMCE_PREMIUM_ and are all uppercase. The api_key environment variable is required.

TINYMCE_PREMIUM_API_KEY="your-api-key"
TINYMCE_PREMIUM_TINYMCE_VERSION="4"
TINYMCE_PREMIUM_TINYMCE_CDN="https://cdn.tiny.cloud/1"

Environment variables are always prioritized over the configuration file.

Usage

The module can be used in the _config.php file to enable TinyMCE premium plugins and set JavaScript config values.

Enabling premium plugins

Enabling premium plugins is as easy as enabling any other plugin. The following example enables the tinymcespellchecker, advcode and mentions plugins.

$editorConfig = HTMLEditorConfig::get('cms');

if ($editorConfig instanceof TinyMCEConfig) {
    $handler = TinyMCEPremiumHandler::create();

    $editorConfig->enablePlugins([
        'tinymcespellchecker' => $handler->getPluginUrl('tinymcespellchecker'),
        'advcode' => $handler->getPluginUrl('advcode'),
        'mentions' => $handler->getPluginUrl('mentions')
    ]);
}

Setting JavaScript config values

Most of the premium plugins allow you to set callbacks and other JavaScript config values. Since this is not natively supported in the built in PHP based SilverStripe TinyMCE config manager, this module provides a way to set JavaScript config values using the setJsConfig method. The following example sets the mentions plugin config value mentions_fetch to a demo callback.

$editorConfig = HTMLEditorConfig::get('cms');

if ($editorConfig instanceof TinyMCEConfig) {
    $handler = TinyMCEPremiumHandler::create();

    $editorConfig->enablePlugins([
        'mentions' => $handler->getPluginUrl('mentions')
    ]);

    $handler->setJsOptions([
        'mentions_fetch' => <<<JS
            function (query, success) {
                // Fetch your full user list from somewhere
                var users = [
                    { id: '1', name: 'wyatt', fullName: 'Wyatt Wilson' },
                    { id: '2', name: 'gabriel', fullName: 'Gabriel Brown' },
                    { id: '3', name: 'hazel', fullName: 'Hazel Lee' },
                    { id: '4', name: 'owen', fullName: 'Owen Johnson' },
                    { id: '5', name: 'lily', fullName: 'Lily Davis' },
                ];

                users = users.filter(function (user) {
                    return user.name.toLowerCase().indexOf(query.term.toLowerCase()) !== -1;
                });

                window.setTimeout(function () {
                    success(users);
                }, 0);
            }
            JS
    ]);
}

violet88/silverstripe-tinymce-premium 适用场景与选型建议

violet88/silverstripe-tinymce-premium 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 11 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「cms」 「tinymce」 「silverstripe」 「tinymce4」 「premium」 「tinymce5」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 violet88/silverstripe-tinymce-premium 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 violet88/silverstripe-tinymce-premium 我们能提供哪些服务?
定制开发 / 二次开发

基于 violet88/silverstripe-tinymce-premium 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2023-11-03