Skip to content

Dekstop: Refactor: Remove templates feature#5115

Merged
laurent22 merged 2 commits into
laurent22:dev_no_templatefrom
nishantwrp:remove-templates
Jun 25, 2021
Merged

Dekstop: Refactor: Remove templates feature#5115
laurent22 merged 2 commits into
laurent22:dev_no_templatefrom
nishantwrp:remove-templates

Conversation

@nishantwrp

Copy link
Copy Markdown
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
Copy Markdown
Contributor

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

@nishantwrp

nishantwrp commented Jun 23, 2021

Copy link
Copy Markdown
Contributor Author

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

laurent22 commented Jun 23, 2021

Copy link
Copy Markdown
Owner

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?

if (!folderId) return;

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

Copy link
Copy Markdown
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
Copy Markdown
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.

type: 'separator',
}, {
label: _('Templates'),
submenu: templateItems,

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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