-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ make
IsEditorEnabled
bindable (#36)
Closes: #34
- Loading branch information
1 parent
4c144e0
commit 2670870
Showing
3 changed files
with
77 additions
and
18 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
....Blazor.RichTextEditor.Samples.Shared/Examples/IsEditorEnabledRichTextEditorExample.razor
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,47 @@ | ||
<div> | ||
<h3> | ||
<code class="hljs">IsEditorEnabled</code> example | ||
</h3> | ||
<CodeSnippet Code="@Code"> | ||
<Component> | ||
<CodeSnippet Code="@_content" | ||
CodeFormat="CodeFormat.Html" | ||
Summary="Show HTML"> | ||
<Component> | ||
<RichTextEditor @bind-Content="@_content" | ||
@bind-IsEditorEnabled="@_isEditorEnabled" /> | ||
|
||
<div class="container items-center border-2 border-dashed border-stone-500 p-4 mt-2"> | ||
@((MarkupString)_isEditorEnabledContent) | ||
</div> | ||
|
||
<button class="cursor-pointer w-full flex justify-center items-center hover:bg-zinc-200 border-2 border-dashed border-stone-500 p-4 mt-2 gap-4" | ||
@onclick="@ToggleEditorState"> | ||
<svg xmlns="http://www.w3.org/2000/svg" | ||
height="24" | ||
viewBox="0 0 24 24" | ||
width="24"> | ||
<path d="M0 0h24v24H0z" | ||
fill="none" /> | ||
<path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z" /> | ||
</svg> | ||
|
||
Toggle editor state | ||
</button> | ||
</Component> | ||
</CodeSnippet> | ||
</Component> | ||
</CodeSnippet> | ||
</div> | ||
|
||
@code { | ||
private const string Code = | ||
@"<RichTextEditor @bind-Content=""@_content"" | ||
@bind-IsEditorEnabled=""@_isEditorEnabled"" />"; | ||
private string _content = "<b>Am I enabled? \ud83d\udd12</b>"; | ||
|
||
private bool _isEditorEnabled; | ||
private string _isEditorEnabledContent => $"<p>Am I enabled? <strong>{_isEditorEnabled}</strong></p>"; | ||
|
||
private void ToggleEditorState() => _isEditorEnabled = !_isEditorEnabled; | ||
} |
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