fix JS Interop methods for includeScript and includeMeta
This commit is contained in:
parent
26e628e189
commit
075a09f0df
|
@ -60,13 +60,13 @@ namespace Oqtane.UI
|
|||
}
|
||||
}
|
||||
|
||||
public Task IncludeMeta(string id, string attribute, string name, string content, string key)
|
||||
public Task IncludeMeta(string id, string attribute, string name, string content)
|
||||
{
|
||||
try
|
||||
{
|
||||
_jsRuntime.InvokeVoidAsync(
|
||||
"Oqtane.Interop.includeMeta",
|
||||
id, attribute, name, content, key);
|
||||
id, attribute, name, content);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
catch
|
||||
|
@ -105,6 +105,7 @@ namespace Oqtane.UI
|
|||
}
|
||||
}
|
||||
|
||||
// external scripts need to specify src, inline scripts need to specify id and content
|
||||
public Task IncludeScript(string id, string src, string integrity, string crossorigin, string content, string location)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -27,14 +27,8 @@ Oqtane.Interop = {
|
|||
document.title = title;
|
||||
}
|
||||
},
|
||||
includeMeta: function (id, attribute, name, content, key) {
|
||||
var meta;
|
||||
if (id !== "" && key === "id") {
|
||||
meta = document.getElementById(id);
|
||||
}
|
||||
else {
|
||||
meta = document.querySelector("meta[" + attribute + "=\"" + CSS.escape(name) + "\"]");
|
||||
}
|
||||
includeMeta: function (id, attribute, name, content) {
|
||||
var meta = document.querySelector("meta[" + attribute + "=\"" + CSS.escape(name) + "\"]");
|
||||
if (meta === null) {
|
||||
meta = document.createElement("meta");
|
||||
meta.setAttribute(attribute, name);
|
||||
|
@ -120,7 +114,13 @@ Oqtane.Interop = {
|
|||
}
|
||||
},
|
||||
includeScript: function (id, src, integrity, crossorigin, content, location) {
|
||||
var script = document.querySelector("script[src=\"" + CSS.escape(src) + "\"]");
|
||||
var script;
|
||||
if (src !== "") {
|
||||
script = document.querySelector("script[src=\"" + CSS.escape(src) + "\"]");
|
||||
}
|
||||
else {
|
||||
script = document.getElementById(id);
|
||||
}
|
||||
if (script === null) {
|
||||
script = document.createElement("script");
|
||||
if (id !== "") {
|
||||
|
|
Loading…
Reference in New Issue
Block a user