Skip to content

Commit 2c13951

Browse files
committed
Shorten Name to Editor instead of EditorComponent
1 parent 54fb011 commit 2c13951

File tree

7 files changed

+36
-22
lines changed

7 files changed

+36
-22
lines changed

MonacoEditorComponent/EditorComponent.Events.cs renamed to MonacoEditorComponent/Editor.Events.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace Monaco
1212
{
13-
public partial class EditorComponent
13+
public partial class Editor
1414
{
1515
// Override default Loaded event so we can make sure we've initialized our WebView contents with the Editor.
1616
public new event RoutedEventHandler Loaded;

MonacoEditorComponent/EditorComponent.Properties.cs renamed to MonacoEditorComponent/Editor.Properties.cs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77

88
namespace Monaco
99
{
10-
partial class EditorComponent
10+
partial class Editor
1111
{
12+
/// <summary>
13+
/// Get or Set the Editor Text.
14+
/// </summary>
1215
public string Text
1316
{
1417
get { return (string)GetValue(TextProperty); }
@@ -17,11 +20,11 @@ public string Text
1720

1821
// Using a DependencyProperty as the backing store for HorizontalLayout. This enables animation, styling, binding, etc...
1922
private static readonly DependencyProperty TextPropertyField =
20-
DependencyProperty.Register("Text", typeof(string), typeof(EditorComponent), new PropertyMetadata("", (d, e) => {
23+
DependencyProperty.Register("Text", typeof(string), typeof(Editor), new PropertyMetadata("", (d, e) => {
2124
//(d as Canvas)?.InvokeScriptAsync("updateToolbox", new string[] { e.NewValue.ToString() });
22-
//(d as EditorComponent).CodeChanged?.Invoke(d, e);
25+
//(d as Editor).CodeChanged?.Invoke(d, e);
2326

24-
(d as EditorComponent)?.InvokeScriptAsync("updateContent", e.NewValue.ToString());
27+
(d as Editor)?.InvokeScriptAsync("updateContent", e.NewValue.ToString());
2528
}));
2629

2730
public static DependencyProperty TextProperty
@@ -31,7 +34,12 @@ public static DependencyProperty TextProperty
3134
return TextPropertyField;
3235
}
3336
}
34-
37+
38+
/// <summary>
39+
/// Set the Syntax Language for the Code Editor.
40+
///
41+
/// Note: Most likely to change or move location.
42+
/// </summary>
3543
public string CodeLanguage
3644
{
3745
get { return (string)GetValue(CodeLanguageProperty); }
@@ -40,9 +48,9 @@ public string CodeLanguage
4048

4149
// Using a DependencyProperty as the backing store for HorizontalLayout. This enables animation, styling, binding, etc...
4250
private static readonly DependencyProperty CodeLanguagePropertyField =
43-
DependencyProperty.Register("CodeLanguage", typeof(string), typeof(EditorComponent), new PropertyMetadata("csharp", (d, e) => {
51+
DependencyProperty.Register("CodeLanguage", typeof(string), typeof(Editor), new PropertyMetadata("csharp", (d, e) => {
4452
//(d as Canvas)?.InvokeScriptAsync("updateToolbox", new string[] { e.NewValue.ToString() });
45-
//(d as EditorComponent).CodeChanged?.Invoke(d, e);
53+
//(d as Editor).CodeChanged?.Invoke(d, e);
4654
}));
4755

4856
internal static DependencyProperty CodeLanguageProperty

MonacoEditorComponent/EditorComponent.cs renamed to MonacoEditorComponent/Editor.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@
88

99
namespace Monaco
1010
{
11+
/// <summary>
12+
/// UWP Windows Runtime Component wrapper for the Monaco Editor
13+
/// https://microsoft.github.io/monaco-editor/
14+
/// </summary>
1115
[TemplatePart(Name = "View", Type = typeof(WebView))]
12-
public sealed partial class EditorComponent : Control
16+
public sealed partial class Editor : Control
1317
{
1418
private bool _initialized;
1519
private WebView _view;
@@ -25,7 +29,7 @@ public bool IsLoaded
2529

2630
// Using a DependencyProperty as the backing store for HorizontalLayout. This enables animation, styling, binding, etc...
2731
private static readonly DependencyProperty IsLoadedPropertyField =
28-
DependencyProperty.Register("IsLoaded", typeof(string), typeof(EditorComponent), new PropertyMetadata(false));
32+
DependencyProperty.Register("IsLoaded", typeof(string), typeof(Editor), new PropertyMetadata(false));
2933

3034
public static DependencyProperty IsLoadedProperty
3135
{
@@ -35,9 +39,9 @@ public static DependencyProperty IsLoadedProperty
3539
}
3640
}
3741

38-
public EditorComponent()
42+
public Editor()
3943
{
40-
this.DefaultStyleKey = typeof(EditorComponent);
44+
this.DefaultStyleKey = typeof(Editor);
4145
}
4246

4347
protected override void OnApplyTemplate()

MonacoEditorComponent/Monaco/LanguagesHelper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ namespace Monaco
1515
/// </summary>
1616
public sealed class LanguagesHelper
1717
{
18-
private EditorComponent editor;
18+
private Editor editor;
1919

20-
public LanguagesHelper(EditorComponent editor)
20+
public LanguagesHelper(Editor editor)
2121
{
2222
// We need the editor component in order to execute JavaScript within
2323
// the WebView environment to retrieve data (even though this Monaco class is static).

MonacoEditorComponent/MonacoEditorComponent.csproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
<PlatformTarget>x64</PlatformTarget>
9292
<UseVSHostingProcess>false</UseVSHostingProcess>
9393
<ErrorReport>prompt</ErrorReport>
94+
<DocumentationFile>bin\x64\Debug\Monaco.xml</DocumentationFile>
9495
</PropertyGroup>
9596
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
9697
<PlatformTarget>x64</PlatformTarget>
@@ -102,13 +103,14 @@
102103
<PlatformTarget>x64</PlatformTarget>
103104
<UseVSHostingProcess>false</UseVSHostingProcess>
104105
<ErrorReport>prompt</ErrorReport>
106+
<DocumentationFile>bin\x64\Release\Monaco.xml</DocumentationFile>
105107
</PropertyGroup>
106108
<PropertyGroup>
107109
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
108110
</PropertyGroup>
109111
<ItemGroup>
110-
<Compile Include="EditorComponent.cs" />
111-
<Compile Include="EditorComponent.Properties.cs" />
112+
<Compile Include="Editor.cs" />
113+
<Compile Include="Editor.Properties.cs" />
112114
<Compile Include="Helpers\DebugLogger.cs" />
113115
<Compile Include="Helpers\ParentAccessor.cs" />
114116
<Compile Include="Helpers\ThemeListener.cs" />
@@ -248,7 +250,7 @@
248250
<Content Include="MonacoEditor.html" />
249251
</ItemGroup>
250252
<ItemGroup>
251-
<Compile Include="EditorComponent.Events.cs" />
253+
<Compile Include="Editor.Events.cs" />
252254
<None Include="monaco-editor\CHANGELOG.md" />
253255
<None Include="monaco-editor\dev\vs\base\worker\workerMain.js.map" />
254256
<None Include="monaco-editor\dev\vs\editor\editor.main.js.map" />

MonacoEditorComponent/Themes/generic.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<ResourceDictionary
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:local="using:Monaco">
4+
xmlns:monaco="using:Monaco">
55

6-
<Style TargetType="local:EditorComponent" >
6+
<Style TargetType="monaco:Editor" >
77
<Setter Property="Template">
88
<Setter.Value>
9-
<ControlTemplate TargetType="local:EditorComponent">
9+
<ControlTemplate TargetType="monaco:Editor">
1010
<Border
1111
Background="{TemplateBinding Background}"
1212
BorderBrush="{TemplateBinding BorderBrush}"

MonacoEditorTestApp/MainPage.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
<RowDefinition Height="*"/>
1717
<RowDefinition Height="Auto"/>
1818
</Grid.RowDefinitions>
19-
<monaco:EditorComponent x:Name="Editor"
19+
<monaco:Editor x:Name="Editor"
2020
Grid.Row="0"
2121
Text="{x:Bind CodeContent, Mode=TwoWay}"
2222
>
23-
</monaco:EditorComponent>
23+
</monaco:Editor>
2424
<TextBlock Text="{x:Bind CodeContent, Mode=OneWay}" Grid.Row="1"/>
2525
<TextBox x:Name="TextEditor"
2626
AcceptsReturn="True"

0 commit comments

Comments
 (0)