Skip to content

Commit

Permalink
Merge branch 'master' of github.com:telesoho/vscode-markdown-paste-image
Browse files Browse the repository at this point in the history
  • Loading branch information
telesoho committed Nov 16, 2022
2 parents 344fc91 + 2585ad1 commit 8d7f659
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Change Log

## 0.19.1 (November 16, 2022)
## 0.19.2 (November 16, 2022)

- Fix #90: allow passing width only

## 0.19.1 (May 28, 2022)

- Fixed paste as base64 not work on Windows. #86

## 0.19.0 (April 8, 2022)

- Added macOS get clipboard content type script. #84
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-markdown-paste-image",
"displayName": "Markdown Paste",
"description": "A smartly paste for markdown.",
"version": "0.19.1",
"version": "0.19.2",
"publisher": "telesoho",
"author": {
"name": "telesoho",
Expand Down
4 changes: 3 additions & 1 deletion src/paster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { spawn } from "child_process";
import * as moment from "moment";
import * as vscode from "vscode";
import { toMarkdown } from "./toMarkdown";

import {
prepareDirForFile,
fetchAndSaveFile,
Expand Down Expand Up @@ -270,7 +271,8 @@ class Paster {

let inputUri = vscode.Uri.parse(inputVal);

if (inputUri.fsPath.slice(inputUri.fsPath.length - 1) == "/") {
const last_char = inputUri.fsPath.slice(inputUri.fsPath.length - 1);
if (["/", "\\"].includes(last_char)) {
// While filename is empty(ex: /abc/?200,20), paste clipboard to a temporay file, then convert it to base64 image to markdown.
pasteImgContext.targetFile = newTemporaryFilename();
pasteImgContext.convertToBase64 = true;
Expand Down
5 changes: 5 additions & 0 deletions test/suite/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ suite("Extension Tests", () => {
paster.Paster.encodePath(targetFile.fsPath),
"w:/Source%20Markdown/Build%20Ours%20Blog/images/test.gif"
);

ret = paster.Paster.parsePasteImageContext(
"d:/Source Markdown/Build Ours Blog/images/"
);
assert.strictEqual(ret.convertToBase64, true);
});
test("getDimensionProps test", () => {
let ret = paster.Paster.getDimensionProps(undefined, 200);
Expand Down

0 comments on commit 8d7f659

Please sign in to comment.