gpt4 book ai didi

javascript - 无法使用wysihtml,未定义错误

转载 作者:行者123 更新时间:2023-11-28 04:43:34 24 4
gpt4 key购买 nike

到目前为止,我正在使用最新版本(与 Bower 一起安装,但重新定位了文件),然后我已经设置了所有内容。

顺便说一句,我还在“创建帖子”中使用 jQuery + Bootstrap + Modal

当一切都完成设置后,当我看到我的 textarea 时,它就像正常的一样,然后我看到我的控制台日志,上面写着:

Uncaught ReferenceError: wysihtml is not defined

但是,我的控制台日志中没有 404 错误。

我的代码片段:

<!DOCTYPE html>
<html>
<head>
<!-- Bootstrap Core CSS -->
<link href="../../../assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="modal fade" id="addPage" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Add Page</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label>Page Title</label>
<input type="text" class="form-control" placeholder="Page Title">
</div>
<div class="form-group">
<label>Page Thumbnail Image:</label>
<input type="file" name="headerimage" style="display: inline" required accept="image/*">
</div>
<div class="form-group">
<label>Page Header Image:</label>
<input type="file" name="thumbnail" style="display: inline" required accept="image/*">
</div>
<div class="form-group">
<label>Page Content</label>
<div id="wysihtml-toolbar" style="display: none;">
<a data-wysihtml-command="bold">bold</a>
<a data-wysihtml-command="italic">italic</a>

<!-- Some wysihtml5 commands require extra parameters -->
<a data-wysihtml-command="foreColor" data-wysihtml-command-value="red">red</a>
<a data-wysihtml-command="foreColor" data-wysihtml-command-value="green">green</a>
<a data-wysihtml-command="foreColor" data-wysihtml-command-value="blue">blue</a>

<!-- Some wysihtml5 commands like 'createLink' require extra paramaters specified by the user (eg. href) -->
<a data-wysihtml-command="createLink">insert link</a>
<div data-wysihtml-dialog="createLink" style="display: none;">
<label>
Link:
<input data-wysihtml-dialog-field="href" value="http://" class="text">
</label>
<a data-wysihtml-dialog-action="save">OK</a> <a data-wysihtml-dialog-action="cancel">Cancel</a>
</div>
</div>
<textarea id="wysihtml-textarea" placeholder="Page Body"></textarea>
</div>
<div class="form-group">
<label>Meta Description</label>
<input type="text" class="form-control" placeholder="Add Meta Description...">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Save changes</button>
</div>
</form>
</div>
</div>
</div>
<!-- jQuery -->
<script src='../../../assets/vendor/jquery/jquery.min.js'></script>

<!-- BootstrapJS -->
<script src='../../../assets/vendor/bootstrap/js/bootstrap.min.js'></script>

<!-- InlineTextEditor -->
<script src="../../../assets/wysihtml/dist/wysihtml.js"></script>
<script src="../../../assets/wysihtml/dist/wysihtml-toolbar.min.js"></script>
<script src="../../../assets/wysihtml/parser_rules/advanced.js"></script>
<script>
var editor = new wysihtml.Editor("wysihtml-textarea", { // id of textarea element
toolbar: "wysihtml-toolbar", // id of toolbar element
parserRules: wysihtml5ParserRules // defined in parser rules set
});
</script>
</body>
</html>

最佳答案

你尝试过吗?

     <script>
$(function() {
var editor = new wysihtml.Editor("wysihtml-textarea", { // id of textarea element
toolbar: "wysihtml-toolbar", // id of toolbar element
parserRules: wysihtml5ParserRules // defined in parser rules set
});
});
</script>

关于javascript - 无法使用wysihtml,未定义错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43580438/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com