이것은 여기에 대한 첫 번째 질문입니다. 그래서 .. 내가 이걸 잘 안하면 사과드립니다.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는 우리가 실행할 때마다 색상을 전환하지 않습니다. 실행 취소 다시 실행은 여전히 작동합니다.
어떤 도움도 대단히 감사하겠습니다, 감사합니다 :)