Problem with java script - customizing Oxygen Web author !
Post here questions and problems related to editing and publishing DITA content.
-
- Posts: 157
- Joined: Mon Aug 18, 2014 4:11 pm
Problem with java script - customizing Oxygen Web author !
Hi team,
We are using Oxygen Xml Web Author 20.1.1 and doing some customization. We are implementing a new feature in the Author mode which needs to read clipboard content and store in a variable using javascript. We tried different approaches but its failing for few browsers because of vulnerability issue.
1.) Compatible with MSIE browser but not working in others:
window.clipboardData.getData('Text');
2.) Compatible with Chrome and Edge( version 87.0 ) but not working in others:
navigator.clipboard.readText().then(text => {
console.log('Pasted content: ', text);
})
.catch(err => {
console.error('Failed to read clipboard contents: ', err);
});
3.) Compatible with Chrome and Edge( Version 44+ ) but not working in others:
document.addEventListener("paste", function(){
var clipText = event.clipboardData.getData('Text');
});
Could you please suggest any solution regarding this which can support all the browsers.
Regards,
Shabeer
We are using Oxygen Xml Web Author 20.1.1 and doing some customization. We are implementing a new feature in the Author mode which needs to read clipboard content and store in a variable using javascript. We tried different approaches but its failing for few browsers because of vulnerability issue.
1.) Compatible with MSIE browser but not working in others:
window.clipboardData.getData('Text');
2.) Compatible with Chrome and Edge( version 87.0 ) but not working in others:
navigator.clipboard.readText().then(text => {
console.log('Pasted content: ', text);
})
.catch(err => {
console.error('Failed to read clipboard contents: ', err);
});
3.) Compatible with Chrome and Edge( Version 44+ ) but not working in others:
document.addEventListener("paste", function(){
var clipText = event.clipboardData.getData('Text');
});
Could you please suggest any solution regarding this which can support all the browsers.
Regards,
Shabeer
-
- Posts: 517
- Joined: Thu Sep 04, 2014 4:22 pm
Re: Problem with java script - customizing Oxygen Web author !
Post by cristi_talau »
You are right - due to security restrictions imposed by the browser, JS code is usually not allowed to read clipboard content. An exception is during the user "paste" event.
If you manage to find different solutions that work on different browsers, you can link them together using some platform detection. Our built-in paste functionality leaves the user to paste the content and read it afterward. I am not sure if this applies in your case.
Anyway, we would be interested in what feature you are trying to implement. Maybe we can make the bulitin paste functionality customizable to cover that use-case.
If you manage to find different solutions that work on different browsers, you can link them together using some platform detection. Our built-in paste functionality leaves the user to paste the content and read it afterward. I am not sure if this applies in your case.
Anyway, we would be interested in what feature you are trying to implement. Maybe we can make the bulitin paste functionality customizable to cover that use-case.
Return to “DITA (Editing and Publishing DITA Content)”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service