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

Dekstop: Refactor: Remove templates feature #5115

Merged
merged 2 commits into from
Jun 25, 2021
Merged

Dekstop: Refactor: Remove templates feature #5115

merged 2 commits into from
Jun 25, 2021

Conversation

nishantwrp
Copy link
Contributor

This PR removes the templates feature from Joplin as a separate plugin for that is being developed here (https://github.com/joplin/plugin-templates).

@roman-r-m
Copy link
Contributor

Maybe it's worth keeping until the plugin is ready?

@nishantwrp
Copy link
Contributor Author

nishantwrp commented Jun 23, 2021

Yup, but I made the PR so that the PR can be reviewed properly before getting merged. Also (https://discourse.joplinapp.org/t/template-plugin/17470/41?u=nishantwrp)

@laurent22
Copy link
Owner

laurent22 commented Jun 23, 2021

What happens if the user has defined a custom shortcut for "insertTemplate", and then upgrades to this version? I'm not sure actually if it will just do nothing, or crash. Could you double-check this please?

@@ -16,7 +15,7 @@ export const runtime = (): CommandRuntime => {
const folderId = Setting.value('activeFolderId');
if (!folderId) return;

const body = template ? TemplateUtils.render(template) : '';
const body = template ? template : '';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove anything related to templates from the code. That includes this variable and the signature of this function. Also make sure you update all code that calls "newNote", such as the "newTodo" command.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh ok, missed it. Done.

@@ -555,9 +516,6 @@ function useMenu(props: Props) {
selector: 'performClose:',
}, {
type: 'separator',
}, {
label: _('Templates'),
submenu: templateItems,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test the app after having made your changes? Because if you remove this, there will be two successive two separators in the menu, so you need to remove one separator. Please test the code. Check all the parts where you've changed something.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I did test it and I couldn't see two separators in the UI. But anyways, removed it.
Screenshot_20210625_002635

}, {
label: _('Templates'),
visible: shim.isMac() ? false : true,
submenu: templateItems,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Two separators.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@laurent22
Copy link
Owner

You also need to remove any mention of templates from README.md, although you should probably copy the Note Templates section and add it to your plugin doc.

@nishantwrp
Copy link
Contributor Author

You also need to remove any mention of templates from README.md, although you should probably copy the Note Templates section and add it to your plugin doc.

Done. I've copied it and will add it there in the future when the plugin is complete/

@nishantwrp
Copy link
Contributor Author

What happens if the user has defined a custom shortcut for "insertTemplate", and then upgrades to this version? I'm not sure actually if it will just do nothing, or crash. Could you double-check this please?

Yes done. I created a custom shortcut to insertTemplate, and switched to this branch and saw that there were no console errors. Although when I saw the custom keyboard map and searched for insertTemplate the results were as follows

Screenshot_20210625_015953

You can see that we have insertTemplate mapped but it's marked as invalid.

@nishantwrp nishantwrp requested a review from laurent22 June 24, 2021 20:37
@laurent22 laurent22 changed the base branch from dev to dev_no_template June 25, 2021 16:48
@laurent22 laurent22 merged commit d13d5b4 into laurent22:dev_no_template Jun 25, 2021
@laurent22
Copy link
Owner

Ok it's merge now. I've put the changes in this branch so if you want to test without the template feature, please use this:

https://github.com/laurent22/joplin/tree/dev_no_template

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

Successfully merging this pull request may close these issues.

3 participants