Giter VIP home page Giter VIP logo

Comments (17)

pbek avatar pbek commented on July 17, 2024

For me the generated ![scribble](media/341084995.png) works just fine. All your points "Expected behaviour" work for me

but in the next line you are trying to replace "file://media" which (as far of my understanding) will never match.

It acts as fallback for the legacy method of linking media files (it was the main method until a few weeks ago).

question link gets inserted but looks like this scribble, shouldn't there be a "file://"?

not any more (since a few weeks)

from scripts.

pbek avatar pbek commented on July 17, 2024

external editor gets opend with full image path as parameter

that didn't work, I just ctrl+clicked the image markdown in the editor

from scripts.

pbek avatar pbek commented on July 17, 2024

var mediaFilePath = mediaFile.replace("file://media", script.currentNoteFolderPath() + "/media");
needs to be updated to just prepend the full path of the current note to make the "opening" work again. It would even better to add an option (checkbox) to do it the way the script currently does it (legacy) and the "new" way (with prepending).

Are you up for the task, @bessw? 💪

from scripts.

bessw avatar bessw commented on July 17, 2024

I'm not shure what parts of the code you want to be switchable to lagacy version.
But I will try to fix it.

from scripts.

pbek avatar pbek commented on July 17, 2024

Sorry, I previously linked the wrong line in the script, this one is correct:

var mediaFilePath = mediaFile.replace("file://media", script.currentNoteFolderPath() + "/media");

The current script works if you enable the "legacy way of inserting links" in the QON settings. In order to be able to open the external application with the correct file the path to the file needs to be generated in a different way.

from scripts.

pbek avatar pbek commented on July 17, 2024

You can do that by using currentNote().fullNoteFilePath or playing with the current note folder and note sub-folder path, but I will add a new property fullNoteFileDirPath for NoteApi to get the absolute directory path of the a note file in the next release.

from scripts.

pbek avatar pbek commented on July 17, 2024

19.10.8

  • there now is a new method getFileURLFromFileName() for NoteApi to get the
    absolute file url from a relative file name
  • there now is a new property fullNoteFileDirPath for NoteApi to get the
    absolute directory path of the a note file

from scripts.

pbek avatar pbek commented on July 17, 2024

There now is a new release, you could use fullNoteFileDirPath now.

from scripts.

pbek avatar pbek commented on July 17, 2024

And don't forget to bump the minAppVersion in https://github.com/qownnotes/scripts/blob/master/scribble/info.json if use are using the new property. 😄

from scripts.

pbek avatar pbek commented on July 17, 2024

If updated the script now. 😄 Does it work for you?

from scripts.

bessw avatar bessw commented on July 17, 2024

I've still got problems with it.

First of all since I'm on Windows I needed to add script.toNativeDirSeparators(mediaFilePath).

But the weird thing is for some reason I needed to replace script.getApplicationSettingsVariable("legacyLinking") with false to test the new behaviour, but when I print script.getApplicationSettingsVariable("legacyLinking") to the console it also returns false 😕

from scripts.

bessw avatar bessw commented on July 17, 2024

script.getApplicationSettingsVariable("legacyLinking") seems to return false as string instead of boolean.

Comparing to "false" would fix this here, or is this a bug of script.getApplicationSettingsVariable("legacyLinking") and you want to fix it there?

from scripts.

pbek avatar pbek commented on July 17, 2024

First of all since I'm on Windows I needed to add script.toNativeDirSeparators(mediaFilePath).

great, just add that

script.getApplicationSettingsVariable("legacyLinking") seems to return false as string instead of boolean.

strange, it worked fine on Linux, getApplicationSettingsVariable will return some kind of QVariant, maybe comparing it to a string would be more safe

do you want to create a pull request with the changes?

from scripts.

bessw avatar bessw commented on July 17, 2024

Yes, wait a sec.

from scripts.

pbek avatar pbek commented on July 17, 2024

I bumped the version for you. Can you please check if the script works for you in the script repository.

from scripts.

bessw avatar bessw commented on July 17, 2024

workes ✔️

from scripts.

pbek avatar pbek commented on July 17, 2024

Great! Thank you

from scripts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.