asp.net blazor集成TinyMCE.Blazor

asp.net blazor项目添加TinyMCE.Blazor nuget包

在blazor页面中添加,可以通过ScriptSrc参数配置自定义TinyMCE.Blazor js

XML 复制代码
            <EditForm class="mb-3" Model="Model" OnValidSubmit="@HandleValidSubmit">
                <div class="form-group">
                    <label class="control-label">内容</label>
                    <TinyMCE.Blazor.Editor Field="() => Model.Content"
                                           @bind-Value="Model.Content"
                                           ScriptSrc="https://zeus-site-www.oss-cn-beijing.aliyuncs.com/tinymce_6.0.2/tinymce/js/tinymce/tinymce.min.js"
                                           JsConfSrc="tinymceConf" />
                </div>
                <div class="form-group">
                    <input type="submit" value="创建" class="btn btn-primary" />
                    <input type="button" value="返回" class="btn btn-secondary" @onclick="(()=> ClickToBack())" />
                </div>
            </EditForm>
javascript 复制代码
 var BuildTinymceConf = (imgUploadUrl) => {
     window.tinymceConf = {
         //selector: 'textarea#tinymce_edit',  // change this value according to your HTML
         theme: 'silver',
         language: 'zh_CN',
         language_url: 'https://zeus-site-www.oss-cn-beijing.aliyuncs.com/tinymce4x_languages/langs/zh_CN.js',
         height: "480",
         images_upload_url: imgUploadUrl,
         images_upload_credentials: true,
         plugins: "code codesample preview searchreplace autolink directionality visualblocks visualchars fullscreen link media template codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help image emoticons",
         toolbar: "codesample | formatselect | bold italic strikethrough forecolor backcolor | link | alignleft aligncenter alignright alignjustify  | numlist bullist outdent indent  | removeformat image emoticons",
         codesample_languages: [
             { text: 'HTML/XML', value: 'markup' },
             { text: 'JavaScript', value: 'javascript' },
             { text: 'TypeScript', value: 'typescript' },
             { text: 'Python', value: 'python' },
             { text: 'PowerShell', value: 'powershell' },
             { text: 'SQL', value: 'sql' },
             { text: 'Git', value: 'git' },
             { text: 'CSS', value: 'css' },
             { text: 'Bash', value: 'bash' },
             { text: 'CSS', value: 'css' },
             { text: 'PHP', value: 'php' },
             { text: 'Ruby', value: 'ruby' },
             { text: 'Python', value: 'python' },
             { text: 'Java', value: 'java' },
             { text: 'C', value: 'c' },
             { text: 'C#', value: 'csharp' },
             { text: 'C++', value: 'cpp' }
         ],
         textcolor_map: [
             "000000", "Black",
             "993300", "Burnt orange",
             "333300", "Dark olive",
             "003300", "Dark green",
             "003366", "Dark azure",
             "000080", "Navy Blue",
             "333399", "Indigo",
             "333333", "Very dark gray",
             "800000", "Maroon",
             "FF6600", "Orange",
             "808000", "Olive",
             "008000", "Green",
             "008080", "Teal",
             "0000FF", "Blue",
             "666699", "Grayish blue",
             "808080", "Gray",
             "FF0000", "Red",
             "FF9900", "Amber",
             "99CC00", "Yellow green",
             "339966", "Sea green",
             "33CCCC", "Turquoise",
             "3366FF", "Royal blue",
             "800080", "Purple",
             "999999", "Medium gray",
             "FF00FF", "Magenta",
             "FFCC00", "Gold",
             "FFFF00", "Yellow",
             "00FF00", "Lime",
             "00FFFF", "Aqua",
             "00CCFF", "Sky blue",
             "993366", "Red violet",
             "FFFFFF", "White",
             "FF99CC", "Pink",
             "FFCC99", "Peach",
             "FFFF99", "Light yellow",
             "CCFFCC", "Pale green",
             "CCFFFF", "Pale cyan",
             "99CCFF", "Light sky blue",
             "CC99FF", "Plum"
         ]
     };
 }
相关推荐
zhougl9966 分钟前
html处理Base文件流
linux·前端·html
花花鱼10 分钟前
node-modules-inspector 可视化node_modules
前端·javascript·vue.js
HBR666_13 分钟前
marked库(高效将 Markdown 转换为 HTML 的利器)
前端·markdown
战族狼魂2 小时前
CSGO 皮肤交易平台后端 (Spring Boot) 代码结构与示例
java·spring boot·后端
careybobo2 小时前
海康摄像头通过Web插件进行预览播放和控制
前端
xyliiiiiL3 小时前
ZGC初步了解
java·jvm·算法
杉之3 小时前
常见前端GET请求以及对应的Spring后端接收接口写法
java·前端·后端·spring·vue
喝拿铁写前端3 小时前
字段聚类,到底有什么用?——从系统混乱到结构认知的第一步
前端
再学一点就睡3 小时前
大文件上传之切片上传以及开发全流程之前端篇
前端·javascript
hycccccch4 小时前
Canal+RabbitMQ实现MySQL数据增量同步
java·数据库·后端·rabbitmq