-
Notifications
You must be signed in to change notification settings - Fork 73
979389: Added a blazor documentation for block editor #7252
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+2,840
−8
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
14b0968
979389: Added a blazor documentation for block editor
premanandh2205 bab2166
Merge branch 'development' into 979389-block-editor
premanandh2205 b4870a2
979389: Added a build-in-blocks sections in block editor
premanandh2205 7aaa595
Merge branch '979389-block-editor' of https://github.com/syncfusion-c…
premanandh2205 8bd3734
979389: Updated the images
premanandh2205 440b93e
Merge branch 'development' into 979389-block-editor
premanandh2205 1a32603
Merge branch 'development' of https://github.com/syncfusion-content/b…
premanandh2205 d0815a9
979389: Update the block editor
premanandh2205 abaf259
Merge branch '979389-block-editor' of https://github.com/syncfusion-c…
premanandh2205 dca6844
979389: update the toc file
premanandh2205 b2873a1
998260: Globalization & Paste Cleanup contents
manikandan-mariappan f0acdc5
Merge branch '979389-block-editor' of https://github.com/syncfusion-c…
manikandan-mariappan 677741c
979389: Update the review corrections
premanandh2205 b7c7f32
Merge branch '979389-block-editor' of https://github.com/syncfusion-c…
premanandh2205 aea3223
979389: editor menus and undo redo doc
SenthilarasuBalu af7d83e
979389: remove unwanted files
premanandh2205 0e670bc
Merge branch '979389-block-editor' of https://github.com/syncfusion-c…
premanandh2205 1ff8433
979389: events changes pushed
SenthilarasuBalu 533a4e2
Merge branch '979389-block-editor' of https://github.com/syncfusion-c…
SenthilarasuBalu 1ea99c1
998260: UG corrections Phase 1
manikandan-mariappan 9dde2cd
Merge branch '979389-block-editor' of https://github.com/syncfusion-c…
manikandan-mariappan 31e2f11
979389: Update the getting started image
premanandh2205 75ca6c6
979389: doc addition
SenthilarasuBalu ef8a9b8
998669: UG content and sample corrections
manikandan-mariappan 96bd0d4
Merge branch '979389-block-editor' of https://github.com/syncfusion-c…
manikandan-mariappan 27b8506
998669: Corrections, image errors resolved
manikandan-mariappan 05ebfbb
Merge branch 'development' into 979389-block-editor
manikandan-mariappan 4f004ad
979389: review corrections
SenthilarasuBalu e507890
Merge branch 'development' into 979389-block-editor
IndrajithSrinivasan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,284 @@ | ||
| --- | ||
| layout: post | ||
| title: Appearance in Blazor Block Editor Component | Syncfusion | ||
| description: Checkout and learn here all about Appearance with Syncfusion Blazor Block Editor component in Blazor Server App and Blazor WebAssembly App. | ||
| platform: Blazor | ||
| control: BlockEditor | ||
| documentation: ug | ||
| --- | ||
|
|
||
| # Appearance in Blazor Block Editor component | ||
|
|
||
| The Block Editor component provides several properties to customize its visual appearance, allowing you to control its dimensions, styling, and behavior. | ||
|
|
||
| ## Setting width and height | ||
|
|
||
| You can specify the width and height for the Block Editor component using the `Width` and `Height` properties. | ||
|
|
||
| ```cshtml | ||
| @using Syncfusion.Blazor.BlockEditor; | ||
| <SfBlockEditor Width="100%" Height="80vh"></SfBlockEditor> | ||
| // Or with specific pixel values | ||
| <SfBlockEditor Width="800px" Height="500px"></SfBlockEditor> | ||
| ``` | ||
|
|
||
| ## Setting readonly mode | ||
|
|
||
| You can utilize the `ReadOnly` property to control whether the editor is in read-only mode. When set to `true`, users cannot edit the content but can still view it. | ||
|
|
||
| ```cshtml | ||
| @using Syncfusion.Blazor.BlockEditor; | ||
| <SfBlockEditor ReadOnly=true></SfBlockEditor> | ||
| ``` | ||
|
|
||
| ## Customization using CSS Class | ||
|
|
||
| You can use the `CssClass` property to customize the appearance of the Block Editor component. | ||
|
|
||
| ```cshtml | ||
| @using Syncfusion.Blazor.BlockEditor; | ||
| <SfBlockEditor Width="600px" Height="400px" CssClass="custom-editor-theme"></SfBlockEditor> | ||
| ``` | ||
|
|
||
| The following example demonstrates the usage of `Readonly` and `CssClass` properties of the Block Editor. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Readonly - ReadOnly |
||
|
|
||
| ```cshtml | ||
| @using Syncfusion.Blazor.BlockEditor | ||
| @using Syncfusion.Blazor.Buttons | ||
| <div id="container"> | ||
| <SfBlockEditor @ref="BlockEditorRef" | ||
| CssClass="@CssClasses" | ||
| ReadOnly="@IsReadonly" | ||
| Blocks="@Blocks" | ||
| Focus="OnEditorFocus" | ||
| Blur="OnEditorBlur"> | ||
| </SfBlockEditor> | ||
| <div id="controls"> | ||
| <h3>Appearance Configuration Demo</h3> | ||
| <div class="button-group"> | ||
| <SfButton @onclick="ToggleReadonly">Toggle Readonly Mode</SfButton> | ||
| <SfButton @onclick="ApplyCustomTheme">Apply Custom Theme</SfButton> | ||
| </div> | ||
| <div id="statusText" style="margin-top: 10px;"> | ||
| <strong>Current Status: </strong>@StatusMessage | ||
| </div> | ||
| </div> | ||
| <div id="output">@OutputMessage</div> | ||
| </div> | ||
| @code { | ||
| private SfBlockEditor? BlockEditorRef; | ||
| private bool IsReadonly { get; set; } = false; | ||
| private string CurrentTheme { get; set; } = "default"; | ||
| private string StatusMessage { get; set; } = "Editable, Default Theme"; | ||
| private string OutputMessage { get; set; } = ""; | ||
| private string CssClasses => $"{CurrentTheme} {(IsReadonly ? "readonly-mode" : "")}".Trim(); | ||
| private List<BlockModel> Blocks => new List<BlockModel> | ||
| { | ||
| new BlockModel | ||
| { | ||
| BlockType = BlockType.Heading, | ||
| Properties = new HeadingBlockSettings { Level = 1 }, | ||
| Content = new List<ContentModel> | ||
| { | ||
| new ContentModel { ContentType = ContentType.Text, Content = "Appearance Configuration Demo" } | ||
| } | ||
| }, | ||
| new BlockModel | ||
| { | ||
| BlockType = BlockType.Paragraph, | ||
| Content = new List<ContentModel> | ||
| { | ||
| new ContentModel { ContentType = ContentType.Text, Content = "This demo showcases different appearance configurations including readonly mode and a custom CSS theme." } | ||
| } | ||
| }, | ||
| new BlockModel | ||
| { | ||
| BlockType = BlockType.Heading, | ||
| Properties = new HeadingBlockSettings { Level = 2 }, | ||
| Content = new List<ContentModel> | ||
| { | ||
| new ContentModel { ContentType = ContentType.Text, Content = "Configured Custom Theme" } | ||
| } | ||
| }, | ||
| new BlockModel | ||
| { | ||
| BlockType = BlockType.BulletList, | ||
| Content = new List<ContentModel> | ||
| { | ||
| new ContentModel { ContentType = ContentType.Text, Content = "Gradient background with modern styling" } | ||
| } | ||
| }, | ||
| new BlockModel | ||
| { | ||
| BlockType = BlockType.Paragraph, | ||
| Content = new List<ContentModel> | ||
| { | ||
| new ContentModel | ||
| { | ||
| ContentType = ContentType.Text, | ||
| Content = "Use the readonly toggle to switch between editable and read-only modes. In readonly mode, you can view content but cannot make changes." | ||
| } | ||
| } | ||
| } | ||
| }; | ||
| private void ToggleReadonly() | ||
| { | ||
| IsReadonly = !IsReadonly; | ||
| UpdateStatus(); | ||
| DisplayOutput($"Readonly mode {(IsReadonly ? "enabled" : "disabled")}. {(IsReadonly ? "Content is now view-only." : "Content is now editable.")}"); | ||
| } | ||
| private void ApplyCustomTheme() | ||
| { | ||
| CurrentTheme = "custom-theme"; | ||
| UpdateStatus(); | ||
| DisplayOutput("Custom theme applied. The editor now features a gradient background with modern styling and hover effects."); | ||
| } | ||
| private void OnEditorFocus() | ||
| { | ||
| DisplayOutput("Editor focused. You can now type or edit content."); | ||
| } | ||
| private void OnEditorBlur() | ||
| { | ||
| DisplayOutput("Editor lost focus."); | ||
| } | ||
| protected override void OnInitialized() | ||
| { | ||
| UpdateStatus(); | ||
| } | ||
| private void UpdateStatus() | ||
| { | ||
| string mode = IsReadonly ? "Readonly" : "Editable"; | ||
| string theme = CurrentTheme == "default" ? "Default" : "Custom"; | ||
| StatusMessage = $"{mode}, {theme} Theme"; | ||
| } | ||
| private void DisplayOutput(string msg) | ||
| { | ||
| OutputMessage = msg; | ||
| StateHasChanged(); | ||
| } | ||
| } | ||
| <style> | ||
| #container { | ||
| margin: 50px; | ||
| gap: 20px; | ||
| display: flex; | ||
| flex-direction: column; | ||
| align-items: center; | ||
| } | ||
| #controls { | ||
| margin-bottom: 20px; | ||
| padding: 20px; | ||
| border: 1px solid #ddd; | ||
| border-radius: 5px; | ||
| background-color: #f8f9fa; | ||
| } | ||
| .button-group { | ||
| margin-bottom: 15px; | ||
| } | ||
| .button-group button { | ||
| margin: 5px; | ||
| padding: 8px 16px; | ||
| background-color: #17a2b8; | ||
| color: white; | ||
| border: none; | ||
| border-radius: 4px; | ||
| cursor: pointer; | ||
| } | ||
| .button-group button:hover { | ||
| background-color: #138496; | ||
| } | ||
| .status-info { | ||
| padding: 10px; | ||
| background-color: #d1ecf1; | ||
| border-left: 4px solid #17a2b8; | ||
| border-radius: 4px; | ||
| } | ||
| .status-info p { | ||
| margin: 0; | ||
| color: #0c5460; | ||
| } | ||
| #output { | ||
| margin-top: 15px; | ||
| padding: 10px; | ||
| background-color: #f8f9fa; | ||
| border-radius: 4px; | ||
| min-height: 50px; | ||
| font-family: monospace; | ||
| white-space: pre-wrap; | ||
| } | ||
| /* Custom Theme CSS Class */ | ||
| .custom-theme { | ||
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | ||
| border-radius: 12px; | ||
| } | ||
| .custom-theme .e-block { | ||
| border-radius: 8px; | ||
| margin-bottom: 10px; | ||
| backdrop-filter: blur(10px); | ||
| } | ||
| .custom-theme .e-block:hover { | ||
| transform: translateY(-2px); | ||
| transition: all 0.3s ease; | ||
| } | ||
| .custom-theme .e-block-content, | ||
| .custom-theme .e-floating-icon { | ||
| color: #fff; | ||
| font-weight: 500; | ||
| } | ||
| /* Readonly Mode Styling */ | ||
| .readonly-mode { | ||
| opacity: 0.8; | ||
| cursor: not-allowed; | ||
| } | ||
| .readonly-mode .e-block-content { | ||
| color: #6c757d; | ||
| } | ||
| .custom-theme.readonly-mode .e-block-content { | ||
| color: #101111; | ||
| } | ||
| </style> | ||
| ``` | ||
|  | ||
|
|
||
|  | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the heading as Editor Security
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed