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
chore: publish dist
thecodrrc92050d9023d
diff --git a/packages/editor/dist/cjs/components/button.js b/packages/editor/dist/cjs/components/button.jsindex b6ee899ad..1a56f98c3 100644--- a/packages/editor/dist/cjs/components/button.js+++ b/packages/editor/dist/cjs/components/button.js@@ -1,4 +1,15 @@"use strict";+var __rest = (this && this.__rest) || function (s, e) {+ var t = {};+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)+ t[p] = s[p];+ if (s != null && typeof Object.getOwnPropertySymbols === "function")+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))+ t[p[i]] = s[p[i]];+ }+ return t;+};Object.defineProperty(exports, "__esModule", { value: true });exports.Button = void 0;const jsx_runtime_1 = require("react/jsx-runtime");@@ -6,6 +17,9 @@ const react_1 = require("react");const react_2 = require("react");const rebass_1 = require("rebass");exports.Button = (0, react_1.forwardRef)((props, forwardedRef) => {+ var _a;+ const { sx } = props, buttonProps = __rest(props, ["sx"]);+ const hoverBg = ((_a = sx === null || sx === void 0 ? void 0 : sx[":hover"]) === null || _a === void 0 ? void 0 : _a["bg"]) || "hover";const buttonRef = (0, react_1.useRef)();(0, react_2.useEffect)(() => {if (!buttonRef.current)@@ -24,7 +38,7 @@ exports.Button = (0, react_1.forwardRef)((props, forwardedRef) => {const onMouseDown = (0, react_1.useCallback)((e) => {e.preventDefault();}, []);- return ((0, jsx_runtime_1.jsx)(rebass_1.Button, Object.assign({}, props, { ref: (ref) => {+ return ((0, jsx_runtime_1.jsx)(rebass_1.Button, Object.assign({}, buttonProps, { sx: Object.assign(Object.assign({}, sx), { ":hover": { bg: ["transparent", hoverBg] }, ":active": { bg: hoverBg } }), ref: (ref) => {buttonRef.current = ref;if (typeof forwardedRef === "function")forwardedRef(ref);diff --git a/packages/editor/dist/cjs/components/menu/menubutton.js b/packages/editor/dist/cjs/components/menu/menubutton.jsindex 443b5acc9..ad6e9c678 100644--- a/packages/editor/dist/cjs/components/menu/menubutton.js+++ b/packages/editor/dist/cjs/components/menu/menubutton.js@@ -22,7 +22,7 @@ function MenuButton(props) {":hover": {bg: isBottom ? "transparent" : "hover",},- } }, { children: [(0, jsx_runtime_1.jsxs)(rebass_1.Flex, { children: [icon && ((0, jsx_runtime_1.jsx)(icon_1.Icon, { path: icons_1.Icons[icon], color: "text", size: "medium", sx: { mr: 2 } })), (0, jsx_runtime_1.jsx)(rebass_1.Text, Object.assign({ as: "span", variant: "body", sx: { fontSize: "inherit" } }, { children: title }))] }), isChecked || menu || modifier ? ((0, jsx_runtime_1.jsxs)(rebass_1.Flex, Object.assign({ sx: { ml: 4 } }, { children: [isChecked && (0, jsx_runtime_1.jsx)(icon_1.Icon, { path: icons_1.Icons.check, size: 14 }), menu && (0, jsx_runtime_1.jsx)(icon_1.Icon, { path: icons_1.Icons.chevronRight, size: 14 }), modifier && ((0, jsx_runtime_1.jsx)(rebass_1.Text, Object.assign({ as: "span", sx: {+ } }, { children: [(0, jsx_runtime_1.jsxs)(rebass_1.Flex, { children: [icon && ((0, jsx_runtime_1.jsx)(icon_1.Icon, { path: icons_1.Icons[icon], color: "text", size: "medium", sx: { mr: 2 } })), (0, jsx_runtime_1.jsx)(rebass_1.Text, Object.assign({ as: "span", variant: "body", sx: { fontSize: "inherit" } }, { children: title }))] }), isChecked || menu || modifier ? ((0, jsx_runtime_1.jsxs)(rebass_1.Flex, Object.assign({ sx: { ml: 4 } }, { children: [isChecked && (0, jsx_runtime_1.jsx)(icon_1.Icon, { path: icons_1.Icons.check, size: "small" }), menu && (0, jsx_runtime_1.jsx)(icon_1.Icon, { path: icons_1.Icons.chevronRight, size: "small" }), modifier && ((0, jsx_runtime_1.jsx)(rebass_1.Text, Object.assign({ as: "span", sx: {fontFamily: "body",fontSize: "menu",color: "fontTertiary",diff --git a/packages/editor/dist/cjs/extensions/listitem/commands.js b/packages/editor/dist/cjs/extensions/listitem/commands.jsindex cc26f7b66..7fb7016fe 100644--- a/packages/editor/dist/cjs/extensions/listitem/commands.js+++ b/packages/editor/dist/cjs/extensions/listitem/commands.js@@ -14,11 +14,18 @@ function onBackspacePressed(editor, name, type) {!editor.can().liftListItem(type))return false;const isEmpty = isListItemEmpty(type, editor.state);- if (isFirstOfType(type, editor.state)) {+ if (isEmpty) {+ if (isFirstOfType(type, editor.state)) {+ const parentList = getListFromListItem(type, editor.state);+ if (!parentList)+ return false;+ return editor.commands.deleteNode(parentList.type);+ }+ return editor.commands.deleteNode(type);+ }+ else if (isFirstOfType(type, editor.state)) {return editor.commands.liftListItem(type);}- else if (isEmpty)- return editor.commands.deleteNode(type);else {// we have to run join backward twice because on the first join// the two list items are joined i.e., the editor just puts their@@ -47,8 +54,21 @@ const isFirstOfType = (type, state) => {return false;const { pos } = block;const resolved = state.doc.resolve(pos);+ console.log("isFirstOfType", resolved);return !resolved.nodeBefore;};+const getListFromListItem = (type, state) => {+ var _a;+ const block = (0, prosemirror_utils_1.findParentNodeOfType)(type)(state.selection);+ if (!block)+ return undefined;+ const { pos } = block;+ const resolved = state.doc.resolve(pos);+ if (!resolved.parent.type.spec.group ||+ ((_a = resolved.parent.type.spec.group) === null || _a === void 0 ? void 0 : _a.indexOf("list")) <= -1)+ return undefined;+ return resolved.parent;+};function isListItemEmpty(type, state) {const block = (0, prosemirror_utils_1.findParentNodeOfType)(type)(state.selection);if (!block)diff --git a/packages/editor/dist/cjs/extensions/taskitem/component.js b/packages/editor/dist/cjs/extensions/taskitem/component.jsindex 52caf57d5..9358c0525 100644--- a/packages/editor/dist/cjs/extensions/taskitem/component.js+++ b/packages/editor/dist/cjs/extensions/taskitem/component.js@@ -8,9 +8,11 @@ const icons_1 = require("../../toolbar/icons");const core_1 = require("@tiptap/core");const react_1 = require("react");const taskitem_1 = require("./taskitem");+const toolbarstore_1 = require("../../toolbar/stores/toolbarstore");function TaskItemComponent(props) {const { editor, updateAttributes, node, getPos, forwardRef } = props;const { checked } = props.node.attrs;+ const isMobile = (0, toolbarstore_1.useIsMobile)();const toggle = (0, react_1.useCallback)(() => {if (!editor.isEditable)return false;@@ -23,6 +25,8 @@ function TaskItemComponent(props) {return true;}, [editor, getPos, node, checked]);return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)(rebass_1.Flex, Object.assign({ "data-drag-image": true, sx: {+ bg: "background",+ borderRadius: "default",":hover > .dragHandle": {opacity: editor.isEditable ? 1 : 0,},@@ -35,7 +39,7 @@ function TaskItemComponent(props) {".icon:hover path": {fill: "var(--checked) !important",},- }, size: 20 }), (0, jsx_runtime_1.jsx)(icon_1.Icon, { path: checked ? icons_1.Icons.check : "", stroke: "1px", sx: {+ }, size: isMobile ? 24 : 20, onMouseDown: (e) => e.preventDefault() }), (0, jsx_runtime_1.jsx)(icon_1.Icon, { path: checked ? icons_1.Icons.check : "", stroke: "1px", sx: {border: "2px solid",borderColor: checked ? "checked" : "icon",borderRadius: "default",@@ -52,7 +56,7 @@ function TaskItemComponent(props) {}, onMouseDown: (e) => {e.preventDefault();toggle();- }, color: checked ? "checked" : "icon", size: 13 }), (0, jsx_runtime_1.jsx)(rebass_1.Text, { as: "div", ref: forwardRef, sx: {+ }, color: checked ? "checked" : "icon", size: isMobile ? 16 : 14 }), (0, jsx_runtime_1.jsx)(rebass_1.Text, { as: "div", ref: forwardRef, sx: {textDecorationLine: checked ? "line-through" : "none",color: checked ? "var(--checked)" : "var(--text)",flex: 1,diff --git a/packages/editor/dist/cjs/extensions/tasklist/component.js b/packages/editor/dist/cjs/extensions/tasklist/component.jsindex b98308c8b..dd4999d2c 100644--- a/packages/editor/dist/cjs/extensions/tasklist/component.js+++ b/packages/editor/dist/cjs/extensions/tasklist/component.js@@ -86,6 +86,7 @@ function TaskListComponent(props) {li: {listStyleType: "none",position: "relative",+ marginBottom: [2, "7px"],},} })] }));}diff --git a/packages/editor/dist/cjs/index.d.ts b/packages/editor/dist/cjs/index.d.tsindex dc11b106e..183bc0edb 100644--- a/packages/editor/dist/cjs/index.d.ts+++ b/packages/editor/dist/cjs/index.d.ts@@ -14,4 +14,4 @@ export { useTiptap, Toolbar, usePermissionHandler };export * from "./types";export * from "./extensions/react";export * from "./toolbar";-export { type AttachmentType } from "./extensions/attachment";+export { type AttachmentType, type Attachment } from "./extensions/attachment";diff --git a/packages/editor/dist/cjs/toolbar/components/dropdown.js b/packages/editor/dist/cjs/toolbar/components/dropdown.jsindex bf3eb0004..78b22268a 100644--- a/packages/editor/dist/cjs/toolbar/components/dropdown.js+++ b/packages/editor/dist/cjs/toolbar/components/dropdown.js@@ -47,6 +47,7 @@ function Dropdown(props) {marginRight: isBottom ? "10px" : 0,display: "flex",alignItems: isBottom ? "center" : "unset",+ mr: isBottom ? 0 : 2,} })] }));}exports.Dropdown = Dropdown;diff --git a/packages/editor/dist/cjs/toolbar/components/moretools.js b/packages/editor/dist/cjs/toolbar/components/moretools.jsindex a50c616b3..935c90e2b 100644--- a/packages/editor/dist/cjs/toolbar/components/moretools.js+++ b/packages/editor/dist/cjs/toolbar/components/moretools.js@@ -22,7 +22,10 @@ function MoreTools(props) {yOffset: isBottom ? 10 : 5,}, autoCloseOnUnmount: autoCloseOnUnmount, focusOnRender: false, blocking: false, renderPopup: () => ((0, jsx_runtime_1.jsx)(toolbargroup_1.ToolbarGroup, { tools: tools, editor: editor, sx: {flex: 1,- p: 1,+ // this is intentionally set to a fixed value+ // because we want the same padding on mobile+ // and web.+ p: "5px",boxShadow: "menu",bg: "background",borderRadius: "default",diff --git a/packages/editor/dist/cjs/toolbar/components/splitbutton.js b/packages/editor/dist/cjs/toolbar/components/splitbutton.jsindex a27cee118..b7c8fe915 100644--- a/packages/editor/dist/cjs/toolbar/components/splitbutton.js+++ b/packages/editor/dist/cjs/toolbar/components/splitbutton.js@@ -31,11 +31,12 @@ function _SplitButton(props) {return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(rebass_1.Flex, Object.assign({ ref: ref, sx: {borderRadius: "default",bg: toggled ? "hover" : "transparent",- ":hover": { bg: "hover" },- } }, { children: [(0, jsx_runtime_1.jsx)(toolbutton_1.ToolButton, Object.assign({}, toolButtonProps, { toggled: toggled })), (0, jsx_runtime_1.jsx)(button_1.Button, Object.assign({ sx: {+ ":hover": { bg: [toggled ? "hover" : "transparent", "hover"] },+ ":active": { bg: toggled ? "hover" : "transparent" },+ } }, { children: [(0, jsx_runtime_1.jsx)(toolbutton_1.ToolButton, Object.assign({}, toolButtonProps, { toggled: false })), (0, jsx_runtime_1.jsx)(button_1.Button, Object.assign({ sx: {p: 0,m: 0,- bg: toggled ? "hover" : "transparent",+ bg: "transparent",":hover": { bg: "hover" },":last-of-type": {mr: 0,diff --git a/packages/editor/dist/cjs/toolbar/components/toolbutton.js b/packages/editor/dist/cjs/toolbar/components/toolbutton.jsindex c69bdb590..8e461e038 100644--- a/packages/editor/dist/cjs/toolbar/components/toolbutton.js+++ b/packages/editor/dist/cjs/toolbar/components/toolbutton.js@@ -22,7 +22,7 @@ const button_1 = require("../../components/button");const icon_1 = require("./icon");exports.ToolButton = react_1.default.memo(function ToolButton(props) {const { id, icon, iconSize, iconColor, toggled, sx, buttonRef, variant = "normal" } = props, buttonProps = __rest(props, ["id", "icon", "iconSize", "iconColor", "toggled", "sx", "buttonRef", "variant"]);- return ((0, jsx_runtime_1.jsx)(button_1.Button, Object.assign({ ref: buttonRef, tabIndex: -1, id: `tool-${id || icon}`, sx: Object.assign({ flexShrink: 0, p: variant === "small" ? "small" : 1, borderRadius: variant === "small" ? "small" : "default", m: 0, bg: toggled ? "hover" : "transparent", mr: variant === "small" ? 0 : 1, ":hover": { bg: ["transparent", "hover"] }, ":active": { bg: "hover" }, ":last-of-type": {+ return ((0, jsx_runtime_1.jsx)(button_1.Button, Object.assign({ ref: buttonRef, tabIndex: -1, id: `tool-${id || icon}`, sx: Object.assign({ flexShrink: 0, p: variant === "small" ? "small" : 1, borderRadius: variant === "small" ? "small" : "default", m: 0, bg: toggled ? "hover" : "transparent", mr: variant === "small" ? 0 : 1, ":hover": { bg: "hover" }, ":last-of-type": {mr: 0,} }, sx), onMouseDown: (e) => e.preventDefault() }, buttonProps, { children: (0, jsx_runtime_1.jsx)(icon_1.Icon, { path: icons_1.Icons[icon], color: iconColor || "icon", size: iconSize || (variant === "small" ? "medium" : "big") }) })));}, (prev, next) => {diff --git a/packages/editor/dist/cjs/toolbar/icons.d.ts b/packages/editor/dist/cjs/toolbar/icons.d.tsindex 7954bdda5..4105cd1e7 100644--- a/packages/editor/dist/cjs/toolbar/icons.d.ts+++ b/packages/editor/dist/cjs/toolbar/icons.d.ts@@ -80,6 +80,8 @@ export declare const Icons: {fontFamily: string;fontSize: string;heading: string;+ indent: string;+ outdent: string;plus: string;minus: string;close: string;diff --git a/packages/editor/dist/cjs/toolbar/icons.js b/packages/editor/dist/cjs/toolbar/icons.jsindex a3a6af50e..24a489b60 100644--- a/packages/editor/dist/cjs/toolbar/icons.js+++ b/packages/editor/dist/cjs/toolbar/icons.js@@ -84,6 +84,8 @@ exports.Icons = {fontFamily: js_1.mdiFormatFont,fontSize: js_1.mdiFormatFontSizeIncrease,heading: js_1.mdiFormatHeaderPound,+ indent: js_1.mdiFormatIndentIncrease,+ outdent: js_1.mdiFormatIndentDecrease,plus: js_1.mdiPlus,minus: js_1.mdiMinus,close: js_1.mdiClose,diff --git a/packages/editor/dist/cjs/toolbar/toolbar.d.ts b/packages/editor/dist/cjs/toolbar/toolbar.d.tsindex c8486e53d..f1b0eb2e0 100644--- a/packages/editor/dist/cjs/toolbar/toolbar.d.ts+++ b/packages/editor/dist/cjs/toolbar/toolbar.d.ts@@ -1,9 +1,10 @@/// <reference types="react" />import { Theme } from "@notesnook/theme";import { Editor } from "../types";+import { FlexProps } from "rebass";import { ToolbarLocation } from "./stores/toolbar-store";import { ToolbarDefinition } from "./types";-declare type ToolbarProps = {+declare type ToolbarProps = FlexProps & {theme: Theme;editor: Editor | null;location: ToolbarLocation;diff --git a/packages/editor/dist/cjs/toolbar/toolbar.js b/packages/editor/dist/cjs/toolbar/toolbar.jsindex 0de4b0012..edec07c3d 100644--- a/packages/editor/dist/cjs/toolbar/toolbar.js+++ b/packages/editor/dist/cjs/toolbar/toolbar.js@@ -1,4 +1,15 @@"use strict";+var __rest = (this && this.__rest) || function (s, e) {+ var t = {};+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)+ t[p] = s[p];+ if (s != null && typeof Object.getOwnPropertySymbols === "function")+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))+ t[p[i]] = s[p[i]];+ }+ return t;+};Object.defineProperty(exports, "__esModule", { value: true });exports.Toolbar = void 0;const jsx_runtime_1 = require("react/jsx-runtime");@@ -11,14 +22,14 @@ const toolbarstore_1 = require("./stores/toolbarstore");const toolbargroup_1 = require("./components/toolbargroup");const popuprenderer_1 = require("../components/popup-presenter/popuprenderer");function Toolbar(props) {- const { editor, theme, location, tools = (0, tooldefinitions_1.getDefaultPresets)().default, } = props;+ const { editor, theme, location, tools = (0, tooldefinitions_1.getDefaultPresets)().default, sx } = props, flexProps = __rest(props, ["editor", "theme", "location", "tools", "sx"]);const setToolbarLocation = (0, toolbarstore_1.useToolbarStore)((store) => store.setToolbarLocation);(0, react_1.useEffect)(() => {setToolbarLocation(location);}, [location]);if (!editor)return null;- return ((0, jsx_runtime_1.jsx)(emotion_theming_1.ThemeProvider, Object.assign({ theme: theme }, { children: (0, jsx_runtime_1.jsx)(popuprenderer_1.EditorContext.Provider, Object.assign({ value: editor }, { children: (0, jsx_runtime_1.jsxs)(popuprenderer_1.PopupRenderer, Object.assign({ editor: editor }, { children: [(0, jsx_runtime_1.jsx)(rebass_1.Flex, Object.assign({ className: "editor-toolbar", sx: { flexWrap: ["nowrap", "wrap"], overflowX: ["auto", "hidden"] } }, { children: tools.map((tools) => {+ return ((0, jsx_runtime_1.jsx)(emotion_theming_1.ThemeProvider, Object.assign({ theme: theme }, { children: (0, jsx_runtime_1.jsx)(popuprenderer_1.EditorContext.Provider, Object.assign({ value: editor }, { children: (0, jsx_runtime_1.jsxs)(popuprenderer_1.PopupRenderer, Object.assign({ editor: editor }, { children: [(0, jsx_runtime_1.jsx)(rebass_1.Flex, Object.assign({ className: "editor-toolbar", sx: Object.assign(Object.assign({}, sx), { flexWrap: ["nowrap", "wrap"], overflowX: ["auto", "hidden"] }) }, flexProps, { children: tools.map((tools) => {return ((0, jsx_runtime_1.jsx)(toolbargroup_1.ToolbarGroup, { tools: tools, editor: editor, sx: {flexShrink: 0,pr: 2,diff --git a/packages/editor/dist/cjs/toolbar/tooldefinitions.d.ts b/packages/editor/dist/cjs/toolbar/tooldefinitions.d.tsindex 224e00ff4..97a23f185 100644--- a/packages/editor/dist/cjs/toolbar/tooldefinitions.d.ts+++ b/packages/editor/dist/cjs/toolbar/tooldefinitions.d.ts@@ -1,5 +1,5 @@import { ToolbarDefinition, ToolDefinition } from "./types";import { ToolId } from "./tools";export declare function getToolDefinition(id: ToolId): ToolDefinition;-export declare function getAllTools(): Record<"fontSize" | "underline" | "bold" | "bulletList" | "code" | "italic" | "subscript" | "superscript" | "textDirection" | "fontFamily" | "highlight" | "removeAttachment" | "downloadAttachment" | "deleteColumn" | "deleteRow" | "deleteTable" | "mergeCells" | "strikethrough" | "codeRemove" | "numberedList" | "textColor" | "openLink" | "linkSettings" | "imageSettings" | "rowProperties" | "insertRowBelow" | "insertRowAbove" | "moveRowDown" | "moveRowUp" | "columnProperties" | "insertColumnRight" | "insertColumnLeft" | "moveColumnRight" | "moveColumnLeft" | "cellProperties" | "cellBorderColor" | "splitCells" | "attachmentSettings" | "embedSettings" | "tableSettings" | "math" | "clearformatting" | "addLink" | "editLink" | "removeLink" | "insertBlock" | "headings" | "alignment" | "imageAlignCenter" | "imageAlignLeft" | "imageAlignRight" | "imageProperties" | "embedAlignCenter" | "embedAlignLeft" | "embedAlignRight" | "embedProperties" | "cellBackgroundColor" | "cellTextColor" | "cellBorderWidth", ToolDefinition>;+export declare function getAllTools(): Record<"fontSize" | "underline" | "bold" | "bulletList" | "code" | "italic" | "subscript" | "superscript" | "textDirection" | "fontFamily" | "highlight" | "removeAttachment" | "downloadAttachment" | "deleteColumn" | "deleteRow" | "deleteTable" | "mergeCells" | "strikethrough" | "codeRemove" | "numberedList" | "textColor" | "openLink" | "linkSettings" | "imageSettings" | "rowProperties" | "insertRowBelow" | "insertRowAbove" | "moveRowDown" | "moveRowUp" | "columnProperties" | "insertColumnRight" | "insertColumnLeft" | "moveColumnRight" | "moveColumnLeft" | "cellProperties" | "cellBorderColor" | "splitCells" | "attachmentSettings" | "embedSettings" | "tableSettings" | "math" | "indent" | "outdent" | "clearformatting" | "addLink" | "editLink" | "removeLink" | "insertBlock" | "headings" | "alignment" | "imageAlignCenter" | "imageAlignLeft" | "imageAlignRight" | "imageProperties" | "embedAlignCenter" | "embedAlignLeft" | "embedAlignRight" | "embedProperties" | "cellBackgroundColor" | "cellTextColor" | "cellBorderWidth", ToolDefinition>;export declare function getDefaultPresets(): Record<"default" | "minimal", ToolbarDefinition>;diff --git a/packages/editor/dist/cjs/toolbar/tooldefinitions.js b/packages/editor/dist/cjs/toolbar/tooldefinitions.jsindex 490c86ec4..a65fab866 100644--- a/packages/editor/dist/cjs/toolbar/tooldefinitions.js+++ b/packages/editor/dist/cjs/toolbar/tooldefinitions.js@@ -278,6 +278,14 @@ const tools = {title: "Embed properties",conditional: true,},+ outdent: {+ icon: "outdent",+ title: "Lift list item",+ },+ indent: {+ icon: "indent",+ title: "Sink list item",+ },};function getToolDefinition(id) {return tools[id];@@ -301,6 +309,8 @@ const defaultPresets = {"attachmentSettings","linkSettings","codeRemove",+ "outdent",+ "indent",],["bold",diff --git a/packages/editor/dist/cjs/toolbar/tools/index.d.ts b/packages/editor/dist/cjs/toolbar/tools/index.d.tsindex 099d7946f..959c01b7c 100644--- a/packages/editor/dist/cjs/toolbar/tools/index.d.ts+++ b/packages/editor/dist/cjs/toolbar/tools/index.d.ts@@ -5,7 +5,7 @@ import { InsertBlock } from "./block";import { FontSize, FontFamily } from "./font";import { Alignment } from "./alignment";import { Headings } from "./headings";-import { NumberedList, BulletList } from "./lists";+import { NumberedList, BulletList, Outdent, Indent } from "./lists";import { TextDirection } from "./text-direction";import { Highlight, TextColor } from "./colors";import { TableSettings, ColumnProperties, RowProperties, CellProperties, CellBackgroundColor, CellBorderColor, CellTextColor, CellBorderWidth } from "./table";@@ -74,6 +74,8 @@ declare const tools: {moveRowDown: (props: ToolProps) => JSX.Element;deleteRow: (props: ToolProps) => JSX.Element;deleteTable: (props: ToolProps) => JSX.Element;+ outdent: typeof Outdent;+ indent: typeof Indent;};export declare function findTool(id: ToolId): React.FunctionComponent<ToolProps>;export {};diff --git a/packages/editor/dist/cjs/toolbar/tools/index.js b/packages/editor/dist/cjs/toolbar/tools/index.jsindex 09091fcb5..d61310321 100644--- a/packages/editor/dist/cjs/toolbar/tools/index.js+++ b/packages/editor/dist/cjs/toolbar/tools/index.js@@ -74,6 +74,8 @@ const tools = {moveRowDown: table_1.MoveRowDown,deleteRow: table_1.DeleteRow,deleteTable: table_1.DeleteTable,+ outdent: lists_1.Outdent,+ indent: lists_1.Indent,};function findTool(id) {return tools[id];diff --git a/packages/editor/dist/cjs/toolbar/tools/link.js b/packages/editor/dist/cjs/toolbar/tools/link.jsindex 94dee753f..944f496fe 100644--- a/packages/editor/dist/cjs/toolbar/tools/link.js+++ b/packages/editor/dist/cjs/toolbar/tools/link.js@@ -112,7 +112,7 @@ function OpenLink(props) {}exports.OpenLink = OpenLink;function LinkTool(props) {- const { isEditing, onClick, onDone } = props, toolProps = __rest(props, ["isEditing", "onClick", "onDone"]);+ const { isEditing, onClick, onDone, editor } = props, toolProps = __rest(props, ["isEditing", "onClick", "onDone", "editor"]);const buttonRef = (0, react_1.useRef)(null);const [isOpen, setIsOpen] = (0, react_1.useState)(false);const [href, setHref] = (0, react_1.useState)();@@ -131,7 +131,11 @@ function LinkTool(props) {location: "below",align: "center",yOffset: 5,- }, title: isEditing ? "Edit link" : "Insert link", isOpen: isOpen, items: [], onClose: () => setIsOpen(false), focusOnRender: false }, { children: (0, jsx_runtime_1.jsx)(linkpopup_1.LinkPopup, { href: href, text: text, isEditing: isEditing, onClose: () => setIsOpen(false), onDone: ({ href, text }) => {+ }, title: isEditing ? "Edit link" : "Insert link", isOpen: isOpen, items: [], onClose: () => {+ var _a;+ setIsOpen(false);+ (_a = editor.current) === null || _a === void 0 ? void 0 : _a.commands.focus();+ }, focusOnRender: false }, { children: (0, jsx_runtime_1.jsx)(linkpopup_1.LinkPopup, { href: href, text: text, isEditing: isEditing, onClose: () => setIsOpen(false), onDone: ({ href, text }) => {onDone(href, text);setIsOpen(false);} }) }))] }));diff --git a/packages/editor/dist/cjs/toolbar/tools/lists.d.ts b/packages/editor/dist/cjs/toolbar/tools/lists.d.tsindex 50718c842..551f6e925 100644--- a/packages/editor/dist/cjs/toolbar/tools/lists.d.ts+++ b/packages/editor/dist/cjs/toolbar/tools/lists.d.ts@@ -2,3 +2,5 @@import { ToolProps } from "../types";export declare function NumberedList(props: ToolProps): JSX.Element;export declare function BulletList(props: ToolProps): JSX.Element;+export declare function Indent(props: ToolProps): JSX.Element | null;+export declare function Outdent(props: ToolProps): JSX.Element | null;diff --git a/packages/editor/dist/cjs/toolbar/tools/lists.js b/packages/editor/dist/cjs/toolbar/tools/lists.jsindex 2365e66e8..3d85d2c90 100644--- a/packages/editor/dist/cjs/toolbar/tools/lists.js+++ b/packages/editor/dist/cjs/toolbar/tools/lists.js@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {return (mod && mod.__esModule) ? mod : { "default": mod };};Object.defineProperty(exports, "__esModule", { value: true });-exports.BulletList = exports.NumberedList = void 0;+exports.Outdent = exports.Indent = exports.BulletList = exports.NumberedList = void 0;const jsx_runtime_1 = require("react/jsx-runtime");const rebass_1 = require("rebass");const react_1 = require("react");@@ -23,13 +23,15 @@ const toolbarstore_1 = require("../stores/toolbarstore");const dom_1 = require("../utils/dom");const popuppresenter_1 = require("../../components/popuppresenter");const react_2 = __importDefault(require("react"));+const toolbutton_1 = require("../components/toolbutton");+const prosemirror_1 = require("../utils/prosemirror");function _ListTool(props) {const { editor, onClick, isActive, subTypes, type } = props, toolProps = __rest(props, ["editor", "onClick", "isActive", "subTypes", "type"]);const toolbarLocation = (0, toolbarstore_1.useToolbarLocation)();const isBottom = toolbarLocation === "bottom";const [isOpen, setIsOpen] = (0, react_1.useState)(false);const buttonRef = (0, react_1.useRef)();- return ((0, jsx_runtime_1.jsx)(splitbutton_1.SplitButton, Object.assign({}, toolProps, { buttonRef: buttonRef, onClick: onClick, toggled: isActive || isOpen, sx: { mr: 0 }, onOpen: () => setIsOpen((s) => !s) }, { children: (0, jsx_runtime_1.jsx)(popuppresenter_1.PopupWrapper, { isOpen: isOpen, group: "lists", id: toolProps.title, blocking: false, focusOnRender: false, position: {+ return ((0, jsx_runtime_1.jsx)(splitbutton_1.SplitButton, Object.assign({}, toolProps, { buttonRef: buttonRef, onClick: onClick, toggled: isOpen, sx: { mr: 0 }, onOpen: () => setIsOpen((s) => !s) }, { children: (0, jsx_runtime_1.jsx)(popuppresenter_1.PopupWrapper, { isOpen: isOpen, group: "lists", id: toolProps.title, blocking: false, focusOnRender: false, position: {isTargetAbsolute: true,target: isBottom ? (0, dom_1.getToolbarElement)() : buttonRef.current || "mouse",align: "center",@@ -43,9 +45,9 @@ function _ListTool(props) {} }, { children: subTypes.map((item) => ((0, jsx_runtime_1.jsx)(rebass_1.Button, Object.assign({ variant: "menuitem", sx: { width: 80 }, onClick: () => {var _a;let chain = (_a = editor.current) === null || _a === void 0 ? void 0 : _a.chain().focus();- if (!chain)+ if (!chain || !editor.current)return;- if (!isActive) {+ if (!(0, prosemirror_1.isListActive)(editor.current)) {if (type === "bulletList")chain = chain.toggleBulletList();else@@ -82,7 +84,7 @@ function NumberedList(props) {exports.NumberedList = NumberedList;function BulletList(props) {const { editor } = props;- const onClick = (0, react_1.useCallback)(() => { var _a; return (_a = editor.current) === null || _a === void 0 ? void 0 : _a.chain().focus().toggleOrderedList().run(); }, []);+ const onClick = (0, react_1.useCallback)(() => { var _a; return (_a = editor.current) === null || _a === void 0 ? void 0 : _a.chain().focus().toggleBulletList().run(); }, []);return ((0, jsx_runtime_1.jsx)(ListTool, Object.assign({}, props, { type: "bulletList", onClick: onClick, isActive: editor.isActive("bulletList"), subTypes: [{ type: "disc", title: "Decimal", items: ["1", "2", "3"] },{ type: "circle", title: "Upper alpha", items: ["A", "B", "C"] },@@ -90,6 +92,24 @@ function BulletList(props) {] })));}exports.BulletList = BulletList;+function Indent(props) {+ const { editor } = props, toolProps = __rest(props, ["editor"]);+ const isBottom = (0, toolbarstore_1.useToolbarLocation)() === "bottom";+ const listItemType = (0, prosemirror_1.findListItemType)(editor);+ if (!listItemType || !isBottom)+ return null;+ return ((0, jsx_runtime_1.jsx)(toolbutton_1.ToolButton, Object.assign({}, toolProps, { toggled: false, onClick: () => { var _a; return (_a = editor.current) === null || _a === void 0 ? void 0 : _a.chain().focus().sinkListItem(listItemType).run(); } })));+}+exports.Indent = Indent;+function Outdent(props) {+ const { editor } = props, toolProps = __rest(props, ["editor"]);+ const isBottom = (0, toolbarstore_1.useToolbarLocation)() === "bottom";+ const listItemType = (0, prosemirror_1.findListItemType)(editor);+ if (!listItemType || !isBottom)+ return null;+ return ((0, jsx_runtime_1.jsx)(toolbutton_1.ToolButton, Object.assign({}, toolProps, { toggled: false, onClick: () => { var _a; return (_a = editor.current) === null || _a === void 0 ? void 0 : _a.chain().focus().liftListItem(listItemType).run(); } })));+}+exports.Outdent = Outdent;function ListThumbnail(props) {const { listStyleType } = props;return ((0, jsx_runtime_1.jsx)(rebass_1.Flex, Object.assign({ as: "ul", sx: {@@ -97,7 +117,7 @@ function ListThumbnail(props) {flex: 1,p: 0,listStyleType,- } }, { children: [0, 1, 2].map((i) => ((0, jsx_runtime_1.jsx)(rebass_1.Box, Object.assign({ as: "li", sx: {+ }, onMouseDown: (e) => e.preventDefault() }, { children: [0, 1, 2].map((i) => ((0, jsx_runtime_1.jsx)(rebass_1.Box, Object.assign({ as: "li", sx: {display: "list-item",color: "text",fontSize: 8,diff --git a/packages/editor/dist/cjs/toolbar/utils/prosemirror.d.ts b/packages/editor/dist/cjs/toolbar/utils/prosemirror.d.tsindex 5dd849997..ef7a00a57 100644--- a/packages/editor/dist/cjs/toolbar/utils/prosemirror.d.ts+++ b/packages/editor/dist/cjs/toolbar/utils/prosemirror.d.ts@@ -10,3 +10,5 @@ export declare function findSelectedDOMNode(editor: Editor, types: string[]): HTexport declare function findSelectedNode(editor: Editor, type: string): Node | null;export declare function findMark(node: Node, type: string): Mark | undefined;export declare function selectionToOffset(selection: Selection): NodeWithOffset;+export declare function findListItemType(editor: Editor): string | null;+export declare function isListActive(editor: Editor): boolean;diff --git a/packages/editor/dist/cjs/toolbar/utils/prosemirror.js b/packages/editor/dist/cjs/toolbar/utils/prosemirror.jsindex cce718844..a72c34706 100644--- a/packages/editor/dist/cjs/toolbar/utils/prosemirror.js+++ b/packages/editor/dist/cjs/toolbar/utils/prosemirror.js@@ -1,6 +1,6 @@"use strict";Object.defineProperty(exports, "__esModule", { value: true });-exports.selectionToOffset = exports.findMark = exports.findSelectedNode = exports.findSelectedDOMNode = void 0;+exports.isListActive = exports.findListItemType = exports.selectionToOffset = exports.findMark = exports.findSelectedNode = exports.findSelectedDOMNode = void 0;const core_1 = require("@tiptap/core");function findSelectedDOMNode(editor, types) {var _a;@@ -36,3 +36,23 @@ function selectionToOffset(selection) {return { node: $from.node(), from, to: from + $from.node().nodeSize };}exports.selectionToOffset = selectionToOffset;+function findListItemType(editor) {+ const isTaskList = editor.isActive("taskList");+ const isOutlineList = editor.isActive("outlineList");+ const isList = editor.isActive("bulletList") || editor.isActive("orderedList");+ return isList+ ? "listItem"+ : isOutlineList+ ? "outlineListItem"+ : isTaskList+ ? "taskItem"+ : null;+}+exports.findListItemType = findListItemType;+function isListActive(editor) {+ const isTaskList = editor.isActive("taskList");+ const isOutlineList = editor.isActive("outlineList");+ const isList = editor.isActive("bulletList") || editor.isActive("orderedList");+ return isTaskList || isOutlineList || isList;+}+exports.isListActive = isListActive;diff --git a/packages/editor/dist/cjs/utils/position.js b/packages/editor/dist/cjs/utils/position.jsindex cc2ec2c8a..a0abe314c 100644--- a/packages/editor/dist/cjs/utils/position.js+++ b/packages/editor/dist/cjs/utils/position.js@@ -45,7 +45,7 @@ function getPosition(element, options) {position.top = y - elementHeight;}if (width && target !== "mouse" && align === "center" && elementWidth > 0) {- position.left -= elementWidth / 2 - width / 2;+ position.left = (width - elementWidth) / 2;}else if (width &&target !== "mouse" &&diff --git a/packages/editor/dist/es/components/button.js b/packages/editor/dist/es/components/button.jsindex e523703f1..fead075e4 100644--- a/packages/editor/dist/es/components/button.js+++ b/packages/editor/dist/es/components/button.js@@ -1,8 +1,22 @@+var __rest = (this && this.__rest) || function (s, e) {+ var t = {};+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)+ t[p] = s[p];+ if (s != null && typeof Object.getOwnPropertySymbols === "function")+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))+ t[p[i]] = s[p[i]];+ }+ return t;+};import { jsx as _jsx } from "react/jsx-runtime";import { forwardRef, useCallback, useRef } from "react";import { useEffect } from "react";import { Button as RebassButton } from "rebass";export const Button = forwardRef((props, forwardedRef) => {+ var _a;+ const { sx } = props, buttonProps = __rest(props, ["sx"]);+ const hoverBg = ((_a = sx === null || sx === void 0 ? void 0 : sx[":hover"]) === null || _a === void 0 ? void 0 : _a["bg"]) || "hover";const buttonRef = useRef();useEffect(() => {if (!buttonRef.current)@@ -21,7 +35,7 @@ export const Button = forwardRef((props, forwardedRef) => {const onMouseDown = useCallback((e) => {e.preventDefault();}, []);- return (_jsx(RebassButton, Object.assign({}, props, { ref: (ref) => {+ return (_jsx(RebassButton, Object.assign({}, buttonProps, { sx: Object.assign(Object.assign({}, sx), { ":hover": { bg: ["transparent", hoverBg] }, ":active": { bg: hoverBg } }), ref: (ref) => {buttonRef.current = ref;if (typeof forwardedRef === "function")forwardedRef(ref);diff --git a/packages/editor/dist/es/components/menu/menubutton.js b/packages/editor/dist/es/components/menu/menubutton.jsindex b62ac4f7e..d1095f3f6 100644--- a/packages/editor/dist/es/components/menu/menubutton.js+++ b/packages/editor/dist/es/components/menu/menubutton.js@@ -19,7 +19,7 @@ export function MenuButton(props) {":hover": {bg: isBottom ? "transparent" : "hover",},- } }, { children: [_jsxs(Flex, { children: [icon && (_jsx(Icon, { path: Icons[icon], color: "text", size: "medium", sx: { mr: 2 } })), _jsx(Text, Object.assign({ as: "span", variant: "body", sx: { fontSize: "inherit" } }, { children: title }))] }), isChecked || menu || modifier ? (_jsxs(Flex, Object.assign({ sx: { ml: 4 } }, { children: [isChecked && _jsx(Icon, { path: Icons.check, size: 14 }), menu && _jsx(Icon, { path: Icons.chevronRight, size: 14 }), modifier && (_jsx(Text, Object.assign({ as: "span", sx: {+ } }, { children: [_jsxs(Flex, { children: [icon && (_jsx(Icon, { path: Icons[icon], color: "text", size: "medium", sx: { mr: 2 } })), _jsx(Text, Object.assign({ as: "span", variant: "body", sx: { fontSize: "inherit" } }, { children: title }))] }), isChecked || menu || modifier ? (_jsxs(Flex, Object.assign({ sx: { ml: 4 } }, { children: [isChecked && _jsx(Icon, { path: Icons.check, size: "small" }), menu && _jsx(Icon, { path: Icons.chevronRight, size: "small" }), modifier && (_jsx(Text, Object.assign({ as: "span", sx: {fontFamily: "body",fontSize: "menu",color: "fontTertiary",diff --git a/packages/editor/dist/es/extensions/listitem/commands.js b/packages/editor/dist/es/extensions/listitem/commands.jsindex 03d1c54aa..1ec880433 100644--- a/packages/editor/dist/es/extensions/listitem/commands.js+++ b/packages/editor/dist/es/extensions/listitem/commands.js@@ -11,11 +11,18 @@ export function onBackspacePressed(editor, name, type) {!editor.can().liftListItem(type))return false;const isEmpty = isListItemEmpty(type, editor.state);- if (isFirstOfType(type, editor.state)) {+ if (isEmpty) {+ if (isFirstOfType(type, editor.state)) {+ const parentList = getListFromListItem(type, editor.state);+ if (!parentList)+ return false;+ return editor.commands.deleteNode(parentList.type);+ }+ return editor.commands.deleteNode(type);+ }+ else if (isFirstOfType(type, editor.state)) {return editor.commands.liftListItem(type);}- else if (isEmpty)- return editor.commands.deleteNode(type);else {// we have to run join backward twice because on the first join// the two list items are joined i.e., the editor just puts their@@ -43,8 +50,21 @@ const isFirstOfType = (type, state) => {return false;const { pos } = block;const resolved = state.doc.resolve(pos);+ console.log("isFirstOfType", resolved);return !resolved.nodeBefore;};+const getListFromListItem = (type, state) => {+ var _a;+ const block = findParentNodeOfType(type)(state.selection);+ if (!block)+ return undefined;+ const { pos } = block;+ const resolved = state.doc.resolve(pos);+ if (!resolved.parent.type.spec.group ||+ ((_a = resolved.parent.type.spec.group) === null || _a === void 0 ? void 0 : _a.indexOf("list")) <= -1)+ return undefined;+ return resolved.parent;+};function isListItemEmpty(type, state) {const block = findParentNodeOfType(type)(state.selection);if (!block)diff --git a/packages/editor/dist/es/extensions/taskitem/component.js b/packages/editor/dist/es/extensions/taskitem/component.jsindex 00cd6b965..129339c77 100644--- a/packages/editor/dist/es/extensions/taskitem/component.js+++ b/packages/editor/dist/es/extensions/taskitem/component.js@@ -5,9 +5,11 @@ import { Icons } from "../../toolbar/icons";import { findChildren, } from "@tiptap/core";import { useCallback } from "react";import { TaskItemNode } from "./task-item";+import { useIsMobile } from "../../toolbar/stores/toolbar-store";export function TaskItemComponent(props) {const { editor, updateAttributes, node, getPos, forwardRef } = props;const { checked } = props.node.attrs;+ const isMobile = useIsMobile();const toggle = useCallback(() => {if (!editor.isEditable)return false;@@ -20,6 +22,8 @@ export function TaskItemComponent(props) {return true;}, [editor, getPos, node, checked]);return (_jsx(_Fragment, { children: _jsxs(Flex, Object.assign({ "data-drag-image": true, sx: {+ bg: "background",+ borderRadius: "default",":hover > .dragHandle": {opacity: editor.isEditable ? 1 : 0,},@@ -32,7 +36,7 @@ export function TaskItemComponent(props) {".icon:hover path": {fill: "var(--checked) !important",},- }, size: 20 }), _jsx(Icon, { path: checked ? Icons.check : "", stroke: "1px", sx: {+ }, size: isMobile ? 24 : 20, onMouseDown: (e) => e.preventDefault() }), _jsx(Icon, { path: checked ? Icons.check : "", stroke: "1px", sx: {border: "2px solid",borderColor: checked ? "checked" : "icon",borderRadius: "default",@@ -49,7 +53,7 @@ export function TaskItemComponent(props) {}, onMouseDown: (e) => {e.preventDefault();toggle();- }, color: checked ? "checked" : "icon", size: 13 }), _jsx(Text, { as: "div", ref: forwardRef, sx: {+ }, color: checked ? "checked" : "icon", size: isMobile ? 16 : 14 }), _jsx(Text, { as: "div", ref: forwardRef, sx: {textDecorationLine: checked ? "line-through" : "none",color: checked ? "var(--checked)" : "var(--text)",flex: 1,diff --git a/packages/editor/dist/es/extensions/tasklist/component.js b/packages/editor/dist/es/extensions/tasklist/component.jsindex 9e974917f..3d9970a25 100644--- a/packages/editor/dist/es/extensions/tasklist/component.js+++ b/packages/editor/dist/es/extensions/tasklist/component.js@@ -83,6 +83,7 @@ export function TaskListComponent(props) {li: {listStyleType: "none",position: "relative",+ marginBottom: [2, "7px"],},} })] }));}diff --git a/packages/editor/dist/es/index.d.ts b/packages/editor/dist/es/index.d.tsindex dc11b106e..183bc0edb 100644--- a/packages/editor/dist/es/index.d.ts+++ b/packages/editor/dist/es/index.d.ts@@ -14,4 +14,4 @@ export { useTiptap, Toolbar, usePermissionHandler };export * from "./types";export * from "./extensions/react";export * from "./toolbar";-export { type AttachmentType } from "./extensions/attachment";+export { type AttachmentType, type Attachment } from "./extensions/attachment";diff --git a/packages/editor/dist/es/toolbar/components/dropdown.js b/packages/editor/dist/es/toolbar/components/dropdown.jsindex 4f8170599..04dcf9706 100644--- a/packages/editor/dist/es/toolbar/components/dropdown.js+++ b/packages/editor/dist/es/toolbar/components/dropdown.js@@ -44,5 +44,6 @@ export function Dropdown(props) {marginRight: isBottom ? "10px" : 0,display: "flex",alignItems: isBottom ? "center" : "unset",+ mr: isBottom ? 0 : 2,} })] }));}diff --git a/packages/editor/dist/es/toolbar/components/moretools.js b/packages/editor/dist/es/toolbar/components/moretools.jsindex c206a9691..5be9b8cf1 100644--- a/packages/editor/dist/es/toolbar/components/moretools.js+++ b/packages/editor/dist/es/toolbar/components/moretools.js@@ -19,7 +19,10 @@ export function MoreTools(props) {yOffset: isBottom ? 10 : 5,}, autoCloseOnUnmount: autoCloseOnUnmount, focusOnRender: false, blocking: false, renderPopup: () => (_jsx(ToolbarGroup, { tools: tools, editor: editor, sx: {flex: 1,- p: 1,+ // this is intentionally set to a fixed value+ // because we want the same padding on mobile+ // and web.+ p: "5px",boxShadow: "menu",bg: "background",borderRadius: "default",diff --git a/packages/editor/dist/es/toolbar/components/splitbutton.js b/packages/editor/dist/es/toolbar/components/splitbutton.jsindex bf67ffdae..af9957f4b 100644--- a/packages/editor/dist/es/toolbar/components/splitbutton.js+++ b/packages/editor/dist/es/toolbar/components/splitbutton.js@@ -25,11 +25,12 @@ function _SplitButton(props) {return (_jsxs(_Fragment, { children: [_jsxs(Flex, Object.assign({ ref: ref, sx: {borderRadius: "default",bg: toggled ? "hover" : "transparent",- ":hover": { bg: "hover" },- } }, { children: [_jsx(ToolButton, Object.assign({}, toolButtonProps, { toggled: toggled })), _jsx(Button, Object.assign({ sx: {+ ":hover": { bg: [toggled ? "hover" : "transparent", "hover"] },+ ":active": { bg: toggled ? "hover" : "transparent" },+ } }, { children: [_jsx(ToolButton, Object.assign({}, toolButtonProps, { toggled: false })), _jsx(Button, Object.assign({ sx: {p: 0,m: 0,- bg: toggled ? "hover" : "transparent",+ bg: "transparent",":hover": { bg: "hover" },":last-of-type": {mr: 0,diff --git a/packages/editor/dist/es/toolbar/components/toolbutton.js b/packages/editor/dist/es/toolbar/components/toolbutton.jsindex 5fc9f8efb..86109ddd3 100644--- a/packages/editor/dist/es/toolbar/components/toolbutton.js+++ b/packages/editor/dist/es/toolbar/components/toolbutton.js@@ -16,7 +16,7 @@ import { Button } from "../../components/button";import { Icon } from "./icon";export const ToolButton = React.memo(function ToolButton(props) {const { id, icon, iconSize, iconColor, toggled, sx, buttonRef, variant = "normal" } = props, buttonProps = __rest(props, ["id", "icon", "iconSize", "iconColor", "toggled", "sx", "buttonRef", "variant"]);- return (_jsx(Button, Object.assign({ ref: buttonRef, tabIndex: -1, id: `tool-${id || icon}`, sx: Object.assign({ flexShrink: 0, p: variant === "small" ? "small" : 1, borderRadius: variant === "small" ? "small" : "default", m: 0, bg: toggled ? "hover" : "transparent", mr: variant === "small" ? 0 : 1, ":hover": { bg: ["transparent", "hover"] }, ":active": { bg: "hover" }, ":last-of-type": {+ return (_jsx(Button, Object.assign({ ref: buttonRef, tabIndex: -1, id: `tool-${id || icon}`, sx: Object.assign({ flexShrink: 0, p: variant === "small" ? "small" : 1, borderRadius: variant === "small" ? "small" : "default", m: 0, bg: toggled ? "hover" : "transparent", mr: variant === "small" ? 0 : 1, ":hover": { bg: "hover" }, ":last-of-type": {mr: 0,} }, sx), onMouseDown: (e) => e.preventDefault() }, buttonProps, { children: _jsx(Icon, { path: Icons[icon], color: iconColor || "icon", size: iconSize || (variant === "small" ? "medium" : "big") }) })));}, (prev, next) => {diff --git a/packages/editor/dist/es/toolbar/icons.d.ts b/packages/editor/dist/es/toolbar/icons.d.tsindex 7954bdda5..4105cd1e7 100644--- a/packages/editor/dist/es/toolbar/icons.d.ts+++ b/packages/editor/dist/es/toolbar/icons.d.ts@@ -80,6 +80,8 @@ export declare const Icons: {fontFamily: string;fontSize: string;heading: string;+ indent: string;+ outdent: string;plus: string;minus: string;close: string;diff --git a/packages/editor/dist/es/toolbar/icons.js b/packages/editor/dist/es/toolbar/icons.jsindex 9f79e87c4..4c70bbce0 100644--- a/packages/editor/dist/es/toolbar/icons.js+++ b/packages/editor/dist/es/toolbar/icons.js@@ -1,4 +1,4 @@-import { mdiAttachment, mdiBorderHorizontal, mdiCheck, mdiChevronDown, mdiCodeBraces, mdiCodeTags, mdiDotsVertical, mdiFormatAlignCenter, mdiFormatAlignJustify, mdiFormatAlignLeft, mdiFormatAlignRight, mdiFormatBold, mdiFormatClear, mdiFormatColorHighlight, mdiFormatColorText, mdiFormatItalic, mdiFormatListBulleted, mdiFormatListNumbered, mdiFormatQuoteClose, mdiFormatStrikethrough, mdiFormatSubscript, mdiFormatSuperscript, mdiFormatTextdirectionLToR, mdiFormatTextdirectionRToL, mdiFormatUnderline, mdiImage, mdiInvertColorsOff, mdiLinkPlus, mdiLoading, mdiTable, mdiTableBorder, mdiTableRowPlusAfter, mdiTableRowPlusBefore, mdiTableRowRemove, mdiTableColumnPlusAfter, mdiTableColumnPlusBefore, mdiTableColumnRemove, mdiUploadOutline, mdiPlus, mdiFormatColorFill, mdiClose, mdiSortDescending, mdiArrowExpandRight, mdiArrowExpandLeft, mdiArrowExpandDown, mdiArrowExpandUp, mdiTableMergeCells, mdiTableSplitCell, mdiDeleteOutline, mdiDownloadOutline, mdiFormatListCheckbox, mdiDrag, mdiCheckboxMarkedOutline, mdiChevronUp, mdiArrowUp, mdiArrowDown, mdiRegex, mdiFormatLetterCase, mdiFormatLetterMatches, mdiMoviePlusOutline, mdiLink, mdiChevronRight, mdiTableColumnWidth, mdiTableRowHeight, mdiMinus, mdiPaletteOutline, mdiCircle, mdiChevronLeft, mdiTableCog, mdiTableOff, mdiRectangle, mdiImageEditOutline, mdiArrowLeft, mdiMovieCogOutline, mdiLinkOff, mdiOpenInNew, mdiCameraOutline, mdiMathIntegral, mdiFunctionVariant, mdiFileTreeOutline, mdiFormatFont, mdiFormatFontSizeIncrease, mdiFormatHeaderPound, } from "@mdi/js";+import { mdiAttachment, mdiBorderHorizontal, mdiCheck, mdiChevronDown, mdiCodeBraces, mdiCodeTags, mdiDotsVertical, mdiFormatAlignCenter, mdiFormatAlignJustify, mdiFormatAlignLeft, mdiFormatAlignRight, mdiFormatBold, mdiFormatClear, mdiFormatColorHighlight, mdiFormatColorText, mdiFormatItalic, mdiFormatListBulleted, mdiFormatListNumbered, mdiFormatQuoteClose, mdiFormatStrikethrough, mdiFormatSubscript, mdiFormatSuperscript, mdiFormatTextdirectionLToR, mdiFormatTextdirectionRToL, mdiFormatUnderline, mdiImage, mdiInvertColorsOff, mdiLinkPlus, mdiLoading, mdiTable, mdiTableBorder, mdiTableRowPlusAfter, mdiTableRowPlusBefore, mdiTableRowRemove, mdiTableColumnPlusAfter, mdiTableColumnPlusBefore, mdiTableColumnRemove, mdiUploadOutline, mdiPlus, mdiFormatColorFill, mdiClose, mdiSortDescending, mdiArrowExpandRight, mdiArrowExpandLeft, mdiArrowExpandDown, mdiArrowExpandUp, mdiTableMergeCells, mdiTableSplitCell, mdiDeleteOutline, mdiDownloadOutline, mdiFormatListCheckbox, mdiDrag, mdiCheckboxMarkedOutline, mdiChevronUp, mdiArrowUp, mdiArrowDown, mdiRegex, mdiFormatLetterCase, mdiFormatLetterMatches, mdiMoviePlusOutline, mdiLink, mdiChevronRight, mdiTableColumnWidth, mdiTableRowHeight, mdiMinus, mdiPaletteOutline, mdiCircle, mdiChevronLeft, mdiTableCog, mdiTableOff, mdiRectangle, mdiImageEditOutline, mdiArrowLeft, mdiMovieCogOutline, mdiLinkOff, mdiOpenInNew, mdiCameraOutline, mdiMathIntegral, mdiFunctionVariant, mdiFileTreeOutline, mdiFormatFont, mdiFormatFontSizeIncrease, mdiFormatHeaderPound, mdiFormatIndentIncrease, mdiFormatIndentDecrease, } from "@mdi/js";export const Icons = {bold: mdiFormatBold,italic: mdiFormatItalic,@@ -81,6 +81,8 @@ export const Icons = {fontFamily: mdiFormatFont,fontSize: mdiFormatFontSizeIncrease,heading: mdiFormatHeaderPound,+ indent: mdiFormatIndentIncrease,+ outdent: mdiFormatIndentDecrease,plus: mdiPlus,minus: mdiMinus,close: mdiClose,diff --git a/packages/editor/dist/es/toolbar/toolbar.d.ts b/packages/editor/dist/es/toolbar/toolbar.d.tsindex c8486e53d..f1b0eb2e0 100644--- a/packages/editor/dist/es/toolbar/toolbar.d.ts+++ b/packages/editor/dist/es/toolbar/toolbar.d.ts@@ -1,9 +1,10 @@/// <reference types="react" />import { Theme } from "@notesnook/theme";import { Editor } from "../types";+import { FlexProps } from "rebass";import { ToolbarLocation } from "./stores/toolbar-store";import { ToolbarDefinition } from "./types";-declare type ToolbarProps = {+declare type ToolbarProps = FlexProps & {theme: Theme;editor: Editor | null;location: ToolbarLocation;diff --git a/packages/editor/dist/es/toolbar/toolbar.js b/packages/editor/dist/es/toolbar/toolbar.jsindex d5c77e9fc..1314bc41b 100644--- a/packages/editor/dist/es/toolbar/toolbar.js+++ b/packages/editor/dist/es/toolbar/toolbar.js@@ -1,3 +1,14 @@+var __rest = (this && this.__rest) || function (s, e) {+ var t = {};+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)+ t[p] = s[p];+ if (s != null && typeof Object.getOwnPropertySymbols === "function")+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))+ t[p[i]] = s[p[i]];+ }+ return t;+};import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";import { Flex } from "rebass";import { ThemeProvider } from "emotion-theming";@@ -8,14 +19,14 @@ import { useToolbarStore, } from "./stores/toolbar-store";import { ToolbarGroup } from "./components/toolbar-group";import { EditorContext, PopupRenderer, } from "../components/popup-presenter/popuprenderer";export function Toolbar(props) {- const { editor, theme, location, tools = getDefaultPresets().default, } = props;+ const { editor, theme, location, tools = getDefaultPresets().default, sx } = props, flexProps = __rest(props, ["editor", "theme", "location", "tools", "sx"]);const setToolbarLocation = useToolbarStore((store) => store.setToolbarLocation);useEffect(() => {setToolbarLocation(location);}, [location]);if (!editor)return null;- return (_jsx(ThemeProvider, Object.assign({ theme: theme }, { children: _jsx(EditorContext.Provider, Object.assign({ value: editor }, { children: _jsxs(PopupRenderer, Object.assign({ editor: editor }, { children: [_jsx(Flex, Object.assign({ className: "editor-toolbar", sx: { flexWrap: ["nowrap", "wrap"], overflowX: ["auto", "hidden"] } }, { children: tools.map((tools) => {+ return (_jsx(ThemeProvider, Object.assign({ theme: theme }, { children: _jsx(EditorContext.Provider, Object.assign({ value: editor }, { children: _jsxs(PopupRenderer, Object.assign({ editor: editor }, { children: [_jsx(Flex, Object.assign({ className: "editor-toolbar", sx: Object.assign(Object.assign({}, sx), { flexWrap: ["nowrap", "wrap"], overflowX: ["auto", "hidden"] }) }, flexProps, { children: tools.map((tools) => {return (_jsx(ToolbarGroup, { tools: tools, editor: editor, sx: {flexShrink: 0,pr: 2,diff --git a/packages/editor/dist/es/toolbar/tooldefinitions.d.ts b/packages/editor/dist/es/toolbar/tooldefinitions.d.tsindex 224e00ff4..97a23f185 100644--- a/packages/editor/dist/es/toolbar/tooldefinitions.d.ts+++ b/packages/editor/dist/es/toolbar/tooldefinitions.d.ts@@ -1,5 +1,5 @@import { ToolbarDefinition, ToolDefinition } from "./types";import { ToolId } from "./tools";export declare function getToolDefinition(id: ToolId): ToolDefinition;-export declare function getAllTools(): Record<"fontSize" | "underline" | "bold" | "bulletList" | "code" | "italic" | "subscript" | "superscript" | "textDirection" | "fontFamily" | "highlight" | "removeAttachment" | "downloadAttachment" | "deleteColumn" | "deleteRow" | "deleteTable" | "mergeCells" | "strikethrough" | "codeRemove" | "numberedList" | "textColor" | "openLink" | "linkSettings" | "imageSettings" | "rowProperties" | "insertRowBelow" | "insertRowAbove" | "moveRowDown" | "moveRowUp" | "columnProperties" | "insertColumnRight" | "insertColumnLeft" | "moveColumnRight" | "moveColumnLeft" | "cellProperties" | "cellBorderColor" | "splitCells" | "attachmentSettings" | "embedSettings" | "tableSettings" | "math" | "clearformatting" | "addLink" | "editLink" | "removeLink" | "insertBlock" | "headings" | "alignment" | "imageAlignCenter" | "imageAlignLeft" | "imageAlignRight" | "imageProperties" | "embedAlignCenter" | "embedAlignLeft" | "embedAlignRight" | "embedProperties" | "cellBackgroundColor" | "cellTextColor" | "cellBorderWidth", ToolDefinition>;+export declare function getAllTools(): Record<"fontSize" | "underline" | "bold" | "bulletList" | "code" | "italic" | "subscript" | "superscript" | "textDirection" | "fontFamily" | "highlight" | "removeAttachment" | "downloadAttachment" | "deleteColumn" | "deleteRow" | "deleteTable" | "mergeCells" | "strikethrough" | "codeRemove" | "numberedList" | "textColor" | "openLink" | "linkSettings" | "imageSettings" | "rowProperties" | "insertRowBelow" | "insertRowAbove" | "moveRowDown" | "moveRowUp" | "columnProperties" | "insertColumnRight" | "insertColumnLeft" | "moveColumnRight" | "moveColumnLeft" | "cellProperties" | "cellBorderColor" | "splitCells" | "attachmentSettings" | "embedSettings" | "tableSettings" | "math" | "indent" | "outdent" | "clearformatting" | "addLink" | "editLink" | "removeLink" | "insertBlock" | "headings" | "alignment" | "imageAlignCenter" | "imageAlignLeft" | "imageAlignRight" | "imageProperties" | "embedAlignCenter" | "embedAlignLeft" | "embedAlignRight" | "embedProperties" | "cellBackgroundColor" | "cellTextColor" | "cellBorderWidth", ToolDefinition>;export declare function getDefaultPresets(): Record<"default" | "minimal", ToolbarDefinition>;diff --git a/packages/editor/dist/es/toolbar/tooldefinitions.js b/packages/editor/dist/es/toolbar/tooldefinitions.jsindex 5e2a7bb17..58ff1a351 100644--- a/packages/editor/dist/es/toolbar/tooldefinitions.js+++ b/packages/editor/dist/es/toolbar/tooldefinitions.js@@ -275,6 +275,14 @@ const tools = {title: "Embed properties",conditional: true,},+ outdent: {+ icon: "outdent",+ title: "Lift list item",+ },+ indent: {+ icon: "indent",+ title: "Sink list item",+ },};export function getToolDefinition(id) {return tools[id];@@ -295,6 +303,8 @@ const defaultPresets = {"attachmentSettings","linkSettings","codeRemove",+ "outdent",+ "indent",],["bold",diff --git a/packages/editor/dist/es/toolbar/tools/index.d.ts b/packages/editor/dist/es/toolbar/tools/index.d.tsindex 099d7946f..959c01b7c 100644--- a/packages/editor/dist/es/toolbar/tools/index.d.ts+++ b/packages/editor/dist/es/toolbar/tools/index.d.ts@@ -5,7 +5,7 @@ import { InsertBlock } from "./block";import { FontSize, FontFamily } from "./font";import { Alignment } from "./alignment";import { Headings } from "./headings";-import { NumberedList, BulletList } from "./lists";+import { NumberedList, BulletList, Outdent, Indent } from "./lists";import { TextDirection } from "./text-direction";import { Highlight, TextColor } from "./colors";import { TableSettings, ColumnProperties, RowProperties, CellProperties, CellBackgroundColor, CellBorderColor, CellTextColor, CellBorderWidth } from "./table";@@ -74,6 +74,8 @@ declare const tools: {moveRowDown: (props: ToolProps) => JSX.Element;deleteRow: (props: ToolProps) => JSX.Element;deleteTable: (props: ToolProps) => JSX.Element;+ outdent: typeof Outdent;+ indent: typeof Indent;};export declare function findTool(id: ToolId): React.FunctionComponent<ToolProps>;export {};diff --git a/packages/editor/dist/es/toolbar/tools/index.js b/packages/editor/dist/es/toolbar/tools/index.jsindex c3964019b..ecfa21689 100644--- a/packages/editor/dist/es/toolbar/tools/index.js+++ b/packages/editor/dist/es/toolbar/tools/index.js@@ -3,7 +3,7 @@ import { InsertBlock } from "./block";import { FontSize, FontFamily } from "./font";import { Alignment } from "./alignment";import { Headings } from "./headings";-import { NumberedList, BulletList } from "./lists";+import { NumberedList, BulletList, Outdent, Indent } from "./lists";import { TextDirection } from "./text-direction";import { Highlight, TextColor } from "./colors";import { TableSettings, ColumnProperties, RowProperties, CellProperties, InsertColumnLeft, InsertColumnRight, MoveColumnLeft, MoveColumnRight, DeleteColumn, SplitCells, MergeCells, InsertRowAbove, InsertRowBelow, MoveRowUp, MoveRowDown, DeleteRow, DeleteTable, CellBackgroundColor, CellBorderColor, CellTextColor, CellBorderWidth, } from "./table";@@ -71,6 +71,8 @@ const tools = {moveRowDown: MoveRowDown,deleteRow: DeleteRow,deleteTable: DeleteTable,+ outdent: Outdent,+ indent: Indent,};export function findTool(id) {return tools[id];diff --git a/packages/editor/dist/es/toolbar/tools/link.js b/packages/editor/dist/es/toolbar/tools/link.jsindex b8e6c1850..1f39026f2 100644--- a/packages/editor/dist/es/toolbar/tools/link.js+++ b/packages/editor/dist/es/toolbar/tools/link.js@@ -104,7 +104,7 @@ export function OpenLink(props) {return (_jsxs(Flex, Object.assign({ sx: { alignItems: "center" } }, { children: [_jsx(Text, Object.assign({ as: "a", href: href, target: "_blank", variant: "body", sx: { mr: 1 } }, { children: href })), _jsx(ToolButton, Object.assign({}, props, { toggled: false, onClick: () => window.open(href, "_blank") }))] })));}function LinkTool(props) {- const { isEditing, onClick, onDone } = props, toolProps = __rest(props, ["isEditing", "onClick", "onDone"]);+ const { isEditing, onClick, onDone, editor } = props, toolProps = __rest(props, ["isEditing", "onClick", "onDone", "editor"]);const buttonRef = useRef(null);const [isOpen, setIsOpen] = useState(false);const [href, setHref] = useState();@@ -123,7 +123,11 @@ function LinkTool(props) {location: "below",align: "center",yOffset: 5,- }, title: isEditing ? "Edit link" : "Insert link", isOpen: isOpen, items: [], onClose: () => setIsOpen(false), focusOnRender: false }, { children: _jsx(LinkPopup, { href: href, text: text, isEditing: isEditing, onClose: () => setIsOpen(false), onDone: ({ href, text }) => {+ }, title: isEditing ? "Edit link" : "Insert link", isOpen: isOpen, items: [], onClose: () => {+ var _a;+ setIsOpen(false);+ (_a = editor.current) === null || _a === void 0 ? void 0 : _a.commands.focus();+ }, focusOnRender: false }, { children: _jsx(LinkPopup, { href: href, text: text, isEditing: isEditing, onClose: () => setIsOpen(false), onDone: ({ href, text }) => {onDone(href, text);setIsOpen(false);} }) }))] }));diff --git a/packages/editor/dist/es/toolbar/tools/lists.d.ts b/packages/editor/dist/es/toolbar/tools/lists.d.tsindex 50718c842..551f6e925 100644--- a/packages/editor/dist/es/toolbar/tools/lists.d.ts+++ b/packages/editor/dist/es/toolbar/tools/lists.d.ts@@ -2,3 +2,5 @@import { ToolProps } from "../types";export declare function NumberedList(props: ToolProps): JSX.Element;export declare function BulletList(props: ToolProps): JSX.Element;+export declare function Indent(props: ToolProps): JSX.Element | null;+export declare function Outdent(props: ToolProps): JSX.Element | null;diff --git a/packages/editor/dist/es/toolbar/tools/lists.js b/packages/editor/dist/es/toolbar/tools/lists.jsindex 312892468..53fe30d76 100644--- a/packages/editor/dist/es/toolbar/tools/lists.js+++ b/packages/editor/dist/es/toolbar/tools/lists.js@@ -17,13 +17,15 @@ import { useToolbarLocation } from "../stores/toolbar-store";import { getToolbarElement } from "../utils/dom";import { PopupWrapper } from "../../components/popup-presenter";import React from "react";+import { ToolButton } from "../components/tool-button";+import { findListItemType, isListActive } from "../utils/prosemirror";function _ListTool(props) {const { editor, onClick, isActive, subTypes, type } = props, toolProps = __rest(props, ["editor", "onClick", "isActive", "subTypes", "type"]);const toolbarLocation = useToolbarLocation();const isBottom = toolbarLocation === "bottom";const [isOpen, setIsOpen] = useState(false);const buttonRef = useRef();- return (_jsx(SplitButton, Object.assign({}, toolProps, { buttonRef: buttonRef, onClick: onClick, toggled: isActive || isOpen, sx: { mr: 0 }, onOpen: () => setIsOpen((s) => !s) }, { children: _jsx(PopupWrapper, { isOpen: isOpen, group: "lists", id: toolProps.title, blocking: false, focusOnRender: false, position: {+ return (_jsx(SplitButton, Object.assign({}, toolProps, { buttonRef: buttonRef, onClick: onClick, toggled: isOpen, sx: { mr: 0 }, onOpen: () => setIsOpen((s) => !s) }, { children: _jsx(PopupWrapper, { isOpen: isOpen, group: "lists", id: toolProps.title, blocking: false, focusOnRender: false, position: {isTargetAbsolute: true,target: isBottom ? getToolbarElement() : buttonRef.current || "mouse",align: "center",@@ -37,9 +39,9 @@ function _ListTool(props) {} }, { children: subTypes.map((item) => (_jsx(Button, Object.assign({ variant: "menuitem", sx: { width: 80 }, onClick: () => {var _a;let chain = (_a = editor.current) === null || _a === void 0 ? void 0 : _a.chain().focus();- if (!chain)+ if (!chain || !editor.current)return;- if (!isActive) {+ if (!isListActive(editor.current)) {if (type === "bulletList")chain = chain.toggleBulletList();else@@ -75,13 +77,29 @@ export function NumberedList(props) {}export function BulletList(props) {const { editor } = props;- const onClick = useCallback(() => { var _a; return (_a = editor.current) === null || _a === void 0 ? void 0 : _a.chain().focus().toggleOrderedList().run(); }, []);+ const onClick = useCallback(() => { var _a; return (_a = editor.current) === null || _a === void 0 ? void 0 : _a.chain().focus().toggleBulletList().run(); }, []);return (_jsx(ListTool, Object.assign({}, props, { type: "bulletList", onClick: onClick, isActive: editor.isActive("bulletList"), subTypes: [{ type: "disc", title: "Decimal", items: ["1", "2", "3"] },{ type: "circle", title: "Upper alpha", items: ["A", "B", "C"] },{ type: "square", title: "Lower alpha", items: ["a", "b", "c"] },] })));}+export function Indent(props) {+ const { editor } = props, toolProps = __rest(props, ["editor"]);+ const isBottom = useToolbarLocation() === "bottom";+ const listItemType = findListItemType(editor);+ if (!listItemType || !isBottom)+ return null;+ return (_jsx(ToolButton, Object.assign({}, toolProps, { toggled: false, onClick: () => { var _a; return (_a = editor.current) === null || _a === void 0 ? void 0 : _a.chain().focus().sinkListItem(listItemType).run(); } })));+}+export function Outdent(props) {+ const { editor } = props, toolProps = __rest(props, ["editor"]);+ const isBottom = useToolbarLocation() === "bottom";+ const listItemType = findListItemType(editor);+ if (!listItemType || !isBottom)+ return null;+ return (_jsx(ToolButton, Object.assign({}, toolProps, { toggled: false, onClick: () => { var _a; return (_a = editor.current) === null || _a === void 0 ? void 0 : _a.chain().focus().liftListItem(listItemType).run(); } })));+}function ListThumbnail(props) {const { listStyleType } = props;return (_jsx(Flex, Object.assign({ as: "ul", sx: {@@ -89,7 +107,7 @@ function ListThumbnail(props) {flex: 1,p: 0,listStyleType,- } }, { children: [0, 1, 2].map((i) => (_jsx(Box, Object.assign({ as: "li", sx: {+ }, onMouseDown: (e) => e.preventDefault() }, { children: [0, 1, 2].map((i) => (_jsx(Box, Object.assign({ as: "li", sx: {display: "list-item",color: "text",fontSize: 8,diff --git a/packages/editor/dist/es/toolbar/utils/prosemirror.d.ts b/packages/editor/dist/es/toolbar/utils/prosemirror.d.tsindex 5dd849997..ef7a00a57 100644--- a/packages/editor/dist/es/toolbar/utils/prosemirror.d.ts+++ b/packages/editor/dist/es/toolbar/utils/prosemirror.d.ts@@ -10,3 +10,5 @@ export declare function findSelectedDOMNode(editor: Editor, types: string[]): HTexport declare function findSelectedNode(editor: Editor, type: string): Node | null;export declare function findMark(node: Node, type: string): Mark | undefined;export declare function selectionToOffset(selection: Selection): NodeWithOffset;+export declare function findListItemType(editor: Editor): string | null;+export declare function isListActive(editor: Editor): boolean;diff --git a/packages/editor/dist/es/toolbar/utils/prosemirror.js b/packages/editor/dist/es/toolbar/utils/prosemirror.jsindex 10b0ecede..fd18498de 100644--- a/packages/editor/dist/es/toolbar/utils/prosemirror.js+++ b/packages/editor/dist/es/toolbar/utils/prosemirror.js@@ -29,3 +29,21 @@ export function selectionToOffset(selection) {const { $from, from } = selection;return { node: $from.node(), from, to: from + $from.node().nodeSize };}+export function findListItemType(editor) {+ const isTaskList = editor.isActive("taskList");+ const isOutlineList = editor.isActive("outlineList");+ const isList = editor.isActive("bulletList") || editor.isActive("orderedList");+ return isList+ ? "listItem"+ : isOutlineList+ ? "outlineListItem"+ : isTaskList+ ? "taskItem"+ : null;+}+export function isListActive(editor) {+ const isTaskList = editor.isActive("taskList");+ const isOutlineList = editor.isActive("outlineList");+ const isList = editor.isActive("bulletList") || editor.isActive("orderedList");+ return isTaskList || isOutlineList || isList;+}diff --git a/packages/editor/dist/es/utils/position.js b/packages/editor/dist/es/utils/position.jsindex ebed04e6a..e836417af 100644--- a/packages/editor/dist/es/utils/position.js+++ b/packages/editor/dist/es/utils/position.js@@ -42,7 +42,7 @@ export function getPosition(element, options) {position.top = y - elementHeight;}if (width && target !== "mouse" && align === "center" && elementWidth > 0) {- position.left -= elementWidth / 2 - width / 2;+ position.left = (width - elementWidth) / 2;}else if (width &&target !== "mouse" &&diff --git a/packages/editor/package.json b/packages/editor/package.jsonindex 7671adf10..f36c2ac38 100644--- a/packages/editor/package.json+++ b/packages/editor/package.json@@ -2,14 +2,7 @@"name": "notesnook-editor","version": "0.0.1","private": true,- "main": "dist/cjs/index.js",- "module": "dist/es/index.js",- "exports": {- ".": {- "import": "./dist/es/index.js",- "require": "./dist/cjs/index.js"- }- },+ "main": "dist/es/index.js","dependencies": {"@_ueberdosis/prosemirror-tables": "^1.1.3","@mdi/js": "^6.9.96",