JavaScript library needs dependencies

Created on 26 January 2024, 10 months ago
Updated 13 May 2024, 6 months ago

Problem/Motivation

I just noticed a small issue with this module.

When viewing highlight JS on pages that include JavaScript libraries that have a dependency on drupal settings everything works as expected.

On a page that doesn't have the Drupal settings library included the highlighter will not work and the following error will be printed in the console:

Uncaught ReferenceError: Drupal is not defined

Proposed resolution

Change the highlightjs library to look like this:

highlightjs:
  version: 1.0.0
  js:
    js/highlightjs_input_filter.js: {  attributes: { type: module }, minified: false }
  dependencies:
    - core/drupal
    - core/drupalSettings

This will include the Drupal settings on pages where the highlight JS is included and will allow the JS to work.

πŸ› Bug report
Status

Fixed

Version

1.1

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom philipnorton42 Cheshire

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024