spring 整合editor.md 实现markdown 编辑

整合一个编辑器,其实很简单。首先找到他的源码,以editor.md 为例:https://github.com/pandao/editor.md
下载后,到examples文件夹看看,看到一个simple.html的例子,这就是可以复制的前端代码:

这里写图片描述

到myeclipse中新建一个应用, 并添加spring支持(公司用jdk1.7,就简单用spring4.2.5, 不用spring boot,理解整合原理就行)

这里写图片描述

着重看下前端的页面:

  • index.jsp,css和js自己拷贝并改下路径
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html>
<html lang="zh">
    <head>
        <meta charset="utf-8" />
        <title>Simple example - Editor.md examples</title>
        <link rel="stylesheet" href="css/style.css" />
        <link rel="stylesheet" href="css/editormd.css" />
        <link rel="shortcut icon" href="https://pandao.github.io/editor.md/favicon.ico" type="image/x-icon" />
        <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">    
    </head>
    <body>
        <div id="layout">
            <header>
                <h1>Simple example</h1>
            </header>
            <form action="markdownTest" method="post">
            <div id="test-editormd">
                <textarea style="display:none;" name="markdownContent"></textarea>
            </div>
            <button type="submit" class="btn btn-info col-md-offset-3 col-md-6">添加</button>
                </form>
        </div>
        <script
  • 2
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值