首页 文章

如何在CKeditor的body字段中自动为图像添加类

提问于
浏览
0

我希望能够为添加到Drupal中的body字段的图像添加一个类 .

我希望为用户保持尽可能简单的事情,这样他们就不必添加类等 . 理想情况下,他们只需单击工具栏中的图像按钮,粘贴URL或上传图像并设置左对齐或左对齐右:Image properties for adding images in CKeditor

我已经尝试了几个选项,包括:CKEditor adding class to img tag但我无法得到任何工作 .

CKEditor的路径是CDN //cdn.ckeditor.com/4.5.4/full-all

我想给我们自己的SCSS让图像在桌面上向左或向右浮动,并以小断点为中心 .

文本格式为“过滤HTML” .

有什么方法可以让这个工作吗?

非常感谢

Update

因为我正在使用CKEditor CDN,所以我将以下内容添加到我的本地'ckeditor.config.js'文件中

config.extraPlugins = 'image, dialog, dialogui';

// Enable local "imagetoolbar" plugin from /myplugins/imagetoolbar/ folder.
CKEDITOR.plugins.addExternal( 'image', '/plugins/image/' 'plugin.js' );
CKEDITOR.plugins.addExternal( 'dialog', '/plugins/dialog/' 'plugin.js' );
CKEDITOR.plugins.addExternal( 'dialogui', '/plugins/dialog/' 'plugin.js' );

// extraPlugins needs to be set too.
CKEDITOR.replace( 'news', {
extraPlugins: 'image, dialog, dialogui'
} );

我复制了这个例子的'news'作为CKEDITOR.replace,我肯定是错的,这应该是什么? https://www.pluginsforckeditor.com/Tutorials/149/How-to-add-a-plugin-to-CKEditor/en/n149.aspx

1 回答

  • 0

    您可以修改图像插件,以便已输入图像的类 . 因此,用户只需粘贴网址或上传图片即可 .

    this is the code you have to modify

    使用您想要的内容填充默认字段 .

    我希望能帮助你 .

相关问题