delay injecting scripts on app load

This commit is contained in:
ammarahm-ed
2021-02-06 13:29:23 +05:00
parent 8419aefb74
commit 98383dc484
2 changed files with 13 additions and 2 deletions

View File

@@ -1,3 +1,5 @@
import {EditorWebView, getWebviewInit} from '../Functions';
const reset = `
isLoading = true;
document.getElementById("titleInput").value = '';
@@ -122,7 +124,14 @@ tinymce.activeEditor.focus();
`;
function call(webview, func) {
webview.current?.injectJavaScript(func);
if (getWebviewInit()) {
webview.current?.injectJavaScript(func);
} else {
setTimeout(() => {
console.log('run after delay');
webview.current?.injectJavaScript(func);
}, 1000);
}
}
const undo = `

View File

@@ -291,7 +291,8 @@ const ToolbarItem = ({
<Paragraph
size={SIZE.md}
color={selected ? colors.accent : colors.pri}>
{formatValue || currentText}
{formatValue || currentText || "12pt"}
</Paragraph>
) : text && groupFormat !== 'header' ? (
<Paragraph
@@ -307,6 +308,7 @@ const ToolbarItem = ({
}}
size={SIZE.md}>
{currentText || text}
</Paragraph>
) : (
<Icon