Browse Source

Fixed line highlighting

tags/3.0.0^2
Teknikode 1 year ago
parent
commit
50e16d87cb

+ 2
- 2
Teknik/Areas/Paste/Views/Paste/Full.cshtml View File

@@ -6,7 +6,7 @@
string format = Model.Syntax;
string formatName = "Text";

if (HighlightHelper.Languages.ContainsKey(format))
if (!string.IsNullOrEmpty(format) && HighlightHelper.Languages.ContainsKey(format))
{
formatName = HighlightHelper.Languages[format];
}
@@ -48,7 +48,7 @@
<br />
<div class="row">
<div class="col-sm-12">
<pre class="line-numbers"><code class="language-@(format)">@Model.Content</code></pre>
<pre class="line-numbers" id="code"><code class="language-@(format)">@Model.Content</code></pre>
</div>
</div>
</div>

+ 3
- 2
Teknik/Areas/Paste/Views/Paste/Simple.cshtml View File

@@ -4,7 +4,8 @@
Layout = null;
string format = Model.Syntax;
string formatName = "Text";
if (HighlightHelper.Languages.ContainsKey(format))

if (!string.IsNullOrEmpty(format) && HighlightHelper.Languages.ContainsKey(format))
{
formatName = HighlightHelper.Languages[format];
}
@@ -26,7 +27,7 @@
</head>
<body data-twttr-rendered="true">

<pre class="line-numbers"><code class="language-@(format)">@Model.Content</code></pre>
<pre class="line-numbers" id="code" style="border: none;"><code class="language-@(format)">@Model.Content</code></pre>
<bundle src="js/common.min.js" append-version="true"></bundle>
<bundle src="js/paste.view.min.js" append-version="true"></bundle>

+ 2
- 2
Teknik/Areas/Vault/Views/Vault/PasteItem.cshtml View File

@@ -4,7 +4,7 @@
string format = Model.Paste.Syntax;
string formatName = "Text";

if (HighlightHelper.Languages.ContainsKey(format))
if (!string.IsNullOrEmpty(format) && HighlightHelper.Languages.ContainsKey(format))
{
formatName = HighlightHelper.Languages[format];
}
@@ -39,7 +39,7 @@
}
else
{
<pre class="line-numbers"><code class="language-@(format)">@Model.Paste.Content</code></pre>
<pre class="line-numbers" id="code-@(Model.VaultItemId)"><code class="language-@(format)">@Model.Paste.Content</code></pre>
}
</div>
<div class="show-more" id="show-more-bottom-@Model.VaultItemId">

+ 1
- 1
Teknik/Scripts/lib/Prism/prism-line-highlight.js View File

@@ -118,7 +118,7 @@ function applyHash() {

highlightLines(pre, range, 'temporary ');

document.querySelector('.temporary.line-highlight').scrollIntoView();
document.querySelector('.temporary.line-highlight').scrollIntoView();
}

var fakeTimer = 0; // Hack to limit the number of times applyHash() runs

Loading…
Cancel
Save