Fix Python syntax highlighting (#3193)

The MIME types for Jython/Python were changed, breaking syntax
highlighting in the script editor:
https://github.com/openhab/openhab-addons/pull/18616

Signed-off-by: Ravi Nadahar <nadahar@rediffmail.com>
pull/3195/head
Nadahar 2025-05-19 16:04:26 +02:00 committed by GitHub
parent 63a3c33fa6
commit 68d47c5d22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -181,7 +181,13 @@ export default {
if (mode.startsWith('application/javascript') || mode === 'js') return 'text/javascript'
if (mode === 'application/vnd.openhab.dsl.rule') return 'text/x-java'
if (mode === 'application/x-groovy' || mode === 'groovy') return 'text/x-groovy'
if (mode === 'application/x-python' || mode === 'py') return 'text/x-python'
if (mode === 'application/x-python2' || mode === 'py2') {
return {
name: 'text/x-python',
version: 2
}
}
if (mode === 'application/x-python' || mode === 'application/x-python3' || mode === 'py' || mode === 'py3') return 'text/x-python'
if (mode === 'application/x-ruby' || mode === 'rb') return 'text/x-ruby'
if (mode.indexOf('jinja') >= 0) return 'text/jinja2'
return mode