From 06de7523b2bcdc23cf7537b9cf7b80213ceaca52 Mon Sep 17 00:00:00 2001 From: Jenny Schweers Date: Mon, 9 Dec 2024 15:16:16 -0500 Subject: [PATCH 1/6] Renamed scheduling/js/create_schedule.ko --- .../static/scheduling/js/conditional_alert_main.js | 2 +- .../js/{create_schedule.ko.js => create_schedule.js} | 8 ++++---- .../static/scheduling/js/create_schedule_main.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) rename corehq/messaging/scheduling/static/scheduling/js/{create_schedule.ko.js => create_schedule.js} (99%) diff --git a/corehq/messaging/scheduling/static/scheduling/js/conditional_alert_main.js b/corehq/messaging/scheduling/static/scheduling/js/conditional_alert_main.js index aa2e48b38555..b3e178c5df23 100644 --- a/corehq/messaging/scheduling/static/scheduling/js/conditional_alert_main.js +++ b/corehq/messaging/scheduling/static/scheduling/js/conditional_alert_main.js @@ -6,7 +6,7 @@ hqDefine("scheduling/js/conditional_alert_main", [ 'data_interfaces/js/case_rule_criteria', 'data_interfaces/js/case_property_input', 'hqwebapp/js/bootstrap3/widgets', - 'scheduling/js/create_schedule.ko', + 'scheduling/js/create_schedule', 'data_interfaces/js/make_read_only', ], function ( $, diff --git a/corehq/messaging/scheduling/static/scheduling/js/create_schedule.ko.js b/corehq/messaging/scheduling/static/scheduling/js/create_schedule.js similarity index 99% rename from corehq/messaging/scheduling/static/scheduling/js/create_schedule.ko.js rename to corehq/messaging/scheduling/static/scheduling/js/create_schedule.js index 633f6799640c..92d92064ee13 100644 --- a/corehq/messaging/scheduling/static/scheduling/js/create_schedule.ko.js +++ b/corehq/messaging/scheduling/static/scheduling/js/create_schedule.js @@ -1,4 +1,4 @@ -hqDefine("scheduling/js/create_schedule.ko", [ +hqDefine("scheduling/js/create_schedule", [ 'jquery', 'knockout', 'hqwebapp/js/initial_page_data', @@ -521,11 +521,11 @@ hqDefine("scheduling/js/create_schedule.ko", [ fieldName: field, multiple: true, }); - + self.getHandlerSlug = function () { return 'scheduling_select2_helper'; }; - + self.getInitialData = function () { return initial_object_list; }; @@ -534,7 +534,7 @@ hqDefine("scheduling/js/create_schedule.ko", [ return self; }; - + recipientsSelect2Handler.prototype = Object.create(recipientsSelect2Handler.prototype); recipientsSelect2Handler.prototype.constructor = recipientsSelect2Handler; diff --git a/corehq/messaging/scheduling/static/scheduling/js/create_schedule_main.js b/corehq/messaging/scheduling/static/scheduling/js/create_schedule_main.js index 97c70f020a95..963e044478f2 100644 --- a/corehq/messaging/scheduling/static/scheduling/js/create_schedule_main.js +++ b/corehq/messaging/scheduling/static/scheduling/js/create_schedule_main.js @@ -1,5 +1,5 @@ hqDefine("scheduling/js/create_schedule_main", [ - 'scheduling/js/create_schedule.ko', + 'scheduling/js/create_schedule', 'data_interfaces/js/make_read_only', 'locations/js/widgets', // remove this altogether? ], function () { From 218e3c10c81ad1eaa2f1e16fddaa5589939d4337 Mon Sep 17 00:00:00 2001 From: Jenny Schweers Date: Fri, 22 Nov 2024 17:13:26 -0500 Subject: [PATCH 2/6] Migrated pages depending on ckeditor, switching to 'New Instalaltion Methods' --- .../hqwebapp/js/ckeditor_knockout_bindings.js | 65 +- .../scheduling/js/conditional_alert_main.js | 1 + .../scheduling/js/create_schedule_main.js | 1 + .../scheduling/conditional_alert.html | 23 +- .../templates/scheduling/create_schedule.html | 23 +- package.json | 7 +- webpack/appPaths.js | 1 + yarn.lock | 1279 ++++++++--------- 8 files changed, 673 insertions(+), 727 deletions(-) diff --git a/corehq/apps/hqwebapp/static/hqwebapp/js/ckeditor_knockout_bindings.js b/corehq/apps/hqwebapp/static/hqwebapp/js/ckeditor_knockout_bindings.js index 2028d0ab8656..437fee5a4477 100644 --- a/corehq/apps/hqwebapp/static/hqwebapp/js/ckeditor_knockout_bindings.js +++ b/corehq/apps/hqwebapp/static/hqwebapp/js/ckeditor_knockout_bindings.js @@ -1,5 +1,4 @@ 'use strict'; -/* global CKEditor5 */ // When adding a ckeditor binding, be sure to also add the name of an image upload url. // For example @@ -9,42 +8,46 @@ hqDefine('hqwebapp/js/ckeditor_knockout_bindings', [ '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 + initialPageData, + CKEditor5 ) { ko.bindingHandlers.ckeditor = { init: function (element, valueAccessor) { var options = { + licenseKey: 'GPL', plugins: [ - CKEditor5.alignment.Alignment, - CKEditor5.link.AutoLink, - CKEditor5.autoformat.Autoformat, - CKEditor5.basicStyles.Bold, - CKEditor5.basicStyles.Italic, - CKEditor5.essentials.Essentials, - CKEditor5.font.Font, - CKEditor5.font.FontColor, - CKEditor5.heading.Heading, - CKEditor5.horizontalLine.HorizontalLine, - CKEditor5.htmlSupport.GeneralHtmlSupport, - CKEditor5.image.Image, - CKEditor5.image.ImageCaption, - CKEditor5.image.ImageStyle, - CKEditor5.image.ImageResize, - CKEditor5.image.ImageResizeButtons, - CKEditor5.image.ImageToolbar, - CKEditor5.image.ImageUpload, - CKEditor5.indent.Indent, - CKEditor5.link.Link, - CKEditor5.link.LinkImage, - CKEditor5.list.List, - CKEditor5.paragraph.Paragraph, - CKEditor5.pasteFromOffice.PasteFromOffice, - CKEditor5.restrictedEditing.RestrictedEditingMode, - CKEditor5.upload.SimpleUploadAdapter, + 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: [ @@ -146,7 +149,7 @@ hqDefine('hqwebapp/js/ckeditor_knockout_bindings', [ }, editorInstance = undefined; - CKEditor5.editorClassic.ClassicEditor.create(element, options).then(function (editor) { + CKEditor5.ClassicEditor.create(element, options).then(function (editor) { var isSubscriberChange = false, isEditorChange = false, editorInstance = editor; @@ -161,7 +164,7 @@ hqDefine('hqwebapp/js/ckeditor_knockout_bindings', [ valueAccessor()(editorInstance.getData()); isEditorChange = false; } - + }); // Update the document whenever the observable changes @@ -181,7 +184,7 @@ hqDefine('hqwebapp/js/ckeditor_knockout_bindings', [ // handle disposal (if KO removes by the template binding) ko.utils.domNodeDisposal.addDisposeCallback(element, function () { - CKEditor5.editorClassic.ClassicEditor.remove(editorInstance); + CKEditor5.ClassicEditor.remove(editorInstance); }); }, diff --git a/corehq/messaging/scheduling/static/scheduling/js/conditional_alert_main.js b/corehq/messaging/scheduling/static/scheduling/js/conditional_alert_main.js index b3e178c5df23..cefc5fc8b00e 100644 --- a/corehq/messaging/scheduling/static/scheduling/js/conditional_alert_main.js +++ b/corehq/messaging/scheduling/static/scheduling/js/conditional_alert_main.js @@ -8,6 +8,7 @@ hqDefine("scheduling/js/conditional_alert_main", [ 'hqwebapp/js/bootstrap3/widgets', 'scheduling/js/create_schedule', 'data_interfaces/js/make_read_only', + 'commcarehq', ], function ( $, _, diff --git a/corehq/messaging/scheduling/static/scheduling/js/create_schedule_main.js b/corehq/messaging/scheduling/static/scheduling/js/create_schedule_main.js index 963e044478f2..5bcdf7edaa90 100644 --- a/corehq/messaging/scheduling/static/scheduling/js/create_schedule_main.js +++ b/corehq/messaging/scheduling/static/scheduling/js/create_schedule_main.js @@ -2,6 +2,7 @@ hqDefine("scheduling/js/create_schedule_main", [ 'scheduling/js/create_schedule', 'data_interfaces/js/make_read_only', 'locations/js/widgets', // remove this altogether? + 'commcarehq' ], function () { // This page doesn't have any page-specific logic, it just depends on the modules above }); diff --git a/corehq/messaging/scheduling/templates/scheduling/conditional_alert.html b/corehq/messaging/scheduling/templates/scheduling/conditional_alert.html index 4ae14cd65b15..3d6e76481153 100644 --- a/corehq/messaging/scheduling/templates/scheduling/conditional_alert.html +++ b/corehq/messaging/scheduling/templates/scheduling/conditional_alert.html @@ -3,28 +3,7 @@ {% load crispy_forms_tags %} {% load i18n %} -{% block js %}{{ block.super }} - {% if request|toggle_enabled:"RICH_TEXT_EMAILS" %} - - - - - - - - - - - - - - - - - - {% endif %} - {% requirejs_main 'scheduling/js/conditional_alert_main' %} -{% endblock %} +{% js_entry_b3 'scheduling/js/conditional_alert_main' %} {% block stylesheets %}{{ block.super }}