[Rt-commit] rt branch 5.0/fix-user-sig-spacing-issues-px created. rt-5.0.2-260-gaa3c22fb59

BPS Git Server git at git.bestpractical.com
Fri Jun 24 19:11:36 UTC 2022


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/fix-user-sig-spacing-issues-px has been created
        at  aa3c22fb59876510037f82df8fb862509e4c7d7e (commit)

- Log -----------------------------------------------------------------
commit aa3c22fb59876510037f82df8fb862509e4c7d7e
Author: Brian Conry <bconry at bestpractical.com>
Date:   Wed May 25 08:51:59 2022 -0500

    Allow CKEDITOR (rich text) boxes to vary in height
    
    Set the height of CKEDITOR based on context.
    
    For ones with the "messagebox" class continue to use
    MessageBoxRichTextHeight.
    
    For others, add a constant to the height of the textarea (in px) to
    partially compensate for the margin/spacing differences between the two.

diff --git a/share/static/js/util.js b/share/static/js/util.js
index e5e93311e0..05ab9e9346 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -374,7 +374,25 @@ function ReplaceAllTextareas() {
             // Set the type
             type.val("text/html");
 
-            CKEDITOR.replace(textArea.name,{ width: '100%', height: RT.Config.MessageBoxRichTextHeight });
+            if (jQuery(textArea).hasClass("messagebox")) {
+                // * the "messagebox" class is used for ticket correspondence/comment content.
+                // * for a long time this was the only use of the CKEDITOR and it was given its own
+                //   user/system configuration option.
+                // * continue using this config option for those CKEDITOR instances
+                CKEDITOR.replace(textArea.name,{ width: '100%', height: RT.Config.MessageBoxRichTextHeight });
+            }
+            else {
+                // * for all CKEDITOR instances without the "messagebox" class we instead base the
+                //   (editable) height on the size of the textarea element it's replacing.
+                //   (the height does not include any toolbars, the status bar, or other "overhead")
+                // * the number 54 is chosen somewhat arbitrarily.  it will not scale well for textareas
+                //   with different number of rows
+                // * in at least one browser/styling:
+                //   * there's 42px more top/bottom margin in the CKEditor than there is in the textarea
+                //   * the gap between lines is 3px taller in the CKEditor than it is in the textarea
+                //   + each new paragraph in the CKEditor adds an additional 13px to the gap between lines
+                CKEDITOR.replace(textArea.name,{ width: '100%', height: (jQuery(textArea).height() + 54) + 'px' });
+            }
 
             jQuery('[name="' + textArea.name + '___Frame"]').addClass("richtext-editor");
         }

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


hooks/post-receive
-- 
rt


More information about the rt-commit mailing list