@@ -2,6 +2,7 @@ package funkin.ui.haxeui.components.editors.timeline;
22
33#if FEATURE_CAMERA_EDITOR
44import funkin .ui .haxeui .components .IconButton ;
5+ import funkin .util .ClipboardUtil ;
56import haxe .ui .components .TextField ;
67import haxe .ui .containers .Box ;
78import haxe .ui .containers .HBox ;
@@ -41,6 +42,14 @@ class TimelineLayerPanel extends VBox
4142 var _editingLayer : TimelineLayerData = null ;
4243 var _editingHandles : LayerRowHandles = null ;
4344 var _screenMouseDownBound : MouseEvent -> Void ;
45+ var _savedClipboard : Null <String > = null ;
46+
47+ public var isEditing (get , never ): Bool ;
48+
49+ function get_isEditing (): Bool
50+ {
51+ return _editingLayer != null ;
52+ }
4453
4554 public function setScrollOffset (offsetPx : Float ): Void
4655 {
@@ -77,6 +86,24 @@ class TimelineLayerPanel extends VBox
7786 _editingHandles .cancelling = false ;
7887 _editingHandles = null ;
7988 _editingLayer = null ;
89+ _restoreSavedClipboard ();
90+ }
91+
92+ function _stashClipboardIfSongData (): Void
93+ {
94+ var clip : String = ClipboardUtil .getClipboard ();
95+ if (clip != null && _looksLikeSongClipboard (clip ))
96+ {
97+ _savedClipboard = clip ;
98+ ClipboardUtil .setClipboard (' ' );
99+ }
100+ }
101+
102+ function _restoreSavedClipboard (): Void
103+ {
104+ if (_savedClipboard == null ) return ;
105+ if (ClipboardUtil .getClipboard () == ' ' ) ClipboardUtil .setClipboard (_savedClipboard );
106+ _savedClipboard = null ;
80107 }
81108
82109 public function insertLayerRow (layer : TimelineLayerData , index : Int ): Void
@@ -221,6 +248,8 @@ class TimelineLayerPanel extends VBox
221248 handles .field .disabled = false ;
222249 handles .field .focus = true ;
223250
251+ _stashClipboardIfSongData ();
252+
224253 _screenMouseDownBound = _onScreenMouseDown ;
225254 Screen .instance .registerEvent (MouseEvent .MOUSE_DOWN , _screenMouseDownBound );
226255 }
@@ -309,6 +338,7 @@ class TimelineLayerPanel extends VBox
309338 handles .editOriginal = null ;
310339 _editingLayer = null ;
311340 _editingHandles = null ;
341+ _restoreSavedClipboard ();
312342
313343 if (handles .cancelling )
314344 {
@@ -342,6 +372,14 @@ class TimelineLayerPanel extends VBox
342372 ev .bubble = true ;
343373 dispatch (ev );
344374 }
375+
376+ static function _looksLikeSongClipboard (text : String ): Bool
377+ {
378+ var trimmed : String = StringTools .trim (text );
379+ return trimmed .length > 0
380+ && trimmed .charAt (0 ) == ' {'
381+ && (trimmed .indexOf (' "events"' ) != - 1 || trimmed .indexOf (' "notes"' ) != - 1 );
382+ }
345383}
346384
347385@:dox (hide ) @:noCompletion
0 commit comments