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
use one source for handling events
ammarahm-ed37440f968107
diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/item.js b/apps/mobile/src/views/Editor/tiny/toolbar/item.jsindex 004b105b3..3568a5eb2 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/item.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/item.js@@ -37,7 +37,7 @@ const ToolbarItem = ({groupType,text,formatValue,- fullname+ fullname,}) => {const [state] = useTracked();const {colors} = state;@@ -76,6 +76,18 @@ const ToolbarItem = ({setSelected(false);return;}++ if (format === 'link') {+ properties.selection = data;+ properties.pauseSelectionChange = true;+ eSendEvent('showTooltip', {+ data: null,+ value: data['link'],+ type: 'link',+ });+ return;+ }+if (data[format]?.startsWith('#')) {setColor(data[format]);} else {@@ -207,7 +219,7 @@ const ToolbarItem = ({return;}- if (format === "image") {+ if (format === 'image') {execCommands.image();return;}diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/tooltip.js b/apps/mobile/src/views/Editor/tiny/toolbar/tooltip.jsindex 2ed07f646..e8b1935ba 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/tooltip.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/tooltip.js@@ -33,41 +33,7 @@ const Tooltip = () => {eUnSubscribeEvent('showTooltip', show);};}, []);-- useEffect(() => {- eSubscribeEvent('onSelectionChange', onSelectionChange);- return () => {- eUnSubscribeEvent('onSelectionChange', onSelectionChange);- };- }, []);-- const onSelectionChange = (data) => {- if (properties.pauseSelectionChange) return;- if (data['link']) {- properties.selection = data;- properties.pauseSelectionChange = true;- show({- data: null,- value: data['link'],- type: 'link',- });- } else if (data['video']) {- properties.selection = data;- properties.pauseSelectionChange = true;- show({- data: null,- value: data['video'],- type: 'video',- format: 'format',- });- } else {- if (editing.tooltip !== 'background' && editing.tooltip !== 'color') {- setVisible(false);- eSendEvent('showTooltip');- editing.tooltip = null;- }- }- };+const show = (data) => {properties.userBlur = true;@@ -81,9 +47,7 @@ const Tooltip = () => {};let ParentElement = (props) =>- group.type === 'link' ||- group.type === 'video' ||- group.type === 'table' ? (+ group.type === 'link' || group.type === 'table' ? (<Viewstyle={{borderRadius: floating ? 5 : 0,@@ -137,7 +101,7 @@ const Tooltip = () => {return (visible && (<ParentElement>- {!group.data && (group.type === 'link' || group.type === 'video') && (+ {!group.data && /^(link|video|)$/.test(group.type) && (<ToolbarLinkInputformat={group.type}setVisible={setVisible}@@ -204,13 +168,12 @@ const Tooltip = () => {</View>)}- {group.type === 'hilitecolor' || group.type === 'forecolor' ? (+ {/^(hilitecolor|forecolor|)$/.test(group.type) ? (<ColorGroup group={group} />) : null}{group.data &&- group.type !== 'hilitecolor' &&- group.type !== 'forecolor' &&+ /^(hilitecolor|forecolor|)$/.test(group.type) === false &&group.data.map((item) =>group.type === 'link' || group.type === 'video' ? (<ToolbarLinkInput