Skip to content

Commit

Permalink
Merge branch '2023.11' into 2024.11
Browse files Browse the repository at this point in the history
  • Loading branch information
pschuele committed Feb 26, 2024
2 parents 6ebfe35 + 9e21e87 commit 47560b2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
13 changes: 10 additions & 3 deletions tine20/Felamimail/js/GridPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,16 @@ Tine.Felamimail.GridPanel = Ext.extend(Tine.widgets.grid.GridPanel, {
handler: this.onRowDblClick,
scope: this,
iconCls: 'action_edit',
actionUpdater: function(action, grants, records, isFilterSelect, filteredContainers) {
action.setHidden(! this.sentFolderSelected);
}.createDelegate(this)
actionUpdater: (action, grants, records, isFilterSelect, filteredContainers) => {
let editable = false;
if (this.sentFolderSelected && records[0]) {
const folder = this.app.getFolderStore().getById(records[0].get('folder_id'));
const account = this.app.getAccountStore().getById(folder.get('account_id'));
editable = folder.get('path').includes(account.getSpecialFolderId('drafts_folder'))
|| folder.get('path').includes(account.getSpecialFolderId('templates_folder'));
}
action.setHidden(!editable);
}
});

this.action_fileRecord = new Tine.Felamimail.MessageFileAction({});
Expand Down
24 changes: 12 additions & 12 deletions tine20/Felamimail/js/MessageEditDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -694,17 +694,17 @@ Tine.Felamimail.MessageEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
* @param {} o
*/
onKeyPress: function (e, t, o) {
if ((e.getKey() == e.TAB || e.getKey() == e.ENTER) && !e.shiftKey) {
if ((e.getKey() === e.TAB || e.getKey() === e.ENTER) && !e.shiftKey) {
if (e.getTarget('input[name=subject]')) {
this.htmlEditor.focus.defer(50, this.htmlEditor);
} else if (e.getTarget('input[type=text]')) {
this.subjectField.focus.defer(50, this.subjectField);
}
}
if (e.getTarget('body')) {
if (e.getKey() == e.ENTER && e.ctrlKey) {
if (e.getKey() === e.ENTER && e.ctrlKey) {
this.onSaveAndClose();
} else if (e.getKey() == e.TAB && e.shiftKey) {
} else if (e.getKey() === e.TAB && e.shiftKey) {
this.subjectField.focus.defer(50, this.subjectField);
}
}
Expand Down Expand Up @@ -1094,8 +1094,8 @@ Tine.Felamimail.MessageEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {

const account = Tine.Tinebase.appMgr.get('Felamimail').getAccountStore().getById(this.record.get('account_id'));
const text = this.bodyCards.layout.activeItem.getValue() || this.record.get('body');
const displayFormat = this.record.getBodyType();
const textEditor = displayFormat === 'text/html' ? this.htmlEditor : this.textEditor;
const format = this.record.getBodyType();
const textEditor = format === 'text/plain' ? this.textEditor : this.htmlEditor;

this.bodyCards.layout.setActiveItem(btn.pressed ? this.mailvelopeWrap : textEditor);

Expand Down Expand Up @@ -1142,10 +1142,10 @@ Tine.Felamimail.MessageEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
* toggle format
*/
onToggleFormat: function () {
var source = this.bodyCards.layout.activeItem,
format = source.mimeType,
target = format === 'text/plain' ? this.htmlEditor : this.textEditor,
convert = format === 'text/plain' ?
const source = this.bodyCards.layout.activeItem;
const format = source.mimeType;
const target = format === 'text/plain' ? this.htmlEditor : this.textEditor;
const convert = format === 'text/plain' ?
Ext.util.Format.nl2br :
Tine.Tinebase.common.html2text;

Expand Down Expand Up @@ -1218,13 +1218,13 @@ Tine.Felamimail.MessageEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {
*/
onRecordLoad: async function () {
// interrupt process flow till dialog is rendered
if (!this.rendered || (this.record.get('content_type') === 'text/html' && !this.htmlEditor?.initialized)) {
if (!this.rendered || (this.record.get('content_type') !== 'text/plain' && !this.htmlEditor?.initialized)) {
this.onRecordLoad.defer(250, this);
return;
}

let title = this.app.i18n._('Compose email:');
const editor = this.record.get('content_type') === 'text/html' ? this.htmlEditor : this.textEditor;
const editor = this.record.get('content_type') === 'text/plain' ? this.textEditor : this.htmlEditor;

if (this.record.get('subject')) {
title = title + ' ' + this.record.get('subject');
Expand Down Expand Up @@ -1308,7 +1308,7 @@ Tine.Felamimail.MessageEditDialog = Ext.extend(Tine.widgets.dialog.EditDialog, {

const format = this.bodyCards.layout.activeItem.mimeType;
if (format.match(/^text/)) {
const editor = format === 'text/html' ? this.htmlEditor : this.textEditor;
const editor = format === 'text/plain' ? this.textEditor : this.htmlEditor;

this.record.set('content_type', format);
this.record.set('body', editor.getValue());
Expand Down

0 comments on commit 47560b2

Please sign in to comment.