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"
         ]
     };
 }
相关推荐
ekskef_sef17 分钟前
32岁前端干了8年,是继续做前端开发,还是转其它工作
前端
火烧屁屁啦19 分钟前
【JavaEE进阶】初始Spring Web MVC
java·spring·java-ee
w_312345433 分钟前
自定义一个maven骨架 | 最佳实践
java·maven·intellij-idea
岁岁岁平安35 分钟前
spring学习(spring-DI(字符串或对象引用注入、集合注入)(XML配置))
java·学习·spring·依赖注入·集合注入·基本数据类型注入·引用数据类型注入
武昌库里写JAVA38 分钟前
Java成长之路(一)--SpringBoot基础学习--SpringBoot代码测试
java·开发语言·spring boot·学习·课程设计
sunshine64142 分钟前
【CSS】实现tag选中对钩样式
前端·css·css3
Q_19284999061 小时前
基于Spring Boot的九州美食城商户一体化系统
java·spring boot·后端
张国荣家的弟弟1 小时前
【Yonghong 企业日常问题 06】上传的文件不在白名单,修改allow.jar.digest属性添加允许上传的文件SH256值?
java·jar·bi
真滴book理喻1 小时前
Vue(四)
前端·javascript·vue.js
蜜獾云1 小时前
npm淘宝镜像
前端·npm·node.js