- gitlist.git
- src
- browser
- js
- blame.js
This file ( 2kB ) exceeds the allowed full mode (48 kb) size.
The editor full hight is disabled, only scrolling is allowed..
If you wish to edit a file, it is recommended to use the scroll mode as some users do not like the full height
mode, although some users like it.
$(() => {
const $blamePanel = $('.p3x-gitlist-blame-panel')
if ($blamePanel.length > 0) {
let $buttonToggleCodeMirrorCurrent;
let $textareaCurrent;
let $textCurrent
for(let blame of $blamePanel) {
const index = blame.dataset.index
const $buttonToggleCodeMirror = $(`#p3x-gitlilst-blame-heading-button-codemirror-${ index }`)
const $text = $(`#p3x-gitlist-blame-text-${ index }`)
const $textarea = $(`#p3x-gitlist-blame-codemirror-${ index }`)
$buttonToggleCodeMirror.on('click', function(event) {
if ($buttonToggleCodeMirrorCurrent !== undefined) {
$('.CodeMirror-wrap').remove()
const wasActive = $buttonToggleCodeMirror.hasClass('active')
window.gitlist.blameCodeMirror = undefined
$buttonToggleCodeMirrorCurrent.removeClass('active')
$textCurrent.removeClass('hidden')
$textareaCurrent.addClass('hidden')
if (wasActive) {
return;
}
}
$buttonToggleCodeMirrorCurrent = $buttonToggleCodeMirror
$textCurrent = $text;
$textareaCurrent = $textarea;
$text.addClass('hidden');
$textarea.removeClass('hidden')
$buttonToggleCodeMirror.addClass('active')
const cm = CodeMirror.fromTextArea($textarea.get(0), {
styleActiveLine: true,
styleSelectedText: true,
value: blame.value,
lineNumbers: true,
matchBrackets: true,
lineWrapping: true,
readOnly: true,
height: 'auto',
mode: blame.dataset.mode,
theme: window.gitlist.getActualThemeCodemirror(),
});
window.gitlist.blameCodeMirror = cm
})
}
}
})