これは私の最初の質問です。だから.. これを下手に聞いたらごめんなさい。
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 は、実行するたびに色を切り替えません。元に戻す やり直しは引き続き機能します。
どんな助けでも大歓迎です、ありがとう:)