Browse Source

Fixed line highlighting

core
Teknikode 4 years ago
parent
commit
50e16d87cb
  1. 4
      Teknik/Areas/Paste/Views/Paste/Full.cshtml
  2. 5
      Teknik/Areas/Paste/Views/Paste/Simple.cshtml
  3. 4
      Teknik/Areas/Vault/Views/Vault/PasteItem.cshtml
  4. 2
      Teknik/Scripts/lib/Prism/prism-line-highlight.js

4
Teknik/Areas/Paste/Views/Paste/Full.cshtml

@ -6,7 +6,7 @@ @@ -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 @@ @@ -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>

5
Teknik/Areas/Paste/Views/Paste/Simple.cshtml

@ -4,7 +4,8 @@ @@ -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 @@ @@ -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>

4
Teknik/Areas/Vault/Views/Vault/PasteItem.cshtml

@ -4,7 +4,7 @@ @@ -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 @@ @@ -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">

2
Teknik/Scripts/lib/Prism/prism-line-highlight.js

@ -118,7 +118,7 @@ function applyHash() { @@ -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