From 8d00f88a0946f7b160342f4d8e2251e3f2fa5d31 Mon Sep 17 00:00:00 2001 From: Matt Raible Date: Tue, 17 Nov 2026 16:50:12 -0700 Subject: [PATCH 01/14] Open entries with active HTML in the textarea instead of the rich editor Before Summernote starts, EntryEditor.jsp checks the entry's HTML with the new rich-editor-content.js, which parses it in an inert DOMParser document and looks for scripts, frames, plugins, document-level elements, noscript, SVG set and animate, on* attributes, and javascript: or vbscript: URLs in any attribute. When it finds any, the entry opens in the plain HTML textarea with a short notice, and media files are inserted into the textarea, since Summernote would start itself on any call. Other entries open in Summernote as before. The stored HTML isn't changed, and the plain text editor is unchanged. --- .../resources/ApplicationResources.properties | 1 + .../WEB-INF/jsps/editor/EntryEditor.jsp | 62 ++++++++++---- .../roller-ui/scripts/rich-editor-content.js | 84 +++++++++++++++++++ .../editor/EntryEditorRichContentTest.java | 74 ++++++++++++++++ 4 files changed, 206 insertions(+), 15 deletions(-) create mode 100644 app/src/main/webapp/roller-ui/scripts/rich-editor-content.js create mode 100644 app/src/test/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEditorRichContentTest.java diff --git a/app/src/main/resources/ApplicationResources.properties b/app/src/main/resources/ApplicationResources.properties index eb6a304856..30663c4923 100644 --- a/app/src/main/resources/ApplicationResources.properties +++ b/app/src/main/resources/ApplicationResources.properties @@ -1559,6 +1559,7 @@ weblogEdit.draft=Draft weblogEdit.draftEntries=Recent Drafts weblogEdit.deleteEntry=Delete Entry weblogEdit.insertMediaFile=Insert Media File +weblogEdit.richEditorShowsHtml=This entry contains HTML the rich text editor can''t show safely, so it opens as HTML. weblogEdit.inlineImageInvalid=This entry contains an unsupported or invalid embedded image. Use a PNG, JPEG or GIF image, or insert a media file. weblogEdit.inlineImageTooLarge=This entry has too much embedded image data. Resize the image or ask an administrator to enable media uploads. error.postTooLarge=The form is too large to submit, so nothing was saved. Use your browser's Back button to return to it. If it contains pasted images, use smaller images or insert them as media files. An administrator can raise the server's maximum POST size. diff --git a/app/src/main/webapp/WEB-INF/jsps/editor/EntryEditor.jsp b/app/src/main/webapp/WEB-INF/jsps/editor/EntryEditor.jsp index b7837e851e..21f3570eee 100644 --- a/app/src/main/webapp/WEB-INF/jsps/editor/EntryEditor.jsp +++ b/app/src/main/webapp/WEB-INF/jsps/editor/EntryEditor.jsp @@ -22,6 +22,11 @@ <%-- ********************************************************************* --%> <%-- content --%> + + + @@ -88,6 +93,10 @@ + + + + ", + "

text

", + "

text

", + "link", + "link", + "link", + "link", + "", + "x", + "
", + "
", + "", + "", + "
x
", + "
x
", + "", + "", + "cell outside a table", + "x", + "", + "