This repository has been archived by the owner on Mar 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from CodeWe-projet/dev
Version 2.1.0
- Loading branch information
Showing
39 changed files
with
3,358 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.htm linguist-detectable=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module.exports = [ | ||
"python", | ||
"c", | ||
"c++", | ||
"c#", | ||
"javascript", | ||
"java", | ||
"haskell", | ||
"smalltalk", | ||
"coffescript", | ||
"css", | ||
"d", | ||
"go", | ||
"haskell", | ||
"html", | ||
"json", | ||
"lua", | ||
"php", | ||
"r", | ||
"ruby", | ||
"scheme", | ||
"shell", | ||
"sql", | ||
'oz', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,62 @@ | ||
/** | ||
* Tab customization (allow convert current file) | ||
* Tab customization | ||
*/ | ||
|
||
import {editor, socket} from "/js/dev/page/editor.js"; | ||
import {patterns} from "/js/dev/page/editor/prism/patterns.js"; | ||
import PrismCustom from "/js/dev/page/editor/prism/prismCustom.js"; | ||
|
||
export default class Customize{ | ||
/** Init the customize object | ||
* @param {Editable} editable | ||
*/ | ||
constructor(editable) { | ||
this.editable = editable; | ||
|
||
document.getElementById('option-language').addEventListener('change', e => { | ||
language = e.target.value.toLowerCase(); | ||
this.editable.updateAllHighlighting(); | ||
socket.send('language', {language}); | ||
}); | ||
|
||
document.addEventListener('socket.receive.language', e => { | ||
if(Object.keys(patterns).includes(e.detail.language.toLowerCase())){ | ||
language = e.detail.language.toLowerCase(); | ||
document.getElementById('option-language').value = language; | ||
this.editable.updateAllHighlighting(); | ||
} | ||
}); | ||
|
||
for(const lang of Object.keys(patterns)){ | ||
const option = document.createElement('option'); | ||
option.innerText = lang; | ||
if(lang === language) option.selected = true; | ||
document.getElementById('option-language').appendChild(option); | ||
} | ||
|
||
document.getElementById('option-space-size').addEventListener('change', e => { | ||
editor.tab.setSize(e.target.value); | ||
|
||
for(const child of this.editable.editable.children){ | ||
child.innerText = editor.tab.updateText(child.innerText); | ||
new PrismCustom(child, language).apply(); | ||
} | ||
|
||
socket.send('changeTabSize', {size: e.target.value}); | ||
}); | ||
|
||
document.getElementById('option-space-size').value = this.editable.tab.size; | ||
|
||
document.addEventListener('socket.receive.changeTabSize', e => { | ||
if(e.detail.size && Number.isInteger(parseInt(e.detail.size))){ | ||
editor.tab.setSize(e.detail.size); | ||
document.getElementById('option-space-size').value = e.detail.size; | ||
|
||
for(const child of this.editable.editable.children){ | ||
child.innerText = editor.tab.updateText(child.innerText); | ||
new PrismCustom(child, language).apply(); | ||
} | ||
} | ||
}); | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.