1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-27 10:32:58 +02:00

Desktop: Fixes #9966: Beta editor plugins: Fix newlines break content scripts (#9967)

This commit is contained in:
Henry Heino 2024-02-22 07:36:10 -08:00 committed by GitHub
parent 2e3783f1c6
commit 4a61ff2df3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -72,6 +72,7 @@ describe('createEditor', () => {
return ` return `
exports.default = context => { exports.default = context => {
context.postMessage(context.pluginId); context.postMessage(context.pluginId);
return {};
}; };
`; `;
}); });
@ -138,6 +139,7 @@ describe('createEditor', () => {
return ` return `
exports.default = context => { exports.default = context => {
context.postMessage(context.pluginId); context.postMessage(context.pluginId);
return {};
}; };
`; `;
}); });

View File

@ -75,7 +75,7 @@ export default class PluginLoader {
return; return;
} }
scriptElement.innerText = ` scriptElement.appendChild(document.createTextNode(`
(async () => { (async () => {
const exports = {}; const exports = {};
const require = window.__pluginLoaderRequireFunctions[${JSON.stringify(this.pluginLoaderId)}]; const require = window.__pluginLoaderRequireFunctions[${JSON.stringify(this.pluginLoaderId)}];
@ -87,7 +87,7 @@ export default class PluginLoader {
window.__pluginLoaderScriptLoadCallbacks[${JSON.stringify(scriptId)}](exports); window.__pluginLoaderScriptLoadCallbacks[${JSON.stringify(scriptId)}](exports);
})(); })();
`; `));
(window as any).__pluginLoaderScriptLoadCallbacks[scriptId] = onLoad; (window as any).__pluginLoaderScriptLoadCallbacks[scriptId] = onLoad;