preview.js:3 Uncaught TypeError: Cannot read property 'addEventListener' of null
at HTMLDocument. (preview.js:3)
(anonymous) @ preview.js:3
"image-list"というidがnewとeditのみ存在するため、indexではこのようなエラーが発生する
そこで
if (document.URL.match(/new/) || document.URL.match(/edit/)) {
(ここに中身を記述)
}
を加えることで、解消される