From 3cdee7b85dca481080cacaeec9a914aa9acd2507 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Wed, 14 Feb 2024 20:55:37 +0000 Subject: [PATCH 1/3] Remove jQuery from the comment task list - Switched to plain JavaScript - Tested the task list functionality and it works as before Signed-off-by: Yarden Shoham --- web_src/js/markup/tasklist.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/web_src/js/markup/tasklist.js b/web_src/js/markup/tasklist.js index ad1c6964a757f..00076bce58915 100644 --- a/web_src/js/markup/tasklist.js +++ b/web_src/js/markup/tasklist.js @@ -1,4 +1,4 @@ -import $ from 'jquery'; +import {POST} from '../modules/fetch.js'; const preventListener = (e) => e.preventDefault(); @@ -55,12 +55,11 @@ export function initMarkupTasklist() { const updateUrl = editContentZone.getAttribute('data-update-url'); const context = editContentZone.getAttribute('data-context'); - await $.post(updateUrl, { - ignore_attachments: true, - _csrf: window.config.csrfToken, - content: newContent, - context - }); + const requestBody = new FormData(); + requestBody.append('ignore_attachments', 'true'); + requestBody.append('content', newContent); + requestBody.append('context', context); + await POST(updateUrl, {data: requestBody}); rawContent.textContent = newContent; } catch (err) { From 5b1fa8e18a32cb8293ea4ad791accbbfb1b03483 Mon Sep 17 00:00:00 2001 From: Yarden Shoham Date: Thu, 15 Feb 2024 09:02:54 +0200 Subject: [PATCH 2/3] Update web_src/js/markup/tasklist.js Co-authored-by: wxiaoguang --- web_src/js/markup/tasklist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/markup/tasklist.js b/web_src/js/markup/tasklist.js index 00076bce58915..7fa817c3eead4 100644 --- a/web_src/js/markup/tasklist.js +++ b/web_src/js/markup/tasklist.js @@ -59,7 +59,7 @@ export function initMarkupTasklist() { requestBody.append('ignore_attachments', 'true'); requestBody.append('content', newContent); requestBody.append('context', context); - await POST(updateUrl, {data: requestBody}); + await POST(updateUrl, {body: requestBody}); rawContent.textContent = newContent; } catch (err) { From f46098c300eef498004e7fad95402f1724e27ff6 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 15 Feb 2024 14:22:07 +0100 Subject: [PATCH 3/3] Update web_src/js/markup/tasklist.js --- web_src/js/markup/tasklist.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/markup/tasklist.js b/web_src/js/markup/tasklist.js index 7fa817c3eead4..00076bce58915 100644 --- a/web_src/js/markup/tasklist.js +++ b/web_src/js/markup/tasklist.js @@ -59,7 +59,7 @@ export function initMarkupTasklist() { requestBody.append('ignore_attachments', 'true'); requestBody.append('content', newContent); requestBody.append('context', context); - await POST(updateUrl, {body: requestBody}); + await POST(updateUrl, {data: requestBody}); rawContent.textContent = newContent; } catch (err) {