diff --git a/src/moonshine/editor/text/TextEditor.hx b/src/moonshine/editor/text/TextEditor.hx index 731461a..95bc6fc 100755 --- a/src/moonshine/editor/text/TextEditor.hx +++ b/src/moonshine/editor/text/TextEditor.hx @@ -80,6 +80,7 @@ class TextEditor extends FeathersControl implements IFocusObject implements ISta _selectionMananger = new SelectionManager(this); _colorManager = new ColorManager(this, invalidateVisibleLines); _findReplaceManager = new FindReplaceManager(this); + createContextMenu(); this.text = text; addEventListener(TextEditorChangeEvent.TEXT_CHANGE, textEditor_textChangeHandler); addEventListener(FocusEvent.FOCUS_IN, textEditor_focusInHandler); @@ -1321,6 +1322,23 @@ class TextEditor extends FeathersControl implements IFocusObject implements ISta } } + private function createContextMenu():Void { + #if flash + if (flash.ui.ContextMenu.isSupported) { + var contextMenu = new flash.ui.ContextMenu(); + contextMenu.hideBuiltInItems(); + var clipboardItems = new flash.ui.ContextMenuClipboardItems(); + clipboardItems.clear = true; + clipboardItems.copy = true; + clipboardItems.cut = true; + clipboardItems.paste = true; + contextMenu.clipboardItems = clipboardItems; + contextMenu.clipboardMenu = true; + this.contextMenu = contextMenu; + } + #end + } + private function textEditor_focusInHandler(event:FocusEvent):Void { if (stage != null && stage.focus != _listView) { event.stopImmediatePropagation();