[Author mode] Insert an element in a textfield
Oxygen general issues.
-
- Posts: 3
- Joined: Tue Nov 22, 2016 12:23 pm
[Author mode] Insert an element in a textfield
Post by Jorge Fins »
Hello,
I am trying to find a way to insert easily an <br/> element in a textfield.
I succeeded to add a custom button with an insertfragmentoperation that permits to insert a <br/> in the code.
However, the behaviour really doesn't correspond to what I expect :
- any text already written in this textfield disappears in the author mode (but it remains in the XML file).
- I would like to be able to insert the <br/> element between words, like with the bold button here, for instance https://www.oxygenxml.com/webapp-demo-a ... John%20Doe, but it seems I can't insert it on the caret position, even if I have no Xpath expression declared on the Action Menu of the document type association : it is inserted as first or as last child.
Many thanks for any help.
I am trying to find a way to insert easily an <br/> element in a textfield.
I succeeded to add a custom button with an insertfragmentoperation that permits to insert a <br/> in the code.
However, the behaviour really doesn't correspond to what I expect :
- any text already written in this textfield disappears in the author mode (but it remains in the XML file).
- I would like to be able to insert the <br/> element between words, like with the bold button here, for instance https://www.oxygenxml.com/webapp-demo-a ... John%20Doe, but it seems I can't insert it on the caret position, even if I have no Xpath expression declared on the Action Menu of the document type association : it is inserted as first or as last child.
Many thanks for any help.
Last edited by Jorge Fins on Tue Nov 22, 2016 4:22 pm, edited 1 time in total.
-
- Posts: 517
- Joined: Thu Sep 04, 2014 4:22 pm
Re: [Author mode] Insert an element in a textfield form
Post by cristi_talau »
Hello,
Let me make sure I understand your use-case:
1. What type of document type are you editing? I would assume XHTML since <br/> is an element specific to XHTML. However, the link that you included in your post points to an TEI document.
2. Are you using a button form control [1] to insert the <br/> element? I would assume yes.
3. You are trying to insert a <br/> element as a child of an <input type="text" /> element. Is that what you call a "textfield"?
If I understood correctly, there are two possible causes for the expected behavior:
1. The XHTML schema does not allow a <br/> to be a child of an <input /> element.
2. The button form control has an "actionContext" property that you need to set to "caret" in order to insert the <br/> at the caret position.
Best,
Critian
[1] https://www.oxygenxml.com/doc/versions/ ... ditor.html
Let me make sure I understand your use-case:
1. What type of document type are you editing? I would assume XHTML since <br/> is an element specific to XHTML. However, the link that you included in your post points to an TEI document.
2. Are you using a button form control [1] to insert the <br/> element? I would assume yes.
3. You are trying to insert a <br/> element as a child of an <input type="text" /> element. Is that what you call a "textfield"?
If I understood correctly, there are two possible causes for the expected behavior:
1. The XHTML schema does not allow a <br/> to be a child of an <input /> element.
2. The button form control has an "actionContext" property that you need to set to "caret" in order to insert the <br/> at the caret position.
Best,
Critian
[1] https://www.oxygenxml.com/doc/versions/ ... ditor.html
-
- Posts: 3
- Joined: Tue Nov 22, 2016 12:23 pm
Re: [Author mode] Insert an element in a textfield form
Post by Jorge Fins »
1. This is an XML file. The link was just an ex&mple found on the forums of what kind of behaviour I was trying to reproduce.
2. Yes.
3. I am trying to insert a a <br/> to be a child of an <author> XML element (specific to the project) for which I have declared in the linked CSS an oxy_textfield property.
About the causes :
1. I have tried with a DTD that permits this insertion, and also without, with a "false" value to the schemaAware argument. Both methods didn't work.
2. Do you know where this would be and what is the exact value ? The tooltips on the Action Menu of the document type association mention that it should already be on the caret position by default.
Best,
Jorge
2. Yes.
3. I am trying to insert a a <br/> to be a child of an <author> XML element (specific to the project) for which I have declared in the linked CSS an oxy_textfield property.
About the causes :
1. I have tried with a DTD that permits this insertion, and also without, with a "false" value to the schemaAware argument. Both methods didn't work.
2. Do you know where this would be and what is the exact value ? The tooltips on the Action Menu of the document type association mention that it should already be on the caret position by default.
Best,
Jorge
-
- Posts: 517
- Joined: Thu Sep 04, 2014 4:22 pm
Re: [Author mode] Insert an element in a textfield
Post by cristi_talau »
Hello,
The default value for "actionContext" [1] is "element". You should specify it explicitely as "caret" in order to insert elements at caret position.
Regarding the text disappearing in Author mode, this is a limitation of the "textfield" form-control. It only renders the first text node in the parent element. You have two alternatives:
1. Use a textArea form control with the "edit" property set to "#content" [2].
2. Use the normal oXygen rendering. You can simulate a textfield by adding a border to the "author" element.
If you can describe more precisely the UI you want to achieve, maybe we can provide better alternatives.
Best,
Cristian
[1] https://www.oxygenxml.com/doc/versions/ ... ditor.html
[2] https://www.oxygenxml.com/doc/versions/ ... ntrol.html
The default value for "actionContext" [1] is "element". You should specify it explicitely as "caret" in order to insert elements at caret position.
Regarding the text disappearing in Author mode, this is a limitation of the "textfield" form-control. It only renders the first text node in the parent element. You have two alternatives:
1. Use a textArea form control with the "edit" property set to "#content" [2].
2. Use the normal oXygen rendering. You can simulate a textfield by adding a border to the "author" element.
If you can describe more precisely the UI you want to achieve, maybe we can provide better alternatives.
Best,
Cristian
[1] https://www.oxygenxml.com/doc/versions/ ... ditor.html
[2] https://www.oxygenxml.com/doc/versions/ ... ntrol.html
-
- Posts: 3
- Joined: Tue Nov 22, 2016 12:23 pm
Re: [Author mode] Insert an element in a textfield
Post by Jorge Fins »
The textarea solution with a value "<br/>$caret" instead of "<br/>" for the fragment argument is good enough to solve my problem.
Thank you !
Thank you !
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