A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
disable markdown patterns for free users
ammarahm-ed7be6b1686f43
diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.jsindex 9cacc2a1e..ee2988115 100644--- a/apps/mobile/src/views/Editor/Functions.js+++ b/apps/mobile/src/views/Editor/Functions.js@@ -5,6 +5,7 @@ import {Actions} from '../../provider/Actions';import {DDS} from '../../services/DeviceDetection';import {eSendEvent, sendNoteEditedEvent} from '../../services/EventManager';import Navigation from '../../services/Navigation';+import PremiumService from '../../services/PremiumService';import {editing, InteractionManager} from '../../utils';import {COLORS_NOTE, COLOR_SCHEME} from '../../utils/Colors';import {hexToRGBA} from '../../utils/ColorUtils';@@ -305,6 +306,11 @@ export const _onMessage = async evt => {setColors(COLOR_SCHEME);webviewInit = true;webviewOK = true;+ if (PremiumService.get()){+ tiny.call(EditorWebView,tiny.setMarkdown,true)+ } else {+ tiny.call(EditorWebView,tiny.removeMarkdown,true)+ }loadNoteInEditor();break;case 'running':@@ -475,6 +481,11 @@ export async function onWebViewLoad(premium, colors) {if (!checkNote()) {Platform.OS === 'android' ? EditorWebView.current?.requestFocus() : null;}+ if (premium){+ tiny.call(EditorWebView,tiny.setMarkdown,true)+ } else {+ tiny.call(EditorWebView,tiny.removeMarkdown,true)+ }setColors(colors);}diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.jsindex c20c61c6d..67a7ed6c6 100755--- a/apps/mobile/src/views/Editor/index.js+++ b/apps/mobile/src/views/Editor/index.js@@ -25,6 +25,7 @@ import {_onMessage,_onShouldStartLoadWithRequest,} from './Functions';+import tiny from './tiny/tiny';import EditorToolbar from './tiny/toolbar';const source =@@ -48,11 +49,18 @@ const Editor = React.memo(const [state] = useTracked();const {premiumUser} = state;const [resetting, setResetting] = useState(false);- const insets = useSafeAreaInsets();const onLoad = async () => {await onWebViewLoad(premiumUser, getCurrentColors());};+ useEffect(()=>{+ if (premiumUser) {+ tiny.call(EditorWebView,tiny.setMarkdown,true)+ }+ },[premiumUser])+++const onResetRequested = async noload => {setResetting(true);await sleep(30);diff --git a/apps/mobile/src/views/Editor/tiny/tiny.js b/apps/mobile/src/views/Editor/tiny/tiny.jsindex 44cdf2c15..d562b88a3 100644--- a/apps/mobile/src/views/Editor/tiny/tiny.js+++ b/apps/mobile/src/views/Editor/tiny/tiny.js@@ -17,6 +17,13 @@ document.activeElement.blur();window.blur();`;+const removeMarkdown = `+ tinymce.activeEditor.plugins.textpattern.setPatterns("")+`+const setMarkdown = `+ tinymce.activeEditor.plugins.textpattern.setPatterns(markdownPatterns)+`+const keyboardStateChanged = `(() => {let node = tinymce.activeEditor.selection.getNode();node.scrollIntoView({behavior: "smooth", block: "end"});@@ -209,4 +216,6 @@ export default {keyboardStateChanged,onKeyboardShow,pre,+ setMarkdown,+ removeMarkdown};