Skip to content

Commit

Permalink
updated compat to v2023.3
Browse files Browse the repository at this point in the history
  • Loading branch information
brandl committed Nov 15, 2023
1 parent 90f1dc3 commit 9ab9995
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

## [1.3.1]

Fixed compat with 2023.2

## [1.3.0]

Fixed NPE when using 2023.1
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
pluginGroup = org.jetbrains.plugins.template
pluginName = PasteImages
pluginRepositoryUrl = https://github.com/holgerbrandl/pasteimages
pluginVersion = 1.3.0
pluginVersion = 1.3.1

# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
pluginSinceBuild = 231
pluginUntilBuild = 231.*
pluginUntilBuild = 232.*

# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension
platformType = IC
platformVersion = 2023.1.2
platformVersion = 2023.2.4

# Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html
# Example: platformPlugins = com.intellij.java, com.jetbrains.php:203.4449.22
Expand Down
15 changes: 8 additions & 7 deletions src/main/java/img2md/ImageUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,16 @@ public static ImageWithInfo getImageFromClipboard(final Transferable transferabl
return null;
}

if (transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) {
// String string = (String) transferable.getTransferData(DataFlavor.stringFlavor);
// @TODO: Check the string is a URL?
return null;
}

if (transferable.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
@SuppressWarnings("unchecked")
List<File> files = (List<File>) transferable.getTransferData(DataFlavor.javaFileListFlavor);
if (files.size() > 0) {
if (!files.isEmpty()) {
File file = files.get(0);
return new ImageWithInfo(ImageIO.read(file), file.getName().split("\\.")[0]);
}
Expand All @@ -41,12 +48,6 @@ public static ImageWithInfo getImageFromClipboard(final Transferable transferabl
return new ImageWithInfo((Image) transferable.getTransferData(DataFlavor.imageFlavor), null);
}

if (transferable.isDataFlavorSupported(DataFlavor.stringFlavor)) {
String string = (String)transferable.getTransferData(DataFlavor.stringFlavor);
// @TODO: Check the string is a URL?
return null;
}

return null;
} catch (UnsupportedFlavorException e) {
e.printStackTrace();
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<idea-plugin>
<id>com.github.holgerbrandl.pasteimages/</id>
<name>Paste Images into Markdown</name>
<version>1.3.0</version>
<version>1.3.1</version>
<vendor email="[email protected]" url="https://github.com/holgerbrandl/pasteimages"/>
<vendor>Holger Brandl</vendor>

Expand Down

0 comments on commit 9ab9995

Please sign in to comment.