1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Mobile: Resolves #9195: Update js-draw to version 1.11.2 (#9120)

This commit is contained in:
Henry Heino
2023-11-12 07:04:55 -08:00
committed by GitHub
parent fb47398554
commit bd1ddb8522
3 changed files with 33 additions and 23 deletions

View File

@ -11,6 +11,8 @@ import { WebViewMessageEvent } from 'react-native-webview';
import ExtendedWebView, { WebViewControl } from '../../ExtendedWebView';
import { clearAutosave, writeAutosave } from './autosave';
import { LocalizedStrings } from './js-draw/types';
import VersionInfo from 'react-native-version-info';
const logger = Logger.create('ImageEditor');
@ -166,6 +168,13 @@ const ImageEditor = (props: Props) => {
redo: _('Redo'),
}), []);
const appInfo = useMemo(() => {
return {
name: 'Joplin',
description: `v${VersionInfo.appVersion}`,
};
}, []);
const injectedJavaScript = useMemo(() => `
window.onerror = (message, source, lineno) => {
window.ReactNativeWebView.postMessage(
@ -229,6 +238,7 @@ const ImageEditor = (props: Props) => {
${JSON.stringify(Setting.value('imageeditor.jsdrawToolbar'))},
${JSON.stringify(Setting.value('locale'))},
${JSON.stringify(localizedStrings)},
${JSON.stringify({ appInfo })},
);
// Start loading the SVG file (if present) after loading the editor.
@ -242,7 +252,7 @@ const ImageEditor = (props: Props) => {
);
}
true;
`, [localizedStrings]);
`, [localizedStrings, appInfo]);
useEffect(() => {
webviewRef.current?.injectJS(`