Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with codebox template #32

Open
vanniand opened this issue Sep 19, 2022 · 3 comments
Open

Problem with codebox template #32

vanniand opened this issue Sep 19, 2022 · 3 comments

Comments

@vanniand
Copy link

Hi, thnx for this plugin and thnx for the default bundles.
I'm trying to use the codebox bundle with the new release of highlight 11.6.0, but I'm facing a problem.
It seems the bundle is not compatile with this new release any more.
I tried to modify the configuration but I always got this error:

require.min.js:5 Uncaught Error: No define call for http://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/highlight.min.js
http://requirejs.org/docs/errors.html#nodefine
at makeError (require.min.js:5:1067)
at Object.completeLoad (require.min.js:5:12223)
at HTMLScriptElement.onScriptLoad (require.min.js:5:13016)

I put in Custom JS
hljs.highlightAll()

Any idea to resolve it?

Thanks
Andrea

@justinhunt
Copy link
Owner

Hi Andrea

I had a look at it. I think Highlight JS has moved on from Require JS and if you want to use the newest version, you need to "shim" this just applies a name to the exported module (highlightjs). It says the function highlight block will be deprecated in version 12.0 too.

I attached the slightly modified template bundle with the shim. Please try it out
codebox.txt

@vanniand
Copy link
Author

Hi Justin,
you are right, the problem was there. THNX
I just modified your new template bundle as follow:
$('#' + @@autoid@@).each(function(i, block) {
hljs.highlightElement(block);
$(block).bind('copy paste cut', function (e) {
if(@@allow_copy@@=='false'){
e.preventDefault(); //disable cut,copy,paste
return false;
}
});
});

because hljs.highlightBlock(block); is deprecated.

Thnx again

@justinhunt
Copy link
Owner

Got it. I will update it with your code. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants