Skip to content

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

mobile: fix error in editor with incorrect tools data

Ammar Ahmedfd183a0e1ece
diff --git a/packages/editor-mobile/src/components/tiptap.tsx b/packages/editor-mobile/src/components/tiptap.tsx
index a786a348c..af0a411ca 100644
--- a/packages/editor-mobile/src/components/tiptap.tsx
+++ b/packages/editor-mobile/src/components/tiptap.tsx
@@ -17,11 +17,10 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Editor, TiptapOptions, Toolbar, useTiptap } from "@notesnook/editor";
+import { useEffect } from "react";
import { useTabContext } from "../hooks/useTabStore";
import { EmotionEditorToolbarTheme } from "../theme-factory";
import { Settings } from "../utils";
-import { useEffect } from "react";
-
export default function TiptapEditorWrapper(props: {
options: Partial<TiptapOptions>;
onEditorUpdate: (editor: Editor) => void;
@@ -49,7 +48,11 @@ export default function TiptapEditorWrapper(props: {
}}
editor={editor}
location="bottom"
- tools={[...props.settings.tools]}
+ tools={
+ Array.isArray(props.settings.tools)
+ ? [...props.settings.tools]
+ : []
+ }
defaultFontFamily={props.settings.fontFamily}
defaultFontSize={props.settings.fontSize}
/>