Skip to content

Commit

Permalink
Issue #3824: disable editing for readonly richtext dynamic fields
Browse files Browse the repository at this point in the history
  • Loading branch information
chzauleck committed Oct 28, 2024
1 parent 16a0b55 commit b67625a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Kernel/System/DynamicField/Driver/RichText.pm
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ sub EditFieldRender {
$FieldClass .= ' Validate_Required';
}

# set readonly css class
if ( $Param{Readonly} ) {
$FieldClass .= ' ReadOnly';
}

# set error css class
if ( $Param{ServerError} ) {
$FieldClass .= ' ServerError';
Expand Down
5 changes: 5 additions & 0 deletions var/httpd/htdocs/js/Core.UI.RichTextEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ Core.UI.RichTextEditor = (function (TargetNS) {
$domEditableElement = $($EditorArea).closest(".RichTextHolder");
}

//Set to Readonly mode if required
if ($EditorArea.hasClass('ReadOnly')) {
editor.enableReadOnlyMode('DF_Readonly');
}

var sourceEditingActive = false;

$domEditableElement.resizable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
font-size: 16px;
color: #ea2400;
}

textarea.ReadOnly ~ .ck .ck-editor__editable {
box-shadow: inset 0px 0px 8px 2px #bfbfce;
box-shadow: inset 0px 0px 8px 2px var(--colBGDark);
}

0 comments on commit b67625a

Please sign in to comment.