清理默认对 codemirror 的依赖,支持外部传入 ueditor 的设置

This commit is contained in:
c4605
2017-07-18 16:58:37 +08:00
parent 323619a2ec
commit 34b8ef1aff
7 changed files with 20 additions and 15 deletions

2
.gitignore vendored
View File

@@ -1,6 +1,6 @@
.DS_Store
node_modules/
dist/
demo
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View File

@@ -6,7 +6,7 @@ module.exports = {
env: require('./prod.env'),
index: path.resolve(__dirname, '../demo/index.html'),
assetsRoot: path.resolve(__dirname, '../demo'),
assetsSubDirectory: 'static',
assetsSubDirectory: 'ueditor-static',
assetsPublicPath: './',
productionSourceMap: true,
// Gzip off by default as many popular static hosts such as
@@ -25,7 +25,7 @@ module.exports = {
env: require('./dev.env'),
port: 8156,
autoOpenBrowser: true,
assetsSubDirectory: 'static',
assetsSubDirectory: 'ueditor-static',
assetsPublicPath: '/',
proxyTable: {},
// CSS Sourcemaps off by default because relative paths are "buggy"

1
dist/vue-weui-ueditor.min.css vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/vue-weui-ueditor.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -44,7 +44,7 @@
.weui_edui_icon
display: inline-block
vertical-align: middle
background-image: url(/ueditor-themes/default/images/ueditor.png)
background-image: url(/ueditor-static/themes/default/images/ueditor_z29f4d5.png)
background-repeat: no-repeat
width: 20px
height: 20px
@@ -100,7 +100,7 @@
cursor: pointer
.clear
background: url(/ueditor-themes/default/images/ueditor.png) 0 -1070px no-repeat
background: url(/ueditor-static/themes/default/images/ueditor_z29f4d5.png) 0 -1070px no-repeat
background-color: transparent
border: none
.input_color
@@ -147,7 +147,7 @@
/* toolselect */
.weui_edui_toolselect_list
background: url(/ueditor-themes/default/images/sparator.png) repeat-y 25px #fff
background: url(/ueditor-static/themes/default/images/sparator.png) repeat-y 25px #fff
ul
margin: 0
padding: 0 2px
@@ -173,7 +173,7 @@
position: absolute
left: 0
top: 2px
background: url(/ueditor-themes/default/images/icons-all.gif) no-repeat 6px -205px
background: url(/ueditor-static/themes/default/images/icons-all29f4d4.gif) no-repeat 6px -205px
/* toolinput */
&.toolinput

View File

@@ -34,14 +34,14 @@
<script type="text/ecmascript-6">
import weuiToolbar from '../Toolbar';
import './editor.stylus';
import {selectOptions, ueConfig} from '../../config/config';
import { selectOptions, ueConfig } from '../../config/config';
import '../../config/ueditor.config';
import '../../../static/ueditor.all.min';
import '../../../static/lang/zh-cn/zh-cn';
export default {
name: 'weui-ueditor',
components: {weuiToolbar},
components: { weuiToolbar },
props: {
content: {
type: String,
@@ -61,7 +61,10 @@
computed: {
selectOptions() {
return Object.assign({}, selectOptions, this.config.selectOptions);
}
},
ueConfig() {
return Object.assign({}, ueConfig, this.config.ueditor);
}
},
data() {
return {
@@ -201,7 +204,7 @@
this.toolbar = this.$refs.toolbar;
this.$nextTick(() => {
this.$refs.editor.id = this.id;
this.editor = this.UE.getEditor(this.id, ueConfig);
this.editor = this.UE.getEditor(this.id, this.ueConfig);
this.editor.ready(() => {
this.init();
this.onContentChange();

View File

@@ -19,12 +19,12 @@
* 因此UEditor提供了针对不同页面的编辑器可单独配置的根路径具体来说在需要实例化编辑器的页面最顶部写上如下代码即可。当然需要令此处的URL等于对应的配置。
* window.UEDITOR_HOME_URL = "/xxxx/xxxx/";
*/
var URL = window.UEDITOR_HOME_URL || '//unpkg.com/vue-weui-ueditor/static/';
var URL = window.UEDITOR_HOME_URL || '/ueditor-static/';
/**
* 配置项主体。注意此处所有涉及到路径的配置别遗漏URL变量。
*/
window.UEDITOR_CONFIG = {
window.UEDITOR_CONFIG = (window.UEDITOR_CONFIG || {
//为编辑器实例添加一个路径,这个不能被注释
UEDITOR_HOME_URL: URL
@@ -329,7 +329,7 @@
//sourceEditor
//源码的查看方式,codemirror 是代码高亮textarea是文本框,默认是codemirror
//注意默认codemirror只能在ie8+和非ie中使用
//,sourceEditor:"codemirror"
,sourceEditor:"textarea"
//如果sourceEditor是codemirror还用配置一下两个参数
//codeMirrorJsUrl js加载的路径默认是 URL + "third-party/codemirror/codemirror.js"
//,codeMirrorJsUrl:URL + "third-party/codemirror/codemirror.js"
@@ -427,7 +427,7 @@
ul: ['class', 'style'],
video: ['autoplay', 'controls', 'loop', 'preload', 'src', 'height', 'width', 'class', 'style']
}
};
});
function getUEBasePath(docUrl, confUrl) {