2012-08-04 10 views
0

이것은 여기에 대한 첫 번째 질문입니다. 그래서 .. 내가 이걸 잘 안하면 사과드립니다.Flex ApplyFormatOperation은 Spark TextArea에서 실행 취소/다시 실행을 중단합니다.

spark TextArea를 확장하는 구문 강조 텍스트 편집기를 작성했습니다. 강조 표시는 다양한 텍스트 섹션에 ApplyFormatOperations를 적용하여 작동합니다. 그러나 형식 작업을 적용하자마자 실행 취소/다시 실행 기능이 모두 손실됩니다. 나는 채색을 끄고 다시 실행 취소하면 다시 돌아옵니다.

다음은 실행 취소/다시 실행을 삭제하는 작업을 단순화 한 버전입니다. 문자를 입력 할 때마다이 동작이 시작된다고 상상해보십시오.

//select everything 
var operationState:SelectionState = new SelectionState(textFlow, 0, text.length); 
//make an example format. 
var exampleFormat:TextLayoutFormat = new TextLayoutFormat(); 
//everytime we run change the color of all the the text. 
m_undoTest = !m_undoTest; 
if (m_undoTest) { 
    exampleFormat.color = "#0839ff"; //make all text bluish. 
} else { 
    exampleFormat.color = "#ff0839"; //make all text redish. 
} 
//make an operation to apply my formatting.  
var formatOperation:ApplyFormatOperation = new ApplyFormatOperation(operationState,   exampleFormat, null); 
//apply the operation to the text area. 
formatOperation.doOperation(); 

이제는 입력 할 때 텍스트가 빨간색에서 파란색으로 전환되어 더 이상 실행 취소 할 수 없습니다. 흥미롭게도 동일한 단계를 수행하지만 새 형식의 속성은 변경하지 마십시오. IE는 우리가 실행할 때마다 색상을 전환하지 않습니다. 실행 취소 다시 실행은 여전히 ​​작동합니다.

어떤 도움도 대단히 감사하겠습니다, 감사합니다 :)

답변

0

은 음 ... 난 더 이상 실행 취소 다시 실행 내역을 잃지은 "editManager"클래스를 통해 내 모든 작업을 파이프하여, 이것에 더 얻었다. 하지만 ... 색칠 작업은 이제 되돌릴 수없는 행동으로 간주됩니다 ... 당신이 상상할 수있는 이상적인 것이 아닙니다. 이제는 실제 구문과 섞어서 구문 강조 표시를 모두 제거했습니다. 아직도 그 문제를 해결하는 방법을 찾으려고 노력 중입니다.

var editManager:IEditManager = textFlow.interactionManager as IEditManager; 
//make an operation to apply my formatting.  
var formatOperation:ApplyFormatOperation = new ApplyFormatOperation(operationState,   exampleFormat, null); 
//apply the operation to the text area. 
editManager.doOperation(formatOperation); 
:

현재 구현의 JIST이있다

관련 문제