• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Return on an empty list causes/converts the paragraph to become not a list event

Guest
Aug 11, 2011 Aug 11, 2011

Copy link to clipboard

Copied

Hi,

I noticed that if I press the return key while I am on the last item of a list which happens to be empty, that last empty list item becomes a regular paragraph (no longer part of the list), instead of leaving that list item as blank and adding another new empty list item. This is a bit surprising, as I had expected it to make another empty list item if I hit the return key.

So, is this intentional/as designed? If so, how does a user make a bunch of empty list items? Also, how do I detect the event of going from an empty list item to a regular paragraph? We implement different styles for list items versus non-lists, so when a paragraph gets converted from a list paragraph to a non-list paragraph, we'll need to do some updates.

Tank you for the info.

Will

TOPICS
Text layout framework

Views

906

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Employee , Aug 15, 2011 Aug 15, 2011

You are right. It is a synchronous process. Only after COMPOSITION_COMPLETE event handler ends, the composing process can end. And only one composing process happens at the same time.

So, I think FlowOperationEvent.FLOW_OPERATION_COMPLETE can help you in such a scenario. FLOW_OPERATION_COMPLETE cannot cover all the changes of the structure and formats of textflow, but it can be triggered when you press enter key. I think it can meet your requirement.

Votes

Translate

Translate
Adobe Employee ,
Aug 11, 2011 Aug 11, 2011

Copy link to clipboard

Copied

So, is this intentional/as designed?

Yes, it's as designed.

If so, how does a user make a bunch of empty list items?

If not so, users cannot jump out of the list when the list is at the end and there is no line after the list, right? Now, users can make empty list items before the last line of the list as they want.

Also, how do I detect the event of going from an empty list item to a regular paragraph? We implement different styles for list items versus non-lists, so when a paragraph gets converted from a list paragraph to a non-list paragraph, we'll need to do some updates.

listen to CompositionCompleteEvent.COMPOSITION_COMPLETE. Find out if the parent of paragraph is a ListItemElement.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 12, 2011 Aug 12, 2011

Copy link to clipboard

Copied

Thank you for the reply and the information. As I mentioned before, if a paragraph changes from being in a list to not being in a list, I would need to do styling update (i.e. change the paragraph style). In COMPOSITION_COMPLETE, I am able to detect the situation of going from list to non-list; however, it's not clear how I can set a new style on the paragraph element and have it applied. My understanding is that I am not able to call compose or update of controllers while in this handler. I tried just marking the paragraph as damaged, but that doesn't seem to work, as later on some of the TextLines are null and interaction manager crashes on clicks. Is there a way for me to set a new paragraph style in this handler?

Will

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 14, 2011 Aug 14, 2011

Copy link to clipboard

Copied

If you set format to textflow or any elements of textflow, the new format will show up only after a recompose. Calling updateAllController() or damage() is the same in your case, because the point is to trigger a recompse. After the recompose, it will always dispatch CompositionCompleteEvent. You may want to make the recompose happen only once, when a paragraph changes from being in a list to not being in a list, to avoid the endless loop. The condition judgment in the CompositionCompleteHandler is the key point.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 15, 2011 Aug 15, 2011

Copy link to clipboard

Copied

But, if I am detecting a paragraph going from list to a non-list inside the composition complete handler, isn't it the case that I can't call another recompose, damage, or update all controllers from within this handler? I tried this, and the text flow doesn't recompose the damaged portion, and error occurs on future interactions.

So, if I am detecting a paragraph being changed from list to a non-list inside composition complete handler, and I change the styling values within this handler, how can I cause another recompose to make sure the updated styling is applied and the text flow is recomposed correctly?

Thank you for the help. I really appreciate it.

Will

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Aug 15, 2011 Aug 15, 2011

Copy link to clipboard

Copied

LATEST

You are right. It is a synchronous process. Only after COMPOSITION_COMPLETE event handler ends, the composing process can end. And only one composing process happens at the same time.

So, I think FlowOperationEvent.FLOW_OPERATION_COMPLETE can help you in such a scenario. FLOW_OPERATION_COMPLETE cannot cover all the changes of the structure and formats of textflow, but it can be triggered when you press enter key. I think it can meet your requirement.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines