|
|
@@ -526,6 +526,22 @@ Vue.component('spaceEditor', {
|
|
|
return new MyUploadAdapter(loader, _this.getUploadOptions());
|
|
|
};
|
|
|
},
|
|
|
+ uploadPlainFileByAdapter: function (file, options, onProgress) {
|
|
|
+ if (typeof MyUploadAdapter == "undefined") {
|
|
|
+ return Promise.reject("上传组件未加载完成,请刷新页面后重试");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (typeof MyUploadAdapter.uploadPlainFile == "function") {
|
|
|
+ return MyUploadAdapter.uploadPlainFile(file, options, onProgress);
|
|
|
+ }
|
|
|
+
|
|
|
+ var adapter = new MyUploadAdapter(null, options || {});
|
|
|
+ if (typeof adapter.uploadPlainFile == "function") {
|
|
|
+ return adapter.uploadPlainFile(file, onProgress);
|
|
|
+ }
|
|
|
+
|
|
|
+ return Promise.reject("上传组件未加载完成,请刷新页面后重试");
|
|
|
+ },
|
|
|
/**
|
|
|
* 获取高度
|
|
|
*/
|
|
|
@@ -763,7 +779,7 @@ Vue.component('spaceEditor', {
|
|
|
imageFiles.forEach(function (file, index) {
|
|
|
chain = chain.then(function () {
|
|
|
_this.uploadStatus = "正在上传图片 " + (index + 1) + "/" + imageFiles.length;
|
|
|
- return MyUploadAdapter.uploadPlainFile(file, _this.getUploadOptions()).then(function (res) {
|
|
|
+ return _this.uploadPlainFileByAdapter(file, _this.getUploadOptions()).then(function (res) {
|
|
|
_this.insertHtml('<p><img src="' + res.default + '"></p>');
|
|
|
});
|
|
|
});
|
|
|
@@ -787,7 +803,7 @@ Vue.component('spaceEditor', {
|
|
|
var _this = this;
|
|
|
_this.uploading = true;
|
|
|
_this.uploadStatus = "正在上传视频";
|
|
|
- MyUploadAdapter.uploadPlainFile(file, {
|
|
|
+ _this.uploadPlainFileByAdapter(file, {
|
|
|
imageQuality: 'origin'
|
|
|
}, function (loaded, total) {
|
|
|
if (total > 0) {
|
|
|
@@ -1000,18 +1016,17 @@ Vue.component('spaceEditor', {
|
|
|
template: `
|
|
|
<div class="space-editor-wrap">
|
|
|
<div class="space-editor-toolstrip" v-if="showEditorTools()">
|
|
|
- <el-button-group>
|
|
|
- <el-button size="small" icon="el-icon-magic-stick" @click="formatContent">一键排版</el-button>
|
|
|
- <el-button size="small" icon="el-icon-picture-outline" @click="openMultiImagePicker" :loading="uploading">多图上传</el-button>
|
|
|
- <el-button size="small" icon="el-icon-video-camera" @click="openVideoPicker" :loading="uploading">视频上传</el-button>
|
|
|
- </el-button-group>
|
|
|
+ <el-button class="space-editor-tool-btn" size="small" plain icon="el-icon-magic-stick" @click="formatContent">一键排版</el-button>
|
|
|
+ <el-button class="space-editor-tool-btn" size="small" plain icon="el-icon-picture-outline" @click="openMultiImagePicker" :loading="uploading">多图上传</el-button>
|
|
|
+ <el-button class="space-editor-tool-btn" size="small" plain icon="el-icon-video-camera" @click="openVideoPicker" :loading="uploading">视频上传</el-button>
|
|
|
+ <span class="space-editor-tool-divider"></span>
|
|
|
<el-select class="space-editor-quality" v-model="imageQuality" size="small" placeholder="图片质量">
|
|
|
<el-option label="原图" value="origin"></el-option>
|
|
|
<el-option label="高清 85%" value="high"></el-option>
|
|
|
<el-option label="标准 70%" value="standard"></el-option>
|
|
|
<el-option label="低流量 50%" value="low"></el-option>
|
|
|
</el-select>
|
|
|
- <el-button size="small" type="primary" plain icon="el-icon-view" @click="openArticlePreview" :loading="previewLoading">三端预览</el-button>
|
|
|
+ <el-button class="space-editor-tool-btn space-editor-preview-btn" size="small" type="primary" plain icon="el-icon-view" @click="openArticlePreview" :loading="previewLoading">三端预览</el-button>
|
|
|
<span class="space-editor-upload-status" v-if="uploadStatus">{{uploadStatus}}</span>
|
|
|
</div>
|
|
|
<input ref="multiImageInput" type="file" accept="image/*" multiple style="display:none;" @change="handleMultiImageSelect">
|
|
|
@@ -1019,7 +1034,7 @@ Vue.component('spaceEditor', {
|
|
|
<div :id="id">
|
|
|
<script type="text/plain"></script>
|
|
|
</div>
|
|
|
- <el-dialog title="正文预览" :visible.sync="previewVisible" width="90%" append-to-body custom-class="space-editor-preview-dialog">
|
|
|
+ <el-dialog title="正文预览" :visible.sync="previewVisible" width="90%" top="4vh" append-to-body custom-class="space-editor-preview-dialog">
|
|
|
<div class="space-editor-preview-toolbar">
|
|
|
<el-radio-group v-model="previewMode" size="small">
|
|
|
<el-radio-button label="pc">PC端</el-radio-button>
|