Skip to content

Support for <raw-text-block> #803

Description

@xindixu

Thank you for this amazing library! ❤️

Is there a way to add a <raw-text-block> block such that content inside the this block stay as plain text and can be edited as plain text thru out the editor life cycle. I think this would be an easy escape hatch while we work on supporting unsupported syntax. For example, when user copy paste in a nested list, or a table, the editor value would be the following:

<html>
<p>some other content</p>
<raw-text-block>
- list 1
  - sub list 1
  - sub list 2
- list 2
</raw-text-block>

<raw-text-block>
header 1 | header 2
--- | ---
a | b
c | d
</raw-text-block>
</html>

and the rendered result can stay as plain text, like this (except the raw-text-block shouldn't use codeblock styling)

Image

Something similar to allowing users to insert a plain <textarea /> block in the editor HTML code.

Is your feature request related to a problem? Please describe.
Partially. I'm looking into a way to allow users to type in unsupported syntax. Main blocking syntax are:

  1. nested lists
  2. code block with language
  3. table

Describe the solution you'd like
Give caller a way to insert raw-text-block, similar to codeblocks. Maybe something like this:

  1. caller calls toggleRawTextBlock() (via a button, or when we detect unsupported syntax when we call setValue(), ex, during copy pasting, or editing message)
  2. inserts <raw-text-block>some content</raw-text-block> in the editor value
  3. allows users to edit the raw text block content
  4. the underlying HTML stay as <raw-text-block>some content</raw-text-block> thru out the edit

Describe alternatives you've considered

  1. Use codeblock. Assign codeblock language as text so that the content stay unchanged. But i can't find a way to assign code block language
  2. Allow users to add plain textarea tags. Either in my app, or in the library fork

Additional context
I use https://github.com/software-mansion/enriched-markdown to render the sent messages as markdown. I'm transitioning my app from a raw TextInput into this library. There are many existing messages that are sent from plain TextInput are now not-editable using the enriched-html input 😢 .

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions