Skip to main content
Inspiring
April 7, 2009
Answered

EditManager.applyContainerFormat() bug(?)

  • April 7, 2009
  • 1 reply
  • 937 views

It looks like the changes caused by applying a container format via the EditManager are not persisting but you do see they are applied successfully.

Here are two code snippets that visually result in the same thing, but when using TextFilter.export() after the 1st snippet, you can see verticalAlign is still "inherit" on the TextFlow.

Example 1 - using EditManager:

  var format:TextLayoutFormat = new TextLayoutFormat();
  format.verticalAlign = VerticalAlign.MIDDLE;

  editManager.applyContainerFormat(format, null);

Example 2 - direct manipulation:

  editManager.textFlow.verticalAlign = VerticalAlign.MIDDLE;

  editManager.textFlow.flowManager.updateAllContainers();

The problem is I am using the first approach so that I get undo-able FlowOperations (I'm listening to FLOW_OPERATION_END).

Am I attempting it wrong, or is there a bug with the applyContainerFormat() method?

Thanks,

Richard

This topic has been closed for replies.
Correct answer robin_briggs

The container format is pretty unique. The TextFlow has it, and the controller also has it. The controller inherits from the TextFlow. This enables the controller to override what the TextFlow specifies, which is useful if you have more than one controller. For instance, you may have text that starts in one controller with two columns, and flows into a second container with just one column. When you call the EditManager applyContainerFormat function, it is changing the format on the controller itself, not the one on the TextFlow. To change the TextFlow itself, call EditManager.applyFormatToElement.

- robin

1 reply

robin_briggsCorrect answer
Adobe Employee
April 7, 2009

The container format is pretty unique. The TextFlow has it, and the controller also has it. The controller inherits from the TextFlow. This enables the controller to override what the TextFlow specifies, which is useful if you have more than one controller. For instance, you may have text that starts in one controller with two columns, and flows into a second container with just one column. When you call the EditManager applyContainerFormat function, it is changing the format on the controller itself, not the one on the TextFlow. To change the TextFlow itself, call EditManager.applyFormatToElement.

- robin

Inspiring
April 8, 2009

Thank you Robin, that works perfectly! I guess it's a little confusing having these options that appear to work (visually), but don't actually alter the model as you think they might. The insight provided here is very useful in understanding the relationship between the TLF's MVC triad with regards to undo-able operations.