zoukankan      html  css  js  c++  java
  • node.js+express+jade系列七:富文本编辑框的使用

    下载nicEdit富文本编辑框,

    把nicEdit.js文件放到public/javascripts/下

    新建jade文件:代码如下

    doctype html
    html
        head
            title
            script(type="text/javascript", src="/javascripts/nicEdit.js")
            script(type="text/javascript").
                var niceditor;
                bkLib.onDomLoaded(function() {
                    niceditor = new nicEditor({fullPanel : true}).panelInstance('area3');
                });
                function getStr(){
                    var str=niceditor.instanceById("area3").getContent()
                    alert(str);
                }
        body
            textarea(name="area3", id="area3", style="500px;height:200px;") hello world
            button(name="btn", id="btn", onclick="getStr()") btn

    在浏览器访问即可看到显示的富文本编辑器,但是上传图片不能用,接下来需要修改nicEdit.js,

    打开nicEdit.js。找到nicURI,把值改成post请求上传图片的方法,如nicURI:"/nicEditUpload"

    后端实现nicEditUpload即可(实现方法如上篇文章),完成后图片上传成功了,但是在编辑器中没有显示不知道怎么解决....以后再弄吧

  • 相关阅读:
    Sql优化思路
    「网络流随想随记」
    「ZJOI 的部分题解整理」
    「循环矩阵相关的一些东西」
    知识蒸馏
    3D Human Pose Estimation with 2D Marginal Heatmaps
    模型剪枝
    目标检测小网络
    selenium---解决clear方法失效
    selenium---快速跳转到指定元素
  • 原文地址:https://www.cnblogs.com/ajun/p/3559738.html
Copyright © 2011-2022 走看看