1

いくつかの WYSIWYG HTML5/JQuery エディターを試しています。ただし、Bootstrap WISWYG と Summernote の両方で、「undefined のプロパティ 'fn' を読み取れません」または「undefined のプロパティ 'Editor' を読み取れません」というメッセージが表示されます。GitHub にある標準ファイルを使用しているだけです。JQueryプラグインを使用してこれらのエラーに精通している人はいますか?

編集

私は今Bootstrap WISWYGを試しています

私の体の中に私が持っている

<div id="editor">Editor</div>

私のjsでは、私は持っています

$(document).ready(function() {
  $('#editor').wysihtml5();
});

ただし、エラーは次のとおりです。未定義のプロパティ 'Editor' を読み取ることができません (157 行目)

157 行目:

var editor = new wysi.Editor(this.el[0], options);

JSFiddle: http://jsfiddle.net/MgcDU/8125/

編集2

JS ファイルを 1 つ含めるのを忘れていました。ただし、それを含めた後、新しいエラーが発生します。

Uncaught TypeError: Cannot read property 'firstChild' of undefined

エラーが参照するコード行:

if (isString) {
  element = wysihtml5.dom.getAsDom(elementOrHtml, context);
} else {
  element = elementOrHtml;
}

while (element.firstChild) <<<Error
4

2 に答える 2

4

問題は、依存関係が欠落DIVしている代わりに要素を使用していることです。textareaBootstrap WYSIHTML5 ページを確認すると、次のように表示されます。

依存関係:

  • ブートストラップ-wysihtml5.js
  • ブートストラップ-wysihtml5.css
  • wysihtml5
  • Twitter ブートストラップ

次に、ドキュメントは次のようになります。

<!DOCTYPE html>
<header>
    <title>HTML5 Editor</title>
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
    <!-- Of course place sources in your own server, do not leech bandwidth -->
    <script type="text/javascript" src="http://jhollingworth.github.io/bootstrap-wysihtml5/lib/js/wysihtml5-0.3.0.js"></script>
    <script type="text/javascript" src="http://jhollingworth.github.io/bootstrap-wysihtml5/lib/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="http://jhollingworth.github.io/bootstrap-wysihtml5/src/bootstrap-wysihtml5.js"></script>
    <link rel="stylesheet" type="text/css" href="http://jhollingworth.github.io/lib/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="http://jhollingworth.github.io/src/bootstrap-wysihtml5.css">
</header>
<body>
   <textarea class="editor"></textarea>
   <script type="text/javascript">
       $(document).ready(function(){
           $('.editor').wysihtml5();
       });
   </script>
</body>

詳細については、以下を確認してください: Wysihtml5 #Usage

于 2013-11-28T00:46:58.220 に答える