Skip to content

Commit 8ba849c

Browse files
committed
Added link
1 parent 011ddbf commit 8ba849c

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

src/LinkDotNet.Blog.Web/Shared/Admin/CreateNewBlogPost.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<label for="content">Content</label>
2525
<TextAreaWithShortcuts Id="content" Class="form-control" Rows="10"
2626
@bind-Value="@model.Content"></TextAreaWithShortcuts>
27-
<small for="content" class="form-text text-muted">You can use markdown to style your component. Additional features are listed <a @onclick="@(() => FeatureDialog.Open())">here</a></small>
27+
<small for="content" class="form-text text-muted">You can use markdown to style your component. Additional features and keyboard shortcuts are listed <a @onclick="@(() => FeatureDialog.Open())">here</a></small>
2828
<UploadFile OnFileUploaded="SetContentFromFile" id="content-upload"></UploadFile>
2929
<small for="content-upload" class="form-text text-muted">Drag and drop markdown files to upload and
3030
insert them</small>

src/LinkDotNet.Blog.Web/Shared/Admin/FeatureInfoDialog.razor

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,30 @@
33
<p>Features marked with <i class="fas fa-flask"></i> are experimental and can change heavily, get removed or the usage changes.</p>
44
<p>Use with caution and check the changelog</p>
55
<hr>
6+
<h3 style="display:inline-block">Shortcuts</h3>
7+
<table class="table">
8+
<thead>
9+
<tr>
10+
<th>Keyboard shortcut</th>
11+
<th>Description</th>
12+
</tr>
13+
</thead>
14+
<tbody>
15+
<tr>
16+
<td>control b</td>
17+
<td>Inserts Markdown formatting for bolding text</td>
18+
</tr>
19+
<tr>
20+
<td>control i</td>
21+
<td>Inserts Markdown formatting for italicizing text</td>
22+
</tr>
23+
<tr>
24+
<td>control m</td>
25+
<td>Inserts Markdown formatting for creating a link</td>
26+
</tr>
27+
</tbody>
28+
</table>
29+
<hr/>
630
<h3 style="display:inline-block">Slide-Show</h3><i class="fas fa-flask"></i>
731
<p>Will create a slide-show with images specified by the tag.</p>
832
<strong>Usage:</strong>

src/LinkDotNet.Blog.Web/Shared/TextAreaWithShortcuts.razor

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
@inject IJSRuntime jsRuntime
22

3-
<textarea class="@Class" id="@Id" rows="@Rows" @onkeyup="MarkShortDescription"
4-
@oninput="args => Value = args.Value.ToString()">@Value</textarea>
3+
<textarea class="@Class" id="@Id" rows="@Rows"
4+
@onkeyup="MarkShortDescription" @onkeyup:preventDefault="true" @onabort:stopPropagation="true"
5+
@oninput="args => Value = args.Value.ToString()">@Value</textarea>
56

67
@code {
78
private string textContent = string.Empty;
@@ -44,6 +45,7 @@
4445
{
4546
"b" => await GetNewMarkdownForElementAsync(elementId, original, "**", "**"),
4647
"i" => await GetNewMarkdownForElementAsync(elementId, original, "*", "*"),
48+
"m" => await GetNewMarkdownForElementAsync(elementId, original, "[","]()"),
4749
_ => original,
4850
} : original;
4951
}

tests/LinkDotNet.Blog.UnitTests/Web/Shared/TextAreaWithShortcutsTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class TextAreaWithShortcutsTests : TestContext
1111
[Theory]
1212
[InlineData("b", 0, 4, true, "**Test**")]
1313
[InlineData("i", 0, 4, true, "*Test*")]
14+
[InlineData("m", 0, 4, true, "[Test]()")]
1415
[InlineData("h", 0, 1, true, "Test")]
1516
[InlineData("b", 0, 1, false, "Test")]
1617
[InlineData("f", 0, 4, false, "Test")]

0 commit comments

Comments
 (0)