mirror of
https://github.com/itflow-org/itflow
synced 2026-02-28 02:44:53 +00:00
Add ticket redaction feature
This commit is contained in:
17
js/app.js
17
js/app.js
@@ -277,6 +277,23 @@ tinymce.init({
|
||||
}
|
||||
});
|
||||
|
||||
// Initialize TinyMCE editor with only a redact button
|
||||
tinymce.init({
|
||||
selector: '.tinymceTicketRedact',
|
||||
browser_spellcheck: false,
|
||||
contextmenu: false,
|
||||
resize: true,
|
||||
min_height: 300,
|
||||
max_height: 500,
|
||||
promotion: false,
|
||||
branding: false,
|
||||
menubar: false,
|
||||
statusbar: false,
|
||||
license_key: 'gpl',
|
||||
readonly: true,
|
||||
toolbar: '',
|
||||
});
|
||||
|
||||
// DateTime
|
||||
$('.datetimepicker').datetimepicker({
|
||||
});
|
||||
|
||||
15
js/ticket_redact.js
Normal file
15
js/ticket_redact.js
Normal file
@@ -0,0 +1,15 @@
|
||||
// Redact the selected text in TinyMCE
|
||||
function redactSelectedText() {
|
||||
const editor = tinymce.get('tinymceTicketRedact'); // Get TinyMCE editor instance
|
||||
const selectedText = editor.selection.getContent(); // Get selected content
|
||||
|
||||
if (selectedText) {
|
||||
// Wrap the selected text with a redacted span
|
||||
const redactedNode = `<strong><span style="color: #e03e2d;">[REDACTED]</span></strong>`;
|
||||
|
||||
// Replace the selected text with the redacted span
|
||||
editor.selection.setContent(redactedNode);
|
||||
} else {
|
||||
alert('Please select some text to redact.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user