Skip to content
Permalink
Browse files
Squiggly now only replaces ContainerControllers if they don't impleme…
…nt ISpellingContainerController
  • Loading branch information
Harbs committed Oct 13, 2016
1 parent 98b189d commit e62376ea9d7738ef96ea6abb93e003eda66b4619
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
@@ -0,0 +1,7 @@
package com.adobe.linguistics.spelling
{
public interface ISpellingContainerController
{

}
}
@@ -23,12 +23,12 @@ package com.adobe.linguistics.spelling
import com.adobe.linguistics.spelling.framework.ui.IHighlighter;
import com.adobe.linguistics.spelling.framework.ui.IWordProcessor;
import com.adobe.linguistics.utils.Token;

import flash.events.ContextMenuEvent;
import flash.ui.ContextMenu;
import flash.ui.ContextMenuItem;
import flash.utils.describeType;

import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.TextFlow;
import flashx.textLayout.tlf_internal;
@@ -65,6 +65,9 @@ package com.adobe.linguistics.spelling
for (var idx:int = 0; idx < numControllers; idx++)
{
var containerController:ContainerController = mTextFlow.flowComposer.getControllerAt(idx);
// if it's already squiggly compatible don't replace it.
if(containerController is ISpellingContainerController)
continue;
var squigglyContainerController:SquigglyCustomContainerController = new SquigglyCustomContainerController(containerController.container, mTextHighlighter, mWordProcessor,
mSpellEngine, func, containerController.compositionWidth, containerController.compositionHeight);
copyObject(containerController, squigglyContainerController);
@@ -23,19 +23,19 @@ package com.adobe.linguistics.spelling
import com.adobe.linguistics.spelling.framework.ui.IWordProcessor;
import com.adobe.linguistics.spelling.framework.ui.TLFWordProcessor;
import com.adobe.linguistics.utils.Token;

import flash.display.Sprite;
import flash.events.ContextMenuEvent;
import flash.ui.ContextMenu;
import flash.ui.ContextMenuItem;

import flashx.textLayout.container.ContainerController;
import flashx.textLayout.elements.FlowLeafElement;
import flashx.textLayout.elements.ParagraphElement;
import flashx.textLayout.elements.TextFlow;

/** Custom container controller for populating context menu and hanlding menu item selection */
internal class SquigglyCustomContainerController extends ContainerController
internal class SquigglyCustomContainerController extends ContainerController implements ISpellingContainerController
{
private var disableMenuItem:ContextMenuItem = new ContextMenuItem("Disable spell checking",true);
private var enableMenuItem:ContextMenuItem = new ContextMenuItem("Enable spell checking");

0 comments on commit e62376e

Please sign in to comment.