From 74d6928e2799f2c87f2a6a6f0cebb812d9a9db3a Mon Sep 17 00:00:00 2001 From: jessikitty Date: Tue, 26 May 2026 10:01:42 +1000 Subject: [PATCH] =?UTF-8?q?fix:=20Edit=20view=20=E2=80=94=20white=20defaul?= =?UTF-8?q?t=20bg,=20paste=20formatting,=20text-align=20+=20all=20styles?= =?UTF-8?q?=20whitelisted?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Views/Slides/Edit.cshtml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Views/Slides/Edit.cshtml b/Views/Slides/Edit.cshtml index f816790..da493fb 100644 --- a/Views/Slides/Edit.cshtml +++ b/Views/Slides/Edit.cshtml @@ -52,7 +52,7 @@
- +
@@ -105,6 +105,20 @@ selector: '#contentEditor', height: 500, license_key: 'gpl', + paste_data_images: true, + paste_webkit_styles: 'all', + paste_postprocess: function(editor, args) { + args.node.querySelectorAll('*').forEach(function(el) { + var tag = el.tagName.toLowerCase(); + var isTablePart = (tag === 'td' || tag === 'th' || tag === 'table' || tag === 'tr'); + if (el.style.color && !isTablePart) el.style.color = '#000'; + if (el.style.backgroundColor && !isTablePart) el.style.backgroundColor = ''; + }); + }, + valid_styles: { + '*': 'color,background-color,background,font-size,font-family,text-align,text-decoration,font-weight,font-style,border,border-color,border-width,border-style,border-collapse,padding,padding-left,padding-right,padding-top,padding-bottom,margin,margin-left,margin-right,margin-top,margin-bottom,width,height,max-width,max-height,min-width,min-height,vertical-align,white-space,display,float,line-height,letter-spacing,text-indent,text-transform,list-style-type,opacity' + }, + extended_valid_elements: 'table[*],tr[*],td[*],th[*],colgroup[*],col[*],thead[*],tbody[*],tfoot[*],div[*],span[*],p[*],img[*],a[*],h1[*],h2[*],h3[*],h4[*],h5[*],h6[*]', menubar: 'file edit view insert format table', plugins: 'advlist autolink lists link image charmap preview anchor searchreplace visualblocks code fullscreen insertdatetime media table help wordcount', toolbar: 'undo redo | blocks fontsize | bold italic forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | image media table | removeformat code fullscreen',