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

Mobile: Add markdown toolbar #6703

Conversation

personalizedrefrigerator
Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator commented Jul 29, 2022

Summary

Screenshots

screenshot of misc. menu
screenshot of math icon bolded when in math
screenshot of list icon bolded when cursor is in a list item
screenshot of header icon bolded when cursor is in header

personalizedrefrigerator and others added 30 commits June 23, 2022 19:03
Math blocks and regions of inline math were missing their original
containing nodes.
@tomasz1986
Copy link

Can you also add screenshots in landscape mode?

Comment on lines 7 to 13
describe('Matching', () => {
describe('should match start and end of bolded regions', () => {
const spec: RegionSpec = RegionSpec.of({
template: '**',
});

it('should return the length of the match', () => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of variables shared within logical groups of tests, I decided to use nested describes here. I've heard that nested/multiple describe blocks can make it difficult to run a specific test (I use a VSCode extension that doesn't have trouble with this, though...).

How might I reorganize this?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could split the tests into two files, which would have the added advantage of being able to run these tests concurrently. See for instance how it's done for the synchonizer tests - synchronizer.basic.test.ts, synchronizer.e2ee.test.ts, etc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've broken markdownCommands.test.ts into multiple files. I'm thinking of each describe in markdownReformatter as a test with sub-tests, however. As each is testing a different RegionSpec with findInlineMatch, I think it makes more sense to either

  • Turn each describe into a single test with multiple expects
  • Leave the nested describes

Comment on lines +1 to +3
/**
* @jest-environment jsdom
*/
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With

// @jest-environment jsdom

JSDom was not used for this test suite.

(a document is required by EditorView).

Comment on lines +21 to +44
export interface RegionSpec {
// The name of the node corresponding to the region in the syntax tree
nodeName?: string;

// Text to be inserted before and after the region when toggling.
template: { start: string; end: string };

// How to identify the region
matcher: RegionMatchSpec;
}

export namespace RegionSpec { // eslint-disable-line no-redeclare
interface RegionSpecConfig {
nodeName?: string;
template: string | { start: string; end: string };
matcher?: RegionMatchSpec;
}

// Creates a new RegionSpec, given a simplified set of options.
// If [config.template] is a string, it is used as both the starting and ending
// templates.
// Similarly, if [config.matcher] is not given, a matcher is created based on
// [config.template].
export const of = (config: RegionSpecConfig): RegionSpec => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of namespace RegionSpec is a set of constructor functions for the RegionSpec interface.

I think I find this easier to read than the class version of RegionSpec in an earlier version of the code, however, of has a several optional/default parameters (which I would like to avoid). How might I structure this differently?

@personalizedrefrigerator
Copy link
Collaborator Author

Can you also add screenshots in landscape mode?

landscape mode screenshot, keyboard hidden
landscape mode screenshot, toolbar is partially off the screen

Note that the toolbar is partially pushed offscreen in the second screenshot — this ensures that there is enough space to edit the note. It would, of course, be better to shrink the buttons, or hide other parts of the UI....

@laurent22
Copy link
Owner

Just so you know there some linter errors: https://github.com/laurent22/joplin/runs/7577564001?check_suite_focus=true#step:10:4515

@laurent22
Copy link
Owner

laurent22 commented Jul 30, 2022

When the editor opens, the toolbar looks like this:

image

Is that expected? because I thought it was broken initially. Also do we want these submenus in the toolbar? For example shouldn't frequently used buttons be immediately accessible? How about on tablet where there's plenty of space?

I feel we should start with a thorough comparison of other mobile editor apps. Like Apple note, Samsung note, Evernote, etc. I suspect there's a better way to do this.

Also please use *italic* for italic, like in the desktop app.

@personalizedrefrigerator
Copy link
Collaborator Author

When the editor opens, the toolbar looks like this:

image

Is that expected?

Yes. That is intentional. My intention was to group related functionality (actions that might be frequently used together) into different submenus to keep the distance between related actions small.

(Additionally, this design seemed easier to make accessible to screen readers).

For example shouldn't frequently used buttons be immediately accessible?

I would prefer to avoid changing the order of buttons -- I personally find it annoying if actions move around (unless the actions are search suggestions/based on what I'm typing).

To make frequently used buttons immediately accessible, I would prefer to allow the user to customize the toolbar in settings. This, however, could be left to a follow-up PR.

How about on tablet where there's plenty of space?

It might make sense to stack submenus below parent menus in this case. This would make the toolbar somewhat similar to the ribbon interface in MS Office.

@personalizedrefrigerator
Copy link
Collaborator Author

Apple Notes has a similar-ish design on my iPhone:

IMG_0837.MOV

@laurent22
Copy link
Owner

Thanks for checking. Samsung Note is also doing something similar so let's stay on this idea then. I'd prefer if we change the icons though because they're a bit hard to decipher. The "Aa" for text formatting of Apple seems pretty good, and then another button that generally represent lists.

By the way, could you provide the complete list of formatting buttons you have at this point, and the category you have them under?

@laurent22
Copy link
Owner

And that's how Samsung Note looks. When pressing on the highlighted button, that popup appears. It needs be explicitly dismissed by clicking on the cross.

20220731_085205

@personalizedrefrigerator
Copy link
Collaborator Author

Closing until #6707 is merged and the toolbar has been redesigned.

@ccvbc
Copy link

ccvbc commented Aug 30, 2022

I want to share my opinion

  1. When I want to bold and italicize text at the same time, I can't do it in one step, here I recorded a video of joplin and another software.
  2. Whether custom html tags or markdown tags should be added, people cannot always rely on the official update software to add them. For example the "underscore" I want is not there.
    I've seen some people disagree with mobile custom tags before, I think it's very useful, joplin users need her, he can make joplin mobile more powerful.
Screenrecording_20220830_101334.mp4
Screenrecording_20220830_103521.mp4

@personalizedrefrigerator

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.

4 participants