File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -129,10 +129,20 @@ export default {
129129 }
130130 // Fit the terminal width to the div container size after terminal is created.
131131 this .updateTerminalSize ();
132+
133+ // Add paste event listener
134+ this .terminal .textarea .addEventListener (" paste" , (event ) => {
135+ const textToPaste = event .clipboardData .getData (" text" ).replace (/ \n + $ / , " " );
136+ this .cursorPosition += textToPaste .length ;
137+ this .terminalInputBuffer += textToPaste;
138+ console .debug (" Paste text: " + textToPaste);
139+ this .terminal .write (textToPaste);
140+ });
132141 },
133142
134143 unmounted () {
135144 window .removeEventListener (" resize" , this .onResizeEvent ); // Remove the resize event listener from the window object.
145+ window .removeEventListener (" paste" , this .onResizeEvent ); // Remove the paste event listener from the window object.
136146 this .$root .unbindTerminal (this .name );
137147 this .terminal .dispose ();
138148 },
You can’t perform that action at this time.
0 commit comments