From d45273e117036a7f6c9c4c1eb3e88d9019f776ba Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Thu, 17 Jan 2019 16:29:30 +0100 Subject: [PATCH] Only initialize champs editor if is present on page --- app/javascript/new_design/administrateur/champs-editor.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/javascript/new_design/administrateur/champs-editor.js b/app/javascript/new_design/administrateur/champs-editor.js index 6bfb9d43d..4b83af165 100644 --- a/app/javascript/new_design/administrateur/champs-editor.js +++ b/app/javascript/new_design/administrateur/champs-editor.js @@ -10,6 +10,12 @@ Vue.component('DraggableItem', DraggableItem); addEventListener('DOMContentLoaded', () => { const el = document.querySelector('#champs-editor'); + if (el) { + initEditor(el); + } +}); + +function initEditor(el) { const { directUploadsUrl, dragIconUrl } = el.dataset; const state = { @@ -48,7 +54,7 @@ addEventListener('DOMContentLoaded', () => { this.updateAll = updateAll; } }); -}); +} function createUpdateFunctions(app, isAnnotation) { let isSaving = false;