Open hukarere opened 2 years ago
I can see that on https://wiki.iota.org, where this plugin is installed, 'Save' displays a message "Changes have been saved, syncing with GitHub...", and it forks the site to my own github repo instead of changing the site contents... However, in my Local testing, nothing similar happens, Save just does nothing...
One more note:
I noticed that when I click on "Edit page", first I am getting a page "This page crashed. 'github' is undefined", and only after that the editor page is displayed... I suspect that Save does not work because of this? Where do I define 'github'?
One more detail: it seems that every time I click "Save", the plugin forks https://github.com/jlvandenhout/docusaurus-plugin-docs-editor-preview to my github account, however, there are no any changes made to the saved file.
The editor forks the repository for the user if it doesn't exist yet and creates a branch for the edited file. save
will commit to that branch and publish
will create a pull request to merge the branch into the upstream repo. See for example the following user, which used the preview to edit a page:
The editor forked the preview repo for the user here: https://github.com/Vipank/docusaurus-plugin-docs-editor-preview , and created a branch for the edited page here: https://github.com/Vipank/docusaurus-plugin-docs-editor-preview/tree/edit/docs-tutorial-basics-create-a-page-md . Then this user edited some content and hit save to commit the changes to that branch and then the user hit publish to create a PR to the upstream preview repo here: https://github.com/jlvandenhout/docusaurus-plugin-docs-editor-preview/pull/18 .
So save
won't directly update your site, that's not what this plugin was designed for. It was designed to allow external contributors to propose changes, without knowing GitHub or Markdown, so anything GitHub related like creating forks and branches, committing and making PRs is handled by the editor.
Hi @jlvandenhout,
Thanks for your explanations! I had figured out the same, and even saw it working on https://wiki.iota.org/ as you describe.
However, when I tried this using 'Local testing', modified intro.md (by adding the line 'foo' in the beginning) and hit save, I saw that the preview repo was forked to my account: https://github.com/hukarere/docusaurus-plugin-docs-editor-preview, BUT the file intro.md was not modified: you can see that the recent commit to https://github.com/hukarere/docusaurus-plugin-docs-editor-preview is yours and it says "This branch is up to date with jlvandenhout/docusaurus-plugin-docs-editor-preview:main".
Also, unlike https://wiki.iota.org/, where hitting Save produces the message "Changes have been saved, syncing with GitHub...", no message is issued in my 'Local testing', so, something prevents Save from commiting the changes after forking the repo...
Your help would be appreciated!
P.S. There is another branch for intro.md that I modified (https://github.com/hukarere/docusaurus-plugin-docs-editor-preview/tree/edit/docs-intro-md), but it's the same (no changes): "This branch is up to date with jlvandenhout/docusaurus-plugin-docs-editor-preview:edit/docs-intro-md"
Hi again @jlvandenhout,
I just tried another page, create-a-page.md, and Save worked, creating the branch "edit/docs-tutorial-basics-create-a-page-md", committing the change and producing the message "Changes have been saved, syncing with GitHub...".
It still doesn't work when editing intro.md, it seems that this page is somehow special. Perhaps because your original repo already has the branch "edit/docs-intro-md" and it prevents Save from creating this branch again?
Interesting. That would be an explanation, although I'd expect it to just find it in that case and use that branch, but it has been a while since I looked at that code. I'll have a look.
Hello,
I tried 'Local testing' of this plugin as described in https://github.com/jlvandenhout/docusaurus-plugin-docs-editor#local-testing.
I click on "Save" and nothing happens. I expected that "Save" must make the changes to the site as seen via http://localhost:3000, but this doesn't happen....
Perhaps I need to fork https://github.com/jlvandenhout/docusaurus-plugin-docs-editor.git to my own repository before cloning it to local dir for "Save" to work? (just guessing).