inInlineContext not working as expected

Post here questions and problems related to oXygen frameworks/document types.
Pascale
Posts: 40
Joined: Wed Jan 29, 2014 4:30 pm

inInlineContext not working as expected

Post by Pascale »

Hi,

Is there a way to configure authorAccess.getDocumentController().inInlineContext(caretOffset) ?
I am asking because it does not work as I expected; it seems to always return true.

I have a custom DTD with the following declaration:

Code: Select all

<!ELEMENT block (label, ( para | list | tablecontainer | graphiccontainer )*)
and an instance

Code: Select all

<block><label>The block label</label><para>First para</para><para>Second para</para></block>
My code is

Code: Select all


final int caretOffset = authorAccess.getEditorAccess().getCaretOffset();
if (authorAccess.getDocumentController().inInlineContext(caretOffset))
{
// insert my inline element
}
else
{
// insert my block element
}
If I place the cursor inside a para element, inInlineContext() returns true; which is correct; but when the cursor is between the 2 para elements, inInlineContext returns also true; which is incorrect.
What am I missing ?

Pascale
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: inInlineContext not working as expected

Post by alex_jitianu »

Hello,

The AuthorDocumentControllerImpl.inInlineContext(int) method works by looking at the CSS styles of the elements around the caret position.

In our tests the method would return false when the caret is positioned between the para elements. It would help if you could post the CSS fragments related to the para, label and block elements (especially the display property).

Best regards,
Alex
Pascale
Posts: 40
Joined: Wed Jan 29, 2014 4:30 pm

Re: inInlineContext not working as expected

Post by Pascale »

I was expecting the application to detect "inline context" based on the DTD, that is everywhere PCDATA content is allowed.
I have now adapted the display property in the CSS and it works as I want.

Could be worthwhile to add a note in the User Manual that "inline context" is related to the display property of your CSS, with a detailed explanation for each possible value.
For example, I understand the use of display:inline versus display:block but what will happen with the more exoctic values like display:flex, display:inline-block, or display:table-cell ?

Pascale
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: inInlineContext not working as expected

Post by alex_jitianu »

Hello,

I will try to describe more clearly the method's behavior in the documentation. To answer your questions, we don't support flex or inline-block and table-cell is treated just like a block.

Best regards,
Alex
Pascale
Posts: 40
Joined: Wed Jan 29, 2014 4:30 pm

Re: inInlineContext not working as expected

Post by Pascale »

Thanks Alex,
I will double check my CSS.

Pascale
Post Reply