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/models/content.py b/corehq/messaging/scheduling/models/content.py index 4ddcc5c5aa42..c8a5f18bfc48 100644 --- a/corehq/messaging/scheduling/models/content.py +++ b/corehq/messaging/scheduling/models/content.py @@ -1,4 +1,3 @@ -import os from contextlib import contextmanager from copy import deepcopy from datetime import datetime, timezone @@ -10,7 +9,6 @@ from django.http import Http404 from django.utils.translation import gettext as _ -import css_inline import jsonfield as old_jsonfield from memoized import memoized @@ -164,12 +162,6 @@ def send(self, recipient, logged_event, phone_entry=None): self.html_message, recipient.get_language_code() ) - # Add extra css added by CKEditor, and inline css styles from template - email_css_filepath = os.path.join( - "corehq", "messaging", "scheduling", "templates", "scheduling", "rich_text_email_styles.css") - with open(email_css_filepath, 'r') as css_file: - css_inliner = css_inline.CSSInliner(extra_css=css_file.read()) - html_message = css_inliner.inline(html_message) try: subject, message, html_message = self.render_subject_and_message( 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 = { 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 %}