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

Enable the HTML / MD editor on text fields within the profile editor #585

Closed
Tracked by #576
jamesrwelch opened this issue Jun 30, 2022 · 6 comments · Fixed by #629
Closed
Tracked by #576

Enable the HTML / MD editor on text fields within the profile editor #585

jamesrwelch opened this issue Jun 30, 2022 · 6 comments · Fixed by #629
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@jamesrwelch
Copy link
Contributor

jamesrwelch commented Jun 30, 2022

We made a simplification in the first iteration of the bulk editor, to not try any fancy editing inside the boxes - in particular not using the Jodit / MD editor within the grid. For space / rendering issues, I think having an HTML editor on each text box might be un-workable, but maybe there's a way to pop-up an HTML / MD editor on request?

@jamesrwelch
Copy link
Contributor Author

Or, like Excel, have the currently-edited value in a box at the top, where there could be a rich-text editor present.

@pjmonks pjmonks added enhancement New feature or request for discussion More discussion required to decide how to resolve an issue labels Jul 4, 2022
@pjmonks
Copy link
Contributor

pjmonks commented Jul 4, 2022

Following the UI standards of Excel may be the best option. The Ag Grid component may be able to use a custom cell editor to embed our own controls into the editing cell, but it will not look very nice and could be complex to handle the event interactions such as mouse clicks.

Having one mdm-content-editor embedded on the page might be more feasible. This would mean:

  1. Clicking on a certain cell type e.g. text, would copy the cell value into the one content editor.
  2. Any changes made to the content editor would be bound back to the cell contents.
  3. The content editor is disabled or hidden for other cell types e.g. numbers, enumerations, dates, etc

Finding a suitable position for the content editor on the page would have to be determined or experimented with:

  1. Editor top, spreadsheet bottom - user would know there is a content editor, but would push down the spreadsheet content
  2. Spreadsheet top, editor bottom - user might miss that there is a content editor and have to scroll down to find it
  3. Side-by-side - Editor might become more compact, especially if they have toolbars

Another idea could be to hold the content editor in a dialog, but this would less "inline" than the rest of the spreadsheet.

@pjmonks pjmonks self-assigned this Jul 22, 2022
pjmonks added a commit that referenced this issue Jul 22, 2022
* Initial test to see what this looks like and how useable it is
* Not complete, but basics are available
@pjmonks
Copy link
Contributor

pjmonks commented Jul 22, 2022

As part of UI experimentation, here is one example of how editing large amounts of text in cells could be achieved (though not definitive):

image

Using a custom Ag Grid cell editor, I've been able to embed our Markdown editor into a cell editor popup just to see what it looks like.

Pros:

  1. Editing the text is in the same region as the cell in question - obvious what text is actively being edited
  2. Responds well to the rest of the grid, and was simple to integrate

Cons:

  1. Narrow region to edit the text. The popup display width can be made wider using CSS width. How well would it look with paragraphs of text though?
  2. The Markdown (and eventually the HTML) editor should ideally be cut down a bit with features to not appear overloaded/crowded. For example, remove the editor toolbars (or significantly reduce their options), remove preview panes etc. This might be OK given the use case, it does not seem as likely that a user would want to do extensive text editing in a spreadsheet view whilst editing other elements.

I will also experiment with the Excel-like single text editor field as explained in the issue description though to provide a comparison.

@pjmonks
Copy link
Contributor

pjmonks commented Jul 25, 2022

Another experiment, this time focusing on what was originally requested in this issue: an Excel-style singular editor which is populated once a cell is clicked:

image

Currently only for the Markdown editor, but how this works is:

  1. Click on a cell that is for a text profile field - other column types hides the editor
  2. The full text editor appears above the spreadsheet, with the contents populated with the selected cell value
  3. Enter text in the editor then click "Update" to put back into the cell. AgGrid has a flash cells feature which will colour the updated cell briefly - makes it easier to see what was updated
  4. If you edit text in the editor but do not click "Update", or click on a different cell, this acts as a "cancel" action, the current changes are not updated back to the cell.

Pros

  1. The full text editor could be used here providing all Markdown/HTML editing actions
  2. The cell flashing on updates is a useful UX cue

Cons

  1. It takes up a lot of space, and the spreadsheet position adjusts a lot when showing/hiding the editor
  2. It's not very obvious which is the current cell being edited, as focus is lost once you start typing. There may be ways around this, using a custom cell renderer.
  3. You have to manually click "Update" to ensure your changes are pushed back to the cells. This could become a keyboard shortcut (e.g. Ctrl + Enter) but could also be the cause of some accidental edit losses.

@pjmonks
Copy link
Contributor

pjmonks commented Jul 25, 2022

One final UX experiment uses Ag Grid overlays to work around the editing experience:

image

The overlay is actually designed for a loading prompt, but has been hijacked slightly to instead show and manage an editor and cell update. It works by:

  1. Tracking which profile field text cell was clicked
  2. Trigger the loading overlay, which display our custom overlay component - in this case the Markdown editor
  3. The selected cell contents are passed via parameters to the overlay, so the current value is the start of the editing process
  4. While the loading overlay is visible, you cannot click on other cells - you must manually click the "Close" button inside the overlay. This then updates the cell with the editor value.

Pros

  1. The overlay exists within the spreadsheet space, so the size of the text editor should be large enough to include a full editing suite if required
  2. Showing the overlay disables the background cells, so there can be no accidental clicking away from the current editor.
  3. All elements remain in the viewport of the spreadsheet where the user is working.

Cons

  1. It's not very obvious which is the current cell being edited. Maybe a custom cell renderer can help.
  2. Although technically possible, the loading overlay isn't really designed for this kind of job. It seems fine for this use case, but would cause conflicts if an actual loading overlay were needed too.
  3. You have to manually click "Close" to ensure your changes are pushed back to the cells. This could become a keyboard shortcut (e.g. Ctrl + Enter) but may feel a bit annoying.

@pjmonks
Copy link
Contributor

pjmonks commented Jul 25, 2022

I have pushed commits to branch feature/gh-585 which can allow you to test these ideas yourself. To switch text edit styles, update the bulk-edit-editor.component.ts file with one of the following modes allowed:

/** TESTING ONLY! For experimenting with text editing features */
textEditStyle: 'cell-editor' | 'excel-like' | 'grid-overlay' = 'excel-like';

jamesrwelch pushed a commit that referenced this issue Jul 29, 2022
* Initial test to see what this looks like and how useable it is
* Not complete, but basics are available
pjmonks added a commit that referenced this issue Jul 29, 2022
* Initial test to see what this looks like and how useable it is
* Not complete, but basics are available
pjmonks added a commit that referenced this issue Jul 29, 2022
* Popup cell editor
* Excel-like controls
pjmonks added a commit that referenced this issue Jul 29, 2022
* Similar to built in ag Grid version but includes hint about creating new lines
* Also includes "Edit" button, this will trigger a larger content editor to appear
pjmonks added a commit that referenced this issue Jul 29, 2022
* Trigger via button click in TextAreaCellEditorComponent
* Open dialog with MDM content editor
* Resize all columns correctly
* Remove agGrid overlay code
pjmonks added a commit that referenced this issue Jul 29, 2022
@pjmonks pjmonks removed the for discussion More discussion required to decide how to resolve an issue label Jul 29, 2022
pjmonks added a commit that referenced this issue Aug 1, 2022
* Initial test to see what this looks like and how useable it is
* Not complete, but basics are available
pjmonks added a commit that referenced this issue Aug 1, 2022
* Popup cell editor
* Excel-like controls
pjmonks added a commit that referenced this issue Aug 1, 2022
* Similar to built in ag Grid version but includes hint about creating new lines
* Also includes "Edit" button, this will trigger a larger content editor to appear
pjmonks added a commit that referenced this issue Aug 1, 2022
* Trigger via button click in TextAreaCellEditorComponent
* Open dialog with MDM content editor
* Resize all columns correctly
* Remove agGrid overlay code
pjmonks added a commit that referenced this issue Aug 1, 2022
pjmonks added a commit that referenced this issue Aug 1, 2022
gh-585 - Edit Markdown and HTML text in the bulk editor
@pjmonks pjmonks added this to the 7.2.0 milestone Aug 1, 2022
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
Status: Released
Development

Successfully merging a pull request may close this issue.

2 participants