Skip to content

Commit

Permalink
Merge branch 'pu/ccheng/rt_247462' into '2024.11'
Browse files Browse the repository at this point in the history
fix(Filemanager/js): preview tinebase node from message compose dialog

See merge request tine20/tine20!6611
  • Loading branch information
ccheng-dev committed Feb 21, 2025
2 parents aa18f1a + b5feef0 commit 8faea80
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions tine20/Filemanager/js/nodeActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,16 +526,25 @@ Tine.Filemanager.nodeActions.Preview = {
scope: this,
constraint: 'file',
handler: function () {
var selection = _.get(this, 'initialConfig.selections[0]') ||_.get(this, 'initialConfig.filteredContainer');

if (selection) {
if (selection.get('type') === 'file') {
Tine.Filemanager.QuickLookPanel.openWindow({
record: selection,
initialApp: this.initialConfig.initialApp || null,
sm: this.initialConfig.sm
});
let record = _.get(this, 'initialConfig.selections[0]') ||_.get(this, 'initialConfig.filteredContainer');
let initialApp = this.initialConfig.initialApp;

if (record && record.get('type') === 'file') {
if (!record.constructor?.getPhpClassName?.()) {
if (record.get('object_id')) {
record = new Tine.Tinebase.Model.Tree_Node(record.data);
if (record.get('path').match(/^\/records/)) {
const appName = record.get('path').split('/')[2].split('_')[0];
initialApp = Tine.Tinebase.appMgr.get(appName);
}
}
}

Tine.Filemanager.QuickLookPanel.openWindow({
record: record,
initialApp: initialApp || null,
sm: this.initialConfig.sm
});
}
},
actionUpdater: Tine.Filemanager.nodeActions.actionUpdater
Expand Down

0 comments on commit 8faea80

Please sign in to comment.