ubc-web-services/ubc_ckeditor_widgets
Composer 安装命令:
composer require ubc-web-services/ubc_ckeditor_widgets
包简介
A Drupal module to add some common widgets to CKeditor
README 文档
README
A Drupal module to add some common widgets to CKeditor
Working with the javascript
Plugin source should be added to
js/ckeditor5_plugins/{pluginNameDirectory}/src and the build tools expect this
directory to include an index.js file that exports one or more CKEditor 5
plugins. Note that requiring index.js to be inside
{pluginNameDirectory}/src is not a fixed requirement of CKEditor 5 or Drupal,
but a requirement of this starter template that can be changed in
webpack.config.js as needed.
In the module directory, run yarn install to set up the necessary assets. The
initial run of install may take a few minutes, but subsequent builds will be
faster.
After installing dependencies, plugins can be built with yarn build or yarn watch. They will be built to js/build/{pluginNameDirectory}.js. co
Custom Styles
Custom styles can be added to the widget dropdowns via the configuration form at: /admin/config/content/ubc-ckeditor-widgets
Styles per widget
The following style / widget combinations are supported:
| Widget | Background Colour | Padding | Margin | Gap | Shadow | 2 Column Layout | 3 Column Layout | Table Styles | Table Column Width |
|---|---|---|---|---|---|---|---|---|---|
| Accordion | |||||||||
| Accordion Toggle | |||||||||
| Card: Horizontal | ✓ | ✓ | ✓ | ||||||
| Card: Vertical (1) | ✓ | ✓ | ✓ | ||||||
| Card: Vertical (2) | ✓ | ✓ | ✓ | ✓ | |||||
| Card: Vertical (3) | ✓ | ✓ | ✓ | ✓ | |||||
| Colour Box | ✓ | ✓ | ✓ | ✓ | |||||
| Columns (2) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||
| Columns (3) | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | |||
| Columns (4) | ✓ | ✓ | ✓ | ✓ | ✓ | ||||
| Table Class | ✓ | ||||||||
| Table Cell Class | ✓ |
Custom style prefixes
To add custom styles, you must ensure your custom class maintains the following prefixes (.prefix-[customclass]):
| Widget | Required Prefix |
|---|---|
| Background Colour | bg- |
| Gap | gap- |
| Margin | my- |
| Padding | p- |
| Shadow | custom styles not supported |
| 2 Column Layout | align- |
| 3 Column Layout | align- |
| Table Styles | table- |
| Table Column Width | w- |
Adding Custom Style Support to the Theme
There are two parts to this. You need to provide your custom styles to the theme and to the editor.
-
THEME - these styles are added to your main stylesheet - that will be sufficent to have the applied styles reflected correctly.
-
EDITOR - create a separate stylesheet that contains your custom widget styles. To ensure the styles don't leak into your admin theme, it is recommended to that you prefix every style with the class
.ck-editor, ending up with something like.ck-editor .bg-myclass. You can then reference this stylesheet in your [theme].info file like so:
ckeditor5-stylesheets:
- css/customeditorstyles.css
CKEditor 5 widgets
Goals:
- make editor widgets for CKEditor 5 that retain feature parity tothose from CKEditor 4
- CKE4 and CKE5 widgets should exist in one module
- CKE5 widgets from repo #2 and #3 should be moved to repo #1 (can leave repo #2 and #3 as is)
- final markup in CKE5 widgets should be the same as is currently used by the CKE4 widgets
Version 4 widget repos:
- https://github.com/ubc-web-services/ubc_ckeditor_widgets/tree/vanilla-js
- https://github.com/ubc-web-services/ubc-column-options-widget
- https://github.com/ubc-web-services/ubc-color-box-widget
CKE 4 widgets [CKE 5 widget status]:
- accordion [complete]
- accordion toggle [complete]
- card-horizontal [complete]
- card-one [complete]
- card-two [complete]
- card-three [complete]
- 2 columns [deprecated]
- 2 columns 1 2 [deprecated]
- 2 columns 2 1 [deprecated]
- 3 columns [deprecated]
- fontawesome icon [deprecated - no cke5 equivalent]
- 2 columns with options [complete]
- 3 columns with options [complete]
- 4 columns with options [complete]
- Color Box [complete]
Net new CKE5 widgets:
- UBC Table Class (adds presentational classes to table elements) [complete]
- UBC Table Cell Class (adds width classes to TD elements) [complete]
CKEditor API
- v4: https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR.html
- custom widget example:
- v5: https://ckeditor.com/docs/ckeditor5/latest/api/index.html
Drupal resources
- Dev Tools for CKE5 - https://www.drupal.org/project/ckeditor5_dev
- CKE5 Drupal API - https://www.drupal.org/docs/drupal-apis/ckeditor-5-api/overview
- Development guide - https://www.drupal.org/docs/core-modules-and-themes/core-modules/ckeditor-5-module/ckeditor-5-development
ubc-web-services/ubc_ckeditor_widgets 适用场景与选型建议
ubc-web-services/ubc_ckeditor_widgets 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 21.4k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 11 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 ubc-web-services/ubc_ckeditor_widgets 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ubc-web-services/ubc_ckeditor_widgets 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 21.4k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2018-11-09