-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* cleanup code * fix index out of range when only front matter present * fix clipboard to DataUri * allow per monitor dpi * move commands * move commands * move commands * refactor to use static * refactor commands * fix init problem * refactor more commands * refactor more commands * refactor more commands * refactor more commands * fix openfile command * move more commands * main window refactored * begin refactoring editor commands * move more editor commands: * move more commands * refactor to commands * update packages, reduce template * make stylesheet less github like * add list indent on tab * add multi-jit startup * fix redraw issues * navigate to named anchors in same document #171 * only add to list items if it's increasing line count #172 * check if previous/previous line in list #173 * to enable newer common control styles * move app manifest into solution items * v1.30
- Loading branch information
Showing
100 changed files
with
3,173 additions
and
1,804 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Windows; | ||
using System.Windows.Input; | ||
using MarkdownEdit.Controls; | ||
|
||
namespace MarkdownEdit.Commands | ||
{ | ||
internal static class CloseCommand | ||
{ | ||
public static readonly RoutedCommand Command = ApplicationCommands.Close; | ||
|
||
static CloseCommand() | ||
{ | ||
Application.Current.MainWindow.CommandBindings.Add(new CommandBinding(Command, Execute)); | ||
} | ||
|
||
private static void Execute(object sender, ExecutedRoutedEventArgs e) | ||
{ | ||
var mainWindow = (MainWindow)sender; | ||
mainWindow.Close(); | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/MarkdownEdit/Commands/ConvertSelectionToListCommand.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System.Windows; | ||
using System.Windows.Input; | ||
using MarkdownEdit.Controls; | ||
using MarkdownEdit.Models; | ||
|
||
namespace MarkdownEdit.Commands | ||
{ | ||
internal static class ConvertSelectionToListCommand | ||
{ | ||
public static readonly RoutedCommand Command = new RoutedCommand(); | ||
|
||
static ConvertSelectionToListCommand() | ||
{ | ||
Application.Current.MainWindow.CommandBindings.Add(new CommandBinding(Command, Execute, CanExecute)); | ||
} | ||
|
||
private static void Execute(object sender, ExecutedRoutedEventArgs e) | ||
{ | ||
var editor = ((MainWindow)sender).Editor; | ||
EditorUtilities.ConvertSelectionToList(editor.EditBox); | ||
} | ||
|
||
private static void CanExecute(object sender, CanExecuteRoutedEventArgs e) | ||
{ | ||
var editor = ((MainWindow)sender).Editor; | ||
e.CanExecute = !editor.EditBox.IsReadOnly; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System; | ||
using System.Windows; | ||
using System.Windows.Input; | ||
using MarkdownEdit.Controls; | ||
|
||
namespace MarkdownEdit.Commands | ||
{ | ||
internal static class DecreaseEditorMarginCommand | ||
{ | ||
public static readonly RoutedCommand Command = new RoutedCommand(); | ||
|
||
static DecreaseEditorMarginCommand() | ||
{ | ||
Application.Current.MainWindow.CommandBindings.Add(new CommandBinding(Command, Execute)); | ||
} | ||
|
||
private static void Execute(object sender, ExecutedRoutedEventArgs e) | ||
{ | ||
App.UserSettings.SinglePaneMargin = | ||
Math.Min(App.UserSettings.SinglePaneMargin + 1, MainWindow.EditorMarginMax); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Windows; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using MarkdownEdit.Controls; | ||
|
||
namespace MarkdownEdit.Commands | ||
{ | ||
internal static class DecreaseFontSizeCommand | ||
{ | ||
public static readonly RoutedCommand Command = EditingCommands.DecreaseFontSize; | ||
|
||
static DecreaseFontSizeCommand() | ||
{ | ||
Application.Current.MainWindow.CommandBindings.Add(new CommandBinding(Command, Execute)); | ||
} | ||
|
||
private static void Execute(object sender, ExecutedRoutedEventArgs e) | ||
{ | ||
var mainWindow = (MainWindow)sender; | ||
mainWindow.Editor.DecreaseFontSize(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System.Windows; | ||
using System.Windows.Input; | ||
using MarkdownEdit.Controls; | ||
|
||
namespace MarkdownEdit.Commands | ||
{ | ||
internal static class DeselectCommand | ||
{ | ||
public static readonly RoutedCommand Command = new RoutedCommand(); | ||
|
||
static DeselectCommand() | ||
{ | ||
Application.Current.MainWindow.CommandBindings.Add(new CommandBinding(Command, Execute, CanExecute)); | ||
} | ||
|
||
private static void Execute(object sender, ExecutedRoutedEventArgs e) | ||
{ | ||
var editor = ((MainWindow)sender).Editor; | ||
editor.EditBox.SelectionLength = 0; | ||
} | ||
|
||
private static void CanExecute(object sender, CanExecuteRoutedEventArgs e) | ||
{ | ||
var editor = ((MainWindow)sender).Editor; | ||
e.CanExecute = !editor.EditBox.IsReadOnly; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Text.RegularExpressions; | ||
using System.Windows; | ||
using System.Windows.Input; | ||
using MarkdownEdit.Controls; | ||
|
||
namespace MarkdownEdit.Commands | ||
{ | ||
internal static class EditorFindCommand | ||
{ | ||
public static readonly RoutedCommand Command = new RoutedCommand(); | ||
|
||
static EditorFindCommand() | ||
{ | ||
Application.Current.MainWindow.CommandBindings.Add(new CommandBinding(Command, Execute)); | ||
} | ||
|
||
private static void Execute(object sender, ExecutedRoutedEventArgs e) | ||
{ | ||
var mainWindow = (MainWindow)sender; | ||
mainWindow.Editor.Find(e.Parameter as Regex); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Text.RegularExpressions; | ||
using System.Windows; | ||
using System.Windows.Input; | ||
using MarkdownEdit.Controls; | ||
|
||
namespace MarkdownEdit.Commands | ||
{ | ||
internal static class EditorReplaceAllCommand | ||
{ | ||
public static readonly RoutedCommand Command = new RoutedCommand(); | ||
|
||
static EditorReplaceAllCommand() | ||
{ | ||
Application.Current.MainWindow.CommandBindings.Add(new CommandBinding(Command, Execute)); | ||
} | ||
|
||
private static void Execute(object sender, ExecutedRoutedEventArgs e) | ||
{ | ||
var mainWindow = (MainWindow)sender; | ||
var tuple = (Tuple<Regex, string>)e.Parameter; | ||
mainWindow.Editor.ReplaceAll(tuple.Item1, tuple.Item2); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Text.RegularExpressions; | ||
using System.Windows; | ||
using System.Windows.Input; | ||
using MarkdownEdit.Controls; | ||
|
||
namespace MarkdownEdit.Commands | ||
{ | ||
internal static class EditorReplaceCommand | ||
{ | ||
public static readonly RoutedCommand Command = new RoutedCommand(); | ||
|
||
static EditorReplaceCommand() | ||
{ | ||
Application.Current.MainWindow.CommandBindings.Add(new CommandBinding(Command, Execute)); | ||
} | ||
|
||
private static void Execute(object sender, ExecutedRoutedEventArgs e) | ||
{ | ||
var mainWindow = (MainWindow)sender; | ||
var tuple = (Tuple<Regex, string>)e.Parameter; | ||
mainWindow.Editor.Replace(tuple.Item1, tuple.Item2); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Windows; | ||
using System.Windows.Input; | ||
using MarkdownEdit.Controls; | ||
|
||
namespace MarkdownEdit.Commands | ||
{ | ||
internal static class EditorReplaceDialogCommand | ||
{ | ||
public static readonly RoutedCommand Command = ApplicationCommands.Replace; | ||
|
||
static EditorReplaceDialogCommand() | ||
{ | ||
Application.Current.MainWindow.CommandBindings.Add(new CommandBinding(Command, Execute)); | ||
} | ||
|
||
private static void Execute(object sender, ExecutedRoutedEventArgs e) | ||
{ | ||
var mainWindow = (MainWindow)sender; | ||
mainWindow.Editor.ReplaceDialog(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Windows; | ||
using System.Windows.Input; | ||
using MarkdownEdit.Controls; | ||
using Clipboard = MarkdownEdit.Models.Clipboard; | ||
|
||
namespace MarkdownEdit.Commands | ||
{ | ||
internal static class ExportHtmlCommand | ||
{ | ||
public static readonly RoutedCommand Command = new RoutedCommand(); | ||
|
||
static ExportHtmlCommand() | ||
{ | ||
Application.Current.MainWindow.CommandBindings.Add(new CommandBinding(Command, Execute)); | ||
} | ||
|
||
private static void Execute(object sender, ExecutedRoutedEventArgs e) | ||
{ | ||
var mainWindow = (MainWindow)sender; | ||
Clipboard.ExportHtmlToClipboard(mainWindow.Editor.Text); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Windows; | ||
using System.Windows.Input; | ||
using MarkdownEdit.Controls; | ||
using Clipboard = MarkdownEdit.Models.Clipboard; | ||
|
||
namespace MarkdownEdit.Commands | ||
{ | ||
internal static class ExportHtmlTemplateCommand | ||
{ | ||
public static readonly RoutedCommand Command = new RoutedCommand(); | ||
|
||
static ExportHtmlTemplateCommand() | ||
{ | ||
Application.Current.MainWindow.CommandBindings.Add(new CommandBinding(Command, Execute)); | ||
} | ||
|
||
private static void Execute(object sender, ExecutedRoutedEventArgs e) | ||
{ | ||
var mainWindow = (MainWindow)sender; | ||
Clipboard.ExportHtmlToClipboard(mainWindow.Editor.Text, true); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Windows; | ||
using System.Windows.Input; | ||
using MarkdownEdit.Controls; | ||
|
||
namespace MarkdownEdit.Commands | ||
{ | ||
internal static class FindNextCommand | ||
{ | ||
public static readonly RoutedCommand Command = new RoutedCommand(); | ||
|
||
static FindNextCommand() | ||
{ | ||
Application.Current.MainWindow.CommandBindings.Add(new CommandBinding(Command, Execute)); | ||
} | ||
|
||
private static void Execute(object sender, ExecutedRoutedEventArgs e) | ||
{ | ||
var editor = ((MainWindow)sender).Editor; | ||
editor.FindReplaceDialog.FindNext(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System.Windows; | ||
using System.Windows.Input; | ||
using MarkdownEdit.Controls; | ||
|
||
namespace MarkdownEdit.Commands | ||
{ | ||
internal static class FindPreviousCommand | ||
{ | ||
public static readonly RoutedCommand Command = new RoutedCommand(); | ||
|
||
static FindPreviousCommand() | ||
{ | ||
Application.Current.MainWindow.CommandBindings.Add(new CommandBinding(Command, Execute)); | ||
} | ||
|
||
private static void Execute(object sender, ExecutedRoutedEventArgs e) | ||
{ | ||
var editor = ((MainWindow)sender).Editor; | ||
editor.FindReplaceDialog.FindPrevious(); | ||
} | ||
} | ||
} |
Oops, something went wrong.