Update scrolling

This commit is contained in:
Kenox 2022-11-03 20:50:54 +01:00
commit dfcd5eeef1
4 changed files with 25 additions and 3 deletions

View file

@ -234,7 +234,11 @@ haste.prototype.loadDocument = function(key) {
_this.doc = new haste_document(); _this.doc = new haste_document();
_this.doc.load(parts[0], function(ret) { _this.doc.load(parts[0], function(ret) {
if (ret) { if (ret) {
_this.$code.html(ret.value); let code = document.createElement('code');
code.innerHTML = ret.value;
let pre = document.getElementById("box");
pre.appendChild(code);
_this.setTitle(ret.key); _this.setTitle(ret.key);
_this.fullKey(); _this.fullKey();
_this.$textarea.val('').hide(); _this.$textarea.val('').hide();

File diff suppressed because one or more lines are too long

View file

@ -76,7 +76,7 @@
</div> </div>
</div> </div>
<pre id="box" style="display:none;" class="hljs" tabindex="0"><code></code></pre> <pre id="box" style="display:none;" class="hljs" tabindex="0"></pre>
<textarea spellcheck="false" style="display:none;"></textarea> <textarea spellcheck="false" style="display:none;"></textarea>
</body> </body>

View file

@ -12,6 +12,24 @@ Orginal Style from ethanschoonover.com/solarized (c) Jeremy Hull <sourdrums@gmai
color: #78797A; color: #78797A;
} }
pre.hljs {
white-space: pre-wrap;
}
pre.hljs::before {
counter-reset: listing;
}
pre.hljs code {
counter-increment: listing;
}
pre.hljs code::before {
content: counter(listing) ". ";
display: inline-block;
width: 8em; /* now works */
padding-left: auto; /* now works */
margin-left: auto; /* now works */
text-align: right; /* now works */
}
.hljs-comment, .hljs-comment,
.hljs-quote { .hljs-quote {
color: #586e75; color: #586e75;