├── README.md ├── changelog.md ├── components ├── robin-color-picker │ └── robin-color-picker.vue ├── robin-editor-header │ └── robin-editor-header.vue └── robin-editor │ ├── editor-icon.css │ ├── editor-icon.ttf │ └── robin-editor.vue └── package.json /README.md: -------------------------------------------------------------------------------- 1 | # 富文本编辑器插件 2 | uniapp 富文本编辑器插件 3 | 4 | ## 兼容性 5 | |微信小程序|H5|APP| 6 | |:--:|:--:|:--:| 7 | |√|√ |x| 8 | 9 | App键盘弹出界面高度未解决 10 | 11 | ## 使用方式 12 | 无需引入,直接使用 13 | 14 | ``` 15 | 在 `template` 中使用组件 16 | ```html 17 | 23 | 24 | ``` 25 | 26 | ## Demo 27 | https://github.com/health901/uniapp-editor-demo 28 | 29 | ## 属性说明 30 | |属性|类型|默认值|说明| 31 | |--|--|--|--| 32 | |v-model|String| |富文本,双向绑定| 33 | |imageUploader|function(img,callback)| |上传图片处理函数 接受参数 img:本地图片地址,callback:上传成功回调传入图片链接| 34 | |muiltImage|Boolean|false|是否支持多图上传| 35 | |compressImage|Boolean|true|图片上传是否压缩| 36 | |previewMode|Boolean|false|预览模式,不可编辑| 37 | |autoHideToolbar|Boolean|false|失去焦点时自动隐藏工具栏| 38 | |tools|Array|['bold', 'italic', 'underline', 'strike', 'align-left', 'align-center', 'align-right', 'remove', 'font', 'color', 'backgroundColor','image', 'clear', 'preview']|工具栏| 39 | 40 | ### 工具栏 41 | |名称|值| 42 | |--|--| 43 | |加粗|`bold`| 44 | |斜体|`italic`| 45 | |下划线|`underline`| 46 | |删除线|`strike`| 47 | |右对齐|`align-left`| 48 | |居中|`align-center`| 49 | |左对齐|`align-right`| 50 | |清除格式|`remove`| 51 | |字体大小|`font`| 52 | |字体颜色|`color`| 53 | |背景色|`backgroundColor`| 54 | |插入图片|`image`| 55 | |清空|`clear`| 56 | |预览|`preview`| 57 | |插入日期|`date`| 58 | |列表|`list-check`,`list-ordered`,`list-bullet`| 59 | |上下标|`sub`,`super`| 60 | |撤销,恢复撤销|`undo`,`redo`| 61 | |缩进|`indent`,`outdent`| 62 | |分割线|`divider`| 63 | |标题|`h1`,`h2`,`h3`,`h4`,`h5`,`h6`| 64 | |书写方向|`rtl`| 65 | 66 | ## 事件说明 67 | |事件|说明|参数| 68 | |--|--|--| 69 | |cancel|点击取消按钮| 70 | |save|点击保存按钮|e={html,text,delta}| 71 | 72 | ## 依赖 73 | |组件|链接|备注| 74 | |---|--|--| 75 | |颜色选择器ColorPicker[[1]](#注)|https://ext.dcloud.net.cn/plugin?id=1237|字体颜色,背景色| 76 | 77 | 78 | ## 注 79 | 1. 修改:添加按钮,支持预设颜色值 80 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | ## 2.1.0(2021-05-27) 2 | 修复因为uni-popup组件升级导致的popup组件报错的问题 3 | ## 2.0.0(2021-02-08) 4 | 迁移至uni_modules -------------------------------------------------------------------------------- /components/robin-color-picker/robin-color-picker.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 213 | 214 | 300 | -------------------------------------------------------------------------------- /components/robin-editor-header/robin-editor-header.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 31 | 32 | 59 | -------------------------------------------------------------------------------- /components/robin-editor/editor-icon.css: -------------------------------------------------------------------------------- 1 | @font-face { 2 | font-family: "iconfont"; 3 | src: url('~./editor-icon.ttf') format('truetype'); 4 | } 5 | 6 | .iconfont { 7 | font-family: "iconfont" !important; 8 | font-size: 16px; 9 | font-style: normal; 10 | -webkit-font-smoothing: antialiased; 11 | -moz-osx-font-smoothing: grayscale; 12 | } 13 | 14 | .icon-redo:before { 15 | content: "\e627"; 16 | } 17 | 18 | .icon-undo:before { 19 | content: "\e633"; 20 | } 21 | 22 | .icon-indent:before { 23 | content: "\eb28"; 24 | } 25 | 26 | .icon-outdent:before { 27 | content: "\e6e8"; 28 | } 29 | 30 | .icon-fontsize:before { 31 | content: "\e6fd"; 32 | } 33 | 34 | .icon-format-header-1:before { 35 | content: "\e860"; 36 | } 37 | 38 | .icon-format-header-4:before { 39 | content: "\e863"; 40 | } 41 | 42 | .icon-format-header-5:before { 43 | content: "\e864"; 44 | } 45 | 46 | .icon-format-header-6:before { 47 | content: "\e865"; 48 | } 49 | 50 | .icon-clearup:before { 51 | content: "\e64d"; 52 | } 53 | 54 | .icon-preview:before { 55 | content: "\e631"; 56 | } 57 | 58 | .icon-date:before { 59 | content: "\e63e"; 60 | } 61 | 62 | .icon-fontbgcolor:before { 63 | content: "\e678"; 64 | } 65 | 66 | .icon-clearedformat:before { 67 | content: "\e67e"; 68 | } 69 | 70 | .icon-font:before { 71 | content: "\e684"; 72 | } 73 | 74 | .icon-723bianjiqi_duanhouju:before { 75 | content: "\e65f"; 76 | } 77 | 78 | .icon-722bianjiqi_duanqianju:before { 79 | content: "\e660"; 80 | } 81 | 82 | .icon-text_color:before { 83 | content: "\e72c"; 84 | } 85 | 86 | .icon-format-header-2:before { 87 | content: "\e75c"; 88 | } 89 | 90 | .icon-format-header-3:before { 91 | content: "\e75d"; 92 | } 93 | 94 | .icon--checklist:before { 95 | content: "\e664"; 96 | } 97 | 98 | .icon-baocun:before { 99 | content: "\ec09"; 100 | } 101 | 102 | .icon-line-height:before { 103 | content: "\e7f8"; 104 | } 105 | 106 | .icon-quanping:before { 107 | content: "\ec13"; 108 | } 109 | 110 | .icon-direction-rtl:before { 111 | content: "\e66e"; 112 | } 113 | 114 | .icon-direction-ltr:before { 115 | content: "\e66d"; 116 | } 117 | 118 | .icon-selectall:before { 119 | content: "\e62b"; 120 | } 121 | 122 | .icon-fuzhi:before { 123 | content: "\ec7a"; 124 | } 125 | 126 | .icon-shanchu:before { 127 | content: "\ec7b"; 128 | } 129 | 130 | .icon-bianjisekuai:before { 131 | content: "\ec7c"; 132 | } 133 | 134 | .icon-fengexian:before { 135 | content: "\ec7f"; 136 | } 137 | 138 | .icon-dianzan:before { 139 | content: "\ec80"; 140 | } 141 | 142 | .icon-charulianjie:before { 143 | content: "\ec81"; 144 | } 145 | 146 | .icon-charutupian:before { 147 | content: "\ec82"; 148 | } 149 | 150 | .icon-wuxupailie:before { 151 | content: "\ec83"; 152 | } 153 | 154 | .icon-juzhongduiqi:before { 155 | content: "\ec84"; 156 | } 157 | 158 | .icon-yinyong:before { 159 | content: "\ec85"; 160 | } 161 | 162 | .icon-youxupailie:before { 163 | content: "\ec86"; 164 | } 165 | 166 | .icon-youduiqi:before { 167 | content: "\ec87"; 168 | } 169 | 170 | .icon-zitidaima:before { 171 | content: "\ec88"; 172 | } 173 | 174 | .icon-xiaolian:before { 175 | content: "\ec89"; 176 | } 177 | 178 | .icon-zitijiacu:before { 179 | content: "\ec8a"; 180 | } 181 | 182 | .icon-zitishanchuxian:before { 183 | content: "\ec8b"; 184 | } 185 | 186 | .icon-zitishangbiao:before { 187 | content: "\ec8c"; 188 | } 189 | 190 | .icon-zitibiaoti:before { 191 | content: "\ec8d"; 192 | } 193 | 194 | .icon-zitixiahuaxian:before { 195 | content: "\ec8e"; 196 | } 197 | 198 | .icon-zitixieti:before { 199 | content: "\ec8f"; 200 | } 201 | 202 | .icon-zitiyanse:before { 203 | content: "\ec90"; 204 | } 205 | 206 | .icon-zuoduiqi:before { 207 | content: "\ec91"; 208 | } 209 | 210 | .icon-zitiyulan:before { 211 | content: "\ec92"; 212 | } 213 | 214 | .icon-zitixiabiao:before { 215 | content: "\ec93"; 216 | } 217 | 218 | .icon-zuoyouduiqi:before { 219 | content: "\ec94"; 220 | } 221 | 222 | .icon-duigoux:before { 223 | content: "\ec9e"; 224 | } 225 | 226 | .icon-guanbi:before { 227 | content: "\eca0"; 228 | } 229 | 230 | .icon-shengyin_shiti:before { 231 | content: "\eca5"; 232 | } 233 | 234 | .icon-Character-Spacing:before { 235 | content: "\e964"; 236 | } 237 | -------------------------------------------------------------------------------- /components/robin-editor/editor-icon.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/health901/uniapp-editor/b9fb2aac6f6764bcd5f2d164e39a982ef12d5887/components/robin-editor/editor-icon.ttf -------------------------------------------------------------------------------- /components/robin-editor/robin-editor.vue: -------------------------------------------------------------------------------- 1 | 120 | 121 | 408 | 409 | 482 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "robin-editor", 3 | "displayName": "robin-editor", 4 | "version": "2.1.0", 5 | "description": "基于原生editor组件的富文本编辑器组件,支持颜色选择,插入图片", 6 | "keywords": [ 7 | "robin-editor", 8 | "编辑器", 9 | "富文本", 10 | "小程序" 11 | ], 12 | "repository": "https://github.com/health901/uniapp-editor", 13 | "engines": { 14 | "HBuilderX": "^3.1.0" 15 | }, 16 | "dcloudext": { 17 | "category": [ 18 | "前端组件", 19 | "通用组件" 20 | ], 21 | "sale": { 22 | "regular": { 23 | "price": "0.00" 24 | }, 25 | "sourcecode": { 26 | "price": "0.00" 27 | } 28 | }, 29 | "contact": { 30 | "qq": "" 31 | }, 32 | "declaration": { 33 | "ads": "无", 34 | "data": "无", 35 | "permissions": "无" 36 | }, 37 | "npmurl": "" 38 | }, 39 | "uni_modules": { 40 | "dependencies": ["uni-popup"], 41 | "encrypt": [], 42 | "platforms": { 43 | "cloud": { 44 | "tcb": "y", 45 | "aliyun": "y" 46 | }, 47 | "client": { 48 | "App": { 49 | "app-vue": "u", 50 | "app-nvue": "u" 51 | }, 52 | "H5-mobile": { 53 | "Safari": "y", 54 | "Android Browser": "y", 55 | "微信浏览器(Android)": "y", 56 | "QQ浏览器(Android)": "y" 57 | }, 58 | "H5-pc": { 59 | "Chrome": "y", 60 | "IE": "y", 61 | "Edge": "y", 62 | "Firefox": "y", 63 | "Safari": "u" 64 | }, 65 | "小程序": { 66 | "微信": "y", 67 | "阿里": "u", 68 | "百度": "u", 69 | "字节跳动": "u", 70 | "QQ": "u" 71 | }, 72 | "快应用": { 73 | "华为": "u", 74 | "联盟": "u" 75 | } 76 | } 77 | } 78 | } 79 | } 80 | --------------------------------------------------------------------------------