cryptee / web-client

Cryptee's web client source code for all platforms.
https://crypt.ee
Other
445 stars 22 forks source link

[Feature] Do not add additional rows to Divider or allow easily deleting unnecessary space #168

Closed ghost closed 1 year ago

ghost commented 1 year ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

1st text i want to separate will put divider here 2nd text i want to separate

1st text i want to separate space1 .- - - (divider) space2 2nd text i want to separate

In order to delete a space WITHOUT DELETING the Divider, I would have to - for example with the 2nd space - either click in the 2nd space and press Del or click to the beginning of the 2nd text and press Backspace to bring the 2nd text closer to the divider. This way the commands do not "touch" the divider and it does not get deleted. If I click in the 2nd space and press Backspace the Divider will get deleted because the command "touched" it somehow. This is the same with the 1st text and space. Just the Del and Backspace commands switched up.

Describe the solution you'd like A clear and concise description of what you want to happen.

Either do not add these spaces after the divider or if that isn't possible. Or allow putting the cursor to the beginning of the divider and move it:

1st text i want to separate | ← cursor, press del here .- - -

1st text i want to separate | - - -

Notice how the divider jumped at the row of the cursor without disappearing? This basically allows the divider to be worked with as a regular character. This should work the other was around with backspace too.

Additional context Add any other context or screenshots about the feature request here.

https://0x0.st/o23d.mp4

johnozbay commented 1 year ago

Hi there! 👋🏻

Thanks a lot for filing this!

TLDR; This is in the Markdown spec, so we can't change this. If a rich document editor's Markdown implementation does not have this, chances are they implemented Markdown wrong. If a comment field / messaging app etc uses this however, it could technically still be spec compliant since they won't need interoperability (like document import / exports from other apps).


What's commonly referred to as "divider" is called a "thematic break" in Markdown.

And as I mentioned in some of the other github issues you've filed earlier: a) Cryptee is not a markdown editor, b) we only use Markdown shortcuts to make it easier to type. c) Markdown was not designed for rich document editing, and it doesn't support tons of features you'd expect in a rich document editor like font-sizes or colors etc. You can read more about all this in #163.

Basically Markdown spec says that thematic breaks can interrupt paragraphs, and when both a thematic break and a list item are possible interpretations of a line, the thematic break takes precedence.

Because Markdown was not designed to deal with rich documents (like font-sizes / colors etc) it doesn't account for the needs of a rich document editor. i.e. elements that which are the same font-size or color, need to live in their own DOM elements to receive this size / color / style information) And thematic breaks cannot and should not break these or your document model would get really REALLY messy.

What I mean by this is ... what happens if you have a text like the following :

 

This is the first sentence. This is the second sentence. --- This is the third sentence. This is the fourth sentence.

 

And both the second sentence and third sentence need to be colored red. Thematic breaks would have to interrupt / split this paragraph, BUT it needs to also split the second and third sentence into their own red-color-elements. So you would need to slice that into 4 elements like this :

 

[This is the first sentence./black] [This is the second sentence /red]. --- [This is the third sentence /red]. [This is the fourth sentence. /black]

 

Meaning, in order not to get 4 paragraphs, you would then need to join these into two paragraphs like this :

<p>
   <span>This is the first sentence.</span> 
   <span class="red" This is the second sentence</span>
</p>
<hr /> <!-- thematic break, which must interrupt paragraphs according to markdown spec-->
<p>
   <span class="red">This is the third sentence.</span> 
   <span> This is the fourth sentence</span>
</p>

And since paragraphs need to have their own margin as well as the thematic break, you end up with one extra space in between there. Otherwise your document wouldn't be interoperable with other Markdown editors that doesn't support color / font sizes etc :-)


Hoping this makes sense and helps ✌🏻

Best,

J