diff --git a/main.ts b/main.ts index 9140727..a83006f 100644 --- a/main.ts +++ b/main.ts @@ -258,10 +258,15 @@ export default class MouseWheelZoomPlugin extends Plugin { // If after the imageName in filetext follows a "|" then it means that the image is already zoomed const imageNamePosition = fileText.indexOf(imageName); + const stringAfterFileName = fileText.substring(imageNamePosition + imageName.length) // Handle the case where behind the imageName there are more attributes like |ctr for ITS Theme by attaching them to the imageName - const regExpMatchArray = fileText.substring(imageNamePosition + imageName.length).match(/^((\\?\|[a-zA-Z]+)+)/); + const regExpMatchArray = stringAfterFileName.match(/([^\]]*?)\\?\|\d+]]|([^\]]*?)]]|/); if (regExpMatchArray) { - imageName += regExpMatchArray[1]; + if (!!regExpMatchArray[1]) { + imageName += regExpMatchArray[1] + } else if (!!regExpMatchArray[2]) { + imageName += regExpMatchArray[2] + } } const sizeMatchRegExp = new RegExp(`${escapeRegex(imageName)}${regexSeparator}(\\d+)`); diff --git a/manifest.json b/manifest.json index e781b6a..62fbef5 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "mousewheel-image-zoom", "name": "Mousewheel Image zoom", - "version": "1.0.12", + "version": "1.0.13", "minAppVersion": "0.9.12", "description": "This plugin enables you to increase/decrease the size of an image by scrolling", "author": "Nico Jeske", diff --git a/package.json b/package.json index 483fc36..06c2322 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mousewheel-image-zoom", - "version": "1.0.9", + "version": "1.0.13", "description": "This plugin enables you to increase/decrease the size of an image by scrolling", "main": "main.js", "scripts": {