Comments (6)
If I understand correctly I have the same issue. I am calling a remote function that returns HTML formatted text I want to display - using the HTML formatting. However I have not found a way to make this happen.
Here is my template (Widget, group scoped)
The problem appears to be that my text is injected into the generated HTML as a quoted string - and because it is quoted the embedded html controls are ignored. This is what I see when I inspect my web page:
Thanks for your help
Colin
from node-red-dashboard.
This is a very difficult thing to get right given the lifecycle of events that needs to take place. The steps are as follows:
- Config for the node is received with
content
defined - Parse
content
and convert it from markdown to HTML - Bind the resulting HTML to the
template
of the Vue component- This triggers Vue internals to parse of any HTML tags, etc, and allow for injection of
{{ msg.<stuff> }}
- This triggers Vue internals to parse of any HTML tags, etc, and allow for injection of
- On receiving a new
msg
, we replace any appearances of{{ msg.<stuff> }}
with the relevant value received - We run the
renderMermaid
function to parse any mermaid content
This falls over because it's possible for the {{ msg.<stuff> }}
to contain HTML/Markdown, which is not re-parsed by VueJS at that point.
from node-red-dashboard.
Commenting on the above I'm not sure it is clear what I'm saying:
- when defining HTML content in a (non-ui) template node and sending it to the UI-template node (which should render HTML), this does not work
-
- when defining Markdown in a (non-ui) template node and sending it to the UI-Markdown node (which should render Markdown) this does not work
And with "this does not work" I mean: the defined content is not displayed in the UI node, and we've even experienced lockups of the entire UI\Dashboard2 (by simply sending HTML to a UI-template node).
I am not asking to rewrite\convert markdown to HTML, that would not make sense (i.e. just use the correct content node). But I would like to be able to just define markdown as a template and send that to and have it rendered by the UI-Markdown node. Same for HTML.
Why: this allows to have one (1) markdown\html node on the dashboard the (entire) content of which can change dynamically.
And this was not working at the time of issue submission.
from node-red-dashboard.
Hi Joe
Thanks for your quick reply.
I also experienced lockups of the entire dashboard when I was experimenting with this - Sorry, I did not pursue this to document exactly how to reproduce the issue. Now I have tidied my code that problem has gone away. If I hit it again I'll document the issue properly.
Re the text formatting. I was mislead by the HTML displayed by Chrome inspect. Copying to notepad I can see the problem is my text has had the HTML control characters escaped so that the exact text I supply is displayed. In most cases this is what is wanted... But not always. To handle this we would need a switch - some way of telling the system not to escape the inserted text.
Markdown uses different controls, perhaps I can use this...
"To create paragraphs, use a blank line to separate one or more lines of text."
"To create a line break or new line (
), end a line with two or more spaces, and then type return."
No joy :-(
The problem appears to be the Markdown processing is done before my text is inserted - the controls I put in the Markdown widget definition work as they should. The same controls in the inserted text do not.
Here is my markdown definition
Here is what I see on the dashboard
I think this is wrong. Text should be inserted before the markdown processing.
All I want to do is display a plain text log file. The only formatting I need is line feed. Is there another way?
Thanks again
Colin
from node-red-dashboard.
This is similar to #715 "support HTML in msg.payload of ui-text."
from node-red-dashboard.
@colin-grierson : discovered this week that using <pre> {{msg.payload}} </pre>
in a ui-template node will display JSON in a (more or less) correct format. Maybe this is of some help..
from node-red-dashboard.
Related Issues (20)
- Informational question: gestures support HOT 7
- 'Widget load' event triggered only when there is data for the node in the Node-red datastore HOT 1
- Add new Teleport for app-bar-title HOT 2
- ui-template: template is not rendered until content is sent HOT 5
- DB2 \ Layout \ Pages keeps resetting to expanded view. HOT 3
- Include VSparkline for use in ui-template HOT 4
- ui-table: add inital Row setting to Items per page dropdown HOT 2
- ui-table: possibility to hide array values that are displayed HOT 3
- Add a way to move a group to other page using "UI Control" node .
- Dashboard does not reconnect if network is down for a significant time. HOT 1
- Ditch the Connection Re-established popup! HOT 7
- After multiple/quick dashboard reload top-bar and side-bar disappear HOT 5
- Form - Add option to allow Drop Down as an element HOT 1
- Form - Allow the Form elements to be sized similar group sizing.
- The presence of a v-switch in a ui-template affects the positioning of core ui-switch node
- PWA feature - problem with Google Oauth authentication (and probably other similar systems) HOT 45
- Radio button group: programatic setting does not work anymore HOT 18
- Add "development" NODE_ENV option for build HOT 4
- Add a way to pass parameters to a page HOT 3
- No Longer possible to change the "favicon" HOT 19
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-red-dashboard.