5353import org .labkey .test .util .EscapeUtil ;
5454import org .labkey .test .util .Ext4Helper ;
5555import org .labkey .test .util .ExtHelper ;
56+ import org .labkey .test .util .HtmlFragmentSelection ;
5657import org .labkey .test .util .LabKeyExpectedConditions ;
5758import org .labkey .test .util .LogMethod ;
5859import org .labkey .test .util .LoggedParam ;
@@ -3503,14 +3504,14 @@ public void actionClear(WebElement input)
35033504 }
35043505
35053506 /**
3506- * puts the specified text into the clipboard, then pastes it into the specified element,
3507+ * puts the specified text and html into the clipboard, then pastes it into the specified element,
35073508 * or whatever has focus at the moment.
35083509 */
3509- public void actionPaste (WebElement input , String text )
3510+ public void actionPaste (WebElement input , String text , boolean isHtml )
35103511 {
35113512 Keys cmdKey = WebDriverUtils .MODIFIER_KEY ;
35123513
3513- setClipboardContent (text );
3514+ setClipboardContent (text , isHtml );
35143515
35153516 if (input == null )
35163517 {
@@ -3531,16 +3532,40 @@ public void actionPaste(WebElement input, String text)
35313532 }
35323533 }
35333534
3535+ /**
3536+ * puts the specified text into the clipboard, then pastes it into the specified element,
3537+ * or whatever has focus at the moment.
3538+ */
3539+ public void actionPaste (WebElement input , String text )
3540+ {
3541+ actionPaste (input , text , false );
3542+ }
3543+
35343544 public void clearClipboardContent ()
35353545 {
35363546 setClipboardContent (" " );
35373547 }
35383548
3539- protected void setClipboardContent (String text )
3549+ protected void setClipboardContent (String text , boolean isHtml )
35403550 {
35413551 Clipboard c = Toolkit .getDefaultToolkit ().getSystemClipboard ();
3542- StringSelection sel = new StringSelection (text );
3543- c .setContents (sel , sel );
3552+ Transferable sel ;
3553+
3554+ if (isHtml )
3555+ {
3556+ sel = new HtmlFragmentSelection (text );
3557+ }
3558+ else
3559+ {
3560+ sel = new StringSelection (text );
3561+ }
3562+
3563+ c .setContents (sel , null );
3564+ }
3565+
3566+ protected void setClipboardContent (String text )
3567+ {
3568+ setClipboardContent (text , false );
35443569 }
35453570
35463571 public String getClipboardContent () throws IOException , UnsupportedFlavorException
0 commit comments