Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix share extension theme at night

ammarahm-edc889297923cb
diff --git a/apps/mobile/html/Web.bundle/site/constants.js b/apps/mobile/html/Web.bundle/site/constants.js
index 911134bb8..52171dd21 100755
--- a/apps/mobile/html/Web.bundle/site/constants.js
+++ b/apps/mobile/html/Web.bundle/site/constants.js
@@ -365,12 +365,13 @@ code {
}
`;
- if (!tinymce.activeEditor) return;
- let editorHead =
- tinymce.activeEditor.contentDocument.getElementsByTagName('head')[0];
- let css2 = document.createElement('style');
- css2.appendChild(document.createTextNode(node2));
- editorHead.appendChild(css2);
+ if (tinymce.activeEditor) {
+ let editorHead =
+ tinymce.activeEditor.contentDocument.getElementsByTagName('head')[0];
+ let css2 = document.createElement('style');
+ css2.appendChild(document.createTextNode(node2));
+ editorHead.appendChild(css2);
+ }
css.appendChild(document.createTextNode(node));
document.getElementsByTagName('head')[0].appendChild(css);
diff --git a/apps/mobile/share/index.js b/apps/mobile/share/index.js
index b19217288..356d90569 100644
--- a/apps/mobile/share/index.js
+++ b/apps/mobile/share/index.js
@@ -57,7 +57,10 @@ function makeHtmlFromUrl(url) {
function makeHtmlFromPlainText(text) {
if (!text) return '';
- return `<p style="overflow-wrap:anywhere;white-space:pre-wrap" >${text.replace(/(?:\r\n|\r|\n)/g, '<br>')}</p>`;
+ return `<p style="overflow-wrap:anywhere;white-space:pre-wrap" >${text.replace(
+ /(?:\r\n|\r|\n)/g,
+ '<br>'
+ )}</p>`;
}
function getBaseUrl(site) {
@@ -156,7 +159,6 @@ const NotesnookShare = ({quicknote = false}) => {
const onKeyboardDidShow = event => {
let kHeight = event.endCoordinates.height;
keyboardHeight.current = kHeight;
-
};
const onKeyboardDidHide = () => {
@@ -253,9 +255,15 @@ const NotesnookShare = ({quicknote = false}) => {
webviewRef.current?.injectJavaScript(`document
.querySelector('.htmldiff_div')
.setAttribute('contenteditable', 'true');`);
+ webviewRef.current.injectJavaScript(`
+ pageTheme.colors = ${theme};
+ setTheme();
+ `);
+
}, 300);
let theme = {...colors};
theme.factor = 1;
+
postMessage(webviewRef, 'theme', JSON.stringify(theme));
};
@@ -485,7 +493,7 @@ const NotesnookShare = ({quicknote = false}) => {
) : null}
<AnimatedKAV
- enabled={!floating }
+ enabled={!floating}
onLayout={event => {
if (prevAnimation.current === 0) return;
translate.setValue(event.nativeEvent.layout.height + 30);
@@ -505,7 +513,7 @@ const NotesnookShare = ({quicknote = false}) => {
<View
style={{
maxHeight: '100%',
- paddingHorizontal: 12,
+ paddingHorizontal: 12
}}>
<ScrollView
horizontal
@@ -603,7 +611,8 @@ const NotesnookShare = ({quicknote = false}) => {
style={{
width: '100%',
height: '100%',
- borderRadius: 10
+ borderRadius: 10,
+ backgroundColor:'transparent'
}}
cacheMode="LOAD_DEFAULT"
domStorageEnabled={true}