Fix context menu "Copy ..." of text contents

This commit is contained in:
nathan 2024-08-01 10:36:17 -06:00
parent 3c0ea24aa7
commit 5f2aba2af9
5 changed files with 25 additions and 1 deletions

View File

@ -662,7 +662,7 @@ export class EgwPopupActionImplementation implements EgwActionImplementation {
}
let os_clipboard_caption = "";
if (this._context.event) {
os_clipboard_caption = this._context.innerText.trim();
os_clipboard_caption = this._context.event.target.innerText.trim()
clipboard_action.set_caption(window.egw.lang('Copy "%1"', os_clipboard_caption.length > 20 ? os_clipboard_caption.substring(0, 20) + '...' : os_clipboard_caption));
clipboard_action.data.target = this._context.target;
}

View File

@ -52,6 +52,11 @@ export class Et2DateDurationReadonly extends Et2DateDuration
this.requestUpdate("value", old_value);
}
get innerText() : string
{
return this.shadowRoot.querySelector('span').innerText;
}
render()
{
let parsed = this.__value;

View File

@ -50,6 +50,12 @@ export class Et2DateReadonly extends Et2Widget(LitElement) implements et2_IDetac
this.value = value;
}
get innerText() : string
{
let parsed : Date | Boolean = this.value ? this.parser(this.value, this.dataFormat) : false
return this.value ? this.formatter(<Date>parsed) : '';
}
render()
{
let parsed : Date | Boolean = this.value ? this.parser(this.value, this.dataFormat) : false

View File

@ -426,6 +426,10 @@ export class Et2Link extends ExposeMixin<Et2Widget>(Et2Widget(LitElement)) imple
return false;
}
get innerText() : string
{
return this.title;
}
getDetachedAttributes(_attrs : string[])
{
_attrs.push("app", "entryId", "statustext");

View File

@ -227,6 +227,15 @@ li {
return this.__select_options;
}
get innerText() : string
{
return typeof this.value == "string" ? this.select_options.find(o => o.value == this.value) :
this.select_options
.filter(o => this.value.includes("" + o.value))
.map(o => o.label)
.join(", ");
}
render()
{
const value = this.getValueAsArray();