push latest build

This commit is contained in:
Ammar Ahmed
2022-06-20 06:18:45 +05:00
parent 7f7096fe06
commit cf91855fae
62 changed files with 301 additions and 159 deletions

View File

@@ -93,8 +93,8 @@ export function ActionSheetPresenter(props) {
(_a = focusedElement.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
}
} }, { children: [_jsxs(Sheet.Container, __assign({ style: {
borderTopLeftRadius: 20,
borderTopRightRadius: 20,
borderTopLeftRadius: 15,
borderTopRightRadius: 15,
boxShadow: theme.shadows.menu,
} }, { children: [_jsx(Sheet.Header, { disableDrag: !onClose }), _jsxs(Sheet.Content, { children: [_jsx("div", { id: "action-sheet-focus", ref: function (ref) { return (contentRef.current = ref || undefined); }, tabIndex: -1 }), _jsx(ContentContainer, __assign({ items: items, title: title, onClose: onClose }, { children: children }))] })] })), blocking ? (_jsx(Sheet.Backdrop, { style: { border: "none" }, onTap: onClose })) : (_jsx(_Fragment, {}))] })));
}
@@ -105,7 +105,7 @@ function ContentContainer(props) {
title: title,
items: items,
}), current = _b.current, goBack = _b.goBack, canGoBack = _b.canGoBack, navigate = _b.navigate;
return (_jsxs(Flex, __assign({ sx: { flexDirection: "column" } }, { children: [_jsxs(Flex, __assign({ id: "header", sx: { alignItems: "center", mx: 2, mb: 2 } }, { children: [canGoBack && (_jsx(Button, __assign({ variant: "icon", sx: { p: 1, mr: 2 }, onClick: goBack }, { children: _jsx(Icon, { path: Icons.chevronLeft, size: "big" }) }))), (current === null || current === void 0 ? void 0 : current.title) && (_jsx(Text, __assign({ variant: "title", sx: { ml: 1, fontSize: "title" } }, { children: current === null || current === void 0 ? void 0 : current.title })))] })), children
return (_jsxs(Flex, __assign({ sx: { flexDirection: "column" } }, { children: [_jsxs(Flex, __assign({ id: "header", sx: { alignItems: "center", mx: 0, mb: 1 } }, { children: [canGoBack && (_jsx(Button, __assign({ variant: "icon", sx: { p: 1, ml: 1 }, onClick: goBack }, { children: _jsx(Icon, { path: Icons.arrowLeft, size: "big" }) }))), (current === null || current === void 0 ? void 0 : current.title) && (_jsx(Text, __assign({ variant: "title", sx: { ml: 1, fontSize: "title" } }, { children: current === null || current === void 0 ? void 0 : current.title })))] })), children
? children
: (_a = current === null || current === void 0 ? void 0 : current.items) === null || _a === void 0 ? void 0 : _a.map(function (item) {
switch (item.type) {
@@ -117,8 +117,11 @@ function ContentContainer(props) {
navigate(item.menu);
}
else if (item.onClick) {
item.onClick();
onClose === null || onClose === void 0 ? void 0 : onClose();
setTimeout(function () {
var _a;
(_a = item.onClick) === null || _a === void 0 ? void 0 : _a.call(item);
}, 300);
}
} }, item.key));
case "popup":

View File

@@ -0,0 +1,2 @@
import { ButtonProps } from "rebass";
export default function Button(props: ButtonProps): JSX.Element;

View File

@@ -0,0 +1,36 @@
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
import { jsx as _jsx } from "react/jsx-runtime";
import { useCallback, useRef } from "react";
import { Button as RebassButton } from "rebass";
export default function Button(props) {
var touchStartTime = useRef(0);
var onTouchEnd = useCallback(function (e) {
e.preventDefault();
var now = Date.now();
setTimeout(function () {
if (touchStartTime.current === 0)
return;
if (now - touchStartTime.current > 300)
return;
//@ts-ignore
props.onClick(e);
}, 1);
}, []);
var onTouchStart = useCallback(function (e) {
touchStartTime.current = Date.now();
e.preventDefault();
}, []);
return (_jsx(RebassButton, __assign({}, props, { onClick: props.onClick, onMouseDown: function (e) { return e.preventDefault(); }, onTouchEnd: onTouchEnd, onTouchMove: function () {
touchStartTime.current = 0;
}, onTouchStart: onTouchStart })));
}

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { InputProps } from "@rebass/forms";
import { FlexProps } from "rebass";
declare type LabelInputProps = InputProps & {

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { MenuButton } from "./types";
declare type MenuButtonProps = {
item: MenuButton;

View File

@@ -11,20 +11,24 @@ var __assign = (this && this.__assign) || function () {
};
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useRef } from "react";
import { Flex, Text, Button } from "rebass";
import { Flex, Text } from "rebass";
import Button from "../button";
import { Icon } from "../../toolbar/components/icon";
import { Icons } from "../../toolbar/icons";
import { useToolbarLocation } from "../../toolbar/stores/toolbar-store";
export function MenuButton(props) {
var item = props.item, isFocused = props.isFocused, onMouseEnter = props.onMouseEnter, onMouseLeave = props.onMouseLeave, onClick = props.onClick;
var title = item.title, key = item.key, icon = item.icon, tooltip = item.tooltip, isDisabled = item.isDisabled, isChecked = item.isChecked, menu = item.menu, modifier = item.modifier;
var itemRef = useRef(null);
var toolbarLocation = useToolbarLocation();
var isBottom = toolbarLocation === "bottom";
return (_jsx(Flex, __assign({ as: "li", sx: { flexShrink: 0, flexDirection: "column" }, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave }, { children: _jsxs(Button, __assign({ id: key, "data-test-id": "MenuButton-".concat(key), ref: itemRef, tabIndex: -1, variant: "menuitem", title: tooltip, disabled: isDisabled, onClick: onClick, sx: {
bg: isFocused ? "hover" : "transparent",
bg: isFocused && !isBottom ? "hover" : "transparent",
display: "flex",
alignItems: "center",
justifyContent: "space-between",
":hover": {
bg: "hover",
bg: isBottom ? "transparent" : "hover",
},
} }, { children: [_jsxs(Flex, { children: [icon && (_jsx(Icon, { path: Icons[icon], color: "text", size: "medium", sx: { mr: 2 } })), _jsx(Text, __assign({ as: "span", variant: "body" }, { children: title }))] }), isChecked || menu || modifier ? (_jsxs(Flex, __assign({ sx: { ml: 4 } }, { children: [isChecked && _jsx(Icon, { path: Icons.check, size: 14 }), menu && _jsx(Icon, { path: Icons.chevronRight, size: 14 }), modifier && (_jsx(Text, __assign({ as: "span", sx: {
fontFamily: "body",

View File

@@ -1,2 +1 @@
/// <reference types="react" />
export declare function MenuSeparator(): JSX.Element;

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { IconNames } from "../../toolbar/icons";
declare type MenuItemComponentProps = {
onClick?: (e?: any) => void;

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { ToggleProps } from "react-toggle";
import "react-toggle/style.css";
export declare function Toggle(props: ToggleProps): JSX.Element;

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { AttachmentWithProgress } from "./attachment";
import { SelectionBasedReactNodeViewProps } from "../react";
export declare function AttachmentComponent(props: SelectionBasedReactNodeViewProps<AttachmentWithProgress>): JSX.Element;

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import "prism-themes/themes/prism-dracula.min.css";
import { CodeBlockAttributes } from "./code-block";
import { ReactNodeViewProps } from "../react/types";

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { EmbedAlignmentOptions, EmbedAttributes } from "./embed";
import { SelectionBasedReactNodeViewProps } from "../react";
export declare function EmbedComponent(props: SelectionBasedReactNodeViewProps<EmbedAttributes & EmbedAlignmentOptions>): JSX.Element;

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { ImageAlignmentOptions, ImageAttributes } from "./image";
import { SelectionBasedReactNodeViewProps } from "../react";
export declare function ImageComponent(props: SelectionBasedReactNodeViewProps<ImageAttributes & ImageAlignmentOptions>): JSX.Element;

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { ReactNodeViewProps } from "../react";
import { OutlineListAttributes } from "./outline-list";
export declare function OutlineListComponent(props: ReactNodeViewProps<OutlineListAttributes>): JSX.Element;

View File

@@ -1,3 +1,2 @@
/// <reference types="react" />
import { ReactNodeViewProps } from "../react";
export declare function OutlineListItemComponent(props: ReactNodeViewProps): JSX.Element;

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { ReactNodeViewProps } from "../react";
import { TaskItemAttributes } from "./task-item";
export declare function TaskItemComponent(props: ReactNodeViewProps<TaskItemAttributes>): JSX.Element;

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { ReactNodeViewProps } from "../react";
import { TaskListAttributes } from "./task-list";
export declare function TaskListComponent(props: ReactNodeViewProps<TaskListAttributes>): JSX.Element;

View File

@@ -96,7 +96,7 @@ export function TaskListComponent(props) {
} })] }))) : (_jsxs(Flex, __assign({ sx: {
position: "relative",
bg: "bgSecondary",
py: 1,
py: 2,
borderRadius: "default",
mb: 2,
alignItems: "center",

View File

@@ -0,0 +1,2 @@
import { ButtonProps } from "rebass";
export default function Button(props: ButtonProps): JSX.Element;

View File

@@ -0,0 +1,36 @@
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
import { jsx as _jsx } from "react/jsx-runtime";
import { useCallback, useRef } from "react";
import { Button as RebassButton } from "rebass";
export default function Button(props) {
var touchStartTime = useRef(0);
var onTouchEnd = useCallback(function (e) {
e.preventDefault();
var now = Date.now();
setTimeout(function () {
if (touchStartTime.current === 0)
return;
if (now - touchStartTime.current > 300)
return;
//@ts-ignore
props.onClick(e);
}, 1);
}, []);
var onTouchStart = useCallback(function (e) {
touchStartTime.current = Date.now();
e.preventDefault();
}, []);
return (_jsx(RebassButton, __assign({}, props, { onClick: props.onClick, onMouseDown: function (e) { return e.preventDefault(); }, onTouchEnd: onTouchEnd, onTouchMove: function () {
touchStartTime.current = 0;
}, onTouchStart: onTouchStart })));
}

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
export declare type CounterProps = {
title: string;
onIncrease: () => void;

View File

@@ -11,6 +11,7 @@ var __assign = (this && this.__assign) || function () {
};
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Flex, Text } from "rebass";
import Button from "../../components/button";
import { ToolButton } from "./tool-button";
export function Counter(props) {
var title = props.title, onDecrease = props.onDecrease, onIncrease = props.onIncrease, onReset = props.onReset, value = props.value;
@@ -20,5 +21,7 @@ export function Counter(props) {
":last-of-type": {
mr: 0,
},
} }, { children: [_jsx(ToolButton, { toggled: false, title: "Decrease ".concat(title), icon: "minus", variant: "small", onClick: onDecrease }), _jsx(Text, __assign({ variant: "body", sx: { fontSize: "subBody", mx: 1, textAlign: "center" }, title: "Reset ".concat(title), onClick: onReset }, { children: value })), _jsx(ToolButton, { toggled: false, title: "Increase ".concat(title), icon: "plus", variant: "small", onClick: onIncrease })] })));
} }, { children: [_jsx(ToolButton, { toggled: false, title: "Decrease ".concat(title), icon: "minus", variant: "small", onClick: onDecrease }), _jsx(Button, __assign({ sx: {
bg: "transparent",
}, onClick: onReset }, { children: _jsx(Text, __assign({ variant: "body", sx: { fontSize: "subBody", mx: 1, textAlign: "center" }, title: "Reset ".concat(title) }, { children: value })) })), _jsx(ToolButton, { toggled: false, title: "Increase ".concat(title), icon: "plus", variant: "small", onClick: onIncrease })] })));
}

View File

@@ -66,8 +66,10 @@ export function Dropdown(props) {
}, blocking: !isMobile, focusOnRender: !isMobile, sx: {
minWidth: menuWidth,
maxWidth: isBottom ? "95vw" : "auto",
p: isBottom ? 1 : 0,
flexDirection: isBottom ? "row" : "column",
overflowX: isBottom ? "auto" : "hidden",
marginRight: isBottom ? "10px" : 0,
display: "flex",
alignItems: isBottom ? "center" : "unset",
} })] }));
}

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { Theme } from "@notesnook/theme";
import { SchemeColors } from "@notesnook/theme/dist/theme/colorscheme";
import { FlexProps } from "rebass";

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { ToolProps } from "../types";
import { ToolId } from "../tools";
declare type MoreToolsProps = ToolProps & {

View File

@@ -46,7 +46,8 @@ export function MoreTools(props) {
yOffset: isBottom ? 10 : 5,
}, focusOnRender: false, blocking: false, renderPopup: function () { return (_jsx(ToolbarGroup, { tools: tools, editor: editor, sx: {
flex: 1,
p: 1,
px: isBottom ? 0 : 1,
height: "50px",
boxShadow: "menu",
bg: "background",
borderRadius: "default",

View File

@@ -22,11 +22,12 @@ var __rest = (this && this.__rest) || function (s, e) {
};
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { useRef } from "react";
import { Button, Flex } from "rebass";
import { Flex } from "rebass";
import { Icons } from "../icons";
import { Icon } from "./icon";
import { ToolButton } from "./tool-button";
import { useToolbarLocation } from "../stores/toolbar-store";
import Button from "../../components/button";
export function SplitButton(props) {
var children = props.children, toggled = props.toggled, onOpen = props.onOpen, toolButtonProps = __rest(props, ["children", "toggled", "onOpen"]);
var ref = useRef(null);
@@ -43,5 +44,5 @@ export function SplitButton(props) {
":last-of-type": {
mr: 0,
},
}, onClick: onOpen, onMouseDown: function (e) { return e.preventDefault(); } }, { children: _jsx(Icon, { path: toolbarLocation === "bottom" ? Icons.chevronUp : Icons.chevronDown, color: "text", size: "small" }) }))] })), children] }));
}, onClick: onOpen }, { children: _jsx(Icon, { path: toolbarLocation === "bottom" ? Icons.chevronUp : Icons.chevronDown, color: "text", size: "small" }) }))] })), children] }));
}

View File

@@ -3,8 +3,8 @@ import { ToolbarGroupDefinition, ToolButtonVariant } from "../types";
import { FlexProps } from "rebass";
import { Editor } from "@tiptap/core";
export declare type ToolbarGroupProps = FlexProps & {
tools: ToolbarGroupDefinition;
editor: Editor;
variant?: ToolButtonVariant;
tools: ToolbarGroupDefinition;
editor: Editor;
variant?: ToolButtonVariant;
};
export declare function ToolbarGroup(props: ToolbarGroupProps): JSX.Element;

View File

@@ -21,12 +21,12 @@ var __rest = (this && this.__rest) || function (s, e) {
return t;
};
import { jsx as _jsx } from "react/jsx-runtime";
import { Button } from "rebass";
import { Icons } from "../icons";
import Button from "../../components/button";
import { Icon } from "./icon";
export function ToolButton(props) {
var id = props.id, icon = props.icon, iconSize = props.iconSize, iconColor = props.iconColor, toggled = props.toggled, sx = props.sx, buttonRef = props.buttonRef, _a = props.variant, variant = _a === void 0 ? "normal" : _a, buttonProps = __rest(props, ["id", "icon", "iconSize", "iconColor", "toggled", "sx", "buttonRef", "variant"]);
return (_jsx(Button, __assign({ ref: buttonRef, tabIndex: -1, id: "tool-".concat(id), sx: __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": {
return (_jsx(Button, __assign({ ref: buttonRef, tabIndex: -1, id: "tool-".concat(id), sx: __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"] }, ":last-of-type": {
mr: 0,
} }, sx), onMouseDown: function (e) { return e.preventDefault(); } }, buttonProps, { children: _jsx(Icon, { path: Icons[icon], color: iconColor || "icon", size: iconSize || variant === "small" ? "medium" : "big" }) })));
}

View File

@@ -1,3 +1,2 @@
/// <reference types="react" />
import { FloatingMenuProps } from "./types";
export declare function EditorFloatingMenus(props: FloatingMenuProps): JSX.Element;

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { FloatingMenuProps } from "../types";
export declare function TableRowFloatingMenu(props: FloatingMenuProps): JSX.Element | null;
export declare function TableColumnFloatingMenu(props: FloatingMenuProps): JSX.Element | null;

View File

@@ -75,6 +75,7 @@ export declare const Icons: {
chevronRight: string;
chevronLeft: string;
circle: string;
arrowLeft: string;
none: string;
};
export declare type IconNames = keyof typeof Icons;

View File

@@ -1,80 +1,158 @@
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, } 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,
mdiArrowLeft,
} from "@mdi/js";
export var Icons = {
bold: mdiFormatBold,
italic: mdiFormatItalic,
underline: mdiFormatUnderline,
strikethrough: mdiFormatStrikethrough,
code: mdiCodeTags,
alignCenter: mdiFormatAlignCenter,
alignLeft: mdiFormatAlignLeft,
alignRight: mdiFormatAlignRight,
alignJustify: mdiFormatAlignJustify,
subscript: mdiFormatSubscript,
superscript: mdiFormatSuperscript,
horizontalRule: mdiBorderHorizontal,
codeblock: mdiCodeBraces,
blockquote: mdiFormatQuoteClose,
formatClear: mdiFormatClear,
ltr: mdiFormatTextdirectionLToR,
rtl: mdiFormatTextdirectionRToL,
numberedList: mdiFormatListNumbered,
bulletList: mdiFormatListBulleted,
highlight: mdiFormatColorHighlight,
textColor: mdiFormatColorText,
link: mdiLinkPlus,
url: mdiLink,
image: mdiImage,
imageSettings: mdiImageEditOutline,
colorClear: mdiInvertColorsOff,
check: mdiCheck,
checkbox: mdiCheckboxMarkedOutline,
loading: mdiLoading,
more: mdiDotsVertical,
upload: mdiUploadOutline,
attachment: mdiAttachment,
table: mdiTable,
rowProperties: mdiTableRowHeight,
insertRowBelow: mdiTableRowPlusAfter,
insertRowAbove: mdiTableRowPlusBefore,
moveRowDown: mdiArrowExpandDown,
moveRowUp: mdiArrowExpandUp,
deleteRow: mdiTableRowRemove,
toggleHeaderRow: mdiTableBorder,
columnProperties: mdiTableColumnWidth,
insertColumnRight: mdiTableColumnPlusAfter,
insertColumnLeft: mdiTableColumnPlusBefore,
moveColumnRight: mdiArrowExpandRight,
moveColumnLeft: mdiArrowExpandLeft,
deleteColumn: mdiTableColumnRemove,
cellProperties: mdiRectangle,
cellBorderColor: "M4 24q-.825 0-1.412-.587Q2 22.825 2 22q0-.825.588-1.413Q3.175 20 4 20h16q.825 0 1.413.587Q22 21.175 22 22q0 .825-.587 1.413Q20.825 24 20 24Zm1-6q-.425 0-.713-.288Q4 17.425 4 17v-2.325q0-.2.075-.388q.075-.187.225-.337l8.75-8.75l3.75 3.75l-8.75 8.75q-.15.15-.337.225q-.188.075-.388.075Zm1-2h.9L14 8.95L13.05 8L6 15.1Zm11.925-8.15l-3.75-3.75l1.8-1.8q.275-.3.7-.288q.425.013.7.288l2.35 2.35q.275.275.275.688q0 .412-.275.712ZM6 16Z",
backgroundColor: mdiFormatColorFill,
borderColor: "M4 24q-.825 0-1.412-.587Q2 22.825 2 22q0-.825.588-1.413Q3.175 20 4 20h16q.825 0 1.413.587Q22 21.175 22 22q0 .825-.587 1.413Q20.825 24 20 24Zm1-6q-.425 0-.713-.288Q4 17.425 4 17v-2.325q0-.2.075-.388q.075-.187.225-.337l8.75-8.75l3.75 3.75l-8.75 8.75q-.15.15-.337.225q-.188.075-.388.075Zm1-2h.9L14 8.95L13.05 8L6 15.1Zm11.925-8.15l-3.75-3.75l1.8-1.8q.275-.3.7-.288q.425.013.7.288l2.35 2.35q.275.275.275.688q0 .412-.275.712ZM6 16Z",
sortDesc: mdiSortDescending,
deleteTable: mdiTableOff,
mergeCells: mdiTableMergeCells,
splitCells: mdiTableSplitCell,
checklist: mdiFormatListCheckbox,
dragHandle: mdiDrag,
previousMatch: mdiArrowUp,
nextMatch: mdiArrowDown,
replaceOne: "m5.4 5.42 3.48 3.5 3.43-3.43-1.08-1.08-1.57 1.55V3.5a.8.8 0 0 1 .76-.81h2.35v-1.5h-2.35a2.29 2.29 0 0 0-2.28 2.3v2.5L6.48 4.33Zm10.3 2.77c.3.48.7.72 1.25.72.61 0 1.1-.26 1.45-.78.37-.51.55-1.2.55-2.05 0-.8-.15-1.41-.46-1.87a1.51 1.51 0 0 0-1.33-.68c-.63 0-1.11.3-1.45.9h-.02V1.19h-1.37v7.6h1.37v-.6Zm-.03-1.64v-.52c0-.39.09-.7.27-.93a.83.83 0 0 1 .69-.36.76.76 0 0 1 .67.36c.16.24.24.57.24 1 0 .5-.09.9-.26 1.18a.8.8 0 0 1-.73.42.76.76 0 0 1-.63-.33 1.32 1.32 0 0 1-.25-.82zm-1.35 12.82c-.4.23-.97.35-1.71.35-.87 0-1.58-.27-2.12-.82a2.9 2.9 0 0 1-.8-2.12c0-1 .28-1.8.86-2.37a3.12 3.12 0 0 1 2.31-.87c.67 0 1.16.1 1.46.28v1.54a1.95 1.95 0 0 0-1.23-.42c-.5 0-.9.15-1.2.46-.29.3-.43.72-.43 1.26 0 .52.14.93.42 1.23.28.3.67.44 1.16.44.43 0 .86-.14 1.28-.43zm-7.73-8.91L5.05 12v9.27l1.54 1.54h10.82l1.54-1.54V12l-1.54-1.54zm0 1.54h10.82v9.27H6.59Z",
replaceAll: "M16.53 4.22c.22-.45.52-.68.92-.68.36 0 .64.17.83.52.2.34.3.81.3 1.4a3.1 3.1 0 0 1-.35 1.57c-.22.39-.53.59-.91.59-.35 0-.61-.19-.79-.55h-.01v.45h-.87V1.77h.87v2.45h.01zm-.02 1.6a1.14 1.14 0 0 0 .15.63c.1.17.24.25.4.25.2 0 .35-.1.46-.32a2 2 0 0 0 .17-.9c0-.32-.05-.57-.15-.75-.1-.18-.24-.27-.43-.27-.17 0-.32.09-.43.27a1.3 1.3 0 0 0-.17.7ZM5.6 11.56l-3.1-3.1.97-.97 1.47 1.46v-2.2A2.03 2.03 0 0 1 6.96 4.7h3.43v1.32H6.96a.72.72 0 0 0-.68.73l.01 2.19 1.39-1.38.96.96-3.04 3.04Zm7.65-4.04h.94v-2.5c0-1.18-.46-1.78-1.38-1.78-.2 0-.41.04-.66.1a2.11 2.11 0 0 0-.56.25v.97c.34-.3.71-.44 1.1-.44.38 0 .57.23.57.68l-.88.16c-.74.12-1.11.59-1.11 1.4 0 .38.09.7.27.92a.9.9 0 0 0 .74.35c.42 0 .74-.24.96-.7h.01zm0-1.98v.28a1.1 1.1 0 0 1-.17.64.54.54 0 0 1-.46.25.4.4 0 0 1-.32-.14.56.56 0 0 1-.11-.36c0-.33.16-.51.48-.57l.59-.1zM9.82 19.21h-.94v-.6h-.02c-.21.46-.53.7-.96.7a.9.9 0 0 1-.74-.35 1.47 1.47 0 0 1-.27-.92c0-.8.38-1.28 1.12-1.4l.87-.15c0-.46-.19-.69-.57-.69-.38 0-.75.15-1.1.45v-.98c.14-.09.33-.17.57-.24.24-.07.46-.1.66-.1.92 0 1.38.59 1.38 1.78zm-.94-1.7v-.29l-.58.1c-.33.06-.49.25-.49.57 0 .15.04.27.12.36a.4.4 0 0 0 .32.14.54.54 0 0 0 .46-.25c.11-.17.17-.38.17-.63zm4.24 1.8c.47 0 .83-.09 1.08-.26v-1.03a1.32 1.32 0 0 1-.8.3.9.9 0 0 1-.74-.31c-.17-.22-.26-.5-.26-.88s.1-.68.28-.9a.94.94 0 0 1 .75-.32c.28 0 .54.1.77.3v-1.1c-.19-.12-.5-.19-.91-.19-.61 0-1.1.2-1.47.62-.36.4-.54.97-.54 1.68 0 .61.17 1.11.5 1.5.35.4.8.59 1.34.59zM2.5 13.46 3.96 12h13.16l1.46 1.46v7.3l-1.46 1.47H3.96L2.5 20.77Zm1.46 0v7.3h13.16v-7.3Zm4.39-2.92L9.8 9.08h10.23l1.46 1.46v7.3l-1.46 1.47v-8.77z",
caseSensitive: mdiFormatLetterCase,
wholeWord: mdiFormatLetterMatches,
regex: mdiRegex,
embed: mdiMoviePlusOutline,
palette: mdiPaletteOutline,
tableSettings: mdiTableCog,
plus: mdiPlus,
minus: mdiMinus,
close: mdiClose,
delete: mdiDeleteOutline,
download: mdiDownloadOutline,
chevronDown: mdiChevronDown,
chevronUp: mdiChevronUp,
chevronRight: mdiChevronRight,
chevronLeft: mdiChevronLeft,
circle: mdiCircle,
none: "",
bold: mdiFormatBold,
italic: mdiFormatItalic,
underline: mdiFormatUnderline,
strikethrough: mdiFormatStrikethrough,
code: mdiCodeTags,
alignCenter: mdiFormatAlignCenter,
alignLeft: mdiFormatAlignLeft,
alignRight: mdiFormatAlignRight,
alignJustify: mdiFormatAlignJustify,
subscript: mdiFormatSubscript,
superscript: mdiFormatSuperscript,
horizontalRule: mdiBorderHorizontal,
codeblock: mdiCodeBraces,
blockquote: mdiFormatQuoteClose,
formatClear: mdiFormatClear,
ltr: mdiFormatTextdirectionLToR,
rtl: mdiFormatTextdirectionRToL,
numberedList: mdiFormatListNumbered,
bulletList: mdiFormatListBulleted,
highlight: mdiFormatColorHighlight,
textColor: mdiFormatColorText,
link: mdiLinkPlus,
url: mdiLink,
image: mdiImage,
imageSettings: mdiImageEditOutline,
colorClear: mdiInvertColorsOff,
check: mdiCheck,
checkbox: mdiCheckboxMarkedOutline,
loading: mdiLoading,
more: mdiDotsVertical,
upload: mdiUploadOutline,
attachment: mdiAttachment,
table: mdiTable,
rowProperties: mdiTableRowHeight,
insertRowBelow: mdiTableRowPlusAfter,
insertRowAbove: mdiTableRowPlusBefore,
moveRowDown: mdiArrowExpandDown,
moveRowUp: mdiArrowExpandUp,
deleteRow: mdiTableRowRemove,
toggleHeaderRow: mdiTableBorder,
columnProperties: mdiTableColumnWidth,
insertColumnRight: mdiTableColumnPlusAfter,
insertColumnLeft: mdiTableColumnPlusBefore,
moveColumnRight: mdiArrowExpandRight,
moveColumnLeft: mdiArrowExpandLeft,
deleteColumn: mdiTableColumnRemove,
cellProperties: mdiRectangle,
cellBorderColor:
"M4 24q-.825 0-1.412-.587Q2 22.825 2 22q0-.825.588-1.413Q3.175 20 4 20h16q.825 0 1.413.587Q22 21.175 22 22q0 .825-.587 1.413Q20.825 24 20 24Zm1-6q-.425 0-.713-.288Q4 17.425 4 17v-2.325q0-.2.075-.388q.075-.187.225-.337l8.75-8.75l3.75 3.75l-8.75 8.75q-.15.15-.337.225q-.188.075-.388.075Zm1-2h.9L14 8.95L13.05 8L6 15.1Zm11.925-8.15l-3.75-3.75l1.8-1.8q.275-.3.7-.288q.425.013.7.288l2.35 2.35q.275.275.275.688q0 .412-.275.712ZM6 16Z",
backgroundColor: mdiFormatColorFill,
borderColor:
"M4 24q-.825 0-1.412-.587Q2 22.825 2 22q0-.825.588-1.413Q3.175 20 4 20h16q.825 0 1.413.587Q22 21.175 22 22q0 .825-.587 1.413Q20.825 24 20 24Zm1-6q-.425 0-.713-.288Q4 17.425 4 17v-2.325q0-.2.075-.388q.075-.187.225-.337l8.75-8.75l3.75 3.75l-8.75 8.75q-.15.15-.337.225q-.188.075-.388.075Zm1-2h.9L14 8.95L13.05 8L6 15.1Zm11.925-8.15l-3.75-3.75l1.8-1.8q.275-.3.7-.288q.425.013.7.288l2.35 2.35q.275.275.275.688q0 .412-.275.712ZM6 16Z",
sortDesc: mdiSortDescending,
deleteTable: mdiTableOff,
mergeCells: mdiTableMergeCells,
splitCells: mdiTableSplitCell,
checklist: mdiFormatListCheckbox,
dragHandle: mdiDrag,
previousMatch: mdiArrowUp,
nextMatch: mdiArrowDown,
replaceOne:
"m5.4 5.42 3.48 3.5 3.43-3.43-1.08-1.08-1.57 1.55V3.5a.8.8 0 0 1 .76-.81h2.35v-1.5h-2.35a2.29 2.29 0 0 0-2.28 2.3v2.5L6.48 4.33Zm10.3 2.77c.3.48.7.72 1.25.72.61 0 1.1-.26 1.45-.78.37-.51.55-1.2.55-2.05 0-.8-.15-1.41-.46-1.87a1.51 1.51 0 0 0-1.33-.68c-.63 0-1.11.3-1.45.9h-.02V1.19h-1.37v7.6h1.37v-.6Zm-.03-1.64v-.52c0-.39.09-.7.27-.93a.83.83 0 0 1 .69-.36.76.76 0 0 1 .67.36c.16.24.24.57.24 1 0 .5-.09.9-.26 1.18a.8.8 0 0 1-.73.42.76.76 0 0 1-.63-.33 1.32 1.32 0 0 1-.25-.82zm-1.35 12.82c-.4.23-.97.35-1.71.35-.87 0-1.58-.27-2.12-.82a2.9 2.9 0 0 1-.8-2.12c0-1 .28-1.8.86-2.37a3.12 3.12 0 0 1 2.31-.87c.67 0 1.16.1 1.46.28v1.54a1.95 1.95 0 0 0-1.23-.42c-.5 0-.9.15-1.2.46-.29.3-.43.72-.43 1.26 0 .52.14.93.42 1.23.28.3.67.44 1.16.44.43 0 .86-.14 1.28-.43zm-7.73-8.91L5.05 12v9.27l1.54 1.54h10.82l1.54-1.54V12l-1.54-1.54zm0 1.54h10.82v9.27H6.59Z",
replaceAll:
"M16.53 4.22c.22-.45.52-.68.92-.68.36 0 .64.17.83.52.2.34.3.81.3 1.4a3.1 3.1 0 0 1-.35 1.57c-.22.39-.53.59-.91.59-.35 0-.61-.19-.79-.55h-.01v.45h-.87V1.77h.87v2.45h.01zm-.02 1.6a1.14 1.14 0 0 0 .15.63c.1.17.24.25.4.25.2 0 .35-.1.46-.32a2 2 0 0 0 .17-.9c0-.32-.05-.57-.15-.75-.1-.18-.24-.27-.43-.27-.17 0-.32.09-.43.27a1.3 1.3 0 0 0-.17.7ZM5.6 11.56l-3.1-3.1.97-.97 1.47 1.46v-2.2A2.03 2.03 0 0 1 6.96 4.7h3.43v1.32H6.96a.72.72 0 0 0-.68.73l.01 2.19 1.39-1.38.96.96-3.04 3.04Zm7.65-4.04h.94v-2.5c0-1.18-.46-1.78-1.38-1.78-.2 0-.41.04-.66.1a2.11 2.11 0 0 0-.56.25v.97c.34-.3.71-.44 1.1-.44.38 0 .57.23.57.68l-.88.16c-.74.12-1.11.59-1.11 1.4 0 .38.09.7.27.92a.9.9 0 0 0 .74.35c.42 0 .74-.24.96-.7h.01zm0-1.98v.28a1.1 1.1 0 0 1-.17.64.54.54 0 0 1-.46.25.4.4 0 0 1-.32-.14.56.56 0 0 1-.11-.36c0-.33.16-.51.48-.57l.59-.1zM9.82 19.21h-.94v-.6h-.02c-.21.46-.53.7-.96.7a.9.9 0 0 1-.74-.35 1.47 1.47 0 0 1-.27-.92c0-.8.38-1.28 1.12-1.4l.87-.15c0-.46-.19-.69-.57-.69-.38 0-.75.15-1.1.45v-.98c.14-.09.33-.17.57-.24.24-.07.46-.1.66-.1.92 0 1.38.59 1.38 1.78zm-.94-1.7v-.29l-.58.1c-.33.06-.49.25-.49.57 0 .15.04.27.12.36a.4.4 0 0 0 .32.14.54.54 0 0 0 .46-.25c.11-.17.17-.38.17-.63zm4.24 1.8c.47 0 .83-.09 1.08-.26v-1.03a1.32 1.32 0 0 1-.8.3.9.9 0 0 1-.74-.31c-.17-.22-.26-.5-.26-.88s.1-.68.28-.9a.94.94 0 0 1 .75-.32c.28 0 .54.1.77.3v-1.1c-.19-.12-.5-.19-.91-.19-.61 0-1.1.2-1.47.62-.36.4-.54.97-.54 1.68 0 .61.17 1.11.5 1.5.35.4.8.59 1.34.59zM2.5 13.46 3.96 12h13.16l1.46 1.46v7.3l-1.46 1.47H3.96L2.5 20.77Zm1.46 0v7.3h13.16v-7.3Zm4.39-2.92L9.8 9.08h10.23l1.46 1.46v7.3l-1.46 1.47v-8.77z",
caseSensitive: mdiFormatLetterCase,
wholeWord: mdiFormatLetterMatches,
regex: mdiRegex,
embed: mdiMoviePlusOutline,
palette: mdiPaletteOutline,
tableSettings: mdiTableCog,
plus: mdiPlus,
minus: mdiMinus,
close: mdiClose,
delete: mdiDeleteOutline,
download: mdiDownloadOutline,
chevronDown: mdiChevronDown,
chevronUp: mdiChevronUp,
chevronRight: mdiChevronRight,
chevronLeft: mdiChevronLeft,
circle: mdiCircle,
arrowLeft: mdiArrowLeft,
none: "",
};

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { Editor } from "@tiptap/core";
declare type CellPropertiesProps = {
editor: Editor;

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
export declare const DEFAULT_COLORS: string[];
declare type ColorPickerProps = {
colors?: string[];

View File

@@ -26,13 +26,14 @@ var __read = (this && this.__read) || function (o, n) {
return ar;
};
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { Box, Button, Flex, Text } from "rebass";
import { Box, Flex, Text } from "rebass";
import { Input } from "@rebass/forms";
import { Icon } from "../components/icon";
import { Icons } from "../icons";
import { useState } from "react";
import tinycolor from "tinycolor2";
import { HexColorPicker } from "react-colorful";
import Button from "../../components/button";
export var DEFAULT_COLORS = [
"#e91e63",
"#9c27b0",
@@ -121,5 +122,8 @@ export function ColorPicker(props) {
}, onClick: function () {
setCurrentColor(color);
onChange(color);
} }, color)); })] })), onClose && (_jsx(Button, __assign({ variant: "icon", sx: { display: ["block", "none"], px: 2 }, onClick: onClose }, { children: _jsx(Icon, { path: Icons.close, size: "big" }) })))] })] })));
} }, color)); })] })), onClose && (_jsx(Button, __assign({ variant: "icon", sx: { display: ["block", "none"], px: 2 }, onClick: onClose, onTouchStart: function (e) { return e.preventDefault(); }, onTouchEnd: function (e) {
e.preventDefault();
onClose();
} }, { children: _jsx(Icon, { path: Icons.close, size: "big" }) })))] })] })));
}

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { EmbedAlignmentOptions, EmbedAttributes, EmbedSizeOptions } from "../../extensions/embed";
declare type Embed = Required<EmbedAttributes> & EmbedAlignmentOptions;
export declare type EmbedPopupProps = {

View File

@@ -68,7 +68,7 @@ export function EmbedPopup(props) {
color: "error",
p: 1,
borderRadius: "default",
} }, { children: ["Error: ", error] }))), _jsxs(Tabs, __assign({ activeIndex: 0, containerProps: { sx: { mx: 1, mb: 1, flexDirection: "column" } }, onTabChanged: function (index) { return setEmbedSource(index === 0 ? "url" : "code"); } }, { children: [_jsxs(Tab, __assign({ title: "From URL" }, { children: [_jsx(Input, { placeholder: "Enter embed source URL", value: src, autoFocus: true, onChange: function (e) { return setSrc(e.target.value); }, sx: { fontSize: "body" } }), _jsxs(Flex, __assign({ sx: { alignItems: "center", mt: 1 } }, { children: [_jsx(InlineInput, { containerProps: { sx: { mr: 1 } }, label: "width", type: "number", placeholder: "Width", value: width, sx: {
} }, { children: ["Error: ", error] }))), _jsxs(Tabs, __assign({ activeIndex: 0, containerProps: { sx: { mx: 1, mb: 1, flexDirection: "column" } }, onTabChanged: function (index) { return setEmbedSource(index === 0 ? "url" : "code"); } }, { children: [_jsxs(Tab, __assign({ title: "From URL" }, { children: [_jsx(Input, { placeholder: "Enter embed source URL", value: src, autoFocus: true, onChange: function (e) { return setSrc(e.target.value); }, autoCapitalize: "none", sx: { fontSize: "body" } }), _jsxs(Flex, __assign({ sx: { alignItems: "center", mt: 1 } }, { children: [_jsx(InlineInput, { containerProps: { sx: { mr: 1 } }, label: "width", type: "number", placeholder: "Width", value: width, sx: {
mr: 1,
fontSize: "body",
}, onChange: function (e) { return onSizeChange(e.target.valueAsNumber); } }), _jsx(InlineInput, { label: "height", type: "number", placeholder: "Height", value: height, sx: { fontSize: "body" }, onChange: function (e) {
@@ -77,6 +77,8 @@ export function EmbedPopup(props) {
alignSelf: ["stretch", "end", "end"],
my: 1,
mr: 1,
ml: [1, 0],
py: 2,
}, onClick: function () {
setError(null);
var _src = src;

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { ImageAlignmentOptions, ImageSizeOptions } from "../../extensions/image";
import { Editor } from "@tiptap/core";
export declare type ImagePropertiesProps = ImageSizeOptions & ImageAlignmentOptions & {

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { ImageAttributes } from "../../extensions/image";
export declare type ImageUploadPopupProps = {
onInsert: (image: ImageAttributes) => void;

View File

@@ -64,16 +64,20 @@ var __read = (this && this.__read) || function (o, n) {
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { Input } from "@rebass/forms";
import { useState } from "react";
import { Flex, Button } from "rebass";
import { Flex } from "rebass";
import Button from "../../components/button";
import { Popup } from "../components/popup";
export function ImageUploadPopup(props) {
var _this = this;
var onInsert = props.onInsert, onClose = props.onClose;
var _a = __read(useState(""), 2), url = _a[0], setUrl = _a[1];
return (_jsx(Popup, __assign({ title: "Upload image from URL", onClose: onClose }, { children: _jsxs(Flex, __assign({ sx: { p: 1, flexDirection: "column", width: ["auto", 250] } }, { children: [_jsx(Input, { type: "url", autoFocus: true, placeholder: "Paste Image URL here", value: url, onChange: function (e) { return setUrl(e.target.value); } }), _jsx(Button, __assign({ variant: "primary", sx: {
return (_jsx(Popup, __assign({ title: "Upload image from URL", onClose: onClose }, { children: _jsxs(Flex, __assign({ sx: { p: 1, flexDirection: "column", width: ["auto", 250] } }, { children: [_jsx(Input, { type: "url", sx: {
height: "45px",
}, autoFocus: true, placeholder: "Paste Image URL here", value: url, onChange: function (e) { return setUrl(e.target.value); } }), _jsx(Button, __assign({ variant: "primary", sx: {
alignSelf: ["stretch", "end", "end"],
my: 1,
mr: 1,
mr: [0, 1],
py: 2,
}, onClick: function () { return __awaiter(_this, void 0, void 0, function () {
var response, dataurl, _a;
return __generator(this, function (_b) {

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
export declare type LinkPopupProps = {
text?: string;
href?: string;

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { Editor } from "@tiptap/core";
export declare type SearchReplacePopupProps = {
editor: Editor;

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
declare type TableSize = {
columns: number;
rows: number;

View File

@@ -32,7 +32,7 @@ import { useIsMobile } from "../stores/toolbar-store";
import { InlineInput } from "../../components/inline-input";
var MAX_COLUMNS = 20;
var MAX_ROWS = 20;
var MIN_COLUMNS = 12;
var MIN_COLUMNS = 10;
var MIN_ROWS = 6;
export function TablePopup(props) {
var isMobile = useIsMobile();

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { Theme } from "@notesnook/theme";
import { Editor } from "@tiptap/core";
import { ToolbarLocation } from "./stores/toolbar-store";

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { ToolProps } from "../types";
export declare function AlignCenter(props: ToolProps): JSX.Element;
export declare function AlignLeft(props: ToolProps): JSX.Element;

View File

@@ -1,3 +1,2 @@
/// <reference types="react" />
import { ToolProps } from "../types";
export declare function InsertBlock(props: ToolProps): JSX.Element;

View File

@@ -29,13 +29,13 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
import { Icons } from "../icons";
import { useMemo, useRef, useState } from "react";
import { Icon } from "../components/icon";
import { Button } from "rebass";
import { EmbedPopup } from "../popups/embed-popup";
import { TablePopup } from "../popups/table-popup";
import { useIsMobile, useToolbarLocation } from "../stores/toolbar-store";
import { ResponsivePresenter, } from "../../components/responsive";
import { showPopup } from "../../components/popup-presenter";
import { ImageUploadPopup } from "../popups/image-upload";
import Button from "../../components/button";
export function InsertBlock(props) {
var buttonRef = useRef();
var _a = __read(useState(false), 2), isOpen = _a[0], setIsOpen = _a[1];

View File

@@ -1,6 +1,5 @@
/// <reference types="react" />
import { ToolProps } from "../types";
import { Editor } from "@tiptap/core";
import { ToolProps } from "../types";
declare type ColorToolProps = ToolProps & {
onColorChange: (editor: Editor, color?: string) => void;
isActive: (editor: Editor) => boolean;

View File

@@ -37,14 +37,14 @@ var __read = (this && this.__read) || function (o, n) {
return ar;
};
import { jsx as _jsx } from "react/jsx-runtime";
import { SplitButton } from "../components/split-button";
import { useState } from "react";
import tinycolor from "tinycolor2";
import { getToolbarElement } from "../utils/dom";
import { useToolbarLocation } from "../stores/toolbar-store";
import { ColorPicker } from "../popups/color-picker";
import { useEditorContext } from "../../components/popup-presenter/popuprenderer";
import { PopupWrapper } from "../../components/popup-presenter";
import { useEditorContext } from "../../components/popup-presenter/popuprenderer";
import { SplitButton } from "../components/split-button";
import { ColorPicker } from "../popups/color-picker";
import { useToolbarLocation } from "../stores/toolbar-store";
import { getToolbarElement } from "../utils/dom";
export function ColorTool(props) {
var onColorChange = props.onColorChange, isActive = props.isActive, getActiveColor = props.getActiveColor, title = props.title, toolProps = __rest(props, ["onColorChange", "isActive", "getActiveColor", "title"]);
var editor = useEditorContext();
@@ -66,9 +66,13 @@ export function ColorTool(props) {
mr: 0,
bg: _isActive ? activeColor : "transparent",
":hover": {
bg: _isActive ? tColor.darken(5).toRgbString() : "transparent",
bg: _isActive && !isBottom
? tColor.darken(5).toRgbString()
: "transparent",
},
}, onOpen: function () { return setIsOpen(function (s) { return !s; }); }, toggled: isOpen }, { children: _jsx(PopupWrapper, { isOpen: isOpen, id: title, group: "color", position: {
}, onOpen: function () {
setIsOpen(function (s) { return !s; });
}, toggled: isOpen }, { children: _jsx(PopupWrapper, { isOpen: isOpen, id: title, group: "color", position: {
isTargetAbsolute: true,
target: getToolbarElement(),
align: isBottom ? "center" : "end",

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { ToolProps } from "../types";
export declare function FontSize(props: ToolProps): JSX.Element;
export declare function FontFamily(props: ToolProps): JSX.Element;

View File

@@ -1,3 +1,2 @@
/// <reference types="react" />
import { ToolProps } from "../types";
export declare function Headings(props: ToolProps): JSX.Element;

View File

@@ -25,19 +25,21 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
};
import { jsx as _jsx } from "react/jsx-runtime";
import { Dropdown } from "../components/dropdown";
import { useToolbarLocation } from "../stores/toolbar-store";
var defaultLevels = [1, 2, 3, 4, 5, 6];
export function Headings(props) {
var editor = props.editor;
var toolbarLocation = useToolbarLocation();
var currentHeadingLevel = defaultLevels.find(function (level) {
return editor.isActive("heading", { level: level });
});
return (_jsx(Dropdown, { selectedItem: currentHeadingLevel ? "Heading ".concat(currentHeadingLevel) : "Paragraph", items: toMenuItems(editor, currentHeadingLevel), menuWidth: 130 }));
return (_jsx(Dropdown, { selectedItem: currentHeadingLevel ? "Heading ".concat(currentHeadingLevel) : "Paragraph", items: toMenuItems(editor, toolbarLocation, currentHeadingLevel), menuWidth: 130 }));
}
function toMenuItems(editor, currentHeadingLevel) {
function toMenuItems(editor, toolbarLocation, currentHeadingLevel) {
var menuItems = defaultLevels.map(function (level) { return ({
type: "button",
key: "heading-".concat(level),
title: "Heading ".concat(level),
title: toolbarLocation === "bottom" ? "H".concat(level) : "Heading ".concat(level),
isChecked: level === currentHeadingLevel,
onClick: function () {
return editor

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { ToolProps } from "../types";
export declare function Italic(props: ToolProps): JSX.Element;
export declare function Strikethrough(props: ToolProps): JSX.Element;

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { ToolProps } from "../types";
export declare function NumberedList(props: ToolProps): JSX.Element;
export declare function BulletList(props: ToolProps): JSX.Element;

View File

@@ -73,7 +73,7 @@ export function NumberedList(props) {
var options = {
type: "orderedList",
icon: "numberedList",
onClick: function (editor) { return editor.chain().focus().toggleTaskList().run(); },
onClick: function (editor) { return editor.chain().focus().toggleOrderedList().run(); },
subTypes: [
{ type: "decimal", title: "Decimal", items: ["1", "2", "3"] },
{ type: "upper-alpha", title: "Upper alpha", items: ["A", "B", "C"] },

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { ToolProps } from "../types";
export declare function TableSettings(props: ToolProps): JSX.Element | null;
export declare function RowProperties(props: ToolProps): JSX.Element;

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { ToolProps } from "../types";
export declare function RightToLeft(props: ToolProps): JSX.Element;
export declare function LeftToRight(props: ToolProps): JSX.Element;

View File

@@ -1,4 +1,3 @@
/// <reference types="react" />
import { Editor } from "@tiptap/core";
import { MenuButton } from "../../components/menu/types";
import { ToolProps } from "../types";

View File

@@ -92,12 +92,9 @@ import {
mdiTableOff,
mdiRectangleOutline,
mdiRectangle,
<<<<<<< HEAD
mdiImageEdit,
mdiImageEditOutline,
=======
mdiArrowLeft,
>>>>>>> 565b7be (ui fixes)
} from "@mdi/js";
export const Icons = {

View File

@@ -74,7 +74,6 @@ const tools = {
rtl: RightToLeft,
textColor: TextColor,
highlight: Highlight,
<<<<<<< HEAD
imageSettings: ImageSettings,
imageAlignCenter: ImageAlignCenter,
@@ -82,8 +81,6 @@ const tools = {
imageAlignRight: ImageAlignRight,
imageProperties: ImageProperties,
=======
>>>>>>> 565b7be (ui fixes)
tableSettings: TableSettings,
columnProperties: ColumnProperties,
rowProperties: RowProperties,