ckeditor使用

参考:https://www.jb51.net/article/86500.htm
https://www.cnblogs.com/Tirisfal/p/5548424.html
#### 注意用标准版的没有背景色文字颜色等功能,所以配置了toolbar也不会显示此功能,需要下载full版本

{% load staticfiles %}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
{#    <script type="text/javascript" src="/static/ckeditor/ckeditor.js"></script>#}
    <script type="text/javascript" src="{% static 'ckeditor/ckeditor.js' %}"></script>
    <script type="text/javascript" src="{% static 'ckeditor/config.js' %}"></script>
{#    <script src="//cdn.ckeditor.com/4.4.6/full/ckeditor.js"></script>#}
</head>

<body>
<form action="">
    <textarea id="TextArea1" cols="20" name="ss" rows="2" class="ckeditor"></textarea>
    
    <script type="text/javascript">
           
    CKEDITOR.replace('TextArea1',
    { toolbar:'Basic', height:300,width:1000 });
    //如果是在ASP.NET环境下用的服务器端控 件<TextBox>
    //CKEDITOR.replace('tbContent');
    //如 果<TextBox>控件在母版页中,要这样写
    //CKEDITOR.replace('<%=tbContent.ClientID.Replace("_","$") %>');
              
</script>
    <input type="submit">
</form>
</body>
</html>

猜你喜欢

转载自www.cnblogs.com/lajiao/p/9266063.html