Skip to content

Commit

Permalink
TextEditor: Feathers UI 1.2 compatibility fix for updateAt() and upda…
Browse files Browse the repository at this point in the history
…teAll()
  • Loading branch information
joshtynjala committed Jul 24, 2023
1 parent aab4c05 commit a5f042d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/moonshine/editor/text/TextEditor.hx
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,15 @@ class TextEditor extends FeathersControl implements IFocusObject implements ISta
if (_lines != null) {
_lines.removeEventListener(FlatCollectionEvent.ADD_ITEM, textEditor_lines_addItemHandler);
_lines.removeEventListener(FlatCollectionEvent.REMOVE_ITEM, textEditor_lines_removeItemHandler);
_lines.removeEventListener(FlatCollectionEvent.UPDATE_ITEM, textEditor_lines_updateItemHandler);
_lines.removeEventListener(FlatCollectionEvent.UPDATE_ALL, textEditor_lines_updateAllHandler);
_lines.removeEventListener(Event.CHANGE, textEditor_lines_changeHandler);
}
_lines = new ArrayCollection(lineModels);
_lines.addEventListener(FlatCollectionEvent.ADD_ITEM, textEditor_lines_addItemHandler);
_lines.addEventListener(FlatCollectionEvent.REMOVE_ITEM, textEditor_lines_removeItemHandler);
_lines.addEventListener(FlatCollectionEvent.UPDATE_ITEM, textEditor_lines_updateItemHandler);
_lines.addEventListener(FlatCollectionEvent.UPDATE_ALL, textEditor_lines_updateAllHandler);
_lines.addEventListener(Event.CHANGE, textEditor_lines_changeHandler);

_colorManager.reset();
Expand Down Expand Up @@ -1885,6 +1889,22 @@ class TextEditor extends FeathersControl implements IFocusObject implements ISta
dispatchEvent(new TextEditorLineEvent(TextEditorLineEvent.TOGGLE_BREAKPOINT, breakpoint));
}
}

private function textEditor_lines_updateItemHandler(event:FlatCollectionEvent):Void {
#if (feathersui >= "1.2.0")
// ensure that validateNow() can be called to force internal ListView
// to validate too
setInvalid(DATA);
#end
}

private function textEditor_lines_updateAllHandler(event:FlatCollectionEvent):Void {
#if (feathersui >= "1.2.0")
// ensure that validateNow() can be called to force internal ListView
// to validate too
setInvalid(DATA);
#end
}
}

private class TextEditorListView extends ListView {
Expand Down

0 comments on commit a5f042d

Please sign in to comment.