&nbsp HTML Entity doesn't work in author mode

Post here questions and problems related to oXygen frameworks/document types.
odurand47
Posts: 6
Joined: Tue Feb 04, 2020 10:16 am

&nbsp HTML Entity doesn't work in author mode

Post by odurand47 »

Hi,

I have a custom character map for the needs of my company unfortunately Non-breaking space (and hyphen) character doesn't work as intended.

Code: Select all

authorAccess.getDocumentController().insertXMLFragment(" ", caretOffset);
With this code I have a Non-breaking space that works once published in pdf but it has no "non-breaking" influence in author mode.

Code: Select all

authorAccess.getDocumentController().insertXMLFragment("\u00A0", caretOffset);
With Unicode that works in pdf and in author mode but It's indistinguishable from any other space (indistinguishable in text mode as well). Sure, we can use the option in Preferences/Editor/"Show TAB/NBSP/EOL/EOF marks" but honestly you need to have good eyes to tell the difference between the two and it's a little overkill for just a rarely used (but important) character.

I would prefer to use HTML entities because you can select them in css with

Code: Select all

oxy|entity[name='nbsp']
and add a colored background. Isn't there a way to make the "non-breaking" work in author mode?
Radu
Posts: 9348
Joined: Fri Jul 09, 2004 5:18 pm

Re: &nbsp HTML Entity doesn't work in author mode

Post by Radu »

Hi,

By this remark:
but it has no "non-breaking" influence in author mode
you mean that the line of text can still visually wrap at the boundaries of this character, right?
When the character is inserted as an entity reference, in our visual editor it's not really part of the text, we create a separate visual rendering node for it (this is why you can also change the color for it). But this means that Oxygen may also move the separate node on a different line. I'm afraid I do not have a workaround for this.

When it's inserted as a plain character, it becomes part of the entire text and we take care not to treat it as a regular space. Maybe to make it more visible you can use our non-persistent highlighter from an Oxygen plugin to add a highlight over it:

ro.sync.exml.workspace.api.editor.page. ... hlighter()

If you contact us via email (support@oxygenxml.com) we can give you some code to get you started, we built a similar example for someone who wanted to highlight soft hyphens.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
odurand47
Posts: 6
Joined: Tue Feb 04, 2020 10:16 am

Re: &nbsp HTML Entity doesn't work in author mode

Post by odurand47 »

Thank you, problem solved with Persistent highlights.
Post Reply