Merge branch 'develop' into 8.1.0-Dev

This commit is contained in:
Josh Tynjala
2023-06-09 11:12:43 -07:00

View File

@@ -20,6 +20,7 @@ class Clipboard
public static var onUpdate = new Event<Void->Void>(); public static var onUpdate = new Event<Void->Void>();
public static var text(get, set):String; public static var text(get, set):String;
private static var _text:String; private static var _text:String;
@:noCompletion private static var __updated = false;
private static function __update():Void private static function __update():Void
{ {
@@ -42,6 +43,7 @@ class Clipboard
_text = FlashClipboard.generalClipboard.getData(TEXT_FORMAT); _text = FlashClipboard.generalClipboard.getData(TEXT_FORMAT);
} }
#end #end
__updated = true;
if (_text != cacheText) if (_text != cacheText)
{ {
@@ -68,6 +70,14 @@ class Clipboard
// formatting will unavoidably be lost.) // formatting will unavoidably be lost.)
set_text(_text); set_text(_text);
} }
#elseif (windows || mac)
if (!__updated)
{
// Lime listens for clipboard updates automatically, but if the
// clipboard has never been updated since before the app started,
// we need to populate the initial contents manually
__update();
}
#end #end
return _text; return _text;