All Projects → Kyle-Undefined → Blazaco

Kyle-Undefined / Blazaco

Licence: MIT license
A Blazor Component utilizing the Monaco editor by Microsoft

Programming Languages

C#
18002 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to Blazaco

awesome-blazor-browser
A Blazor WebAssembly app for browsing the "Awesome Blazor" resources.
Stars: ✭ 155 (+573.91%)
Mutual labels:  blazor, blazor-client
use-monaco
Use 🗒️ monaco-editor in any ⚛️ React app with simple hooks 🎣
Stars: ✭ 85 (+269.57%)
Mutual labels:  monaco-editor, monaco
RoleBasedAuthWithBlazor
Companion code sample for my blog post - Configuring Role-based Authorization with client-side Blazor
Stars: ✭ 22 (-4.35%)
Mutual labels:  blazor, blazor-client
MudBlazor.Markdown
Markdown component based on the MudBlazor environment
Stars: ✭ 30 (+30.43%)
Mutual labels:  blazor, blazor-client
Home
Home for Blazor Extensions
Stars: ✭ 51 (+121.74%)
Mutual labels:  blazor, blazor-extensions
BlazorWasmWithDocker
Companion code sample for my blog post - Containerising a Blazor WebAssembly App
Stars: ✭ 16 (-30.43%)
Mutual labels:  blazor, blazor-client
Matblazor
Material Design components for Blazor and Razor Components
Stars: ✭ 2,599 (+11200%)
Mutual labels:  blazor, blazor-client
Blazorade-Teams
A Blazor component library that is designed to be used when building applications for Microsoft Teams.
Stars: ✭ 29 (+26.09%)
Mutual labels:  blazor, blazor-client
AsteroidsWasm
Collection of applications based on a single C# .NET Standard project running in: Blazor Client (WebAssembly), Blazor Server, Electron, WPF, WinForms, Xamarin
Stars: ✭ 136 (+491.3%)
Mutual labels:  blazor, blazor-client
blazor-docs
Public Documentation for Telerik UI for Blazor components.
Stars: ✭ 42 (+82.61%)
Mutual labels:  blazor, blazor-client
AutoSaveEditForm
A replacement for the default EditForm component which will auto save a form until it is successfully submitted
Stars: ✭ 44 (+91.3%)
Mutual labels:  blazor, blazor-client
MudBlazor
Blazor Component Library based on Material design with an emphasis on ease of use. Mainly written in C# with Javascript kept to a bare minimum it empowers .NET developers to easily debug it if needed.
Stars: ✭ 4,539 (+19634.78%)
Mutual labels:  blazor, blazor-client
BlazorCefApp
Build windows desktop GUI app via CEF / WinForms / Blazor server-site
Stars: ✭ 28 (+21.74%)
Mutual labels:  blazor, blazor-interop
TextEditor
Rich text editor for Blazor applications - Uses Quill JS
Stars: ✭ 156 (+578.26%)
Mutual labels:  blazor, blazor-client
blazor-analytics
Blazor extensions for Analytics: Google Analytics, GTAG, ...
Stars: ✭ 101 (+339.13%)
Mutual labels:  blazor, blazor-extensions
Awesome Blazor
Resources for Blazor, a .NET web framework using C#/Razor and HTML that runs in the browser with WebAssembly.
Stars: ✭ 6,063 (+26260.87%)
Mutual labels:  blazor, blazor-interop
BlazorHealthApp
Example application ported from Angular 2 to Blazor
Stars: ✭ 37 (+60.87%)
Mutual labels:  blazor, blazor-client
smart-blazor
Blazor UI Components & Examples
Stars: ✭ 32 (+39.13%)
Mutual labels:  blazor, blazor-client
BlazorMonaco
Blazor component for Microsoft's Monaco Editor which powers Visual Studio Code.
Stars: ✭ 151 (+556.52%)
Mutual labels:  monaco-editor, blazor
BlazorVirtualScrolling
Blazor components for efficiently rendering large lists and data using virtual scrolling
Stars: ✭ 56 (+143.48%)
Mutual labels:  blazor, blazor-client

Blazaco

A Blazor Component utilizing the Monaco editor by Microsoft, inspired by BlazorBits. Built and tested for Blazor version 3.0.100-preview5-011568.

I built this after writing my own ShareX (image / code / link) API in Blazor, just seeing what all it's capable of, and was looking for a way to style the code page. Found the BlazorBits but noticed it wasn't on Nuget anymore and was outdated, so decided to build an updated version. Any feedback would greatly be appreciated.

Blazaco dependencies

  • Visual Studio 16.1.0 Preview 3
  • .NET Core 3.0.100-preview5-011568

Demo

Installation

  • Add the NuGet package to your Blazor Client project
dotnet add package Blazaco

// or

Install-Package Blazaco

Usage

  • Add the following to your root _ViewImports.cshtml file, or any file you want to use the Monaco Editor
@using Blazaco
@using Blazaco.Editor
@using Blazaco.Editor.Options // Only needed if you want to change defaults
  • Add the MonacoEditor Component anywhere in your file
<MonacoEditor ref="_editor" Model="@_editorModel" Width="500" Height="500" />

// or

<MonacoEditor ref="_editor" Model="@_editorModel" FullScreen="true" />

Note: You can have a set Width / Height (Defaults to 800 / 600) or have a Fullscreen mode

  • Add your MonacoEditor and EditorModel fields to your @functions
private EditorModel _editorModel { get; set; }
private MonacoEditor _editor;
  • Configure Blazaco settings in your OnInit or OnInitAsync
_editorModel = new EditorModel(); // Uses defaults

// or

var options = new EditorOptions()
{
    Value = "// Your Code Here!",
    Language = "csharp",
    Theme = "vs-dark"
};

_editorModel = new EditorModel(options);

// or

var options = new EditorOptions()
{
	Value = "// Your Code Here!",
	Language = "csharp",
	Theme = "vs-dark",
	Minimap = new MinimapOptions()
	{
		Enabled = false
	}
};

_editorModel = new EditorModel(options);

// or

_editorModel = new EditorModel(new EditorOptions()
{
	Value = "// Your Code Here!",
	Language = "csharp",
	Theme = "vs-dark",
	Minimap = new MinimapOptions()
	{
		Enabled = false
	}
});

Note: You can configure the Constructor Options based on these options

  • Add the monaco-editor folder and link the Javascript and CSS files in your index.html file
<head>
    <link rel="stylesheet" data-name="vs/editor/editor.main" href="monaco-editor/min/vs/editor/editor.main.css">
</head>
<body>
    <app></app>
    ...
    <script>var require = { paths: { 'vs': 'monaco-editor/min/vs' } };</script>
    <script src="monaco-editor/min/vs/loader.js"></script>
    <script src="monaco-editor/min/vs/editor/editor.main.nls.js"></script>
    <script src="monaco-editor/min/vs/editor/editor.main.js"></script>
    <script type="blazor-boot">
    </script>
	...
</body>

Interop

Currently I've only created a handful of Methods for Interop, as that's all I really need for my purposes. Current plans are to expand the Interop to allow more integration of the Monaco Editor API and make it more fleshed out.

  • InitializeEditor
    • Internal Method to Initialize the Monaco Editor with default or set settings
  • GetValue
    • Gets the Value from the Monaco Editor
  • SetValue
    • Sets the Value for the Monaco Editor to display
  • SetTheme
    • Sets the Theme for the Monaco Editor

Change log

Copyright

Copyright (c) 2019 Kyle Undefined under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].