开发备忘录

纵饮孤独 提交于 2020-02-13 13:45:38

在家玩了几天,

完全忘记上班的时候写的代码了,但是也怪我基本上都是百度了,感觉可以了也没有记下来

开始做小程序后台了,后台前端用的AceAdmin

这次用了好半天总算搜到了,哎又是搜到的

一个表格插件

Bootstrap Table 挺好看的,感觉配置起来也不复杂

富文本编辑器

TinyMCE

把我的配置记下来,做个备忘

 tinymce.init({
                selector: '#ArticleContent',
                language: 'zh_CN',
                height: 650,
                min_height: 500,
                object_resizing: false,
                setup: function (editor) {
                    editor.on('change', function () {
                        editor.save();
                    });
                },
                convert_urls: false, // 图片路径 ,设置成false后可以防止生成相对路径


                plugins: ' preview searchreplace autolink directionality visualblocks visualchars fullscreen image link media template importcss code codesample table charmap hr pagebreak nonbreaking anchor insertdatetime advlist lists wordcount imagetools textpattern help emoticons autosave   autoresize  axupimgs',
                toolbar: 'styleselect code undo redo restoredraft | cut copy paste pastetext | forecolor backcolor bold italic underline strikethrough link anchor | alignleft aligncenter alignright alignjustify outdent indent | \
                                                         styleselect formatselect fontselect fontsizeselect | bullist numlist | blockquote subscript superscript removeformat | \
                                                         table image media charmap emoticons hr pagebreak insertdatetime  preview | fullscreen |  axupimgs',
                //content_css: "../Content/tinymce/global.css",
                images_upload_handler: function (blobInfo, succFun, failFun) {
                    var xhr, formData;
                    var file = blobInfo.blob();//转化为易于理解的file对象
                    xhr = new XMLHttpRequest();
                    xhr.withCredentials = false;
                    xhr.open('POST', '/Article/Upload');
                    xhr.onload = function () {
                        var json;
                        if (xhr.status != 200) {
                            console.log('HTTP Error: ' + xhr.status);
                            return;
                        }
                        json = JSON.parse(xhr.responseText);
                        //if (!json || typeof json.location != 'string') {
                        //    console.log('Invalid JSON: ' + xhr.responseText);
                        //    return;
                        //}
                        if (json.status == false) {
                            console.log('Invalid JSON: ' + xhr.responseText);
                            return;
                        }
                        succFun(json.url);
                    };
                    formData = new FormData();
                    formData.append('file', file, file.name);
                    xhr.send(formData);
                }
            });

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!