Skip to content

Commit

Permalink
feat: optional skip image extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
8bitgentleman committed Jul 15, 2023
1 parent 1060154 commit 58cba04
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Binary file modified .DS_Store
Binary file not shown.
11 changes: 8 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const panelConfig = {
name: "Image Location",
description: "If there are images attached to a tweet where should they be added",
action: {type: "select",
items: ["child block", "inline"],
items: ["child block", "inline", "skip images"],
}}
]
};
Expand Down Expand Up @@ -186,7 +186,7 @@ async function extractTweet(uid, tweet, template, imageLocation){
}


console.log("DATA HERE", tweetData)
// console.log("DATA HERE", tweetData)

// extract tweet info
let tweetText = tweetData.text;
Expand Down Expand Up @@ -223,6 +223,9 @@ async function extractTweet(uid, tweet, template, imageLocation){
}
// get all of the images and place them inline
parsedTweet = parsedTweet.replaceAll('{IMAGES}',parsedImages);
} else if (imageLocation=='skip images') {
// mostly do nothing
parsedTweet = parsedTweet.replaceAll('{IMAGES}',"");
} else {
// if inserting images as children removed unneeded template item
parsedTweet = parsedTweet.replaceAll('{IMAGES}',"");
Expand All @@ -243,7 +246,9 @@ async function extractTweet(uid, tweet, template, imageLocation){
}
}
}

} else {
// no images in the tweet so get rid of the variable
parsedTweet = parsedTweet.replaceAll('{IMAGES}',"");
}
window.roamAlphaAPI.updateBlock({"block":
{"uid": uid,
Expand Down

0 comments on commit 58cba04

Please sign in to comment.