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

In-browser editor #4

Open
Pablo2m opened this issue Oct 14, 2020 · 20 comments
Open

In-browser editor #4

Pablo2m opened this issue Oct 14, 2020 · 20 comments
Labels
enhancement New feature or request

Comments

@Pablo2m
Copy link
Collaborator

Pablo2m commented Oct 14, 2020

The use of typora in windows is being a tough nut to crack (I don't know if this expression is used in your country), in short I am having a hard time getting it to work.
Can I add support to another editor? , I am thinking of something that uses JS (a necessary evil), so that it is independent of the platform, what do you think?

@klieret
Copy link
Owner

klieret commented Oct 14, 2020

That sounds great. Best would be that we could make it configurable.

So if you say that it should be a JS editor, do you mean one that directly runs in the browser?

Other than that, currently the button doesn't do much more than running a system command (e.g. typora for Typora). So all we would need to do there is to start creating a config file, where you set up the different system commands together with the name that appears on the button.

@klieret klieret added the enhancement New feature or request label Oct 14, 2020
@Pablo2m
Copy link
Collaborator Author

Pablo2m commented Oct 14, 2020

So if you say that it should be a JS editor, do you mean one that directly runs in the browser?

Yes, , I have found two possible options:

https://github.com/Vanessa219/vditor/blob/master/README_en_US.md
https://github.com/nhn/tui.editor

I have also seen another that could serve but does not seem actively maintained

https://github.com/laobubu/HyperMD

@klieret
Copy link
Owner

klieret commented Oct 15, 2020

Yes, those options would of course be awesome! That would bring the project to a whole new level. As you saw, it's currently just using pandoc to go from markdown files (which I most often edit in zettlr) to html.

But using one of these projects probably requires a lot more work than just opening an editor via system command, right?

I probably won't have too much time to spend on this for now, how about you?

@Pablo2m
Copy link
Collaborator Author

Pablo2m commented Oct 16, 2020

But using one of these projects probably requires a lot more work than just opening an editor via system command, right?

I probably won't have too much time to spend on this for now, how about you?

I never did something like that, I really wouldn't know how to estimate the time that something like this could take, I'll try.

@Pablo2m
Copy link
Collaborator Author

Pablo2m commented Oct 19, 2020

have almost one half ready: read files and be able to edit them. I basically use a template in which the content of the file is completed.

I am missing how to save them, my current idea is to try to use an HTTP POST method to update it from Python, what do you think?

@klieret
Copy link
Owner

klieret commented Oct 23, 2020

Oh interesting! So you're making fast progress afterall :)

Do you have some work in progress that I could take a look at to see how it looks? Very excited!

But yes, saving new markdown is very easy. This could be done with a normal HTTP Post exactly as you describe or we could use flask socketio to save without having to load any new page.

@klieret
Copy link
Owner

klieret commented Oct 23, 2020

In the backend this is as easy as

@socketio.on('save_button_clicked')
def save_new_version(json, methods=('GET', 'POST')):
    path = json["path"]
    with open(Path(path), "w") as outf:
        outf.write(json["file_content"])

or similar.

And from the client:

socket.emit( 'save_button_clicked', {content: 'File contnet', path: 'path/to/file'} );

(from top of my head)

@Pablo2m
Copy link
Collaborator Author

Pablo2m commented Oct 24, 2020

I still have two problems, sending the text to the server (I'll check your idea, I don't know anything about javascript, I'm just trying to interpret the code).
Second problem, [[wiki]] links are not supported by the editor Vanessa219/vditor#789
Tomorrow I will make a commit and send you a message in this issue, so you can see it, that editor except for that (and because I have not yet scheduled the file upload) is very interesting

@Pablo2m
Copy link
Collaborator Author

Pablo2m commented Oct 25, 2020

Take a look:
Pablo2m@39c8f2c

@klieret
Copy link
Owner

klieret commented Oct 29, 2020

Wow, that looks amazing indeed! Let me see if I can get it to work with saving changes

@klieret
Copy link
Owner

klieret commented Oct 29, 2020

Hi @Pablo2m that's marvellous! Thanks so much for starting this. I've made the save button work right now (and it redirects to the rendered page). I'll add an edit button there in a second as well.

I'm working on the vditor branch of this repository where I've pulled over your commits. I've also added you to this repository (you should have a pending invite), so you should be able to work on that branch as well (and create new branches etc.). The master branch is protected, so you still have to make PRs though.

@klieret
Copy link
Owner

klieret commented Oct 29, 2020

@all-contributors please add @Pablo2m for code,bug,ideas

@allcontributors
Copy link
Contributor

@klieret

I couldn't determine any contributions to add, did you specify any contributions?
Please make sure to use valid contribution names.

@klieret
Copy link
Owner

klieret commented Oct 29, 2020

@all-contributors please add @Pablo2m for code, bug, ideas

@allcontributors
Copy link
Contributor

@klieret

I've put up a pull request to add @Pablo2m! 🎉

@klieret
Copy link
Owner

klieret commented Oct 29, 2020

#12

@klieret
Copy link
Owner

klieret commented Oct 30, 2020

@Pablo2m Ah, I see you're already working on removing this edit/open duality by making the vditor preview work properly! That would really make it a much better experience!! 🤩

@Pablo2m
Copy link
Collaborator Author

Pablo2m commented Oct 30, 2020

Yes, I think it would be good, at least as an alternative.
There is still a lot to do.

@klieret
Copy link
Owner

klieret commented Oct 31, 2020

It would also be much faster, I'm sure ;)

@klieret klieret changed the title Aditional editor? In-browser editor Nov 6, 2020
@Pablo2m
Copy link
Collaborator Author

Pablo2m commented Nov 10, 2020

I have advanced with the prototyping, this week I will try to polish it and put it in the vditor branch. I liked the new readme

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

No branches or pull requests

2 participants