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
fix search replace & input event not firing
ammarahm-ed0e112d22f3c5
diff --git a/apps/mobile/src/views/Editor/TableCellProperties.js b/apps/mobile/src/views/Editor/TableCellProperties.jsindex 2c7628377..2d5c6c23b 100644--- a/apps/mobile/src/views/Editor/TableCellProperties.js+++ b/apps/mobile/src/views/Editor/TableCellProperties.js@@ -51,7 +51,7 @@ export const TableCellProperties = ({ data }) => {let node = editor.selection.getNode();node.style.width = "${width}";tableCellNodeOptions();- editor.fire("input");+ editor.fire("input",{data:""});})()`);}@@ -70,7 +70,7 @@ export const TableCellProperties = ({ data }) => {let node = editor.selection.getNode();node.style.width = "${width}";tableCellNodeOptions();- editor.fire("input");+ editor.fire("input",{data:""});})()`);}@@ -81,7 +81,7 @@ export const TableCellProperties = ({ data }) => {`tinymce.activeEditor.execCommand('mceTableCellType', false, { type: '${type}' });tableCellNodeOptions();- editor.fire("input");+ editor.fire("input",{data:""});`);}@@ -92,7 +92,7 @@ export const TableCellProperties = ({ data }) => {`tinymce.activeEditor.execCommand('mceTableColType', false, { type: '${type}' });tableCellNodeOptions();- editor.fire("input");+ editor.fire("input",{data:""});`);}@@ -247,7 +247,7 @@ export const TableCellProperties = ({ data }) => {let node = editor.selection.getNode();node.style.backgroundColor = "${color}";tableCellNodeOptions();- editor.fire("input");+ editor.fire("input",{data:""})})()`);}}diff --git a/apps/mobile/src/views/Editor/TableRowProperties.js b/apps/mobile/src/views/Editor/TableRowProperties.jsindex b48b0d86d..d98bf08fa 100644--- a/apps/mobile/src/views/Editor/TableRowProperties.js+++ b/apps/mobile/src/views/Editor/TableRowProperties.js@@ -41,7 +41,7 @@ export const TableRowProperties = ({ data }) => {`tinymce.activeEditor.execCommand('mceTableRowType', false, { type: '${type}' });tableRowNodeOptions();- editor.fire("input");+ editor.fire("input",{data:""});`);};@@ -122,7 +122,7 @@ export const TableRowProperties = ({ data }) => {if (node) {node.style.backgroundColor = "${color}";tableRowNodeOptions();- editor.fire("input");+ editor.fire("input",{data:""});}})()`@@ -167,6 +167,8 @@ export const TableRowProperties = ({ data }) => {});}});++ editor.fire("input",{data:""});}})()`diff --git a/apps/mobile/src/views/Editor/tiny/tiny.js b/apps/mobile/src/views/Editor/tiny/tiny.jsindex 1053d10c2..07c660222 100644--- a/apps/mobile/src/views/Editor/tiny/tiny.js+++ b/apps/mobile/src/views/Editor/tiny/tiny.js@@ -73,7 +73,7 @@ const pre = `(function() {});});tinymce.activeEditor.selection.setRng(rng, true);- tinymce.activeEditor.fire("input");+ tinymce.activeEditor.fire("input",{data:""})};let node = tinymce.activeEditor.selection.getNode();diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/commands.js b/apps/mobile/src/views/Editor/tiny/toolbar/commands.jsindex 9c5d67567..aeeef8003 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/commands.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/commands.js@@ -63,7 +63,7 @@ export const execCommands = {if (body.lastElementChild && body.lastElementChild.innerHTML === tinymce.activeEditor.selection.getNode().innerHTML) {let rng = tinymce.activeEditor.selection.getRng()tinymce.activeEditor.execCommand("mceInsertNewLine")- tinymce.activeEditor.fire("input");+ tinymce.activeEditor.fire("input",{data:""})tinymce.activeEditor.selection.setRng(rng)}editor.undoManager.transact(function() {@@ -123,7 +123,7 @@ export const execCommands = {if (tinymce.activeEditor.selection.getNode().tagName === 'IMG') {tinymce.activeEditor.undoManager.transact(function() {tinymce.activeEditor.execCommand('Delete');});setTimeout(function() {- tinymce.activeEditor.fire("input");+ tinymce.activeEditor.fire("input",{data:""})},100)}})();@@ -146,7 +146,7 @@ const setFloat = float => `(function () {tinymce.activeEditor.undoManager.transact(function() {node.style.float = "${float}";setTimeout(function() {- tinymce.activeEditor.fire("input");+ tinymce.activeEditor.fire("input",{data:""})},100)});}@@ -169,7 +169,7 @@ if (tinymce.activeEditor.selection.getNode().tagName === 'IMG') {node.width = originalWidth * ${size}setTimeout(function() {- tinymce.activeEditor.fire("input");+ tinymce.activeEditor.fire("input",{data:""})},100)});}diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/index.js b/apps/mobile/src/views/Editor/tiny/toolbar/index.jsindex 508ce2730..85904c6b1 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/index.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/index.js@@ -1,4 +1,4 @@-import React, { useEffect, useState } from 'react';+import React, { useEffect } from 'react';import { ScrollView, View } from 'react-native';import { ActionIcon } from '../../../../components/ActionIcon';import { useTracked } from '../../../../provider';@@ -10,7 +10,7 @@ import { EditorWebView, getNote, setNoteOnly } from '../../Functions';import HistoryComponent from '../../HistoryComponent';import tiny from '../tiny';import { TOOLBAR_CONFIG } from './config';-import { focusEditor, properties, reFocusEditor, toolbarRef } from './constants';+import { properties, toolbarRef } from './constants';import ToolbarGroup from './group';import SearcReplace from './searchreplace';import Tooltip from './tooltip';diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/picker.js b/apps/mobile/src/views/Editor/tiny/toolbar/picker.jsindex 47a440185..5f4fff653 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/picker.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/picker.js@@ -124,7 +124,7 @@ const file = async () => {editor.undoManager.transact(function() {tinymce.activeEditor.execCommand('mceAttachFile',file);setTimeout(function() {- tinymce.activeEditor.fire("input");+ tinymce.activeEditor.fire("input",{data:""})},100)});@@ -285,7 +285,7 @@ const handleImageResponse = async response => {editor.undoManager.transact(function() {tinymce.activeEditor.execCommand('mceAttachImage',image);setTimeout(function() {- tinymce.activeEditor.fire("input");+ tinymce.activeEditor.fire("input",{data:""})},100)});})();diff --git a/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.js b/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.jsindex 3929bad16..d7114d70f 100644--- a/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.js+++ b/apps/mobile/src/views/Editor/tiny/toolbar/searchreplace.js@@ -8,7 +8,6 @@ import { TipManager } from '../../../../services/tip-manager';import { showTooltip, TOOLTIP_POSITIONS } from '../../../../utils';import layoutmanager from '../../../../utils/layout-manager';import { SIZE } from '../../../../utils/SizeUtils';-import { useKeyboard } from '../../../../utils/use-keyboard';import useTooltip, { hideAllTooltips, useTooltipHandler } from '../../../../utils/use-tooltip';import { EditorWebView, getNote } from '../../Functions';import tiny from '../tiny';@@ -34,6 +33,7 @@ const SearcReplace = () => {});const switchModeRef = useRef();const tooltip = useTooltip();+ const valueChangeTimer = useRef();useTooltipHandler('searchreplace', () => {let popup = TipManager.popup('searchreplace');@@ -78,15 +78,14 @@ const SearcReplace = () => {tiny.call(EditorWebView,`tinymce.activeEditor.undoManager.transact(function () {- tinymce.activeEditor.plugins.searchreplace.replace("${values.current?.replace}",true${+ tinymce.activeEditor.plugins.searchreplace.replace("${values.current?.replace}",true${all ? ',true' : ''});setTimeout(function() {- tinymce.activeEditor.fire("input");- },100)+ tinyMCE.activeEditor.fire("input",{data:""})+ },300)- });- `+ });`);}@@ -216,7 +215,6 @@ const SearcReplace = () => {onPress={() => {if (getNote()?.readonly) return;hideAllTooltips();- layoutmanager.withSpringAnimation(500);if (enableReplace) {if (focusType === 2) {findRef.current?.focus();@@ -239,6 +237,10 @@ const SearcReplace = () => {fwdRef={findRef}onChangeText={value => {values.current.find = value;+ valueChangeTimer.current && clearTimeout(valueChangeTimer.current);+ valueChangeTimer.current = setTimeout(() => {+ find();+ }, 300);}}defaultValue={values.current?.find || properties.selection?.current?.value}onFocusInput={() => setFocusType(1)}