1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-24 08:12:24 +02:00

Desktop: WYSIWYG: Prevent scripts from loading multiple times

This commit is contained in:
Laurent Cozic 2020-03-29 20:06:13 +01:00
parent 1c938a5998
commit e095369e1a

View File

@ -388,13 +388,17 @@ const TinyMCE = (props:TinyMCEProps, ref:any) => {
// -----------------------------------------------------------------------------------------
const loadDocumentAssets = (editor:any, pluginAssets:any[]) => {
const cssFiles = ['css/fork-awesome.min.css'].concat(pluginAssets
.filter((a:any) => a.mime === 'text/css' && !loadedAssetFiles_.includes(a.path))
.map((a:any) => a.path));
const cssFiles = ['css/fork-awesome.min.css'].concat(
pluginAssets
.filter((a:any) => a.mime === 'text/css')
.map((a:any) => a.path)
).filter((path:string) => !loadedAssetFiles_.includes(path));
const jsFiles = ['gui/editors/TinyMCE/content_script.js'].concat(pluginAssets
.filter((a:any) => a.mime === 'application/javascript' && !loadedAssetFiles_.includes(a.path))
.map((a:any) => a.path));
const jsFiles = ['gui/editors/TinyMCE/content_script.js'].concat(
pluginAssets
.filter((a:any) => a.mime === 'application/javascript')
.map((a:any) => a.path)
).filter((path:string) => !loadedAssetFiles_.includes(path));
for (const cssFile of cssFiles) loadedAssetFiles_.push(cssFile);
for (const jsFile of jsFiles) loadedAssetFiles_.push(jsFile);