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

Add RichContenteditable component #1433

Merged
merged 1 commit into from
Oct 12, 2020
Merged

Add RichContenteditable component #1433

merged 1 commit into from
Oct 12, 2020

Conversation

skjnldsv
Copy link
Contributor

@skjnldsv skjnldsv commented Oct 6, 2020

  • Supports v-model
  • Supports sync modifier
  • Supports core AutoCompletion endpoint format
  • Use inline UserBubble
  • Capture paste, auto-escape and format
    • Allows to capture the paste event from the parent, so you can manage the file paste if you want to. We only capture the paste if it contains text only.
  • Exports the html➡️text and text➡️html functions in a mixin so anyone can render rich text

Capture d’écran_2020-10-06_23-03-40

<RichContenteditable
			v-model="message"
			:auto-complete="autoCompleteMethod" />

Insights

The html generation method I used there (mounting the component, pulling the html and destroying) is actually quite fast!
For the biggest data sets it takes around 6ms to render and pull. The first one is usually longer, after that it takes around 1-2ms! 🚀

Followup

@skjnldsv skjnldsv self-assigned this Oct 6, 2020
@skjnldsv skjnldsv added 2. developing Work in progress enhancement New feature or request labels Oct 6, 2020
@skjnldsv skjnldsv force-pushed the add/RichContenteditable branch from ae9e5e4 to 1acf5ed Compare October 6, 2020 10:18
@skjnldsv skjnldsv added the feature: rich-contenteditable Related to the rich-contenteditable components label Oct 6, 2020
@skjnldsv skjnldsv force-pushed the add/RichContenteditable branch 7 times, most recently from d8519a6 to 9344467 Compare October 6, 2020 12:09
@skjnldsv skjnldsv added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Oct 6, 2020
@skjnldsv skjnldsv force-pushed the add/RichContenteditable branch from 9344467 to 3e35ecc Compare October 6, 2020 13:14
@skjnldsv skjnldsv requested a review from jancborchardt October 6, 2020 13:27
Copy link
Contributor

@marcoambrosini marcoambrosini left a comment

Choose a reason for hiding this comment

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

It seems that this is not working properly on netlify. I tried writing a sentence in there and new words are added on the left before the last word that I just typed. Maybe I'm doing something wrong?

@skjnldsv
Copy link
Contributor Author

skjnldsv commented Oct 6, 2020

It seems that this is not working properly on netlify. I tried writing a sentence in there and new words are added on the left before the last word that I just typed. Maybe I'm doing something wrong?

Have you entered new lines?

@skjnldsv skjnldsv added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Oct 6, 2020
@skjnldsv skjnldsv force-pushed the add/RichContenteditable branch from b41c3aa to 6904aaf Compare October 6, 2020 21:05
@skjnldsv skjnldsv removed the 2. developing Work in progress label Oct 6, 2020
@danxuliu
Copy link
Contributor

danxuliu commented Oct 9, 2020

Sorry, I did not understand

I added the htmlToText and textToHtml functions as a mixin. So you can now use them to render messages in talk for example.

Good :-) But... how is it related to what to do when fetching the autocompletion results fail? :-)

Does it support swapping Enter and Shift+Enter ?

why would you need swapping between those?

See nextcloud/spreed#3268

@danxuliu
Copy link
Contributor

danxuliu commented Oct 9, 2020

when testing newlines, please always mention which browser you used.

Right, the wondrous land of content editable new lines :-P I initially tested with Firefox, and the text became aa\n. Now I have tested with Chromium and the text became aa. In both cases it should have been a\na.

@skjnldsv
Copy link
Contributor Author

skjnldsv commented Oct 9, 2020

  1. Deleting an @mention right after having added it requires pressing backspace twice. The cursor goes right after the first backspace keystroke.

because we add a space after a mention

@skjnldsv skjnldsv force-pushed the add/RichContenteditable branch from 494af70 to f651515 Compare October 9, 2020 10:26
@skjnldsv skjnldsv force-pushed the add/RichContenteditable branch 2 times, most recently from e362298 to decd70c Compare October 9, 2020 17:50
@skjnldsv
Copy link
Contributor Author

skjnldsv commented Oct 9, 2020

Fixed:

  • FF deletion
  • New line with shift/no-shift management
  • Paste data (currently no support for direct-rendering of a mention, it will stay as text, we'll discuss this in a followup)

Followups:

  • Emoji autocompletion
  • Ctrl+z history (currently doesn't work, doesn't work on talk either)
  • ... ?

@skjnldsv skjnldsv added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Oct 9, 2020
@skjnldsv skjnldsv force-pushed the add/RichContenteditable branch from decd70c to 7058a9e Compare October 9, 2020 17:53
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
@skjnldsv skjnldsv force-pushed the add/RichContenteditable branch from 7058a9e to d27ca50 Compare October 9, 2020 17:57
@skjnldsv
Copy link
Contributor Author

skjnldsv commented Oct 9, 2020

Let's try to get this in and fix potentials small bugs later if possible, unless there is a complete breaking one still laying around (you never know 😁)

Copy link
Contributor

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

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

I didn't make a deep code review but it works fine from a user point of view!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish enhancement New feature or request feature: rich-contenteditable Related to the rich-contenteditable components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants