- gitlist.git
- src
- browser
- js
- file-fragment.js
This file ( 3kB ) 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 $fragmentFilePanel = $('.p3x-gitlist-file-fragment-panel')
if ($fragmentFilePanel.length > 0) {
let $buttonToggleCodeMirrorCurrent;
let $textareaCurrent;
let $textCurrent
for(let fragmentFile of $fragmentFilePanel) {
const index = fragmentFile.dataset.index
const $buttonToggleCodeMirror = $(`#p3x-gitlilst-file-fragment-heading-button-codemirror-${ index }`)
const $text = $(`#p3x-gitlist-file-fragment-text-${ index }`)
const $textarea = $(`#p3x-gitlist-file-fragment-codemirror-${ index }`)
const $buttonEditor = $(`#p3x-gitlilst-file-fragment-heading-button-edit-${ index}`)
if ($buttonEditor.length > 0) {
$buttonEditor.on('click', function(event) {
const url = $buttonEditor.get(0).dataset.url
location = url;
})
}
$buttonToggleCodeMirror.on('click', function(event) {
if ($buttonToggleCodeMirrorCurrent !== undefined) {
$('.CodeMirror-wrap').remove()
const wasActive = $buttonToggleCodeMirror.hasClass('active')
window.gitlist.fragmentFileCodeMirror = undefined
$buttonToggleCodeMirrorCurrent.removeClass('active')
$textCurrent.removeClass('hidden')
$textareaCurrent.addClass('hidden')
if (wasActive) {
return;
}
}
/*
const position = $buttonToggleCodeMirror.get(0).dataset.commitShort
const hash = `#${position}`
//history.pushState(null, document.title,);
location.hash = hash
$buttonToggleCodeMirror.get(0).scrollIntoView()
*/
/*
$buttonToggleCodeMirrorCurrent = $buttonToggleCodeMirror
$textCurrent = $text;
$textareaCurrent = $textarea;
$text.addClass('hidden');
$textarea.removeClass('hidden')
$buttonToggleCodeMirror.addClass('active')
// const maxSize = window.gitlist.codemirror_full_limit;
// const size = Math.ceil($textarea.get(0).value.length / 1024);
// const codeMirrorHeight = window.gitlist.editorMaxHeight;
const cm = CodeMirror.fromTextArea($textarea.get(0), {
styleActiveLine: true,
styleSelectedText: true,
value: fragmentFile.value,
lineNumbers: true,
matchBrackets: true,
lineWrapping: true,
readOnly: true,
height: 'auto',
mode: fragmentFile.dataset.mode,
theme: window.gitlist.getActualThemeCodemirror(),
});
window.gitlist.fragmentFileCodeMirror = cm
})
}
}
})
*/