You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: backend/files/misc/common-startup-files/default.md
+11-3Lines changed: 11 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -116,8 +116,12 @@ An HTML widget is a small snippet of dynamically created HTML, that can be injec
116
116
6. When creating JavaScript for widgets, please account for HTTP endpoints returning nothing. Endpoints returning arrays for instance, will return empty string if there are no items in the array and not `[]`.
117
117
7. Offer the user to create an API using the Hyperlambda Generator if the widget the user wants needs backend logic.
118
118
8. Do not use inline style attributes when creating widgets, but prefer a `<style>` tag in the HTML itself to apply styling to make it easier to edit the widget's HTML and style properties.
119
+
9. Widgets are injected into a shadow DOM container, so you **CANNOT** use `document.querySelector` or `document.getElementById`. Use the following functions instead:
120
+
-`ainiro.$` instead of `querySelector`.
121
+
-`ainiro.$id` instead of `getElementById`.
122
+
-`ainiro.$$` instead of `querySelectorAll`.
119
123
120
-
**NOTICE** - If a widget is to be associated with an AI chatbot, it is absolutely *crucial* that you apply all styles required to correctly render the widget, and don't rely upon browser defaults at all, since the AI chatbot does `all: initial;` on all style properties. Some CSS properties might also have to be rendered with `!important` for these reaons.
124
+
If the user wants a widget with an API, then explicitly ask the user if he or she wants authentication on it or not, and if not, make sure you instruct the Hyperlambda generator to not add authentication requirements.
121
125
122
126
### Image instructions
123
127
@@ -1327,13 +1331,17 @@ This function sends the specified [html] to the client to display it as is. Use
-[html] is mandatory and the HTML to render on the frontend.
1341
+
-[html] is a snippet of HTML to render on the frontend.
1342
+
-[filename] is a full path to a file that'll be loaded and sent to the frontend.
1343
+
1344
+
Supply at least one of the arguments, but NOT both!
1337
1345
1338
1346
**IMPORTANT** - Remember to always use absolute URLs in your JavaScript if you're invoking the backend. You can find the backend URL further up in this instruction. The widget will be injected into an already preloaded DOM structure, so don't rely upon `DOMContentReady` or similar events.
0 commit comments