mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-29 03:13:40 +01:00
Switch htmlarea to use vfs-select-dialog webcomponent for file selection
This commit is contained in:
parent
9388a8f930
commit
bf383fbbb4
@ -17,13 +17,14 @@
|
|||||||
|
|
||||||
import {et2_editableWidget} from "./et2_core_editableWidget";
|
import {et2_editableWidget} from "./et2_core_editableWidget";
|
||||||
import {ClassWithAttributes} from "./et2_core_inheritance";
|
import {ClassWithAttributes} from "./et2_core_inheritance";
|
||||||
import {et2_createWidget, et2_register_widget, WidgetConfig} from "./et2_core_widget";
|
import {et2_register_widget, WidgetConfig} from "./et2_core_widget";
|
||||||
import {et2_IResizeable} from "./et2_core_interfaces";
|
import {et2_IResizeable} from "./et2_core_interfaces";
|
||||||
import {et2_no_init} from "./et2_core_common";
|
import {et2_no_init} from "./et2_core_common";
|
||||||
import {egw} from "../jsapi/egw_global";
|
import {egw} from "../jsapi/egw_global";
|
||||||
import {et2_vfsSelect} from "./et2_widget_vfs";
|
|
||||||
import "../../../vendor/tinymce/tinymce/tinymce.min.js";
|
import "../../../vendor/tinymce/tinymce/tinymce.min.js";
|
||||||
import {etemplate2} from "./etemplate2";
|
import {etemplate2} from "./etemplate2";
|
||||||
|
import {loadWebComponent} from "./Et2Widget/Et2Widget";
|
||||||
|
import {Et2VfsSelectDialog} from "./Et2Vfs/Et2VfsSelectDialog";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @augments et2_inputWidget
|
* @augments et2_inputWidget
|
||||||
@ -404,22 +405,23 @@ export class et2_htmlarea extends et2_editableWidget implements et2_IResizeable
|
|||||||
{
|
{
|
||||||
et2 = app[egw(window).app_name()].et2;
|
et2 = app[egw(window).app_name()].et2;
|
||||||
}
|
}
|
||||||
|
const dialog = <Et2VfsSelectDialog><unknown>loadWebComponent("et2-vfs-select-dialog", {
|
||||||
let vfsSelect = <et2_vfsSelect>et2_createWidget('vfs-select', {
|
|
||||||
id: 'upload',
|
id: 'upload',
|
||||||
mode: 'open',
|
mode: 'open',
|
||||||
name: '',
|
multiple: false,
|
||||||
button_caption:"Link",
|
buttonLabel: "Link",
|
||||||
button_label:"Link",
|
title: "Link file",
|
||||||
dialog_title: "Link file",
|
open: true
|
||||||
method: "download"
|
}, this);
|
||||||
}, et2);
|
|
||||||
jQuery(vfsSelect.getDOMNode()).on('change', function (){
|
dialog.addEventListener('change', function()
|
||||||
callback(vfsSelect.get_value(), {alt:vfsSelect.get_value()});
|
{
|
||||||
|
const file = dialog.fileInfo(Array.isArray(dialog.value) ? dialog.value[0] : dialog.value);
|
||||||
|
callback(egw.webserverUrl + file.downloadUrl, {alt: file.name});
|
||||||
});
|
});
|
||||||
|
|
||||||
// start the file selector dialog
|
// start the file selector dialog
|
||||||
vfsSelect.click();
|
document.body.append(dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user