简体   繁体   English

将自定义按钮添加到CKEditor

[英]Add custom button to CKEditor

Hello I am trying to learn CKEditor. 您好,我正在尝试学习CKEditor。 Want to add custom button. 要添加自定义按钮。 I am following this tutorial 我正在关注本教程

http://docs.cksource.com/CKEditor_3.x/Tutorials/Timestamp_Plugin http://docs.cksource.com/CKEditor_3.x/Tutorials/Timestamp_Plugin

It's a very simple tutorial but I am stuck at the end can't see my button. 这是一个非常简单的教程,但是我被困在最后看不到我的按钮。

This is my Web Form 这是我的网络表格

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb"   Inherits="WebApplication1.WebForm1" %>
<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <CKEditor:CKEditorControl ID="CKEditor1" BasePath="/ckeditor/" ExtraPlugins="timestamp" runat="server">
        </CKEditor:CKEditorControl>
    </div>
    </form>
</body>
</html>

And this is my plugin.js file 这是我的plugin.js文件

CKEDITOR.plugins.add('timestamp',
{
init: function (editor) {
    editor.addCommand('insertTimestamp',
        {
            exec: function (editor) {
                var timestamp = new Date();
                editor.insertHtml('The current date and time is: <em>' + timestamp.toString() + '</em>');
            }
        });
    editor.ui.addButton('Timestamp',
    {
        label: 'Insert Timestamp',
        command: 'insertTimestamp',
        icon: this.path + 'images/timestamp.png'
    });
}
});

I am using Microsoft Visual Studio 2012, CKEditor 3.6.4 for ASP.net, tried CKEditor version 3.6.6.1 and 4.4.1 nothing changed. 我正在使用Microsoft Visual Studio 2012,ASP.net的CKEditor 3.6.4,尝试了CKEditor 3.6.6.1和4.4.1版本,没有任何更改。 Also checked the questions here but none of them helped. 还检查了这里的问题,但没有一个有帮助。 Also add the extralugin to the config.js 还将多余的东西添加到config.js

config.extraPlugins = 'timestamp';

The code is correct, It was a visual studio error. 该代码是正确的,这是一个视觉工作室错误。 Cleaned the solution and then rebuild the project. 清洗解决方案,然后重建项目。 It is now works perfect. 现在可以正常使用了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM