diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-07-26 00:39:23 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-07-26 00:39:23 +0530 |
| commit | 3f56d76a2b0d528c05ab8d0a38059ca82ba90952 (patch) | |
| tree | daae7849815c122803f8ddd08cbfcb87552eab8a /lua | |
| parent | 031b22e0bb0f1d132731aea3776917731a8ab4ce (diff) | |
| download | null-browser-3f56d76a2b0d528c05ab8d0a38059ca82ba90952.tar.gz null-browser-3f56d76a2b0d528c05ab8d0a38059ca82ba90952.zip | |
Add set_html for views + example use with decorations
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/null-browser/api.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lua/null-browser/api.lua b/lua/null-browser/api.lua index a414522..62dfc76 100644 --- a/lua/null-browser/api.lua +++ b/lua/null-browser/api.lua @@ -111,6 +111,21 @@ function web.view.select(view_id) return __internals.view_select(view_id) end --- ``` function web.view.set_url(url, view_id) return __internals.view_set_url(url, view_id) end +--- @class SetHTMLOpts +--- @field view? number View id + +--- Set html in a given view +--- +--- @param html string HTML string +--- @param opts? SetHTMLOpts Options +--- +--- @example +--- ```lua +--- web.view.set_html('<h2>HJello</h2>') +--- web.view.set_html('<h2>HJello</h2>', 3) -- Set html for view with id 3 +--- ``` +function web.view.set_html(html, opts) return __internals.view_set_html(html, (opts or {}).view) end + --- Open devtools window for the view --- --- @param view_id? number Id of the view |
