mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-07-04 20:57:56 +02:00
feat(#134): add support for line highlighting in code
This commit is contained in:
@@ -560,4 +560,10 @@ loc .lang {
|
|||||||
|
|
||||||
.org-subscript-child {
|
.org-subscript-child {
|
||||||
font-size: 85%;
|
font-size: 85%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.highlighted-line {
|
||||||
|
position:absolute;
|
||||||
|
background:rgba(100,200,100,0.5);
|
||||||
|
z-index:20
|
||||||
}
|
}
|
||||||
@@ -1478,6 +1478,25 @@ angular
|
|||||||
mode: getMode(extension),
|
mode: getMode(extension),
|
||||||
|
|
||||||
onLoad: function (_editor) {
|
onLoad: function (_editor) {
|
||||||
|
if (window.location.hash && window.location.hash.match(/^#L\d+/)) {
|
||||||
|
let from = 0;
|
||||||
|
let to = 0;
|
||||||
|
if (window.location.hash.indexOf('-') > -1) {
|
||||||
|
const match = window.location.hash.match(/^#L(\d+)-L(\d+)/);
|
||||||
|
from = parseInt(match[1]) - 1;
|
||||||
|
to = parseInt(match[2]) - 1;
|
||||||
|
} else {
|
||||||
|
from = parseInt(window.location.hash.substring(2)) - 1;
|
||||||
|
to = from;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Range = ace.require('ace/range').Range;
|
||||||
|
_editor.session.addMarker(new Range(from, 0, to, 1), "highlighted-line", "fullLine");
|
||||||
|
setTimeout(() => {
|
||||||
|
_editor.scrollToLine(from, true, true, function () {});
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
_editor.setFontSize($scope.aceOption.fontSize);
|
_editor.setFontSize($scope.aceOption.fontSize);
|
||||||
_editor.setReadOnly($scope.aceOption.readOnly);
|
_editor.setReadOnly($scope.aceOption.readOnly);
|
||||||
_editor.setKeyboardHandler($scope.aceOption.keyBinding);
|
_editor.setKeyboardHandler($scope.aceOption.keyBinding);
|
||||||
|
|||||||
Reference in New Issue
Block a user