Typing newline in oxy_textArea

<oXygen/> general issues.
Topi
Posts: 2
Joined: Tue May 25, 2021 2:09 pm

Typing newline in oxy_textArea

Post by Topi » Tue May 25, 2021 2:41 pm

Hello,

I am making a Web Author framework for editing xml documents. I have an oxy_textArea form control to edit the text content in <mainDescription> as follows:

Code: Select all

metadata > mainDescription {
    content:oxy_textArea(
          edit, '#text',
          contentType, 'text/plain',
          rows, 12,
          width, 100%);
     visibility: -oxy-collapse-text;    
}
The problem is, I'm unable to type newlines into the text by pressing enter. Pressing the enter key simply does nothing when the caret is inside the text area. Ctrl-enter does nothing either. Interestingly, I can paste newlines into the text from the clipboard. Any idea on how to get the enter key to work?

Best,
Topi

cristi_talau
Posts: 341
Joined: Thu Sep 04, 2014 4:22 pm

Re: Typing newline in oxy_textArea

Post by cristi_talau » Wed May 26, 2021 11:39 am

Hello,

I managed to reproduce the issue. I registered an issue for it and we will update this forum post once it is implemented.

To fix this problem in your deployment you can paste the following code snippet in the JS code [1] of your framework:

Code: Select all

document.body.addEventListener('keydown', e => {
  if (e.keyCode === 13) {
    if (e.target.tagName === 'TEXTAREA') {
      e.stopPropagation();
    }
  }
}, true);
Best,
Cristian

[1] https://www.oxygenxml.com/doc/versions/ ... _framework

Topi
Posts: 2
Joined: Tue May 25, 2021 2:09 pm

Re: Typing newline in oxy_textArea

Post by Topi » Fri Jun 04, 2021 11:16 am

Thanks Cristi, that does the job!

Sorry for the late reply, somehow I didn't notice your reply.

In the meantime I managed to modify the function

Code: Select all

sync.formctrls.TextEnhancer.prototype.enterDocument = function(a) {
in workspace.js to get a temporary solution.

Again, thanks :)

Best, Topi

Post Reply