|
@@ -522,6 +522,28 @@ Vue.component('spaceEditor', {
|
|
|
}
|
|
}
|
|
|
return this.normalizeLocalUploadUrl(url);
|
|
return this.normalizeLocalUploadUrl(url);
|
|
|
},
|
|
},
|
|
|
|
|
+ normalizeVideoHtmlForEditor: function (html) {
|
|
|
|
|
+ if (!html || html.indexOf("<video") === -1 || html.indexOf("<source") === -1) {
|
|
|
|
|
+ return html || "";
|
|
|
|
|
+ }
|
|
|
|
|
+ var wrapper = document.createElement("div");
|
|
|
|
|
+ wrapper.innerHTML = html;
|
|
|
|
|
+ var videos = wrapper.querySelectorAll("video");
|
|
|
|
|
+ var changed = false;
|
|
|
|
|
+ for (var i = 0; i < videos.length; i++) {
|
|
|
|
|
+ var video = videos[i];
|
|
|
|
|
+ if (video.getAttribute("src")) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ var source = video.querySelector("source[src]");
|
|
|
|
|
+ if (!source) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ video.setAttribute("src", this.normalizeEditorMediaUrl(source.getAttribute("src") || ""));
|
|
|
|
|
+ changed = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ return changed ? wrapper.innerHTML : html;
|
|
|
|
|
+ },
|
|
|
sanitizePdfHtmlForSave: function (html) {
|
|
sanitizePdfHtmlForSave: function (html) {
|
|
|
if (!html) {
|
|
if (!html) {
|
|
|
return "";
|
|
return "";
|
|
@@ -568,11 +590,96 @@ Vue.component('spaceEditor', {
|
|
|
}
|
|
}
|
|
|
return wrapper.innerHTML;
|
|
return wrapper.innerHTML;
|
|
|
},
|
|
},
|
|
|
|
|
+ sanitizeVideoHtmlForSave: function (html) {
|
|
|
|
|
+ if (!html) {
|
|
|
|
|
+ return "";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (html.indexOf("<video") === -1 && html.indexOf("space-editor-video") === -1 && html.indexOf("data-space-video") === -1) {
|
|
|
|
|
+ return html;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ var wrapper = document.createElement("div");
|
|
|
|
|
+ wrapper.innerHTML = html;
|
|
|
|
|
+ var _this = this;
|
|
|
|
|
+ var getVideoSrc = function (video) {
|
|
|
|
|
+ if (!video) {
|
|
|
|
|
+ return "";
|
|
|
|
|
+ }
|
|
|
|
|
+ var figure = video.closest ? video.closest("figure.space-editor-video-viewer, figure[data-space-video='true']") : null;
|
|
|
|
|
+ var source = video.querySelector("source[src]");
|
|
|
|
|
+ return _this.normalizeEditorMediaUrl((figure && figure.getAttribute("data-space-video-src"))
|
|
|
|
|
+ || video.getAttribute("src")
|
|
|
|
|
+ || (source ? source.getAttribute("src") : "")
|
|
|
|
|
+ || "");
|
|
|
|
|
+ };
|
|
|
|
|
+ var inferVideoType = function (src) {
|
|
|
|
|
+ if (/\.webm(\?.*)?$/i.test(src)) {
|
|
|
|
|
+ return "video/webm";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (/\.ogg|\.ogv(\?.*)?$/i.test(src)) {
|
|
|
|
|
+ return "video/ogg";
|
|
|
|
|
+ }
|
|
|
|
|
+ return "video/mp4";
|
|
|
|
|
+ };
|
|
|
|
|
+ var buildCleanVideoBlock = function (video, src) {
|
|
|
|
|
+ var p = document.createElement("p");
|
|
|
|
|
+ var cleanVideo = document.createElement("video");
|
|
|
|
|
+ var source = document.createElement("source");
|
|
|
|
|
+ cleanVideo.setAttribute("controls", "controls");
|
|
|
|
|
+ cleanVideo.setAttribute("playsinline", "playsinline");
|
|
|
|
|
+ cleanVideo.setAttribute("webkit-playsinline", "webkit-playsinline");
|
|
|
|
|
+ cleanVideo.setAttribute("preload", video.getAttribute("preload") || "metadata");
|
|
|
|
|
+ var poster = video.getAttribute("poster") || "";
|
|
|
|
|
+ if (poster) {
|
|
|
|
|
+ cleanVideo.setAttribute("poster", _this.normalizeEditorMediaUrl(poster));
|
|
|
|
|
+ }
|
|
|
|
|
+ cleanVideo.setAttribute("style", video.getAttribute("style")
|
|
|
|
|
+ || "display:block;width:100%;max-width:960px;background:#000;");
|
|
|
|
|
+ source.setAttribute("src", src);
|
|
|
|
|
+ source.setAttribute("type", inferVideoType(src));
|
|
|
|
|
+ cleanVideo.appendChild(source);
|
|
|
|
|
+ cleanVideo.appendChild(document.createTextNode("您的浏览器暂不支持视频播放。"));
|
|
|
|
|
+ p.appendChild(cleanVideo);
|
|
|
|
|
+ return p;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ var videos = Array.prototype.slice.call(wrapper.querySelectorAll("video"));
|
|
|
|
|
+ for (var v = 0; v < videos.length; v++) {
|
|
|
|
|
+ var looseVideo = videos[v];
|
|
|
|
|
+ if (!looseVideo.parentNode) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ var src = getVideoSrc(looseVideo);
|
|
|
|
|
+ if (!src) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ var cleanBlock = buildCleanVideoBlock(looseVideo, src);
|
|
|
|
|
+ var videoFigure = looseVideo.closest ? looseVideo.closest("figure.space-editor-video-viewer, figure[data-space-video='true']") : null;
|
|
|
|
|
+ var parent = looseVideo.parentNode;
|
|
|
|
|
+ var shouldReplaceParent = false;
|
|
|
|
|
+ if (parent && /^(p|div)$/i.test(parent.tagName || "") && parent.querySelectorAll("video").length == 1) {
|
|
|
|
|
+ var parentClone = parent.cloneNode(true);
|
|
|
|
|
+ var cloneVideo = parentClone.querySelector("video");
|
|
|
|
|
+ if (cloneVideo && cloneVideo.parentNode) {
|
|
|
|
|
+ cloneVideo.parentNode.removeChild(cloneVideo);
|
|
|
|
|
+ }
|
|
|
|
|
+ shouldReplaceParent = (parentClone.textContent || "").replace(/\s+/g, "") == "";
|
|
|
|
|
+ }
|
|
|
|
|
+ var replaceTarget = videoFigure || (shouldReplaceParent ? parent : looseVideo);
|
|
|
|
|
+ if (replaceTarget && replaceTarget.parentNode) {
|
|
|
|
|
+ replaceTarget.parentNode.replaceChild(cleanBlock, replaceTarget);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return wrapper.innerHTML;
|
|
|
|
|
+ },
|
|
|
getEditorSaveHtml: function () {
|
|
getEditorSaveHtml: function () {
|
|
|
if (!this.editor) {
|
|
if (!this.editor) {
|
|
|
return this.htmlContent || "";
|
|
return this.htmlContent || "";
|
|
|
}
|
|
}
|
|
|
- return this.sanitizePdfHtmlForSave(this.editor.getData());
|
|
|
|
|
|
|
+ var html = this.editor.getData();
|
|
|
|
|
+ html = this.sanitizePdfHtmlForSave(html);
|
|
|
|
|
+ html = this.sanitizeVideoHtmlForSave(html);
|
|
|
|
|
+ return html;
|
|
|
},
|
|
},
|
|
|
deferEmitEditorHtml: function () {
|
|
deferEmitEditorHtml: function () {
|
|
|
if (this._emitEditorHtmlTimer) {
|
|
if (this._emitEditorHtmlTimer) {
|
|
@@ -1092,6 +1199,148 @@ Vue.component('spaceEditor', {
|
|
|
_this.deferEnhanceEditorPdfViewers();
|
|
_this.deferEnhanceEditorPdfViewers();
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ installVideoViewerPlugin: function (editor) {
|
|
|
|
|
+ var inferVideoType = function (src) {
|
|
|
|
|
+ if (/\.webm(\?.*)?$/i.test(src)) {
|
|
|
|
|
+ return "video/webm";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (/\.ogg|\.ogv(\?.*)?$/i.test(src)) {
|
|
|
|
|
+ return "video/ogg";
|
|
|
|
|
+ }
|
|
|
|
|
+ return "video/mp4";
|
|
|
|
|
+ };
|
|
|
|
|
+ var createVideoView = function (modelItem, viewWriter, isData) {
|
|
|
|
|
+ var src = modelItem.getAttribute("src") || "";
|
|
|
|
|
+ var title = modelItem.getAttribute("title") || "视频";
|
|
|
|
|
+ var poster = modelItem.getAttribute("poster") || "";
|
|
|
|
|
+ if (isData) {
|
|
|
|
|
+ var p = viewWriter.createContainerElement("p");
|
|
|
|
|
+ var dataAttrs = {
|
|
|
|
|
+ controls: "controls",
|
|
|
|
|
+ playsinline: "playsinline",
|
|
|
|
|
+ "webkit-playsinline": "webkit-playsinline",
|
|
|
|
|
+ preload: "metadata",
|
|
|
|
|
+ title: title,
|
|
|
|
|
+ style: "display:block;width:100%;max-width:960px;background:#000;"
|
|
|
|
|
+ };
|
|
|
|
|
+ if (poster) {
|
|
|
|
|
+ dataAttrs.poster = poster;
|
|
|
|
|
+ }
|
|
|
|
|
+ var dataVideo = viewWriter.createContainerElement("video", dataAttrs);
|
|
|
|
|
+ var source = viewWriter.createEmptyElement("source", {
|
|
|
|
|
+ src: src,
|
|
|
|
|
+ type: inferVideoType(src)
|
|
|
|
|
+ });
|
|
|
|
|
+ viewWriter.insert(viewWriter.createPositionAt(dataVideo, 0), source);
|
|
|
|
|
+ viewWriter.insert(viewWriter.createPositionAt(dataVideo, "end"), viewWriter.createText("您的浏览器暂不支持视频播放。"));
|
|
|
|
|
+ viewWriter.insert(viewWriter.createPositionAt(p, 0), dataVideo);
|
|
|
|
|
+ return p;
|
|
|
|
|
+ }
|
|
|
|
|
+ var figure = viewWriter.createContainerElement("figure", {
|
|
|
|
|
+ "class": "space-editor-video-viewer media",
|
|
|
|
|
+ "data-space-video": "true",
|
|
|
|
|
+ "data-space-video-src": src
|
|
|
|
|
+ });
|
|
|
|
|
+ var attrs = {
|
|
|
|
|
+ "class": "space-editor-video-frame",
|
|
|
|
|
+ controls: "controls",
|
|
|
|
|
+ playsinline: "playsinline",
|
|
|
|
|
+ "webkit-playsinline": "webkit-playsinline",
|
|
|
|
|
+ preload: "metadata",
|
|
|
|
|
+ src: src,
|
|
|
|
|
+ title: title,
|
|
|
|
|
+ style: "max-width:100%;width:100%;display:block;"
|
|
|
|
|
+ };
|
|
|
|
|
+ if (poster) {
|
|
|
|
|
+ attrs.poster = poster;
|
|
|
|
|
+ }
|
|
|
|
|
+ var video = viewWriter.createRawElement("video", attrs);
|
|
|
|
|
+ viewWriter.insert(viewWriter.createPositionAt(figure, 0), video);
|
|
|
|
|
+ return figure;
|
|
|
|
|
+ };
|
|
|
|
|
+ var findVideo = function (element) {
|
|
|
|
|
+ if (!element || !element.is || !element.is("element")) {
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (element.is("element:video")) {
|
|
|
|
|
+ return element;
|
|
|
|
|
+ }
|
|
|
|
|
+ var child = element.getChild(0);
|
|
|
|
|
+ while (child) {
|
|
|
|
|
+ var matched = findVideo(child);
|
|
|
|
|
+ if (matched) {
|
|
|
|
|
+ return matched;
|
|
|
|
|
+ }
|
|
|
|
|
+ child = child.nextSibling;
|
|
|
|
|
+ }
|
|
|
|
|
+ return null;
|
|
|
|
|
+ };
|
|
|
|
|
+ var createModelFromVideo = function (viewElement, conversionApi, fallbackSrc) {
|
|
|
|
|
+ var video = viewElement.is && viewElement.is("element:video") ? viewElement : findVideo(viewElement);
|
|
|
|
|
+ var src = fallbackSrc || viewElement.getAttribute("data-space-video-src") || "";
|
|
|
|
|
+ var title = viewElement.getAttribute("title") || "视频";
|
|
|
|
|
+ var poster = "";
|
|
|
|
|
+ if (video) {
|
|
|
|
|
+ src = src || video.getAttribute("src") || "";
|
|
|
|
|
+ var child = video.getChild(0);
|
|
|
|
|
+ while (!src && child) {
|
|
|
|
|
+ if (child.is && child.is("element:source") && child.getAttribute("src")) {
|
|
|
|
|
+ src = child.getAttribute("src");
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ child = child.nextSibling;
|
|
|
|
|
+ }
|
|
|
|
|
+ title = video.getAttribute("title") || title;
|
|
|
|
|
+ poster = video.getAttribute("poster") || "";
|
|
|
|
|
+ }
|
|
|
|
|
+ return conversionApi.writer.createElement("spaceVideoViewer", {
|
|
|
|
|
+ src: src,
|
|
|
|
|
+ title: title,
|
|
|
|
|
+ poster: poster
|
|
|
|
|
+ });
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ editor.model.schema.register("spaceVideoViewer", {
|
|
|
|
|
+ isObject: true,
|
|
|
|
|
+ allowWhere: "$block",
|
|
|
|
|
+ allowAttributes: ["src", "title", "poster"]
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ editor.conversion.for("editingDowncast").elementToElement({
|
|
|
|
|
+ model: "spaceVideoViewer",
|
|
|
|
|
+ view: function (modelItem, conversionApi) {
|
|
|
|
|
+ return createVideoView(modelItem, conversionApi.writer, false);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ editor.conversion.for("dataDowncast").elementToElement({
|
|
|
|
|
+ model: "spaceVideoViewer",
|
|
|
|
|
+ view: function (modelItem, conversionApi) {
|
|
|
|
|
+ return createVideoView(modelItem, conversionApi.writer, true);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ editor.conversion.for("upcast").elementToElement({
|
|
|
|
|
+ view: {
|
|
|
|
|
+ name: "figure",
|
|
|
|
|
+ classes: "space-editor-video-viewer"
|
|
|
|
|
+ },
|
|
|
|
|
+ model: function (viewElement, conversionApi) {
|
|
|
|
|
+ return createModelFromVideo(viewElement, conversionApi);
|
|
|
|
|
+ },
|
|
|
|
|
+ converterPriority: "high"
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ editor.conversion.for("upcast").elementToElement({
|
|
|
|
|
+ view: {
|
|
|
|
|
+ name: "video"
|
|
|
|
|
+ },
|
|
|
|
|
+ model: function (viewElement, conversionApi) {
|
|
|
|
|
+ return createModelFromVideo(viewElement, conversionApi, viewElement.getAttribute("src") || "");
|
|
|
|
|
+ },
|
|
|
|
|
+ converterPriority: "high"
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
enhanceEditorPdfViewers: function () {
|
|
enhanceEditorPdfViewers: function () {
|
|
|
var _this = this;
|
|
var _this = this;
|
|
|
if (this._pdfEnhancing) {
|
|
if (this._pdfEnhancing) {
|
|
@@ -1669,7 +1918,7 @@ Vue.component('spaceEditor', {
|
|
|
var emptyBlocks = wrapper.querySelectorAll("p, div");
|
|
var emptyBlocks = wrapper.querySelectorAll("p, div");
|
|
|
for (var e = emptyBlocks.length - 1; e >= 0; e--) {
|
|
for (var e = emptyBlocks.length - 1; e >= 0; e--) {
|
|
|
var block = emptyBlocks[e];
|
|
var block = emptyBlocks[e];
|
|
|
- var hasMedia = block.querySelector("img, video, iframe, object, embed, table, .space-editor-pdf-viewer");
|
|
|
|
|
|
|
+ var hasMedia = block.querySelector("img, video, iframe, object, embed, table, .space-editor-pdf-viewer, .space-editor-video-viewer");
|
|
|
var text = (block.textContent || "").replace(/\u00a0/g, "").trim();
|
|
var text = (block.textContent || "").replace(/\u00a0/g, "").trim();
|
|
|
if (!hasMedia && text == "" && block.parentNode) {
|
|
if (!hasMedia && text == "" && block.parentNode) {
|
|
|
block.parentNode.removeChild(block);
|
|
block.parentNode.removeChild(block);
|
|
@@ -1707,7 +1956,7 @@ Vue.component('spaceEditor', {
|
|
|
var textBlocks = wrapper.querySelectorAll("p, div");
|
|
var textBlocks = wrapper.querySelectorAll("p, div");
|
|
|
for (var blockIndex = 0; blockIndex < textBlocks.length; blockIndex++) {
|
|
for (var blockIndex = 0; blockIndex < textBlocks.length; blockIndex++) {
|
|
|
var textBlock = textBlocks[blockIndex];
|
|
var textBlock = textBlocks[blockIndex];
|
|
|
- var blockHasMedia = textBlock.querySelector("img, video, iframe, object, embed, table, .space-editor-pdf-viewer");
|
|
|
|
|
|
|
+ var blockHasMedia = textBlock.querySelector("img, video, iframe, object, embed, table, .space-editor-pdf-viewer, .space-editor-video-viewer");
|
|
|
var blockText = (textBlock.textContent || "").replace(/\u00a0/g, "").trim();
|
|
var blockText = (textBlock.textContent || "").replace(/\u00a0/g, "").trim();
|
|
|
if (blockHasMedia) {
|
|
if (blockHasMedia) {
|
|
|
textBlock.style.textAlign = "left";
|
|
textBlock.style.textAlign = "left";
|
|
@@ -1756,6 +2005,14 @@ Vue.component('spaceEditor', {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ var videoFigures = wrapper.querySelectorAll("figure.space-editor-video-viewer");
|
|
|
|
|
+ for (var vf = 0; vf < videoFigures.length; vf++) {
|
|
|
|
|
+ videoFigures[vf].style.width = "100%";
|
|
|
|
|
+ videoFigures[vf].style.maxWidth = "100%";
|
|
|
|
|
+ videoFigures[vf].style.margin = "18px 0";
|
|
|
|
|
+ videoFigures[vf].style.textAlign = "center";
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
var tables = wrapper.querySelectorAll("table");
|
|
var tables = wrapper.querySelectorAll("table");
|
|
|
for (var t = 0; t < tables.length; t++) {
|
|
for (var t = 0; t < tables.length; t++) {
|
|
|
tables[t].style.width = "100%";
|
|
tables[t].style.width = "100%";
|
|
@@ -1879,7 +2136,7 @@ Vue.component('spaceEditor', {
|
|
|
}
|
|
}
|
|
|
}).then(function (res) {
|
|
}).then(function (res) {
|
|
|
var videoUrl = _this.normalizeLocalUploadUrl(res.default);
|
|
var videoUrl = _this.normalizeLocalUploadUrl(res.default);
|
|
|
- _this.insertHtml('<p><video controls playsinline preload="metadata" src="' + _this.escapeHtmlAttr(videoUrl) + '" style="max-width:100%;"></video></p>');
|
|
|
|
|
|
|
+ _this.insertVideoViewer(videoUrl, file.name);
|
|
|
_this.$emit("input", _this.getEditorSaveHtml());
|
|
_this.$emit("input", _this.getEditorSaveHtml());
|
|
|
space.message.success("视频已插入正文");
|
|
space.message.success("视频已插入正文");
|
|
|
}).catch(function (msg) {
|
|
}).catch(function (msg) {
|
|
@@ -1889,6 +2146,42 @@ Vue.component('spaceEditor', {
|
|
|
_this.uploadStatus = "";
|
|
_this.uploadStatus = "";
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
|
|
+ buildVideoViewerHtml: function (url, fileName) {
|
|
|
|
|
+ var safeUrl = this.escapeHtmlAttr(url);
|
|
|
|
|
+ var safeName = this.escapeHtmlAttr(fileName || "视频");
|
|
|
|
|
+ var type = /\.webm(\?.*)?$/i.test(url) ? "video/webm" : ((/\.ogg|\.ogv(\?.*)?$/i.test(url)) ? "video/ogg" : "video/mp4");
|
|
|
|
|
+ return '<p><video controls playsinline webkit-playsinline preload="metadata" title="' + safeName
|
|
|
|
|
+ + '" style="display:block;width:100%;max-width:960px;background:#000;">'
|
|
|
|
|
+ + '<source src="' + safeUrl + '" type="' + type + '">'
|
|
|
|
|
+ + '您的浏览器暂不支持视频播放。'
|
|
|
|
|
+ + '</video></p><p></p>';
|
|
|
|
|
+ },
|
|
|
|
|
+ insertVideoViewer: function (url, fileName) {
|
|
|
|
|
+ if (!this.editor || space.utils.isNull(url)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ var title = fileName || "视频";
|
|
|
|
|
+ try {
|
|
|
|
|
+ this.editor.model.change(function (writer) {
|
|
|
|
|
+ var videoViewer = writer.createElement("spaceVideoViewer", {
|
|
|
|
|
+ src: url,
|
|
|
|
|
+ title: title,
|
|
|
|
|
+ poster: ""
|
|
|
|
|
+ });
|
|
|
|
|
+ this.editor.model.insertContent(videoViewer);
|
|
|
|
|
+ }.bind(this));
|
|
|
|
|
+ this.$emit("input", this.getEditorSaveHtml());
|
|
|
|
|
+ this.deferSyncEditorPlayableVideos();
|
|
|
|
|
+ return;
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.log(e);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.insertHtml(this.buildVideoViewerHtml(url, title));
|
|
|
|
|
+ this.$emit("input", this.getEditorSaveHtml());
|
|
|
|
|
+ this.deferSyncEditorPlayableVideos();
|
|
|
|
|
+ },
|
|
|
uploadPdfFile: function (file) {
|
|
uploadPdfFile: function (file) {
|
|
|
if (!this.isPdfFile(file)) {
|
|
if (!this.isPdfFile(file)) {
|
|
|
space.message.warning("请选择PDF文件");
|
|
space.message.warning("请选择PDF文件");
|
|
@@ -2412,6 +2705,7 @@ Vue.component('spaceEditor', {
|
|
|
ClassicEditor.create(document.querySelector("#" + _this.id), {
|
|
ClassicEditor.create(document.querySelector("#" + _this.id), {
|
|
|
extraPlugins: [function (editor) {
|
|
extraPlugins: [function (editor) {
|
|
|
_this.installUploadAdapter(editor);
|
|
_this.installUploadAdapter(editor);
|
|
|
|
|
+ _this.installVideoViewerPlugin(editor);
|
|
|
_this.installPdfViewerPlugin(editor);
|
|
_this.installPdfViewerPlugin(editor);
|
|
|
}], // 添加上传适配器
|
|
}], // 添加上传适配器
|
|
|
toolbar: toolbar || {},
|
|
toolbar: toolbar || {},
|
|
@@ -2475,7 +2769,7 @@ Vue.component('spaceEditor', {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (_this.htmlContent != undefined) {
|
|
if (_this.htmlContent != undefined) {
|
|
|
- _this.editor.setData(_this.htmlContent);
|
|
|
|
|
|
|
+ _this.editor.setData(_this.normalizeVideoHtmlForEditor(_this.htmlContent));
|
|
|
_this.upgradePdfLinksToViewers();
|
|
_this.upgradePdfLinksToViewers();
|
|
|
_this.deferSyncEditorPlayableVideos();
|
|
_this.deferSyncEditorPlayableVideos();
|
|
|
_this.enhanceEditorPdfViewers();
|
|
_this.enhanceEditorPdfViewers();
|