[Rt-commit] rt branch 5.0/top-bottom-posting created. rt-5.0.4-20-gb4c38d98c6
BPS Git Server
git at git.bestpractical.com
Sat Jun 3 16:45:33 UTC 2023
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/top-bottom-posting has been created
at b4c38d98c679f56171a976c04166867882cd5092 (commit)
- Log -----------------------------------------------------------------
commit b4c38d98c679f56171a976c04166867882cd5092
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Sat Jun 3 19:44:27 2023 +0300
Add MessageBoxTopPostinng option
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index adcd78594c..a58d6bd632 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -3588,6 +3588,15 @@ Height of rich text JavaScript enabled editing boxes (in pixels)
Set($MessageBoxRichTextHeight, 300);
+
+=item C<$MessageBoxTopPosting>
+
+Focus cursor above or below quoted text in replies.
+
+=cut
+
+Set($MessageBoxTopPosting, 0);
+
=item C<$MessageBoxIncludeSignature>
Should your users' signatures (from their Preferences page) be
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 2cb614f825..4220febd35 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -324,6 +324,15 @@ our %META;
Description => 'Message box height', #loc
},
},
+ MessageBoxTopPosting => {
+ Section => 'Ticket composition',
+ Overridable => 1,
+ SortOrder => 8.1,
+ Widget => '/Widgets/Form/Boolean',
+ WidgetArguments => {
+ Description => 'Place cursor above quoted content on replies and comments' # loc
+ }
+ },
DefaultTimeUnitsToHours => {
Section => 'Ticket composition', #loc
Overridable => 1,
diff --git a/share/html/Elements/JavascriptConfig b/share/html/Elements/JavascriptConfig
index 6cbb2021bf..ce990c9d2b 100644
--- a/share/html/Elements/JavascriptConfig
+++ b/share/html/Elements/JavascriptConfig
@@ -49,7 +49,8 @@
my $Config = {};
$Config->{$_} = RT->Config->Get( $_, $session{CurrentUser} )
for qw(rtname WebPath MessageBoxRichText MessageBoxRichTextHeight
- MaxAttachmentSize WebDefaultStylesheet QuoteSelectedText );
+ MaxAttachmentSize WebDefaultStylesheet QuoteSelectedText
+ MessageBoxTopPosting);
# JS-only config value. Setting default here, can be reset with
# the Data callback below.
diff --git a/share/html/Ticket/Update.html b/share/html/Ticket/Update.html
index 6446e46042..0475f7d876 100644
--- a/share/html/Ticket/Update.html
+++ b/share/html/Ticket/Update.html
@@ -225,6 +225,21 @@
% if ($TicketObj->CurrentUserHasRight('ShowOutgoingEmail') or RT->Config->Get('SimplifiedRecipients', $session{'CurrentUser'})) {
<script type="text/javascript">
+jQuery.fn.setCursorPosition = function(pos) {
+ this.each(function(index, elem) {
+ if (elem.setSelectionRange) {
+ elem.setSelectionRange(pos, pos);
+ } else if (elem.createTextRange) {
+ var range = elem.createTextRange();
+ range.collapse(true);
+ range.moveEnd('character', pos);
+ range.moveStart('character', pos);
+ range.select();
+ }
+ });
+ return this;
+};
+
jQuery( function() {
var updateScrips = function() {
if (CKEDITOR.instances && CKEDITOR.instances['UpdateContent']) {
@@ -327,6 +342,38 @@ jQuery( function() {
jQuery("#UpdateCc, #UpdateBcc").change(syncOneTimeCheckboxes);
+
+ if (CKEDITOR.instances && CKEDITOR.instances['UpdateContent']) {
+ CKEDITOR.instances['UpdateContent'].on('instanceReady', function(e) {
+ var editor = e.editor;
+ editor.focus();
+
+ if ( RT.Config.MessageBoxTopPosting) {
+ editor.insertHtml('<p></p>');
+ var range = editor.createRange();
+ range.moveToElementEditStart( range.root );
+ editor.getSelection().selectRanges( [ range ] );
+ } else {
+ editor.editable().appendHtml('<p></p>');
+
+ var range = editor.createRange();
+ range.moveToElementEditEnd( range.root );
+ editor.getSelection().selectRanges( [ range ] );
+ }
+ });
+ }
+ else {
+ var area = jQuery('#UpdateContent');
+
+ if (RT.Config.MessageBoxTopPosting) {
+ area.val("\n"+ area.val());
+ area.focus().setCursorPosition(0);
+ } else {
+ area.val(area.val() +"\n");
+ area.focus();
+ }
+ }
+
});
</script>
% }
-----------------------------------------------------------------------
hooks/post-receive
--
rt
More information about the rt-commit
mailing list