0

我无法在我的应用程序中初始化Summernote 所见即所得编辑器,我不知道为什么不起作用。

我开始导入 JS 和 CSS 文件,打开一个以“summernote”为 id 的 div 标签,并在底部插入 javascript 代码。源文件都正确指出。

我想渲染hackerwins.github.io/summernote中显示的文本编辑器。它不显示编辑器。只是里面的纯文本“ use element<div id="summernote"></div>

<!DOCTYPE html>
    <!--[if lt IE 7]>      <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
    <!--[if IE 7]>         <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
    <!--[if IE 8]>         <html class="no-js lt-ie9"> <![endif]-->
    <!--[if gt IE 8]><!--> <html> <!--<![endif]-->
    <head>
    <meta charset="utf-8">

    <title>Dashboard</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
    <script src="//code.jquery.com/jquery-1.9.1.min.js"></script>   
    <link rel="stylesheet" href="http://localhost/projecto/assets/css/bootstrap.css">
    <link rel="stylesheet" href="http://localhost/projecto/assets/css/animations.css">
    <link rel="stylesheet" href="http://localhost/projecto/assets/css/main.css">
    <link rel="stylesheet" href="http://localhost/projecto/assets/css/extras.css">

    <script src="http://localhost/projecto/assets/js/vendor/modernizr-2.6.2.min.js"></script>


    <link href="http://localhost/projecto/assets/css/summernote.css" rel="stylesheet">
    <script src="http://localhost/projecto/assets/js/summernote.min.js"></script>



    </head>
    <body><div id="top"></div>
    <!--[if lt IE 7]>
    <p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
    <![endif]-->



    <section id="topline">
    <div class="container">
    <div class="row">
    <div class="col-sm-6">
    <p>ana.coelho@anacoelhoarq.com |  <a href="http://localhost/projecto/index.php/admin/login/logout">Logout</a> </p>
    </div>

    </div>
    </div>        
    </section>


    <section id="header">
    <div class="container"><div class="row">

    <img class="navbar-brand" src="http://localhost/projecto/assets/img/logotipo.jpg" alt="logo">

    <div class="col-sm-12 mainmenu_wrap"><div class="main-menu-icon visible-xs"><span></span><span></span><span></span></div>
    <ul id="mainmenu" class="nav menu sf-menu responsive-menu superfish">
    <li class="active">
    <a href="./">Dashboard</a>
    </li>
    <li class="dropdown">
    <a href="./about.html">Projectos</a>
    <ul class="nav dropdown-menu">
    <li class="dropdown">
    <a href="./blog.html">Inserir</a>

    </li>
    <li class="dropdown">
    <a href="./blog.html">Consultar</a>

    </li>

    </ul>
    </li>
    <li class="dropdown">
    <a href="./blog.html">Publicações</a>
    <ul class="nav dropdown-menu">
    <li class="">
    <a href="./blog.html">Inserir</a>
    </li>
    <li class="">
    <a href="./blog.html">Consultar</a>
    </li>

    </ul>
    </li>
    <li class="dropdown">
    <a href="./blog.html">Newsletter</a>
    <ul class="nav dropdown-menu">
    <li class="">
    <a href="./blog.html">Consultar inscriçóes</a>
    </li>

    </ul>
    </li>

    </ul>
    </div>

    </div></div>
    </section><div class="container">

    <div class="row">


    <div id="summernote" class="summernote col-sm-12"><h4>use element</h4></div>

    </div>
    </div>
    <footer id="footer" style="padding: 0px;" class="darkgrey_section">
    <div class="container">
    <div class="row">


    <div class="col-sm-8">

    <p style="color: #AAA;">© 2014 - anacoelhoarq.com Todos os direitos reservados</p>

    </div>
    <div class="col-sm-4">



    </div>

    </div>
    </div>
    </footer>

    <script>$(document).ready(function() {
    $('.summernote').summernote();
    });</script>


    </body>
    </html>
4

1 回答 1

4

检查文档。你需要包括jQuerybootstrapfontawesome

<script src="//code.jquery.com/jquery-1.9.1.min.js"></script> 
<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.1/css/bootstrap.min.css"> 
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.1/js/bootstrap.min.js"></script> 
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css">

你需要初始化 Summernote,像这样:

$(document).ready(function() {
  $('#summernote').summernote();
});
于 2014-07-01T11:48:58.907 回答