未捕获的类型错误: $(..).froala编辑器不是一个函数//解决方案被找到,但不确定如何使用它

Uncaught TypeError: $(...).froalaEditor is not a function// solution is found but not sure how to use it

本文关键字:解决方案 函数 何使用 不确定 一个 类型 错误 编辑器 froala      更新时间:2023-09-26

我只是想在我的网站上使用froala文本编辑器,但我得到未捕获的类型错误: $(...).froala编辑器不是一个函数。

我用谷歌搜索了一下,在这里找到了解决方案,但我不知道如何使用这个来源。主要是因为我的代码中没有这个

var $ = require('jquery');
require('node_modules/froala-editor/js/froala_editor.min.js');
$(function() {
  var $target = $('<div>').appendTo('body');
  $target.froalaEditor()
});

我只是按照文档进行操作,https://github.com/froala/wysiwyg-editor。我在顶部使用了{{form.media}}来使用它,但在控制台上我得到了上述错误。有人可以告诉我如何在 github 中使用解决方案吗?

require('node_modules/froala-editor/js/froala_editor.min.js')($);

你看到最后了吗?