outlawplz/ckeditor_templates

此包已被废弃且不再维护。未建议替代包。

此插件提供了一个对话框,以提供预定义的内容模板 - 包括页面布局、文本格式和样式。

安装: 41

依赖项: 0

建议者: 0

安全性: 0

星标: 2

关注者: 1

分支: 1

开放问题: 0

类型:drupal-module

v0.1.1 2017-03-13 16:08 UTC

This package is auto-updated.

Last update: 2020-10-04 14:36:57 UTC


README

Drupal 8自定义模块,实现了CKEditor的模板插件。

快速开始

在三个步骤中开始使用CKEditor模板。

  1. Github或通过Composer下载最新的CKEditor Templates模块,并像往常一样启用它。
composer require outlawplz/ckeditor_templates
  1. 下载CKEditor Templates插件,并将其复制到Drupal根目录下的libraries/文件夹。
# Plug-in location
/libraries/templates/plugin.js
  1. 编辑使用CKEditor的文本格式,并将模板插件从可用按钮拖动到活动工具栏以启用它。

就是这样。现在您可以开始使用CKEditor模板了。

选项

启用插件后,您可以通过编辑插件设置来指定模板文件的位置。可用选项有名称路径替换内容

  • 名称: 您的模板集名称。在下面的示例中,模板名称为custom

  • 路径: 模板文件的路径。在下面的示例中,路径为/libraries/custom_templates/custom.templates.js

  • 替换内容: 默认情况下,插入模板时是否应替换内容。

模板定义

模板在JS文件中定义。将您的模板文件保存到/libraries文件夹或/sites/default/files文件夹中。在这个示例中,文件将被创建到/libraries/custom_templates文件夹中。

// The name of templates set is 'custom'.
CKEDITOR.addTemplates( 'custom', {

  // Path to the subfolder that contains the preview images.
  imagesPath: '/libraries/custom_templates/images/',

  // Template definition.
  templates: [
    {
      title: 'Custom template',
      image: 'custom.gif',
      description: 'Description of my custom template.',
      html:
        '<h2>Custom Template</h2>' +
        '<p>Your text...</p>'
    },
    {
      title: 'Custom template with image',
      image: 'custom_image.gif',
      description: 'Description of my custom template with image.',
      html:
        '<h2>Custom Template with Image</h2>' +
        '<p><img src="/image.png" /></p>',
        '<p>Your text...</p>'
    }
  ]
} );