public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 2/3] ui: tags: prevent pasting non plain-text content
Date: Thu, 19 Oct 2023 15:36:06 +0200	[thread overview]
Message-ID: <20231019133607.1416999-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20231019133607.1416999-1-d.csapak@proxmox.com>

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@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





  reply	other threads:[~2023-10-19 13:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-19 13:36 [pve-devel] [PATCH manager 1/3] ui: tags: fix focus for edit mode Dominik Csapak
2023-10-19 13:36 ` Dominik Csapak [this message]
2023-10-19 13:59   ` [pve-devel] [PATCH manager 2/3] ui: tags: prevent pasting non plain-text content Dominik Csapak
2023-10-24  9:53     ` Thomas Lamprecht
2023-10-24  9:57       ` Dominik Csapak
2023-10-24 10:07         ` Thomas Lamprecht
2023-10-24 10:51           ` Dominik Csapak
2023-10-24 10:52             ` Thomas Lamprecht
2023-10-19 13:36 ` [pve-devel] [PATCH manager 3/3] ui: wizards: allow adding tags in the qemu/lxc create wizard Dominik Csapak
2023-10-24 14:48   ` Thomas Lamprecht
2023-10-24 14:49 ` [pve-devel] applied: [PATCH manager 1/3] ui: tags: fix focus for edit mode Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231019133607.1416999-2-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal