|
|
@@ -379,7 +379,7 @@ Vue.component('spaceEditor', {
|
|
|
// 编辑器需要的 js 文件
|
|
|
jsUrl: [
|
|
|
'/apps/space/plug-in/ckeditor5/build/ckeditor.js',
|
|
|
- '/apps/space/plug-in/ckeditor5/src/plugins/upload/src/myUploadAdapter.js'
|
|
|
+ '/apps/space/plug-in/ckeditor5/src/plugins/upload/src/myUploadAdapter.js?v=2026062706'
|
|
|
],
|
|
|
// 标识,全部为 true 则代表全部加载完成
|
|
|
jsUrlFlag: [],
|
|
|
@@ -649,6 +649,58 @@ Vue.component('spaceEditor', {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
+ mountVideoUploadToolbarButton: function (retryCount) {
|
|
|
+ if (!this.editor || !this.editor.ui || !this.editor.ui.view || !this.editor.ui.view.element) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var toolbarItems = this.editor.ui.view.element.querySelector(".ck-toolbar__items");
|
|
|
+ if (!toolbarItems) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (toolbarItems.querySelector(".space-editor-video-upload-ck-button")) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var dropdowns = toolbarItems.querySelectorAll(".ck-dropdown");
|
|
|
+ var mediaDropdown = null;
|
|
|
+ for (var i = 0; i < dropdowns.length; i++) {
|
|
|
+ var button = dropdowns[i].querySelector(".ck-button");
|
|
|
+ var label = button ? (button.getAttribute("aria-label") || button.getAttribute("title") || button.textContent || "") : "";
|
|
|
+ label = label.replace(/\s/g, "").toLowerCase();
|
|
|
+ if (label.indexOf("媒体") != -1 || label.indexOf("media") != -1) {
|
|
|
+ mediaDropdown = dropdowns[i];
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!mediaDropdown) {
|
|
|
+ if ((retryCount || 0) < 3) {
|
|
|
+ var _this = this;
|
|
|
+ setTimeout(function () {
|
|
|
+ _this.mountVideoUploadToolbarButton((retryCount || 0) + 1);
|
|
|
+ }, 200);
|
|
|
+ }
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ var _this = this;
|
|
|
+ var videoButton = document.createElement("button");
|
|
|
+ videoButton.type = "button";
|
|
|
+ videoButton.className = "ck ck-button ck-off space-editor-video-upload-ck-button";
|
|
|
+ videoButton.setAttribute("aria-label", "上传视频");
|
|
|
+ videoButton.setAttribute("title", "上传视频");
|
|
|
+ videoButton.innerHTML = '<svg class="ck ck-icon ck-button__icon space-editor-video-upload-icon" viewBox="0 0 20 20" aria-hidden="true"><path d="M3.2 5.4c-.9 0-1.6.7-1.6 1.6v6.2c0 .9.7 1.6 1.6 1.6h8.2c.9 0 1.6-.7 1.6-1.6V7c0-.9-.7-1.6-1.6-1.6H3.2zm.2 1.8h7.8V13H3.4V7.2z"></path><path d="M13.9 8.2l2.9-2c.7-.5 1.6 0 1.6.9v6c0 .8-.9 1.3-1.6.9l-2.9-2V8.2z"></path><path d="M7.6 12.2h1.8V9.3l1.1 1.1 1.2-1.2-3.2-3-3.2 3 1.2 1.2 1.1-1.1v2.9z"></path></svg><span class="ck ck-button__label">上传视频</span>';
|
|
|
+ videoButton.addEventListener("click", function (event) {
|
|
|
+ event.preventDefault();
|
|
|
+ event.stopPropagation();
|
|
|
+ _this.openVideoPicker();
|
|
|
+ });
|
|
|
+
|
|
|
+ mediaDropdown.classList.add("space-editor-media-link-dropdown");
|
|
|
+ mediaDropdown.parentNode.insertBefore(videoButton, mediaDropdown);
|
|
|
+ },
|
|
|
formatContent: function () {
|
|
|
if (!this.editor) {
|
|
|
return;
|
|
|
@@ -917,6 +969,7 @@ Vue.component('spaceEditor', {
|
|
|
|
|
|
_this.editor = editor;
|
|
|
_this.alignFullScreenToolbarButton();
|
|
|
+ _this.mountVideoUploadToolbarButton();
|
|
|
_this.bindVideoPasteUpload();
|
|
|
|
|
|
if (_this.htmlContent != undefined) {
|
|
|
@@ -975,7 +1028,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-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>
|