Skip to content

Commit 3616bc9

Browse files
authored
Support minting new javascript resources
Currently an attempt to create a new javascript reource such as foo.js errors with the message "A new text file has to have an file extension like .txt .ttl .json etc". These changes support files whose content-type includes javascript.
1 parent 72eaaf3 commit 3616bc9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sourcePane.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module.exports = {
2121
if (t.startsWith(prefix)) return 'Source'
2222
if (t.includes('xml')) return 'XML Source'
2323
if (t.includes('json')) return 'JSON Source' // Like eg application/ld+json
24+
if (t.includes('javascript')) return 'Javascript Source';
2425
}
2526
return null
2627
},
@@ -42,7 +43,7 @@ module.exports = {
4243
const contentType = mime.lookup(newInstance.uri)
4344
if (
4445
!contentType ||
45-
!(contentType.startsWith('text') || contentType.includes('xml') || contentType.includes('json'))
46+
!(contentType.startsWith('text') || contentType.includes('xml') || contentType.includes('json') || contentType.includes('javascript')
4647
) {
4748
const msg =
4849
'A new text file has to have an file extension like .txt .ttl .json etc.'

0 commit comments

Comments
 (0)