Skip to content

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

fix: enter not working in outline list

thecodrr9bbb0d0ed172
diff --git a/packages/editor/dist/es/extensions/outlinelist/component.js b/packages/editor/dist/es/extensions/outlinelist/component.js
index 3c4106018..9d8d782cf 100644
--- a/packages/editor/dist/es/extensions/outlinelist/component.js
+++ b/packages/editor/dist/es/extensions/outlinelist/component.js
@@ -18,5 +18,8 @@ export function OutlineListComponent(props) {
marginBlockStart: isNested ? 5 : 0,
marginBlockEnd: 0,
},
+ li: {
+ listStyleType: "none",
+ },
} }) }));
}
diff --git a/packages/editor/dist/es/extensions/outlinelistitem/component.js b/packages/editor/dist/es/extensions/outlinelistitem/component.js
index 8df9e140c..592d25fb6 100644
--- a/packages/editor/dist/es/extensions/outlinelistitem/component.js
+++ b/packages/editor/dist/es/extensions/outlinelistitem/component.js
@@ -4,9 +4,11 @@ import { Icon } from "../../toolbar/components/icon";
import { Icons } from "../../toolbar/icons";
import { findChildren, } from "@tiptap/core";
import { OutlineList } from "../outline-list/outline-list";
+import { useIsMobile } from "../../toolbar/stores/toolbar-store";
export function OutlineListItemComponent(props) {
var _a, _b;
const { editor, updateAttributes, node, getPos, forwardRef } = props;
+ const isMobile = useIsMobile();
const isNested = ((_a = node.lastChild) === null || _a === void 0 ? void 0 : _a.type.name) === OutlineList.name;
const isCollapsed = isNested && ((_b = node.lastChild) === null || _b === void 0 ? void 0 : _b.attrs.collapsed);
return (_jsxs(Flex, { children: [_jsxs(Flex, Object.assign({ className: "outline", sx: {
@@ -19,18 +21,21 @@ export function OutlineListItemComponent(props) {
cursor: "pointer",
transition: `all .2s ease-in-out`,
":hover": {
- transform: "scale(1.3)",
+ transform: ["unset", "scale(1.3)"],
+ },
+ ":active": {
+ transform: ["scale(1.3)", "unset"],
},
".icon:hover path": {
fill: "var(--checked) !important",
},
- }, size: 18, onMouseDown: (e) => e.preventDefault(), onClick: () => {
+ }, size: isMobile ? 24 : 18, onMouseDown: (e) => e.preventDefault(), onClick: () => {
const [subList] = findChildren(node, (node) => node.type.name === OutlineList.name);
if (!subList)
return;
const { pos } = subList;
editor.commands.toggleOutlineCollapse(pos + getPos() + 1, !isCollapsed);
- } })) : (_jsx(Icon, { path: Icons.circle, size: 18, sx: { transform: "scale(0.4)" } })), isNested && !isCollapsed && (_jsx(Box, { sx: {
+ } })) : (_jsx(Icon, { path: Icons.circle, size: isMobile ? 24 : 18, sx: { transform: "scale(0.4)" } })), isNested && !isCollapsed && (_jsx(Box, { sx: {
flex: 1,
width: 1,
mt: 2,
@@ -43,7 +48,7 @@ export function OutlineListItemComponent(props) {
backgroundColor: "fontTertiary",
width: 4,
},
- }, contentEditable: false }))] })), _jsx(Text, { as: "li", ref: forwardRef, sx: {
+ }, contentEditable: false }))] })), _jsx(Text, { ref: forwardRef, sx: {
pl: 2,
listStyleType: "none",
flex: 1,
diff --git a/packages/editor/dist/es/extensions/outlinelistitem/outlinelistitem.js b/packages/editor/dist/es/extensions/outlinelistitem/outlinelistitem.js
index 7f4b95865..876a52bf4 100644
--- a/packages/editor/dist/es/extensions/outlinelistitem/outlinelistitem.js
+++ b/packages/editor/dist/es/extensions/outlinelistitem/outlinelistitem.js
@@ -11,7 +11,7 @@ export const OutlineListItem = Node.create({
HTMLAttributes: {},
};
},
- content: "heading* block*",
+ content: "heading* paragraph block*",
defining: true,
parseHTML() {
return [
@@ -39,13 +39,12 @@ export const OutlineListItem = Node.create({
return this.editor.commands.toggleOutlineCollapse(subListPos, !isCollapsed);
},
Enter: ({ editor }) => {
- const subList = findSublist(editor, this.type);
- if (!subList)
- return this.editor.commands.splitListItem(this.name);
- const { isCollapsed, subListPos } = subList;
- if (isCollapsed) {
- return this.editor.commands.toggleOutlineCollapse(subListPos, false);
- }
+ // const subList = findSublist(editor, this.type);
+ // if (!subList) return this.editor.commands.splitListItem(this.name);
+ // const { isCollapsed, subListPos } = subList;
+ // if (isCollapsed) {
+ // return this.editor.commands.toggleOutlineCollapse(subListPos, false);
+ // }
return this.editor.commands.splitListItem(this.name);
},
Tab: () => this.editor.commands.sinkListItem(this.name),
@@ -66,7 +65,7 @@ export const OutlineListItem = Node.create({
addNodeView() {
return createNodeView(OutlineListItemComponent, {
contentDOMFactory: true,
- // wrapperFactory: () => document.createElement("li"),
+ wrapperFactory: () => document.createElement("li"),
});
},
});
diff --git a/packages/editor/src/extensions/outline-list-item/component.tsx b/packages/editor/src/extensions/outline-list-item/component.tsx
index 372863a9d..b6b2fed5a 100644
--- a/packages/editor/src/extensions/outline-list-item/component.tsx
+++ b/packages/editor/src/extensions/outline-list-item/component.tsx
@@ -12,10 +12,12 @@ import {
} from "@tiptap/core";
import { useCallback, useEffect } from "react";
import { OutlineList } from "../outline-list/outline-list";
+import { useIsMobile } from "../../toolbar/stores/toolbar-store";
export function OutlineListItemComponent(props: ReactNodeViewProps) {
const { editor, updateAttributes, node, getPos, forwardRef } = props;
+ const isMobile = useIsMobile();
const isNested = node.lastChild?.type.name === OutlineList.name;
const isCollapsed = isNested && node.lastChild?.attrs.collapsed;
@@ -41,13 +43,16 @@ export function OutlineListItemComponent(props: ReactNodeViewProps) {
cursor: "pointer",
transition: `all .2s ease-in-out`,
":hover": {
- transform: "scale(1.3)",
+ transform: ["unset", "scale(1.3)"],
+ },
+ ":active": {
+ transform: ["scale(1.3)", "unset"],
},
".icon:hover path": {
fill: "var(--checked) !important",
},
}}
- size={18}
+ size={isMobile ? 24 : 18}
onMouseDown={(e) => e.preventDefault()}
onClick={() => {
const [subList] = findChildren(
@@ -66,7 +71,7 @@ export function OutlineListItemComponent(props: ReactNodeViewProps) {
) : (
<Icon
path={Icons.circle}
- size={18}
+ size={isMobile ? 24 : 18}
sx={{ transform: "scale(0.4)" }}
/>
)}
@@ -92,7 +97,6 @@ export function OutlineListItemComponent(props: ReactNodeViewProps) {
)}
</Flex>
<Text
- as="li"
ref={forwardRef}
sx={{
pl: 2,
diff --git a/packages/editor/src/extensions/outline-list-item/outline-list-item.ts b/packages/editor/src/extensions/outline-list-item/outline-list-item.ts
index 973563912..3e0b8e195 100644
--- a/packages/editor/src/extensions/outline-list-item/outline-list-item.ts
+++ b/packages/editor/src/extensions/outline-list-item/outline-list-item.ts
@@ -28,7 +28,7 @@ export const OutlineListItem = Node.create<ListItemOptions>({
};
},
- content: "heading* block*",
+ content: "heading* paragraph block*",
defining: true,
@@ -63,14 +63,14 @@ export const OutlineListItem = Node.create<ListItemOptions>({
);
},
Enter: ({ editor }) => {
- const subList = findSublist(editor, this.type);
- if (!subList) return this.editor.commands.splitListItem(this.name);
+ // const subList = findSublist(editor, this.type);
+ // if (!subList) return this.editor.commands.splitListItem(this.name);
- const { isCollapsed, subListPos } = subList;
+ // const { isCollapsed, subListPos } = subList;
- if (isCollapsed) {
- return this.editor.commands.toggleOutlineCollapse(subListPos, false);
- }
+ // if (isCollapsed) {
+ // return this.editor.commands.toggleOutlineCollapse(subListPos, false);
+ // }
return this.editor.commands.splitListItem(this.name);
},
@@ -97,7 +97,7 @@ export const OutlineListItem = Node.create<ListItemOptions>({
addNodeView() {
return createNodeView(OutlineListItemComponent, {
contentDOMFactory: true,
- // wrapperFactory: () => document.createElement("li"),
+ wrapperFactory: () => document.createElement("li"),
});
},
});
diff --git a/packages/editor/src/extensions/outline-list/component.tsx b/packages/editor/src/extensions/outline-list/component.tsx
index ee141d7fb..ef92c7287 100644
--- a/packages/editor/src/extensions/outline-list/component.tsx
+++ b/packages/editor/src/extensions/outline-list/component.tsx
@@ -29,6 +29,9 @@ export function OutlineListComponent(
marginBlockStart: isNested ? 5 : 0,
marginBlockEnd: 0,
},
+ li: {
+ listStyleType: "none",
+ },
}}
/>
</>