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/broadcasts_list.js b/corehq/messaging/scheduling/static/scheduling/js/broadcasts_list.js index b42b8b756d47..c796cdc6b931 100644 --- a/corehq/messaging/scheduling/static/scheduling/js/broadcasts_list.js +++ b/corehq/messaging/scheduling/static/scheduling/js/broadcasts_list.js @@ -4,7 +4,8 @@ hqDefine("scheduling/js/broadcasts_list", [ 'knockout', 'hqwebapp/js/assert_properties', 'hqwebapp/js/initial_page_data', - "hqwebapp/js/components/pagination", + 'hqwebapp/js/components/pagination', + 'commcarehq', ], function ( $, _, diff --git a/corehq/messaging/scheduling/static/scheduling/js/conditional_alert_list.js b/corehq/messaging/scheduling/static/scheduling/js/conditional_alert_list.js index 283bc27a557c..4153178d999a 100644 --- a/corehq/messaging/scheduling/static/scheduling/js/conditional_alert_list.js +++ b/corehq/messaging/scheduling/static/scheduling/js/conditional_alert_list.js @@ -6,6 +6,7 @@ hqDefine("scheduling/js/conditional_alert_list", [ 'hqwebapp/js/initial_page_data', 'hqwebapp/js/components/pagination', 'hqwebapp/js/components/search_box', + 'commcarehq', ], function ( $, ko, 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..cefc5fc8b00e 100644 --- a/corehq/messaging/scheduling/static/scheduling/js/conditional_alert_main.js +++ b/corehq/messaging/scheduling/static/scheduling/js/conditional_alert_main.js @@ -6,8 +6,9 @@ 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', + 'commcarehq', ], 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..5bcdf7edaa90 100644 --- a/corehq/messaging/scheduling/static/scheduling/js/create_schedule_main.js +++ b/corehq/messaging/scheduling/static/scheduling/js/create_schedule_main.js @@ -1,7 +1,8 @@ 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? + 'commcarehq' ], function () { // This page doesn't have any page-specific logic, it just depends on the modules above }); diff --git a/corehq/messaging/scheduling/static/scheduling/js/dashboard.js b/corehq/messaging/scheduling/static/scheduling/js/dashboard.js index 50fd8948c410..d8c8797dbd12 100644 --- a/corehq/messaging/scheduling/static/scheduling/js/dashboard.js +++ b/corehq/messaging/scheduling/static/scheduling/js/dashboard.js @@ -4,6 +4,7 @@ hqDefine("scheduling/js/dashboard",[ 'hqwebapp/js/initial_page_data', 'd3/d3.min', 'nvd3/nv.d3.min', + 'commcarehq', ], function ($, ko, initialPageData, d3, nv) { var dashboardUrl = initialPageData.reverse("messaging_dashboard"); diff --git a/corehq/messaging/scheduling/templates/scheduling/broadcasts_list.html b/corehq/messaging/scheduling/templates/scheduling/broadcasts_list.html index 8441e2fc49b6..6fb69985aaff 100644 --- a/corehq/messaging/scheduling/templates/scheduling/broadcasts_list.html +++ b/corehq/messaging/scheduling/templates/scheduling/broadcasts_list.html @@ -2,7 +2,7 @@ {% load hq_shared_tags %} {% load i18n %} -{% requirejs_main 'scheduling/js/broadcasts_list' %} +{% js_entry_b3 'scheduling/js/broadcasts_list' %} {% block stylesheets %}{{ block.super }}