How to use the clipboard.get function in clipboard

To help you get started, we’ve selected a few clipboard examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ongaeshi / firelink / tests / test-commands.js View on Github external
exports.test_commands = function(test) {
  test.pass("Test Commands .....");

  // 先頭に戻す
  commands.setLinkFormIndex(0);

  // 前回の値でリンク生成
  commands.redoLink("redo test", {text: "TEXT", title: "TITLE", url: "http://www.example.jp"});
  test.assertEqual("TEXT\nhttp://www.example.jp", clipboard.get());

  // 全てのタブをリンク
  commands.allTabs("DUMMY", "%text%\\n%url%");
  test.assertEqual("\nabout:blank\n", clipboard.get());
  
  commands.allTabsSpace("DUMMY", "%text%\\n%url%");
  test.assertEqual("\nabout:blank\n\n", clipboard.get());

  // リンク種類を直接設定
  commands.setLinkFormIndex(0);
  test.assertEqual(0, fl.currentIndex());
  commands.setLinkFormIndex(1);
  test.assertEqual(1, fl.currentIndex());
  commands.setLinkFormIndex(2);
  test.assertEqual(2, fl.currentIndex());
  commands.setLinkFormIndex(3);
  test.assertEqual(3, fl.currentIndex());
  commands.setLinkFormIndex(500);
  test.assertEqual(3, fl.currentIndex());

  // Export
  commands.exportFromClipboard();
  // let text =
github ongaeshi / firelink / tests / test-firelink_lib.js View on Github external
function test_copyLinkAndNotify(test) {
  let linkdata = {text: "YAAOO!! JIPAN", title: "YAAOO!! JIPAN", url: "http://www.example.jp"};
  
  fl.copyLinkAndNotify("DUMMY", "%text%\\n%url%", linkdata);
  test.assertEqual("YAAOO!! JIPAN\nhttp://www.example.jp", clipboard.get());

  fl.copyLinkAndNotify("DUMMY2", "<a href="\&quot;%url%\&quot;">%text%</a>", linkdata);
  test.assertEqual("<a href="\&quot;http://www.example.jp\&quot;">YAAOO!! JIPAN</a>", clipboard.get());
}
github ongaeshi / firelink / tests / test-menu_lib.js View on Github external
let item = {
    label: "test-menu_lib"
  };

  let action = {
    linkform: "[[%text%|%url%]]",
    item: item
  };

  let linkdata = {text: "TEXT",
                  title: "TITLE",
                  url: "http://www.example.jp"};
  
  MenuLib.redoLink(action, linkdata);
  test.assertEqual("[[TEXT|http://www.example.jp]]", clipboard.get());
  
  MenuLib.changeLinkform(action, linkdata);
  test.assertEqual("[[TEXT|http://www.example.jp]]", clipboard.get());
  
  MenuLib.copyTabs(action, linkdata);
};