diff --git a/CHANGELOG.md b/CHANGELOG.md index c37f113..dbcba85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changes +## [1.3.1] + +Fixed compat with 2023.2 + ## [1.3.0] Fixed NPE when using 2023.1 diff --git a/gradle.properties b/gradle.properties index 8fe9c9e..eef91eb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -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 diff --git a/src/main/java/img2md/ImageUtils.java b/src/main/java/img2md/ImageUtils.java index 70d2ecd..857b6ae 100644 --- a/src/main/java/img2md/ImageUtils.java +++ b/src/main/java/img2md/ImageUtils.java @@ -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 files = (List) 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]); } @@ -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(); diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index 205f5f8..1f530a2 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -1,7 +1,7 @@ com.github.holgerbrandl.pasteimages/ Paste Images into Markdown - 1.3.0 + 1.3.1 Holger Brandl