From 526954dd5a2fe389a03a217cc827fc19935044c5 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期三, 19 十一月 2025 18:08:59 +0800
Subject: [PATCH] *号问题
---
manager/src/views/activity/video.js | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/manager/src/views/activity/video.js b/manager/src/views/activity/video.js
index a5993ce..166112f 100644
--- a/manager/src/views/activity/video.js
+++ b/manager/src/views/activity/video.js
@@ -3,23 +3,17 @@
const BlockEmbed = Quill.import('blots/block/embed');
const Link = Quill.import('formats/link');
-const ATTRIBUTES = ['height', 'width', 'controls', 'src', 'poster'];
+const ATTRIBUTES = ['height', 'width', 'controls', 'src', ];
class VideoBlot extends BlockEmbed {
static create(value) {
const node = super.create();
- // 璁剧疆鍩烘湰灞炴��
- node.setAttribute('controls', 'controls');
- node.setAttribute('controlsList', 'nodownload');
- node.setAttribute('preload', 'metadata');
-
- // 鏀寔瀵硅薄褰㈠紡鐨剉alue
if (typeof value === 'object') {
node.setAttribute('src', this.sanitize(value.url));
- node.setAttribute('poster', value.poster || '');
node.setAttribute('width', value.width || '100%');
node.setAttribute('height', value.height || 'auto');
+ node.setAttribute('controls', value.controls || 'controls');
} else {
node.setAttribute('src', this.sanitize(value));
}
@@ -43,9 +37,9 @@
static value(node) {
return {
url: node.getAttribute('src'),
- poster: node.getAttribute('poster'),
width: node.getAttribute('width'),
- height: node.getAttribute('height')
+ height: node.getAttribute('height'),
+ controls: node.getAttribute('controls'),
};
}
@@ -66,4 +60,10 @@
VideoBlot.className = 'ql-video';
VideoBlot.tagName = 'video';
+// 娣诲姞涓嶄細琚� sanitize 鐨勬爣璁�
+VideoBlot.sanitize = function(url) {
+ const sanitized = Link.sanitize(url);
+ return sanitized === Link.PROTOCOL_WHITELIST[0] ? 'about:blank' : sanitized;
+};
+
export default VideoBlot;
--
Gitblit v1.8.0