如何使JS错误不会阻止Trix正常工作? [英] How do I make that JS errors don't prevent Trix from working?
本文介绍了如何使JS错误不会阻止Trix正常工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发现有一些JS文件抛出了错误,似乎阻止了Trix正确执行(或根本无法执行).
I figured out that there is some JS file that is throwing an error that seems to be preventing Trix from executing properly (or at all).
这是我的app/javascript/packs/application.js
的样子:
// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
require("@rails/ujs").start()
require("turbolinks").start()
require("@rails/activestorage").start()
require("channels")
require("local-time").start()
window.Rails = Rails
import '../src/popper.min'
import '../src/jquery.min'
import 'bootstrap'
import '../src/aos'
// import '../src/clipboard.min'
// import '../src/jquery.fancybox.min'
// import '../src/flatpickr.min'
// import '../src/flickity.pkgd.min'
// import '../src/ion.rangeSlider.min'
// import '../src/isotope.pkgd.min'
// import '../src/jarallax.min'
// import '../src/jarallax-video.min'
// import '../src/jarallax-element.min'
// import '../src/jquery.countdown.min'
// import '../src/jquery.smartWizard.min'
// import '../src/plyr.polyfilled.min'
// import '../src/prism'
// import '../src/scrollMonitor'
// import '../src/smooth-scroll.polyfills.min'
// import '../src/svg-injector.umd.production'
// import '../src/svg-injector'
// import '../src/twitterFetcher_min'
// import '../src/typed.min'
// import '../src/theme'
$(document).on("turbolinks:load", () => {
$('[data-toggle="tooltip"]').tooltip()
$('[data-toggle="popover"]').popover()
})
import "controllers"
require("trix")
require("@rails/actiontext")
我尝试将require("trix")
调用放在此文件的顶部,但仍然无法正常工作.
I tried putting the require("trix")
calls at the top of this file and it still doesn't work.
考虑到这里所有的JS依赖关系,无论如何我是否可以确保trix
和actiontext
文件得到执行?
Given all of the JS dependencies here, is there anyway I can make sure the trix
and actiontext
files get executed regardless?
推荐答案
尝试以下通用答案:逐步在* .js文件中逐行注释
Try this universal answer: comment line by line in your *.js file step by step
这篇关于如何使JS错误不会阻止Trix正常工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文