|
|
@@ -740,21 +740,11 @@ Vue.component('spaceEditor', {
|
|
|
this.editor.model.insertContent(modelFragment);
|
|
|
this.$emit("input", this.editor.getData());
|
|
|
},
|
|
|
- openMultiImagePicker: function () {
|
|
|
- if (this.$refs.multiImageInput) {
|
|
|
- this.$refs.multiImageInput.click();
|
|
|
- }
|
|
|
- },
|
|
|
openVideoPicker: function () {
|
|
|
if (this.$refs.videoInput) {
|
|
|
this.$refs.videoInput.click();
|
|
|
}
|
|
|
},
|
|
|
- handleMultiImageSelect: function (event) {
|
|
|
- var files = Array.prototype.slice.call(event.target.files || []);
|
|
|
- event.target.value = "";
|
|
|
- this.uploadImageFiles(files);
|
|
|
- },
|
|
|
handleVideoSelect: function (event) {
|
|
|
var files = Array.prototype.slice.call(event.target.files || []);
|
|
|
event.target.value = "";
|
|
|
@@ -762,38 +752,6 @@ Vue.component('spaceEditor', {
|
|
|
this.uploadVideoFile(files[0]);
|
|
|
}
|
|
|
},
|
|
|
- uploadImageFiles: function (files) {
|
|
|
- var imageFiles = files.filter(function (file) {
|
|
|
- return file && file.type && file.type.indexOf("image/") === 0;
|
|
|
- });
|
|
|
- if (imageFiles.length == 0) {
|
|
|
- space.message.warning("请选择图片文件");
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- var _this = this;
|
|
|
- _this.uploading = true;
|
|
|
- _this.uploadStatus = "正在上传图片 0/" + imageFiles.length;
|
|
|
-
|
|
|
- var chain = Promise.resolve();
|
|
|
- imageFiles.forEach(function (file, index) {
|
|
|
- chain = chain.then(function () {
|
|
|
- _this.uploadStatus = "正在上传图片 " + (index + 1) + "/" + imageFiles.length;
|
|
|
- return _this.uploadPlainFileByAdapter(file, _this.getUploadOptions()).then(function (res) {
|
|
|
- _this.insertHtml('<p><img src="' + res.default + '"></p>');
|
|
|
- });
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- chain.then(function () {
|
|
|
- space.message.success("图片已上传");
|
|
|
- }).catch(function (msg) {
|
|
|
- space.message.error(msg || "图片上传失败");
|
|
|
- }).finally(function () {
|
|
|
- _this.uploading = false;
|
|
|
- _this.uploadStatus = "";
|
|
|
- });
|
|
|
- },
|
|
|
uploadVideoFile: function (file) {
|
|
|
if (!file || !file.type || file.type.indexOf("video/") !== 0) {
|
|
|
space.message.warning("请选择视频文件");
|
|
|
@@ -1017,7 +975,6 @@ Vue.component('spaceEditor', {
|
|
|
<div class="space-editor-wrap">
|
|
|
<div class="space-editor-toolstrip" v-if="showEditorTools()">
|
|
|
<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="图片质量">
|
|
|
@@ -1029,7 +986,6 @@ Vue.component('spaceEditor', {
|
|
|
<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">
|
|
|
<input ref="videoInput" type="file" accept="video/*" style="display:none;" @change="handleVideoSelect">
|
|
|
<div :id="id">
|
|
|
<script type="text/plain"></script>
|
|
|
@@ -1044,7 +1000,7 @@ Vue.component('spaceEditor', {
|
|
|
<el-button size="small" icon="el-icon-refresh" @click="openArticlePreview" :loading="previewLoading">刷新预览</el-button>
|
|
|
</div>
|
|
|
<div class="space-editor-preview-stage">
|
|
|
- <iframe v-if="previewUrl" :src="previewUrl" :style="previewFrameStyle" frameborder="0"></iframe>
|
|
|
+ <iframe v-if="previewUrl" :key="previewMode + previewUrl" :src="previewUrl" :style="previewFrameStyle" frameborder="0"></iframe>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|