You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-08-10 22:11:50 +02:00
This commit is contained in:
@@ -49,6 +49,13 @@ const useWebViewSetup = ({
|
|||||||
|
|
||||||
const injectedJavaScript = useMemo(() => `
|
const injectedJavaScript = useMemo(() => `
|
||||||
if (!window.cm) {
|
if (!window.cm) {
|
||||||
|
const parentClassName = ${JSON.stringify(editorOptions.parentElementClassName)};
|
||||||
|
const foundParent = document.getElementsByClassName(parentClassName).length > 0;
|
||||||
|
|
||||||
|
// On Android, injectedJavaScript can be run multiple times, including once before the
|
||||||
|
// document has loaded. To avoid logging an error each time the editor starts, don't throw
|
||||||
|
// if the parent element can't be found:
|
||||||
|
if (foundParent) {
|
||||||
${shim.injectedJs('markdownEditorBundle')};
|
${shim.injectedJs('markdownEditorBundle')};
|
||||||
markdownEditorBundle.setUpLogger();
|
markdownEditorBundle.setUpLogger();
|
||||||
|
|
||||||
@@ -65,6 +72,9 @@ const useWebViewSetup = ({
|
|||||||
window.onresize = () => {
|
window.onresize = () => {
|
||||||
cm.execCommand('scrollSelectionIntoView');
|
cm.execCommand('scrollSelectionIntoView');
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
console.log('No parent element found with class name ', parentClassName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`, [jumpToHashJs, setInitialSearchJs, setInitialSelectionJs, editorOptions]);
|
`, [jumpToHashJs, setInitialSearchJs, setInitialSelectionJs, editorOptions]);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user