[pve-devel] [PATCH manager 2/3] ui: tags: prevent pasting non plain-text content

Dominik Csapak d.csapak at proxmox.com
Thu Oct 19 15:36:06 CEST 2023


by setting 'contentEditable' to 'plaintext-only' instead of true.
Otherwise it was possible to paste html code into the field (an error
was thrown by the backend since it does not match the regex)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/form/Tag.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/www/manager6/form/Tag.js b/www/manager6/form/Tag.js
index 6b1d6aa5..39afe04b 100644
--- a/www/manager6/form/Tag.js
+++ b/www/manager6/form/Tag.js
@@ -45,7 +45,7 @@ Ext.define('Proxmox.form.Tag', {
     selectText: function(collapseToEnd) {
 	let me = this;
 	let tagEl = me.tagEl();
-	tagEl.contentEditable = true;
+	tagEl.contentEditable = "plaintext-only";
 	let range = document.createRange();
 	range.selectNodeContents(tagEl);
 	if (collapseToEnd) {
@@ -98,7 +98,7 @@ Ext.define('Proxmox.form.Tag', {
 	let me = this;
 	let tagEl = me.tagEl();
 	if (tagEl) {
-	    tagEl.contentEditable = mode === 'editable';
+	    tagEl.contentEditable = mode === 'editable' ? 'plaintext-only' : false;
 	}
 	me.removeCls(me.mode);
 	me.addCls(mode);
-- 
2.30.2






More information about the pve-devel mailing list