cancel
Showing results for 
Search instead for 
Did you mean: 

clip to board API for UI5

AlexDong
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Experts,

I recently had a requirement with copying the title from SAP object page into clipboard. Is there any API in SAP UI5 to handle this?

Cause I didn't get any information on this topic. Actually, there is some third-party tool to handle this. But I think should it make more sense if UI5 can provide such kind of API?

Is there any plan with this?

Thanks for any hints!

Best regards,

Alex

Accepted Solutions (0)

Answers (1)

Answers (1)

junwu
Active Contributor
0 Kudos

no

AlexDong
Product and Topic Expert
Product and Topic Expert
0 Kudos

OK well, I am afraid I have to use the third party plugin to resolve this. Why so many browsers...

former_member182862
Active Contributor
0 Kudos

HI Alex

can you elaborate on Copy to Clipboard? How does user do this? Click on an icon, or button?


Thanks

-D

AlexDong
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Dennis,

Some customers want to copy a title from a document, e.g. SAP Notes. Then they paste it in email, and the title will exist as a link. Customers can click a button to achieve this. I want to take advantage of UI5 API as it is very tricky for different browsers and there are a lot of security policy for  accessing clipboard.

Did you have any experience with this before?

Thanks

former_member182862
Active Contributor
0 Kudos

HI Alex

Sorry, I am still unclear on what you want to achieve. If you wish to copy something to the copy clipboard then document.execCommand('copy') will do it. Only Safari does not support this.

AlexDong
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Dennis,

This seems a simple functionality but I suppose execCommand is not enough here because,

the title should exist as a hyperlink instead of a plain text.

Please refer to the above pictures for the logic.

Thanks and best regards,

Alex

former_member182862
Active Contributor
0 Kudos

Thanks Alex

I tried to do it and I failed. I cannot copy an URL into a clipboard.

Which open source library do you have in mind?

Thanks

-D

AlexDong
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Dennis,

Unfortunately I neither don't have a good solution. There is a chrome extention called "create link". I tried to extract some codes inside it but still has encountered a lot of problems with compability with different browsers.

The simplest way is let the ui5 control "objectpageheader" to have the link as title. But ... you know, the title can only be a string according to the API.

Best regards,

Alex

former_member182862
Active Contributor
0 Kudos

you can change it to a link like this

JS Bin - Collaborative JavaScript Debugging