[Rt-commit] rt branch 5.0/ckeditor-font-color-in-dark-mode created. rt-5.0.1-609-g6fa67d4dc9

BPS Git Server git at git.bestpractical.com
Tue Sep 14 13:50:25 UTC 2021


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt".

The branch, 5.0/ckeditor-font-color-in-dark-mode has been created
        at  6fa67d4dc9de9f716dc3c8f51c03fd5fd0eea9bb (commit)

- Log -----------------------------------------------------------------
commit 6fa67d4dc9de9f716dc3c8f51c03fd5fd0eea9bb
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Sep 14 20:59:35 2021 +0800

    Add response/comment css class after ckeditor is fully loaded in dark mode
    
    This is mainly to set correct font color in ckeditor. Previously the
    hard-coded 100ms is not long enough in cases where cke_editable hasn't
    been created yet.

diff --git a/share/static/js/util.js b/share/static/js/util.js
index 5c0c7fc18f..ef04fa9274 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -779,11 +779,12 @@ jQuery(function() {
     if ( RT.Config.WebDefaultStylesheet.match(/dark/) ) {
 
         // Add action type into iframe to customize default font color
-        jQuery(['action-response', 'action-private']).each(function(index, class_name) {
-            jQuery('.' + class_name).on('DOMNodeInserted', 'iframe', function(e) {
-                setTimeout(function() {
-                    jQuery(e.target).contents().find('.cke_editable').addClass(class_name);
-                }, 100);
+        CKEDITOR.on('instanceReady', function(e) {
+            var container = jQuery(e.editor.element.$.closest('div.messagebox-container'));
+            jQuery(['action-response', 'action-private']).each(function(index, class_name) {
+                if ( container.hasClass(class_name) ) {
+                    container.find('iframe').contents().find('.cke_editable').addClass(class_name);
+                }
             });
         });
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list