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

XEP-0393: Message Styling #1083

Closed
jcbrand opened this issue Apr 24, 2018 · 1 comment
Closed

XEP-0393: Message Styling #1083

jcbrand opened this issue Apr 24, 2018 · 1 comment
Assignees
Milestone

Comments

@jcbrand
Copy link
Member

jcbrand commented Apr 24, 2018

No description provided.

@jcbrand jcbrand changed the title XEP-0393: Message Styling (Support for markdown-like syntax) XEP-0393: Message Styling Oct 16, 2018
@jcbrand
Copy link
Member Author

jcbrand commented Sep 2, 2020

@XaviFP

The UI code of this task is roughly similar to how we replace XEP-0372 references with special markup, or how we replace image hyperlinks with <img> tags.

In each case, you have to construct an array of reference objects with each object containing the plaintext to be replaced with a lit-html TemplateResult instance, and start and end keys which describe where in the message the plaintext to replace resides.

So for messages with XEP-0372 styling hints, you'll have to write a parser that identifies these parts of the message that needs to be replaced with special markup, for example *this is bold* needs to be replaced with a lit-html TemplateResult object like html`<b>this is bold</b>` .

Then you can create a function addMessageStyling and add it in the transform method of the MessageBodyRenderer class, which is responsible for taking plaintext, turning it into a MessageText instance and then add markup to it so that we can render rich messages.

See here:

addReferences(text, this.model);

Also, take a look at the MessageText class to get a better idea of what needs to be done to add rich content to a chat message:

* @class MessageText

Let me know if you have any questions.

@XaviFP XaviFP self-assigned this Oct 5, 2020
@jcbrand jcbrand added this to the 7.0.0 milestone Oct 30, 2020
jcbrand added a commit that referenced this issue Oct 30, 2020
jcbrand added a commit that referenced this issue Oct 30, 2020
jcbrand added a commit that referenced this issue Oct 30, 2020
jcbrand added a commit that referenced this issue Nov 2, 2020
jcbrand added a commit that referenced this issue Nov 2, 2020
@jcbrand jcbrand modified the milestones: 7.0.0, 7.0.1 Nov 18, 2020
jcbrand added a commit that referenced this issue Nov 23, 2020
jcbrand added a commit that referenced this issue Nov 23, 2020
jcbrand added a commit that referenced this issue Nov 23, 2020
jcbrand added a commit that referenced this issue Nov 24, 2020
Fixes #1083

Directives are rendered as templates and their bodies are MessageText instances.
We thereby achieve the necessary nesting of directives (and other rich
elements inside directives) by letting each directive
body render itself similarly to how the whole message body is rendered.
jcbrand added a commit that referenced this issue Nov 24, 2020
Fixes #1083

Directives are rendered as templates and their bodies are MessageText instances.
We thereby achieve the necessary nesting of directives (and other rich
elements inside directives) by letting each directive
body render itself similarly to how the whole message body is rendered.
jcbrand added a commit that referenced this issue Nov 24, 2020
Fixes #1083

Directives are rendered as templates and their bodies are MessageText instances.
We thereby achieve the necessary nesting of directives (and other rich
elements inside directives) by letting each directive
body render itself similarly to how the whole message body is rendered.
jcbrand added a commit that referenced this issue Nov 24, 2020
Fixes #1083

Directives are rendered as templates and their bodies are MessageText instances.
We thereby achieve the necessary nesting of directives (and other rich
elements inside directives) by letting each directive
body render itself similarly to how the whole message body is rendered.
jcbrand added a commit that referenced this issue Nov 24, 2020
Fixes #1083

Directives are rendered as templates and their bodies are MessageText instances.
We thereby achieve the necessary nesting of directives (and other rich
elements inside directives) by letting each directive
body render itself similarly to how the whole message body is rendered.
jcbrand added a commit that referenced this issue Nov 24, 2020
Fixes #1083

Directives are rendered as templates and their bodies are MessageText instances.
We thereby achieve the necessary nesting of directives (and other rich
elements inside directives) by letting each directive
body render itself similarly to how the whole message body is rendered.
jcbrand added a commit that referenced this issue Nov 24, 2020
Fixes #1083

Directives are rendered as templates and their bodies are MessageText instances.
We thereby achieve the necessary nesting of directives (and other rich
elements inside directives) by letting each directive
body render itself similarly to how the whole message body is rendered.
jcbrand added a commit that referenced this issue Nov 24, 2020
Fixes #1083

Directives are rendered as templates and their bodies are MessageText instances.
We thereby achieve the necessary nesting of directives (and other rich
elements inside directives) by letting each directive
body render itself similarly to how the whole message body is rendered.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants