add: Monaco编辑器
This commit is contained in:
parent
d102b47da8
commit
d8edc6c28b
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AntDesign" Version="0.15.5" />
|
<PackageReference Include="AntDesign" Version="0.15.5" />
|
||||||
|
<PackageReference Include="BlazorMonaco" Version="3.1.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
19
Frontend/Pages/Editor.razor
Normal file
19
Frontend/Pages/Editor.razor
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
@page "/editor"
|
||||||
|
|
||||||
|
<Layout>
|
||||||
|
<Content>
|
||||||
|
<div class="editor-zone">
|
||||||
|
<StandaloneCodeEditor ConstructionOptions="GetEditorConstructionOptions" Id="my-editor-instance"/>
|
||||||
|
</div>
|
||||||
|
</Content>
|
||||||
|
</Layout>
|
||||||
|
|
||||||
|
@code {
|
||||||
|
private StandaloneEditorConstructionOptions GetEditorConstructionOptions(StandaloneCodeEditor editor)
|
||||||
|
{
|
||||||
|
return new StandaloneEditorConstructionOptions
|
||||||
|
{
|
||||||
|
Language = "yaml"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
3
Frontend/Pages/Editor.razor.css
Normal file
3
Frontend/Pages/Editor.razor.css
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.editor-zone {
|
||||||
|
min-height: calc(100vh - 64px);
|
||||||
|
}
|
|
@ -27,7 +27,10 @@
|
||||||
<a class="dismiss">🗙</a>
|
<a class="dismiss">🗙</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="_framework/blazor.server.js"></script>
|
|
||||||
<script src="_content/AntDesign/js/ant-design-blazor.js"></script>
|
<script src="_content/AntDesign/js/ant-design-blazor.js"></script>
|
||||||
|
<script src="_content/BlazorMonaco/jsInterop.js"></script>
|
||||||
|
<script src="_content/BlazorMonaco/lib/monaco-editor/min/vs/loader.js"></script>
|
||||||
|
<script src="_content/BlazorMonaco/lib/monaco-editor/min/vs/editor/editor.main.js"></script>
|
||||||
|
<script src="_framework/blazor.server.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -2,5 +2,8 @@
|
||||||
@using Microsoft.AspNetCore.Components.Web
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
@using Microsoft.JSInterop
|
@using Microsoft.JSInterop
|
||||||
@using AntDesign
|
@using AntDesign
|
||||||
|
@using BlazorMonaco
|
||||||
|
@using BlazorMonaco.Editor
|
||||||
|
@using BlazorMonaco.Languages
|
||||||
@using Frontend
|
@using Frontend
|
||||||
@using Frontend.Shared
|
@using Frontend.Shared
|
|
@ -30,3 +30,7 @@
|
||||||
body {
|
body {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.monaco-editor-container {
|
||||||
|
min-height: 100%;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user