From 6f57810379a8b7ac5ee7f84f1ce74f255b62beac Mon Sep 17 00:00:00 2001 From: Jenny Schweers Date: Tue, 10 Dec 2024 12:59:11 -0500 Subject: [PATCH 1/7] Removed usage of ckeditor binding --- .../scheduling/partials/rich_text_message_configuration.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/corehq/messaging/scheduling/templates/scheduling/partials/rich_text_message_configuration.html b/corehq/messaging/scheduling/templates/scheduling/partials/rich_text_message_configuration.html index ff67040d56e2..0079ae22476c 100644 --- a/corehq/messaging/scheduling/templates/scheduling/partials/rich_text_message_configuration.html +++ b/corehq/messaging/scheduling/templates/scheduling/partials/rich_text_message_configuration.html @@ -10,12 +10,12 @@
- +
- +
From faf46f9057248588ba5346dd245c7acd0ad7c615 Mon Sep 17 00:00:00 2001 From: Jenny Schweers Date: Wed, 11 Dec 2024 07:16:07 -0500 Subject: [PATCH 2/7] Removed bindings module --- .../hqwebapp/js/ckeditor_knockout_bindings.js | 192 ------------------ .../static/scheduling/js/create_schedule.js | 1 - 2 files changed, 193 deletions(-) delete mode 100644 corehq/apps/hqwebapp/static/hqwebapp/js/ckeditor_knockout_bindings.js diff --git a/corehq/apps/hqwebapp/static/hqwebapp/js/ckeditor_knockout_bindings.js b/corehq/apps/hqwebapp/static/hqwebapp/js/ckeditor_knockout_bindings.js deleted file mode 100644 index 437fee5a4477..000000000000 --- a/corehq/apps/hqwebapp/static/hqwebapp/js/ckeditor_knockout_bindings.js +++ /dev/null @@ -1,192 +0,0 @@ -'use strict'; - -// When adding a ckeditor binding, be sure to also add the name of an image upload url. -// For example - -hqDefine('hqwebapp/js/ckeditor_knockout_bindings', [ - 'jquery', - 'underscore', - 'knockout', - 'hqwebapp/js/initial_page_data', - 'ckeditor5/ckeditor5.js', // This needs the .js extension to differentiate it from ckeditor.css - // and similar files in the same directory -], function ( - $, - _, - ko, - initialPageData, - CKEditor5 -) { - ko.bindingHandlers.ckeditor = { - init: function (element, valueAccessor) { - var options = { - licenseKey: 'GPL', - plugins: [ - CKEditor5.Alignment, - CKEditor5.AutoLink, - CKEditor5.Autoformat, - CKEditor5.Bold, - CKEditor5.Italic, - CKEditor5.Essentials, - CKEditor5.Font, - CKEditor5.FontColor, - CKEditor5.Heading, - CKEditor5.HorizontalLine, - CKEditor5.GeneralHtmlSupport, - CKEditor5.Image, - CKEditor5.ImageCaption, - CKEditor5.ImageStyle, - CKEditor5.ImageResize, - CKEditor5.ImageResizeButtons, - CKEditor5.ImageToolbar, - CKEditor5.ImageUpload, - CKEditor5.Indent, - CKEditor5.Link, - CKEditor5.LinkImage, - CKEditor5.List, - CKEditor5.Paragraph, - CKEditor5.PasteFromOffice, - CKEditor5.RestrictedEditingMode, - CKEditor5.SimpleUploadAdapter, - ], - toolbar: { - items: [ - 'heading', - 'fontFamily', - 'fontSize', - 'fontColor', - '|', - 'bold', - 'italic', - 'link', - 'alignment', - 'bulletedList', - 'numberedList', - 'uploadImage', - '|', - 'outdent', - 'indent', - '|', - 'undo', - 'redo', - 'restrictedEditing', - ], - }, - image: { - insert: { - type: 'inline', - }, - toolbar: [ - 'imageStyle:side', - '|', - 'toggleImageCaption', - '|', - 'linkImage', - ], - }, - simpleUpload: { - uploadUrl: initialPageData.reverse(element.attributes['data-image-upload-url'].value), - withCredentials: true, - headers: { - 'X-CSRFTOKEN': $("#csrfTokenContainer").val(), - }, - }, - htmlSupport: { - // We allow all HTML here, and filter it out in a sanitizing step - allow: [ - { - name: /.*/, - attributes: true, - classes: true, - styles: true, - }, - ], - }, - restrictedEditing: { - allowedCommands: [ - "alignment", - "fontColor", - "fontBackgroundColor", - "deleteForward", - "forwardDelete", - "delete", - "bold", - "italic", - "enter", - "selectAll", - "shiftEnter", - "insertText", - "input", - "undo", - "redo", - "fontFamily", - "fontSize", - "paragraph", - "insertParagraph", - "heading", - "horizontalLine", - "insertImage", - "replaceImageSource", - "imageInsert", - "imageTextAlternative", - "imageTypeInline", - "toggleImageCaption", - "imageStyle", - "resizeImage", - "imageResize", - "uploadImage", - "imageUpload", - "indent", - "outdent", - "link", - "unlink", - "numberedList", - "bulletedList", - "indentList", - "outdentList", - ], - }, - }, - editorInstance = undefined; - - CKEditor5.ClassicEditor.create(element, options).then(function (editor) { - var isSubscriberChange = false, - isEditorChange = false, - editorInstance = editor; - if (typeof ko.utils.unwrapObservable(valueAccessor()) !== "undefined") { - editorInstance.setData(ko.utils.unwrapObservable(valueAccessor())); - } - - // Update the observable value when the document changes - editorInstance.model.document.on('change:data', function () { - if (!isSubscriberChange) { - isEditorChange = true; - valueAccessor()(editorInstance.getData()); - isEditorChange = false; - } - - }); - - // Update the document whenever the observable changes - valueAccessor().subscribe(function (value) { - if (!isEditorChange) { - isSubscriberChange = true; - editorInstance.setData(value); - isSubscriberChange = false; - } - - }); - - if (initialPageData.get('read_only_mode')) { - editorInstance.enableReadOnlyMode(''); - } - }); - - // handle disposal (if KO removes by the template binding) - ko.utils.domNodeDisposal.addDisposeCallback(element, function () { - CKEditor5.ClassicEditor.remove(editorInstance); - }); - - }, - }; -}); diff --git a/corehq/messaging/scheduling/static/scheduling/js/create_schedule.js b/corehq/messaging/scheduling/static/scheduling/js/create_schedule.js index 92d92064ee13..0eaf2402ab56 100644 --- a/corehq/messaging/scheduling/static/scheduling/js/create_schedule.js +++ b/corehq/messaging/scheduling/static/scheduling/js/create_schedule.js @@ -5,7 +5,6 @@ hqDefine("scheduling/js/create_schedule", [ 'hqwebapp/js/select2_handler', 'jquery-ui/ui/widgets/datepicker', 'bootstrap-timepicker/js/bootstrap-timepicker', - 'hqwebapp/js/ckeditor_knockout_bindings', 'hqwebapp/js/components/select_toggle', ], function ($, ko, initialPageData, select2Handler) { ko.bindingHandlers.useTimePicker = { From 1e5aefc2a646c779ab53e8e49b4e3d25e9cc60e1 Mon Sep 17 00:00:00 2001 From: Jenny Schweers Date: Tue, 10 Dec 2024 13:02:43 -0500 Subject: [PATCH 3/7] Removed css --- .../scheduling/templates/scheduling/conditional_alert.html | 3 --- .../scheduling/templates/scheduling/create_schedule.html | 6 ------ 2 files changed, 9 deletions(-) diff --git a/corehq/messaging/scheduling/templates/scheduling/conditional_alert.html b/corehq/messaging/scheduling/templates/scheduling/conditional_alert.html index 141f63d89f4b..3d6e76481153 100644 --- a/corehq/messaging/scheduling/templates/scheduling/conditional_alert.html +++ b/corehq/messaging/scheduling/templates/scheduling/conditional_alert.html @@ -6,9 +6,6 @@ {% js_entry_b3 'scheduling/js/conditional_alert_main' %} {% block stylesheets %}{{ block.super }} - {% if request|toggle_enabled:"RICH_TEXT_EMAILS" %} - - {% endif %}