How to use the ssb-ref.extract function in ssb-ref

To help you get started, we’ve selected a few ssb-ref 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 mmckegg / patchwork-next / lib / context-menu-and-spellcheck.js View on Github external
contextMenuBuilder.buildMenuForLink = function (menuInfo) {
  var menu = new Menu()
  var isEmailAddress = menuInfo.linkURL.startsWith('mailto:')
  var isFile = menuInfo.linkURL.startsWith('file:')
  var extractedRef = ref.extract(menuInfo.linkURL)

  if (!isFile) {
    var copyLink = new MenuItem({
      label: isEmailAddress ? this.stringTable.copyMail() : this.stringTable.copyLinkUrl(),
      click: () => {
        // Omit the mailto: portion of the link; we just want the address
        clipboard.writeText(isEmailAddress ? menuInfo.linkText : menuInfo.linkURL)
      }
    })

    var openLink = new MenuItem({
      label: this.stringTable.openLinkUrl(),
      click: () => {
        shell.openExternal(menuInfo.linkURL)
      }
    })
github soapdog / patchfox / src / patchpatchcore / message / html / markdown.js View on Github external
element.querySelectorAll("img").forEach(img => {
            var id = ref.extract(img.src);
            if (id) {
                releases.push(watch(hasBlob(id), has => {
                    if (has === false) {
                        img.classList.add("-pending");
                    } else {
                        img.classList.remove("-pending");
                    }
                }));
            }
        });
        return function () {