Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outline style supported (I tried but failed) #11

Open
yoghurtdewdew opened this issue Jun 23, 2023 · 10 comments
Open

Outline style supported (I tried but failed) #11

yoghurtdewdew opened this issue Jun 23, 2023 · 10 comments

Comments

@yoghurtdewdew
Copy link

This plugin is great, but I don't use DayOne frequently. I'm wondering if it's possible to better connect it to Logseq.
Due to not wanting to directly modify the source file, I copied several JS files for modification. The process is as follows, but I encountered an error. Would it be convient to ask for your advice? - and spaces are used to create an outline style and indentations for the output content.

As you can see, default is like:
image
image

That what I'm trying to do, need your help!
image
image
image
image
image
image

@ksalzke
Copy link
Owner

ksalzke commented Jun 24, 2023

Hi! I'm happy to try to help but I don't think I have enough info. I think you might possibly have an issue with the file structure, rather than the changes to the code that you have made. Are you using the regular 'Copy To Clipboard' action (or the other actions) at all? If not, I would suggest that directly making the changes to completedReportLib that you have made should work just fine.

@yoghurtdewdew
Copy link
Author

  • Hello! The default actions of sending to DayOne and Drafts, as well as the 'Copy To Clipboard' action, can work properly at first.
    My requirements may be a bit excessive. I hope to adjust the format without affecting the original format of sending to DayOne and Drafts, so that I can place the report in multiple places, both in a comfortable layout in DayOne/Drafts, also in Logseq in opml format. So, I still really want to know how I can make the above modifications and error prompts work properly?
  • **folder**- **folder**_project_ - _project_,tasks I used -,and the spaces are for recognizing indentation.
  • In addition, I did directly modify the completedReportLib file after the failure, modifying lines 180 and 201. It was indeed possible to paste it as I wanted through the 'Copy To Clipboard' action after the modifying. But today I found out that no function of the plugin is functioning properly.

actions of sending to DayOne and Drafts, as well as the 'Copy To Clipboard' actions shows:

TypeError: null is not an object (evaluating 'completedReportLib
.functionLibrary()
.adjustDateByDays') /Users/yoghurtlu/Library/Mobile Documents/iCloud~com~omnigroup~OmniFocus/Documents/Plug-Ins/CompletedTaskReport.omnifocusjs/Resources/completedReportLib.js:250:25
image

actions of 'Copy To Clipboard 4 Logseq' action shows (still the same as last time):

TypeError: undefined is not an object (evaluating 'lib.promptAndRunReport') /Users/yoghurtlu/Library/Mobile Documents/iCloud~com~omnigroup~OmniFocus/Documents/Plug-Ins/CompletedTaskReport.omnifocusjs/Resources/copyToClipboard4Logseq.js:9:8
image

@ksalzke
Copy link
Owner

ksalzke commented Jun 24, 2023

In that case, I would try:

  1. Use the plug-in as-is (unmodified) for Day One, Drafts, etc.

  2. Copy the plug-in in its entirety, and modify the manifest.js file so that the identifier is something different (e.g. CompletedTasksForLogseq) and make the formatting changes in the library file that you need for Logseq. You'll probably also want to update the .strings files as you've done. You could delete the DayOne and Drafts actions, too, for simplicity.

Then you will end up with two separate plug-ins and have the ability to generate both actions. You'll have two separate menu items but I imagine that's not a huge issue.

Let me know how you get on.

@yoghurtdewdew
Copy link
Author

Your suggestion is really great, it does work! But there is new problem. I found that two omnifocusjs files share the same preference setting, so that tasks in both formats will become prefixed with -. How should I make the preference settings independent of each other? I tried to change the name in preferences. strings to got a different name, but I don't know what and how to make a next step. TBH. I am not familiar with code.
image
In addition, changed "identifier": "com.KaitlinSalzke.completedTaskReport4Logseq", in manifest.json would turns a long folder name in the Menubar. I'm not sure if there will be other problems if I shorten them into "identifier": "completedTaskReport4Logseq", as it reduced information.

I'm still wondering why that modified omnifocusjs file worked yesterday but got TypeError today. So I'm worried that the new omnifocusjs file would get similar TypeError tomorrow or sometime. I just know a little markdown, and I don't even understand regular expression yet, so I am still not sure the modification in line 180 and 201 would be the right syntax.

@ksalzke
Copy link
Owner

ksalzke commented Jul 7, 2023

Hey @yoghurtdewdew

Ah, yes! You'll want to head to completedReportLib in your new version and change the name of the synced preference there: line 23 is return new SyncedPref('com.KaitlinSalzke.CompletedTaskReport') so you will just need to change that to something different to store a separate preference e.g. return new SyncedPref('com.KaitlinSalzke.CompletedTasksForLogseq')

Let me know how you get on.

@yoghurtdewdew
Copy link
Author

It worked! Thanks a lot for your kindly help! Thanks for your amazing creation!

@ksalzke ksalzke closed this as completed Jul 7, 2023
@yoghurtdewdew
Copy link
Author

image It appears error again. And I have no idea about how to fix it.

@ksalzke
Copy link
Owner

ksalzke commented Jul 14, 2023

Hi again @yoghurtdewdew

Hmm. That is a different error to the one you were receiving before, and I can't see why you would be receiving it. I'm assuming you have the Function Library installed (if you didn't, you should be getting a different error message).

I'm wondering whether it might have to do with having two instances of the same plug-in, but it's quite tricky for me to troubleshoot without seeing what's going on.

Based on the description in the error message, I'm assuming you are receiving this message immediately when you try to run the report in the duplicated version for Logseq?

Do you get the same error when you try to run the report in the original version of the plug-in?

@ksalzke ksalzke reopened this Jul 14, 2023
@yoghurtdewdew
Copy link
Author

Yes. I get the same error in running the report in the original version of the plug-in. I'm thinking about removing these two plug-ins and then re-put a original one and a modified one. But I'm still not sure if I will see error in future.

TypeError: null is not an object (evaluating 'completedReportLib
.functionLibrary()
.adjustDateByDays') /Users/yoghurtlu/Library/Mobile Documents/iCloud~com~omnigroup~OmniFocus/Documents/Plug-Ins/CompletedTaskReport4opml.omnifocusjs/Resources/completedReportLib.js:250:25

@yoghurtdewdew
Copy link
Author

Sorry for my troubling!
I just found that can be fixed by restart omnifocus desktop app! Thanks a lot for your great help!
❤️❤️❤️❤️❤️❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants