[Rt-commit] rt branch, 4.6/ckeditor4, updated. rt-4.4.4-520-g9e5fd9f2fe
Blaine Motsinger
blaine at bestpractical.com
Mon Nov 18 18:41:57 EST 2019
The branch, 4.6/ckeditor4 has been updated
via 9e5fd9f2fe0f5127d04d83e58a918a0460ba3f6b (commit)
from 241ab23f34282710825946b13bb3a16e5ced9be4 (commit)
Summary of changes:
share/html/Ticket/Update.html | 10 +++++
share/static/RichText/contents.css | 3 +-
share/static/css/elevator-light/ckeditor5.css | 12 ------
share/static/css/elevator-light/main.css | 1 -
share/static/css/elevator-light/ticket-form.css | 6 ++-
share/static/js/util.js | 52 +++++++++++++++++++++----
6 files changed, 60 insertions(+), 24 deletions(-)
delete mode 100644 share/static/css/elevator-light/ckeditor5.css
- Log -----------------------------------------------------------------
commit 9e5fd9f2fe0f5127d04d83e58a918a0460ba3f6b
Author: Blaine Motsinger <blaine at bestpractical.com>
Date: Mon Nov 18 17:34:54 2019 -0600
Restore CKEditor4 functionality
This commit restores the remaining changes from the CKEditor5
update, including the following:
Remove left over ckeditor5.css
Restore CKEditor4 global functionality in util.js
Restore attachment warning functionality
Theme updates for elevator-light were kept, as well as one change
to the RichText css to allow for comment/reply background color
changes.
diff --git a/share/html/Ticket/Update.html b/share/html/Ticket/Update.html
index b3084bce1e..10220a5cf5 100644
--- a/share/html/Ticket/Update.html
+++ b/share/html/Ticket/Update.html
@@ -219,6 +219,9 @@
<script type="text/javascript">
jQuery( function() {
var updateScrips = function() {
+ if (CKEDITOR.instances && CKEDITOR.instances['UpdateContent']) {
+ CKEDITOR.instances['UpdateContent'].updateElement();
+ }
var syncCheckboxes = function(ev) {
var target = ev.target;
jQuery("input[name=TxnSendMailTo]").filter( function() { return this.value == target.value; } ).prop("checked",jQuery(target).prop('checked'));
@@ -259,6 +262,13 @@ jQuery( function() {
};
updateScrips();
+ if (CKEDITOR.instances && CKEDITOR.instances['UpdateContent']) {
+ CKEDITOR.instances['UpdateContent'].on('blur', updateScrips );
+ }
+ else {
+ jQuery('#UpdateContent').on('blur', updateScrips );
+ }
+
jQuery("#ticket-update-metadata :input, #UpdateCc, #UpdateBcc").change( updateScrips );
});
diff --git a/share/static/RichText/contents.css b/share/static/RichText/contents.css
index 20e84053a2..f10238a2db 100644
--- a/share/static/RichText/contents.css
+++ b/share/static/RichText/contents.css
@@ -14,7 +14,8 @@ body
color: #333;
/* Remove the background color to make it transparent. */
- background-color: #fff;
+ /* RT change to allow for .messagebox-container .action-response and .action-private (reply and comment) colors */
+ /*background-color: #fff;*/
margin: 20px;
}
diff --git a/share/static/css/elevator-light/ckeditor5.css b/share/static/css/elevator-light/ckeditor5.css
deleted file mode 100644
index de73ddb177..0000000000
--- a/share/static/css/elevator-light/ckeditor5.css
+++ /dev/null
@@ -1,12 +0,0 @@
-.ck-editor__editable_inline {
- min-height: 300px;
-}
-
-/* Change background color for reply and comment */
-div.messagebox-container.action-response div.ck-editor__editable_inline {
- background-color: #fcc !important;
-}
-
-div.messagebox-container.action-private div.ck-editor__editable_inline {
- background-color: #ffffdd !important;
-}
diff --git a/share/static/css/elevator-light/main.css b/share/static/css/elevator-light/main.css
index e8f8a031df..adb371822b 100644
--- a/share/static/css/elevator-light/main.css
+++ b/share/static/css/elevator-light/main.css
@@ -41,4 +41,3 @@
@import "ticket-lists.css";
@import "ticket-search.css";
@import "print.css";
- at import "ckeditor5.css";
diff --git a/share/static/css/elevator-light/ticket-form.css b/share/static/css/elevator-light/ticket-form.css
index b727d043b7..dc2523c002 100644
--- a/share/static/css/elevator-light/ticket-form.css
+++ b/share/static/css/elevator-light/ticket-form.css
@@ -24,12 +24,14 @@
white-space: nowrap;
}
-.messagebox-container.action-response textarea
+.messagebox-container.action-response textarea,
+.messagebox-container.action-response iframe
{
background-color: #fcc !important;
}
-.messagebox-container.action-private textarea
+.messagebox-container.action-private textarea,
+.messagebox-container.action-private iframe
{
background-color: #ffffdd !important;
}
diff --git a/share/static/js/util.js b/share/static/js/util.js
index f04ac28c38..f54c129656 100644
--- a/share/static/js/util.js
+++ b/share/static/js/util.js
@@ -269,6 +269,13 @@ function textToHTML(value) {
CKEDITOR_BASEPATH=RT.Config.WebPath + "/static/RichText/";
function ReplaceAllTextareas() {
+ var sAgent = navigator.userAgent.toLowerCase();
+ if (!CKEDITOR.env.isCompatible ||
+ sAgent.indexOf('iphone') != -1 ||
+ sAgent.indexOf('ipad') != -1 ||
+ sAgent.indexOf('android') != -1 )
+ return false;
+
// replace all content and signature message boxes
var allTextAreas = document.getElementsByTagName("textarea");
@@ -284,14 +291,13 @@ function ReplaceAllTextareas() {
type.val("text/html");
CKEDITOR.replace(textArea.name,{ width: '100%', height: RT.Config.MessageBoxRichTextHeight });
+
jQuery("#" + textArea.name + "___Frame").addClass("richtext-editor");
}
}
};
-/*
-
-function AddAttachmentWarning(richTextEditor) {
+function AddAttachmentWarning() {
var plainMessageBox = jQuery('.messagebox');
if (plainMessageBox.hasClass('suppress-attachment-warning')) return;
@@ -301,7 +307,13 @@ function AddAttachmentWarning(richTextEditor) {
var fallbackElement = jQuery('.old-attach');
var reuseElements = jQuery('#reuse-attachments');
+ // there won't be a ckeditor when using the plain <textarea>
+ var richTextEditor;
var messageBoxId = plainMessageBox.attr('id');
+ if (CKEDITOR.instances && CKEDITOR.instances[messageBoxId]) {
+ richTextEditor = CKEDITOR.instances[messageBoxId];
+ }
+
var regex = new RegExp(loc_key("attachment_warning_regex"), "i");
// if the quoted text or signature contains the magic word
@@ -359,8 +371,34 @@ function AddAttachmentWarning(richTextEditor) {
var listenForAttachmentEvents = function () {
if (richTextEditor) {
- richTextEditor.model.document.on( 'change:data', () => {
- delayedAttachmentWarning();
+ richTextEditor.on('instanceReady', function () {
+ // this set of events is imperfect. what I really want is:
+ // this.on('change', ...)
+ // but ckeditor doesn't seem to provide that out of the box
+
+ this.on('blur', function () {
+ toggleAttachmentWarning();
+ });
+
+ // we want to capture ~every keystroke type event; we only do the
+ // full checking periodically to avoid overloading the browser
+ this.document.on("keyup", function () {
+ delayedAttachmentWarning();
+ });
+ this.document.on("keydown", function () {
+ delayedAttachmentWarning();
+ });
+ this.document.on("keypress", function () {
+ delayedAttachmentWarning();
+ });
+
+ // hook into the undo/redo buttons in the ckeditor UI
+ this.getCommand('undo').on('afterUndo', function () {
+ toggleAttachmentWarning();
+ });
+ this.getCommand('redo').on('afterRedo', function () {
+ toggleAttachmentWarning();
+ });
});
}
else {
@@ -406,8 +444,6 @@ function AddAttachmentWarning(richTextEditor) {
}
}
-*/
-
function toggle_addprincipal_validity(input, good, title) {
if (good) {
jQuery(input).nextAll(".invalid-feedback").addClass('hidden');
@@ -516,7 +552,7 @@ function loadCollapseStates() {
jQuery(function() {
ReplaceAllTextareas();
jQuery('select.chosen.CF-Edit').chosen({ width: '20em', placeholder_text_multiple: ' ', no_results_text: ' ', search_contains: true });
-/* AddAttachmentWarning(); */
+ AddAttachmentWarning();
jQuery('a.delete-attach').click( function() {
var parent = jQuery(this).closest('div');
var name = jQuery(this).attr('data-name');
-----------------------------------------------------------------------
More information about the rt-commit
mailing list