Skip to main content
Inspiring
Apr 7, 2009 4:28 PM UTC
Answered

EditManager.applyContainerFormat() bug(?)

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 is closed to new replies. Start a new post to keep the conversation going.
robin_briggsCorrect answer
Adobe Employee
Apr 7, 2009 10:58 PM UTC

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

2 replies

robin_briggsCorrect answer
Adobe Employee
Apr 7, 2009 10:58 PM UTC

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

Translate
Inspiring
Apr 8, 2009 9:24 AM UTC

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.

Translate