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

Feature Request: wysiwyg editor for issues and wiki #5436

Closed
1 of 7 tasks
callamaris opened this issue Nov 30, 2018 · 18 comments
Closed
1 of 7 tasks

Feature Request: wysiwyg editor for issues and wiki #5436

callamaris opened this issue Nov 30, 2018 · 18 comments
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@callamaris
Copy link

callamaris commented Nov 30, 2018

  • Gitea version (or commit ref): 1.5.1
  • Git version: All supported versions
  • Operating system: All supported platforms
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

Please add some sort of markdown wysiwyg editor to wiki and issue input boxes.

Something like benweet/stackedit for example.

Screenshots

@lafriks
Copy link
Member

lafriks commented Nov 30, 2018

For wiki there already is one

@lafriks lafriks added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Nov 30, 2018
@KaKi87
Copy link

KaKi87 commented Apr 22, 2019

@lafriks Wiki's editor is not WYSIWYG

@lafriks
Copy link
Member

lafriks commented Apr 22, 2019

I think it is already close enough to have it easy to use

@KaKi87
Copy link

KaKi87 commented Apr 23, 2019

It's not about ease but experience.
Editing and previewing simultaneously is a better experience than edititing then previewing.
However, some complex elements like tables, are much easier to edit with a WYSIWYG editor.
Less significantly, images and links are easier too.
By the way, inline code and checkboxes are missing from the current editor. I noticed that but other elements may be missing as well

@lafriks
Copy link
Member

lafriks commented Apr 23, 2019

Implementing new WYSIWYG editor in gitea is totally out of scope for this project. If there is any JavaScript library that is better than currently used we could look into it

@lunny
Copy link
Member

lunny commented Apr 25, 2019

I think it Maybe like typora ?

@Cherrg
Copy link
Contributor

Cherrg commented Jun 18, 2019

It's not about ease but experience.
Editing and previewing simultaneously is a better experience than edititing then previewing.

There is a problems with an live preview (Editing and previewing):

  • currently markdown is rendered by https://github.com/russross/blackfriday which is an internal go library
  • the live js implementation has to render the result exactly like the internal go variant, otherwise the user experience would be even worse.

the previewing button request gitea to render the text to html and show it back on website.

May you suggest some other CodeMirror theme or rules or something what should really be changed in edit mode. But I wouldn't like to see really colored markdown like here: https://codemirror.net/mode/markdown/.

I think it Maybe like typora ?

if i see it correctly 'typora' is standalone and no js library

@Cherrg
Copy link
Contributor

Cherrg commented Jun 18, 2019

I think this issue is more like #6975

@KaKi87
Copy link

KaKi87 commented Jun 18, 2019

the previewing button request gitea to render the text to html and show it back on website

How would that make live rendering impossible ?

@Cherrg
Copy link
Contributor

Cherrg commented Jun 18, 2019

I never said impossible, but


Let Go do the rendering:

  • this will trigger rendering with every keypress
    • may the update could be delayed to time interval, or X changed letters)
  • how do you integrate the returned html code into your text editor as it will return the whole text
    • A solution would be an additional container where the preview is shown. As it does not effect the editor at all.

Let JS do the rendering:

  • The JS render implementation has to do the same thing as the go code, otherwise it will render differently on live preview and when it is finished. This would be an even worse solution.

Let me ask which solution is preferred/ goal should be achieved?
May the go rendering variant with delay could be done, if codemirror is fullscreen, screen is large enougth.


The codemirror (used by simpleMDEditor) currently does some simple highlighting.

However, some complex elements like tables, are much easier to edit with a WYSIWYG editor.

The current editor has a simple feature to add tables.
Are you looking for something like https://codepen.io/jasondavis/pen/eJBoeK ? Such things could be added to codemirror too. Or something else?

Less significantly, images and links are easier too.

You could simply paste links. Image pasting could be easily achieved too, if upload is working at all.

By the way, inline code

I don't know if it will make any sense to add inline code button if it could be done by simply adding ` around your code. Are there keyboards without this key?

and checkboxes are missing from the current editor.

* [ ] checkbox

There is a codemirror plugin called 'button' or 'buttons'. It allows to simply add some buttons and code there, by adding some lines to an array. May I will add some buttons later on to support

  • inline code
  • checkboxes

@Cherrg
Copy link
Contributor

Cherrg commented Jun 18, 2019

simpleMDE actually support side-by-side view -> which give live preview (and runs request by every keypress)
I will create an pr to anable this feature and i will delay the preview like mentioned above

Cherrg added a commit to Cherrg/gitea that referenced this issue Jun 18, 2019
and add some delay so side-by-side live preview is updated
* every 10th keypress
* if keypress < 10 -> apter no input for 1 sec

affects go-gitea#5436


Signed-off-by: Michael Gnehr <[email protected]>
@KaKi87
Copy link

KaKi87 commented Jun 18, 2019

this will trigger rendering with every keypress
may the update could be delayed to time interval, or X changed letters)

Smarter : we could trigger rendering when the user stops typing for 0.5s

how do you integrate the returned html code into your text editor as it will return the whole text
A solution would be an additional container where the preview is shown. As it does not effect the editor at all.

Even smarter : we could use contenteditable and only trigger rendering whenever the user creates a new block.

@Cherrg
Copy link
Contributor

Cherrg commented Jun 18, 2019

added an pull request to enable sideby side editor

Smarter : we could trigger rendering when the user stops typing for 0.5s

currently it will render on every 10th keystroke or with 1sec delay, i will reduce the delay to 500ms.

Even smarter : we could use contenteditable and only trigger rendering whenever the user creates a new block.

Codemirror will create elements on every line, and on every styled text element, so this could be quite often. (e.g. inserting an image by this: ![alias](image.png) will create 4 html elements. (and if i bind to that event, the renderer may get triggert 4 times))
Internal Codemirror does something like contenteditable on html elements. While updating an internal raw text state and tracks every keystroke, it will also update an rendered preview.

@Cherrg
Copy link
Contributor

Cherrg commented Jun 18, 2019

added PR for

  • inline code
  • checkboxes

too

@Cherrg
Copy link
Contributor

Cherrg commented Jun 19, 2019

@KaKi87 As you requested something for tables, i've written some jquery extension for it.
If you like it, i would create a PR to add this to simpleMDE/codemirror.
(First i will add this to wiki page, if all is done there, i will add all features to issues and normal markdown editor)

Running version could be found here:

Without Code

https://jsfiddle.net/cherrg/kywdz0jc/show

With Code

https://jsfiddle.net/cherrg/kywdz0jc/

Features

  • create md tables of selected size
  • editable table
  • mark and edit tables
  • text alignment inside tables

  • parse and creates markdown tables from
    • markdown tables
    • html tables
    • csv
    • text based tables (copied by clipboard)

Images

grafik

grafik

grafik

grafik

techknowlogick pushed a commit that referenced this issue Jul 7, 2019
… checkbox' (#7243)

* wiki - editor - add buttons 'inline code', 'add empty checkbox', 'add checked checkbox'

affects #5436

Signed-off-by: Michael Gnehr <[email protected]>

* add missing 'set focus' after insert with buttons

Signed-off-by: Michael Gnehr <[email protected]>

* consistent usage of let/const in added code
jeffliu27 pushed a commit to jeffliu27/gitea that referenced this issue Jul 18, 2019
… checkbox' (go-gitea#7243)

* wiki - editor - add buttons 'inline code', 'add empty checkbox', 'add checked checkbox'

affects go-gitea#5436

Signed-off-by: Michael Gnehr <[email protected]>

* add missing 'set focus' after insert with buttons

Signed-off-by: Michael Gnehr <[email protected]>

* consistent usage of let/const in added code
@Booteille
Copy link

Hi. What's the status of this issue? I really think this is a must-have feature if we want non-technical users to be able to report issues easily.

lunny pushed a commit that referenced this issue Nov 16, 2019
* wiki - enable side-by-side button in editor

and add some delay so side-by-side live preview is updated
* every 10th keypress
* if keypress < 10 -> apter no input for 1 sec

affects #5436


Signed-off-by: Michael Gnehr <[email protected]>

* decrease timeinterval user need to stop before rendering is triggered

Signed-off-by: Michael Gnehr <[email protected]>

* removed not needed code with simpleMDE placeholder

Signed-off-by: Michael Gnehr <[email protected]>

* run highlight.js on markdown preview

Signed-off-by: Michael Gnehr <[email protected]>

* fix white border around side-by-side preview

Signed-off-by: Michael Gnehr <[email protected]>
@6543
Copy link
Member

6543 commented Jan 13, 2020

@Cherrg your commit (#5436 (comment)) is worth a own issue ... i think

@callamaris gitea v1.11.0 will have wysiwyng editor for issue and wiki

@6543
Copy link
Member

6543 commented Jan 13, 2020

@callamaris can you close this issue

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

7 participants