Merge pull request #608 from jimspillane/AddJavaScriptDependencyManager
Add JavaScript dependency manager
This commit is contained in:
@ -117,6 +117,11 @@
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
var oqtaneInterop = new Interop(JsRuntime);
|
||||
|
||||
await oqtaneInterop.LoadInteropScript("js/quill-interop.js");
|
||||
|
||||
|
||||
var interop = new RichTextEditorInterop(JsRuntime);
|
||||
|
||||
await interop.CreateEditor(
|
||||
|
@ -13,7 +13,7 @@ namespace Oqtane.Modules.Controls
|
||||
_jsRuntime = jsRuntime;
|
||||
}
|
||||
|
||||
public Task CreateEditor(
|
||||
public async Task CreateEditor(
|
||||
ElementReference quillElement,
|
||||
ElementReference toolbar,
|
||||
bool readOnly,
|
||||
@ -23,15 +23,14 @@ namespace Oqtane.Modules.Controls
|
||||
{
|
||||
try
|
||||
{
|
||||
_jsRuntime.InvokeAsync<object>(
|
||||
await _jsRuntime.InvokeAsync<object>(
|
||||
"Oqtane.RichTextEditor.createQuill",
|
||||
quillElement, toolbar, readOnly,
|
||||
placeholder, theme, debugLevel);
|
||||
return Task.CompletedTask;
|
||||
quillElement, toolbar, readOnly, placeholder, theme, debugLevel);
|
||||
return;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
// handle exception
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -29,10 +29,7 @@
|
||||
new Resource { ResourceType = ResourceType.Stylesheet, Url = ModulePath() + "Module.css" },
|
||||
// the following resources should be declared in the RichTextEditor component however the framework currently only supports resource management for modules and themes
|
||||
new Resource { ResourceType = ResourceType.Stylesheet, Url = "css/quill/quill1.3.6.bubble.css" },
|
||||
new Resource { ResourceType = ResourceType.Stylesheet, Url = "css/quill/quill1.3.6.snow.css" },
|
||||
new Resource { ResourceType = ResourceType.Script, Url = "js/quill1.3.6.min.js" },
|
||||
new Resource { ResourceType = ResourceType.Script, Url = "js/quill-blot-formatter.min.js" },
|
||||
new Resource { ResourceType = ResourceType.Script, Url = "js/quill-interop.js" }
|
||||
new Resource { ResourceType = ResourceType.Stylesheet, Url = "css/quill/quill1.3.6.snow.css" }
|
||||
};
|
||||
|
||||
private RichTextEditor RichTextEditorHtml;
|
||||
|
@ -234,5 +234,18 @@ namespace Oqtane.UI
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task LoadInteropScript(string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _jsRuntime.InvokeAsync<bool>("Oqtane.Interop.loadInteropScript", filePath);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// handle exception
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user