diff --git a/app/javascript/article-form/articleForm.jsx b/app/javascript/article-form/articleForm.jsx index dff7b6191..56e522029 100644 --- a/app/javascript/article-form/articleForm.jsx +++ b/app/javascript/article-form/articleForm.jsx @@ -200,17 +200,22 @@ export class ArticleForm extends Component { fetchMarkdownLint = async () => { if (!window.markdownlint) { + const pathDataElement = document.getElementById('markdown-lint-js-path'); + if (!pathDataElement) { + return; + } + + // Retrieve the correct fingerprinted URL for the scripts + const { markdownItJsPath, markdownLintJsPath } = pathDataElement.dataset; + const markdownItScript = document.createElement('script'); - markdownItScript.setAttribute('src', '/assets/markdown-it.min.js'); + markdownItScript.setAttribute('src', markdownItJsPath); document.body.appendChild(markdownItScript); // The markdownlint script needs the first script to have finished loading first markdownItScript.addEventListener('load', () => { const markdownLintScript = document.createElement('script'); - markdownLintScript.setAttribute( - 'src', - '/assets/markdownlint-browser.min.js', - ); + markdownLintScript.setAttribute('src', markdownLintJsPath); document.body.appendChild(markdownLintScript); markdownLintScript.addEventListener('load', this.lintMarkdown); diff --git a/app/views/articles/edit.html.erb b/app/views/articles/edit.html.erb index 84df38d00..75b4c751b 100644 --- a/app/views/articles/edit.html.erb +++ b/app/views/articles/edit.html.erb @@ -31,3 +31,4 @@ <%= render "articles/v2_form", article: @article, organizations: @organizations, version: @version %> <%= javascript_packs_with_chunks_tag "clipboardCopy", "articleForm", defer: true %> +