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: prevent keyboard open on task item check on iOS
thecodrrf5912db66db1
diff --git a/packages/editor/src/extensions/react/react-node-view.tsx b/packages/editor/src/extensions/react/react-node-view.tsxindex 79eda1827..29df77eb7 100644--- a/packages/editor/src/extensions/react/react-node-view.tsx+++ b/packages/editor/src/extensions/react/react-node-view.tsx@@ -451,21 +451,6 @@ export function createNodeView<TProps extends ReactNodeViewProps>(};}-// function isiOS(): boolean {-// return (-// [-// "iPad Simulator",-// "iPhone Simulator",-// "iPod Simulator",-// "iPad",-// "iPhone",-// "iPod",-// ].includes(navigator.platform) ||-// // iPad on iOS 13 detection-// (navigator.userAgent.includes("Mac") && "ontouchend" in document)-// );-// }-function forceHandleDrag(event: DragEvent, editor: Editor) {if (!event.dataTransfer) return;const { view } = editor;diff --git a/packages/editor/src/extensions/task-item/component.tsx b/packages/editor/src/extensions/task-item/component.tsxindex 2aa5aa2e1..f22d8a2ed 100644--- a/packages/editor/src/extensions/task-item/component.tsx+++ b/packages/editor/src/extensions/task-item/component.tsx@@ -11,6 +11,7 @@ import {useIsKeyboardOpen,useIsMobile,} from "../../toolbar/stores/toolbar-store";+import { isiOS } from "../../utils/platform";export function TaskItemComponent(props: ReactNodeViewProps<TaskItemAttributes>@@ -111,7 +112,7 @@ export function TaskItemComponent(toggle();}}onTouchEnd={(e) => {- if (useIsKeyboardOpen.current) {+ if (useIsKeyboardOpen.current || isiOS()) {e.preventDefault();toggle();}@@ -156,20 +157,3 @@ function toggleChildren(}return tr;}--function getChildren(node: Node, parentPos: number) {- const children: NodeWithPos[] = [];- node.forEach((node, offset) => {- children.push({ node, pos: parentPos + offset + 1 });- });- return children;-}--function areAllChecked(node: Node) {- const children = findChildren(- node,- (node) => node.type.name === TaskItemNode.name- );- if (children.length <= 0) return undefined;- return children.every((node) => node.node.attrs.checked);-}diff --git a/packages/editor/src/utils/platform.ts b/packages/editor/src/utils/platform.tsnew file mode 100644index 000000000..dfcfa7c25--- /dev/null+++ b/packages/editor/src/utils/platform.ts@@ -0,0 +1,14 @@+export function isiOS(): boolean {+ return (+ [+ "iPad Simulator",+ "iPhone Simulator",+ "iPod Simulator",+ "iPad",+ "iPhone",+ "iPod",+ ].includes(navigator.platform) ||+ // iPad on iOS 13 detection+ (navigator.userAgent.includes("Mac") && "ontouchend" in document)+ );+}