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

BPS Git Server git at git.bestpractical.com
Tue Sep 14 13:07:30 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  410789e7b0cc728c580cb042d4eac45e54fac3ab (commit)

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

    Try harder to add response/comment css class to ckeditor for dark mode
    
    This is mainly to set correct font color in ckeditor. Previously we only
    tried once(in 100ms), which could be too early in some 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..3e2676e076 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -781,9 +781,14 @@ jQuery(function() {
         // 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);
+                var interval;
+                interval = setInterval(function() {
+                    var elem = jQuery(e.target).contents().find('.cke_editable');
+                    if ( elem.length ) {
+                        elem.addClass(class_name);
+                        clearInterval(interval);
+                    }
+                }, 10);
             });
         });
 

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list