diff --git a/README.md b/README.md
index 298bdc3..aea7352 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,30 @@
# logseq-plugin-image-uploader
+
+
+
+
+
# Usage
+## How to use it?
+
+Currently, we only support [PicGo](https://github.com/Molunerfinn/PicGo), so please open PicGo manually.
+
+By default, when you paste any content into a block, after exit editing that block, the plugin will check whether its content contains any images, if it does, the plugin will upload them and replace them with remote URLs. You can turn off this feature in the configuration file.
+
+![example_usage](./example_usage_auto.gif)
+
+Alternatively, if you have inserted any images before, you can right-click any block's dot to show its context menu, and select `Upload image`. All images detected in that block will be uploaded, and replaced with remote URLs.
+
+![example_usage](./example_usage.gif)
+
+### Note
+
+Since we don't have any permission to operate the file system in a logseq plugin, we can't delete the original file saved by logseq. So we create a page named **"Uploaded image file record(created by logseq-plugin-image-uploader)"** to save all the images we uploaded. You can delete them manually. (One image path actually can appear more than once on that page, for example, you use that image many times, and you upload them more than once)
+
+We may provide a script to delete those images in the future.
+
## Installation
- Download the latest [release](https://github.com/JJAYCHEN1e/logseq-plugin-image-uploader/releases) of the plugin.
@@ -15,33 +38,16 @@
## Configuration
-Currently, we only support turning off auto uploading feature in the configuration file.
+Currently, we only support **turning off auto uploading** feature and **allow uploading network images** feature in the configuration file. Note that at present, only network images using Markdown syntax will be uploaded, although the picture link will also be correctly displayed by Logseq.
```json
{
"disabled": false,
- "autoUploading": true
+ "autoUploading": true,
+ "uploadNetworkImage": false,
}
```
-## How to use it?
-
-Currently, we only support [PicGo](https://github.com/Molunerfinn/PicGo), so please open PicGo manually.
-
-By default, when you paste any content into a block, after exit editing that block, the plugin will check whether its content contains any images, if it does, the plugin will upload them and replace them with remote URLs. You can turn off this feature in the configuration file.
-
-![example_usage](./example_usage_auto.gif)
-
-Alternatively, if you have inserted any images before, you can right-click any block's dot to show its context menu, and select `Upload image`. All images detected in that block will be uploaded, and replaced with remote URLs.
-
-![example_usage](./example_usage.gif)
-
-### Note
-
-Since we don't have any permission to operate the file system in a logseq plugin, we can't delete the original file saved by logseq. So we create a page named **"Uploaded image file record(created by logseq-plugin-image-uploader)"** to save all the images we uploaded. You can delete them manually. (One image path actually can appear more than once on that page, for example, you use that image many times, and you upload them more than once)
-
-We may provide a script to delete those images in the future.
-
# Development
Logseq plugins API: https://logseq.github.io/plugins/
diff --git a/package.json b/package.json
index 4c74243..e3a183b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "logseq-plugin-image-uploader",
- "version": "0.0.4",
+ "version": "0.0.5",
"main": "dist/index.html",
"scripts": {
"dev": "vite",
diff --git a/src/ImageUploadUtils.ts b/src/ImageUploadUtils.ts
index 07b6cfb..6df452b 100644
--- a/src/ImageUploadUtils.ts
+++ b/src/ImageUploadUtils.ts
@@ -27,7 +27,8 @@ export async function checkAndUploadBlock(srcBlock: BlockEntity, graphPath: stri
let match;
while ((match = /\!\[.*?\]\((.*?)\)/g.exec(content))) {
const imageURLText = match[1];
- if (imageURLText.startsWith("../")) {
+ let uploadNetworkImage = logseq.settings?.uploadNetworkImage ?? false;
+ if (imageURLText.startsWith("../") || uploadNetworkImage) {
// Ensure this is a local image.
const imageURLLocal = graphPath + match[1].replace("..", "");
const imageURLRemote = await uploadImage(imageURLLocal);