@antscorp/antsomi-ui 2.0.86-text-editor-beta.5 → 2.0.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/assets/css/main.scss +2 -4
- package/es/components/molecules/EmojiPopover/EmojiPopover.js +1 -5
- package/es/components/molecules/VirtualizedMenu/VirtualizedMenu.d.ts +3 -6
- package/es/components/molecules/VirtualizedMenu/__mocks__/index.js +982 -2594
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.d.ts +3 -13
- package/es/components/molecules/VirtualizedMenu/components/Item/Item.js +25 -53
- package/es/components/molecules/VirtualizedMenu/components/Item/index.d.ts +1 -1
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.d.ts +5 -8
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/MenuInline.js +46 -289
- package/es/components/molecules/VirtualizedMenu/components/MenuInline/index.js +0 -1
- package/es/components/molecules/VirtualizedMenu/styled.d.ts +1 -1
- package/es/components/molecules/VirtualizedMenu/styled.js +4 -23
- package/es/components/molecules/VirtualizedMenu/types.d.ts +9 -6
- package/es/components/molecules/VirtualizedMenu/utils.d.ts +5 -8
- package/es/components/molecules/VirtualizedMenu/utils.js +18 -13
- package/es/components/molecules/index.d.ts +0 -1
- package/es/components/molecules/index.js +0 -1
- package/es/components/organism/index.d.ts +0 -1
- package/es/components/organism/index.js +0 -1
- package/es/components/template/Layout/constants/permission.d.ts +1 -0
- package/es/components/template/Layout/constants/permission.js +1 -1
- package/es/hooks/index.d.ts +0 -1
- package/es/hooks/index.js +0 -1
- package/es/utils/common.d.ts +9 -6
- package/es/utils/common.js +23 -44
- package/es/utils/index.d.ts +0 -1
- package/es/utils/index.js +0 -1
- package/es/utils/web.d.ts +0 -4
- package/es/utils/web.js +0 -25
- package/package.json +3 -29
- package/es/components/index.scss +0 -2
- package/es/components/molecules/FontSizeInput/FontSizeInput.d.ts +0 -3
- package/es/components/molecules/FontSizeInput/FontSizeInput.js +0 -128
- package/es/components/molecules/FontSizeInput/components/FontSizeControl.d.ts +0 -8
- package/es/components/molecules/FontSizeInput/components/FontSizeControl.js +0 -14
- package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.d.ts +0 -20
- package/es/components/molecules/FontSizeInput/components/FontSizeDropdown.js +0 -17
- package/es/components/molecules/FontSizeInput/constants.d.ts +0 -2
- package/es/components/molecules/FontSizeInput/constants.js +0 -5
- package/es/components/molecules/FontSizeInput/index.d.ts +0 -2
- package/es/components/molecules/FontSizeInput/index.js +0 -1
- package/es/components/molecules/FontSizeInput/styled.d.ts +0 -3
- package/es/components/molecules/FontSizeInput/styled.js +0 -22
- package/es/components/molecules/FontSizeInput/styles.scss +0 -15
- package/es/components/molecules/FontSizeInput/types.d.ts +0 -24
- package/es/components/molecules/FontSizeInput/types.js +0 -1
- package/es/components/molecules/FontSizeInput/utils.d.ts +0 -7
- package/es/components/molecules/FontSizeInput/utils.js +0 -9
- package/es/components/molecules/index.scss +0 -1
- package/es/components/organism/ActivityTimeline/__mocks__/event_tracking.json +0 -1290
- package/es/components/organism/ActivityTimeline/__mocks__/timeline.json +0 -3059
- package/es/components/organism/TextEditor/TextEditor.d.ts +0 -3
- package/es/components/organism/TextEditor/TextEditor.js +0 -251
- package/es/components/organism/TextEditor/__mocks__/text-block.settings.json +0 -320
- package/es/components/organism/TextEditor/__mocks__/text-contennt.d.ts +0 -1
- package/es/components/organism/TextEditor/__mocks__/text-contennt.js +0 -38
- package/es/components/organism/TextEditor/constants.d.ts +0 -135
- package/es/components/organism/TextEditor/constants.js +0 -280
- package/es/components/organism/TextEditor/extensions/BackgroundColor.d.ts +0 -25
- package/es/components/organism/TextEditor/extensions/BackgroundColor.js +0 -46
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.d.ts +0 -130
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu-plugin.js +0 -247
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.d.ts +0 -15
- package/es/components/organism/TextEditor/extensions/BubbleMenu/bubble-menu.js +0 -31
- package/es/components/organism/TextEditor/extensions/BubbleMenu/index.d.ts +0 -2
- package/es/components/organism/TextEditor/extensions/BubbleMenu/index.js +0 -2
- package/es/components/organism/TextEditor/extensions/Color.d.ts +0 -6
- package/es/components/organism/TextEditor/extensions/Color.js +0 -41
- package/es/components/organism/TextEditor/extensions/Emoji.d.ts +0 -57
- package/es/components/organism/TextEditor/extensions/Emoji.js +0 -184
- package/es/components/organism/TextEditor/extensions/FontFamily.d.ts +0 -6
- package/es/components/organism/TextEditor/extensions/FontFamily.js +0 -43
- package/es/components/organism/TextEditor/extensions/FontSize.d.ts +0 -32
- package/es/components/organism/TextEditor/extensions/FontSize.js +0 -47
- package/es/components/organism/TextEditor/extensions/FontWeight.d.ts +0 -23
- package/es/components/organism/TextEditor/extensions/FontWeight.js +0 -41
- package/es/components/organism/TextEditor/extensions/Highlight.d.ts +0 -1
- package/es/components/organism/TextEditor/extensions/Highlight.js +0 -14
- package/es/components/organism/TextEditor/extensions/Indent.d.ts +0 -28
- package/es/components/organism/TextEditor/extensions/Indent.js +0 -68
- package/es/components/organism/TextEditor/extensions/LineHeight.d.ts +0 -20
- package/es/components/organism/TextEditor/extensions/LineHeight.js +0 -36
- package/es/components/organism/TextEditor/extensions/Link.d.ts +0 -15
- package/es/components/organism/TextEditor/extensions/Link.js +0 -50
- package/es/components/organism/TextEditor/extensions/ListItemMarker.d.ts +0 -13
- package/es/components/organism/TextEditor/extensions/ListItemMarker.js +0 -174
- package/es/components/organism/TextEditor/extensions/Selection.d.ts +0 -6
- package/es/components/organism/TextEditor/extensions/Selection.js +0 -40
- package/es/components/organism/TextEditor/extensions/SmartTag.d.ts +0 -39
- package/es/components/organism/TextEditor/extensions/SmartTag.js +0 -167
- package/es/components/organism/TextEditor/extensions/StyleMemory.d.ts +0 -36
- package/es/components/organism/TextEditor/extensions/StyleMemory.js +0 -163
- package/es/components/organism/TextEditor/extensions/TextTransform.d.ts +0 -31
- package/es/components/organism/TextEditor/extensions/TextTransform.js +0 -37
- package/es/components/organism/TextEditor/hooks/index.d.ts +0 -7
- package/es/components/organism/TextEditor/hooks/index.js +0 -7
- package/es/components/organism/TextEditor/hooks/useColorSet.d.ts +0 -4
- package/es/components/organism/TextEditor/hooks/useColorSet.js +0 -6
- package/es/components/organism/TextEditor/hooks/useDocumentState.d.ts +0 -18
- package/es/components/organism/TextEditor/hooks/useDocumentState.js +0 -42
- package/es/components/organism/TextEditor/hooks/useLinkHandler.d.ts +0 -10
- package/es/components/organism/TextEditor/hooks/useLinkHandler.js +0 -223
- package/es/components/organism/TextEditor/hooks/useMarkTracking.d.ts +0 -26
- package/es/components/organism/TextEditor/hooks/useMarkTracking.js +0 -68
- package/es/components/organism/TextEditor/hooks/usePersistence.d.ts +0 -31
- package/es/components/organism/TextEditor/hooks/usePersistence.js +0 -169
- package/es/components/organism/TextEditor/hooks/useStyleMemory.d.ts +0 -6
- package/es/components/organism/TextEditor/hooks/useStyleMemory.js +0 -42
- package/es/components/organism/TextEditor/hooks/useStylePresets.d.ts +0 -34
- package/es/components/organism/TextEditor/hooks/useStylePresets.js +0 -83
- package/es/components/organism/TextEditor/index.d.ts +0 -14
- package/es/components/organism/TextEditor/index.js +0 -6
- package/es/components/organism/TextEditor/index.scss +0 -61
- package/es/components/organism/TextEditor/provider.d.ts +0 -12
- package/es/components/organism/TextEditor/provider.js +0 -34
- package/es/components/organism/TextEditor/store.d.ts +0 -13
- package/es/components/organism/TextEditor/store.js +0 -20
- package/es/components/organism/TextEditor/styled.d.ts +0 -8
- package/es/components/organism/TextEditor/styled.js +0 -90
- package/es/components/organism/TextEditor/types.d.ts +0 -92
- package/es/components/organism/TextEditor/types.js +0 -1
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/BubbleMenu/BubbleMenu.js +0 -78
- package/es/components/organism/TextEditor/ui/BubbleMenu/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/BubbleMenu/index.js +0 -1
- package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.d.ts +0 -43
- package/es/components/organism/TextEditor/ui/ColorPicker/ColorPicker.js +0 -132
- package/es/components/organism/TextEditor/ui/ColorPicker/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/ColorPicker/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.d.ts +0 -11
- package/es/components/organism/TextEditor/ui/Emoji/EmojiList.js +0 -66
- package/es/components/organism/TextEditor/ui/Emoji/index.d.ts +0 -2
- package/es/components/organism/TextEditor/ui/Emoji/index.js +0 -2
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.d.ts +0 -4
- package/es/components/organism/TextEditor/ui/Emoji/suggestion.js +0 -71
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.d.ts +0 -12
- package/es/components/organism/TextEditor/ui/FontPopover/FontPopover.js +0 -69
- package/es/components/organism/TextEditor/ui/FontPopover/styled.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/FontPopover/styled.js +0 -20
- package/es/components/organism/TextEditor/ui/Popover/Popover.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/Popover/Popover.js +0 -7
- package/es/components/organism/TextEditor/ui/Popover/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/Popover/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Select/Select.d.ts +0 -4
- package/es/components/organism/TextEditor/ui/Select/Select.js +0 -7
- package/es/components/organism/TextEditor/ui/Select/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/Select/index.js +0 -1
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.d.ts +0 -30
- package/es/components/organism/TextEditor/ui/TextAlignSelect/TextAlignSelect.js +0 -49
- package/es/components/organism/TextEditor/ui/TextAlignSelect/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/TextAlignSelect/index.js +0 -1
- package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.d.ts +0 -14
- package/es/components/organism/TextEditor/ui/Toolbar/Toolbar.js +0 -42
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BoldAction.js +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/BulletListAction.js +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ClearFormattingAction.js +0 -18
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.d.ts +0 -4
- package/es/components/organism/TextEditor/ui/Toolbar/actions/EmojiAction.js +0 -13
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.d.ts +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontFamilyAction.js +0 -18
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.d.ts +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/FontSizeAction.js +0 -37
- package/es/components/organism/TextEditor/ui/Toolbar/actions/HighlightAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/HighlightAction.js +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/IndentAction.js +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/ItalicAction.js +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/Toolbar/actions/LinkAction.js +0 -4
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OrderedListAction.js +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/OutdentAction.js +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.d.ts +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SmartTagAction.js +0 -9
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.d.ts +0 -9
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SpacingAction.js +0 -22
- package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/StrikeAction.js +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SubscriptAction.js +0 -13
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/SuperscriptAction.js +0 -13
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextAlignAction.js +0 -3
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.d.ts +0 -7
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextBackgroundColorAction.js +0 -19
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.d.ts +0 -15
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextColorAction.js +0 -14
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/TextTransformAction.js +0 -30
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.d.ts +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnderlineAction.js +0 -5
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.d.ts +0 -6
- package/es/components/organism/TextEditor/ui/Toolbar/actions/UnsetLink.js +0 -10
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.d.ts +0 -20
- package/es/components/organism/TextEditor/ui/Toolbar/actions/index.js +0 -20
- package/es/components/organism/TextEditor/ui/Toolbar/index.d.ts +0 -1
- package/es/components/organism/TextEditor/ui/Toolbar/index.js +0 -1
- package/es/components/organism/TextEditor/utils/documentState.d.ts +0 -57
- package/es/components/organism/TextEditor/utils/documentState.js +0 -100
- package/es/components/organism/TextEditor/utils/font.d.ts +0 -84
- package/es/components/organism/TextEditor/utils/font.js +0 -175
- package/es/components/organism/TextEditor/utils/htmlProcessing.d.ts +0 -63
- package/es/components/organism/TextEditor/utils/htmlProcessing.js +0 -319
- package/es/components/organism/TextEditor/utils/index.d.ts +0 -8
- package/es/components/organism/TextEditor/utils/index.js +0 -16
- package/es/components/organism/TextEditor/utils/link.d.ts +0 -100
- package/es/components/organism/TextEditor/utils/link.js +0 -149
- package/es/components/organism/TextEditor/utils/menu.d.ts +0 -134
- package/es/components/organism/TextEditor/utils/menu.js +0 -317
- package/es/components/organism/TextEditor/utils/selection.d.ts +0 -25
- package/es/components/organism/TextEditor/utils/selection.js +0 -57
- package/es/components/organism/TextEditor/utils/smartTag.d.ts +0 -49
- package/es/components/organism/TextEditor/utils/smartTag.js +0 -89
- package/es/components/organism/TextEditor/utils/style.d.ts +0 -78
- package/es/components/organism/TextEditor/utils/style.js +0 -193
- package/es/components/organism/index.scss +0 -1
- package/es/hooks/useBroadcastedLocalStorage.d.ts +0 -5
- package/es/hooks/useBroadcastedLocalStorage.js +0 -71
- package/es/hooks/useElementSize.d.ts +0 -7
- package/es/hooks/useElementSize.js +0 -56
- package/es/utils/tree.d.ts +0 -225
- package/es/utils/tree.js +0 -469
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Tooltip } from 'antd';
|
|
3
|
-
import { IndentIcon } from 'lucide-react';
|
|
4
|
-
export const IndentAction = ({ editor }) => {
|
|
5
|
-
const disabled = !editor.can().chain().focus().indent().run();
|
|
6
|
-
return (_jsx(Tooltip, { open: disabled ? false : undefined, title: "Indent (Tab)", placement: "top", children: _jsx(Button, { size: "small", disabled: disabled, onClick: () => editor.chain().focus().indent().run(), icon: _jsx(IndentIcon, { size: 16 }) }) }));
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Tooltip } from 'antd';
|
|
3
|
-
import { ItalicIcon } from 'lucide-react';
|
|
4
|
-
import { formatHotkey } from '../../../utils';
|
|
5
|
-
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
6
|
-
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
7
|
-
export const ItalicAction = ({ editor }) => (_jsx(Tooltip, { title: `${TOOLTIPS.ITALIC.TITLE} (${formatHotkey(TOOLTIPS.ITALIC.SHORTCUT)})`, placement: "top", children: _jsx(Button, { size: "small", onClick: () => editor.chain().focus().toggleItalic().run(), disabled: !editor.can().chain().focus().toggleItalic().run(), type: editor.isActive('italic') ? 'primary' : 'default', icon: _jsx(ItalicIcon, { size: 16 }) }) }));
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Tooltip } from 'antd';
|
|
3
|
-
import { Link2Icon } from 'lucide-react';
|
|
4
|
-
export const LinkAction = ({ editor, onClick }) => (_jsx(Tooltip, { title: "Link Tag", placement: "top", children: _jsx(Button, { size: "small", type: editor.isActive('link') ? 'primary' : 'default', icon: _jsx(Link2Icon, { size: 16 }), onClick: () => onClick?.() }) }));
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Tooltip } from 'antd';
|
|
3
|
-
import { ListOrderedIcon } from 'lucide-react';
|
|
4
|
-
import { formatHotkey } from '../../../utils';
|
|
5
|
-
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
6
|
-
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
7
|
-
export const OrderedListAction = ({ editor }) => (_jsx(Tooltip, { title: `${TOOLTIPS.ORDERED_LIST.TITLE} (${formatHotkey(TOOLTIPS.ORDERED_LIST.SHORTCUT)})`, placement: "top", children: _jsx(Button, { size: "small", onClick: () => editor.chain().focus().toggleOrderedList().run(), type: editor.isActive('orderedList') ? 'primary' : 'default', icon: _jsx(ListOrderedIcon, { size: 16 }) }) }));
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Tooltip } from 'antd';
|
|
3
|
-
import { OutdentIcon } from 'lucide-react';
|
|
4
|
-
export const OutdentAction = ({ editor }) => {
|
|
5
|
-
const disabled = !editor.can().chain().focus().outdent().run();
|
|
6
|
-
return (_jsx(Tooltip, { open: disabled ? false : undefined, title: "Outdent (Shift + Tab)", placement: "top", children: _jsx(Button, { size: "small", disabled: disabled, onClick: () => editor.chain().focus().outdent().run(), icon: _jsx(OutdentIcon, { size: 16 }) }) }));
|
|
7
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { Editor } from '@tiptap/core';
|
|
3
|
-
export interface SmartTagActionProps {
|
|
4
|
-
editor: Editor;
|
|
5
|
-
onClick?: (event: React.MouseEvent) => void;
|
|
6
|
-
}
|
|
7
|
-
export declare const SmartTagAction: (props: SmartTagActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Tooltip } from 'antd';
|
|
3
|
-
import { BracesIcon } from 'lucide-react';
|
|
4
|
-
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
5
|
-
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
6
|
-
export const SmartTagAction = (props) => {
|
|
7
|
-
const { editor, onClick } = props;
|
|
8
|
-
return (_jsx(Tooltip, { title: TOOLTIPS.SMART_TAG.TITLE, placement: "top", children: _jsx(Button, { size: "small", onClick: onClick, type: editor.isActive('smartTag') ? 'primary' : 'default', icon: _jsx(BracesIcon, { size: 16 }) }) }));
|
|
9
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Editor } from '@tiptap/core';
|
|
2
|
-
interface SpacingActionProps {
|
|
3
|
-
editor: Editor;
|
|
4
|
-
}
|
|
5
|
-
export declare const SpacingIcon: (props: React.SVGProps<SVGSVGElement> & {
|
|
6
|
-
size?: number;
|
|
7
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export declare const SpacingAction: (props: SpacingActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Menu, Tooltip } from 'antd';
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import { TextEditorPopover } from '../../Popover';
|
|
5
|
-
export const SpacingIcon = (props) => {
|
|
6
|
-
const { size = 24, ...restProps } = props;
|
|
7
|
-
return (_jsx("svg", { width: size, height: size, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...restProps, children: _jsx("path", { d: "M21 10H13M21 6H13M21 14H13M21 18H13M6 20L6 4M6 20L3 17M6 20L9 17M6 4L3 7M6 4L9 7", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }));
|
|
8
|
-
};
|
|
9
|
-
export const SpacingAction = (props) => {
|
|
10
|
-
const { editor } = props;
|
|
11
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
12
|
-
return (_jsx(TextEditorPopover, { open: isOpen, onOpenChange: setIsOpen, trigger: ['click'], arrow: false, overlayInnerStyle: {
|
|
13
|
-
padding: 0,
|
|
14
|
-
}, content: _jsx(Menu, { items: [
|
|
15
|
-
{ key: '1', label: 'Single' },
|
|
16
|
-
{ key: '1.15', label: '1.15' },
|
|
17
|
-
{ key: '1.5', label: '1.5' },
|
|
18
|
-
{ key: '2', label: 'Double' },
|
|
19
|
-
], onClick: ({ key }) => {
|
|
20
|
-
editor.chain().focus().setLineHeight(key).run();
|
|
21
|
-
} }), children: _jsx(Tooltip, { open: isOpen ? false : undefined, title: "Line Spacing", placement: "top", destroyTooltipOnHide: true, children: _jsx(Button, { size: "small", icon: _jsx(SpacingIcon, { size: 16 }) }) }) }));
|
|
22
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Tooltip } from 'antd';
|
|
3
|
-
import { StrikethroughIcon } from 'lucide-react';
|
|
4
|
-
import { formatHotkey } from '../../../utils';
|
|
5
|
-
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
6
|
-
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
7
|
-
export const StrikeAction = ({ editor }) => (_jsx(Tooltip, { title: `${TOOLTIPS.STRIKE.TITLE} (${formatHotkey(TOOLTIPS.STRIKE.SHORTCUT)})`, placement: "top", children: _jsx(Button, { size: "small", onClick: () => editor.chain().focus().toggleStrike().run(), disabled: !editor.can().chain().focus().toggleStrike().run(), type: editor.isActive('strike') ? 'primary' : 'default', children: _jsx(StrikethroughIcon, { size: 16 }) }) }));
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Tooltip } from 'antd';
|
|
3
|
-
import { SubscriptIcon } from 'lucide-react';
|
|
4
|
-
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
5
|
-
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
6
|
-
export const SubscriptAction = ({ editor }) => (_jsx(Tooltip, { title: TOOLTIPS.SUBSCRIPT.TITLE, placement: "top", children: _jsx(Button, { size: "small", onClick: () => {
|
|
7
|
-
if (editor.isActive('superscript')) {
|
|
8
|
-
editor.chain().focus().toggleSuperscript().toggleSubscript().run();
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
editor.chain().focus().toggleSubscript().run();
|
|
12
|
-
}
|
|
13
|
-
}, disabled: !editor.can().chain().focus().toggleSubscript().run(), type: editor.isActive('subscript') ? 'primary' : 'default', children: _jsx(SubscriptIcon, { size: 16 }) }) }));
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Tooltip } from 'antd';
|
|
3
|
-
import { SuperscriptIcon } from 'lucide-react';
|
|
4
|
-
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
5
|
-
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
6
|
-
export const SuperscriptAction = ({ editor }) => (_jsx(Tooltip, { title: TOOLTIPS.SUPERSCRIPT.TITLE, placement: "top", children: _jsx(Button, { size: "small", onClick: () => {
|
|
7
|
-
if (editor.isActive('subscript')) {
|
|
8
|
-
editor.chain().focus().toggleSubscript().toggleSuperscript().run();
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
editor.chain().focus().toggleSuperscript().run();
|
|
12
|
-
}
|
|
13
|
-
}, disabled: !editor.can().chain().focus().toggleSuperscript().run(), type: editor.isActive('superscript') ? 'primary' : 'default', children: _jsx(SuperscriptIcon, { size: 16 }) }) }));
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Editor } from '@tiptap/core';
|
|
2
|
-
import { ColorPickerProps } from '../../ColorPicker/ColorPicker';
|
|
3
|
-
export interface HighlightActionProps {
|
|
4
|
-
editor: Editor;
|
|
5
|
-
colorPickerProps?: ColorPickerProps;
|
|
6
|
-
}
|
|
7
|
-
export declare const TextBackColorAction: ({ editor, colorPickerProps }: HighlightActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Flex, Tooltip } from 'antd';
|
|
3
|
-
import { HighlighterIcon, BrushCleaningIcon } from 'lucide-react';
|
|
4
|
-
import { ColorPicker } from '../../ColorPicker';
|
|
5
|
-
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
6
|
-
import { useRef } from 'react';
|
|
7
|
-
import tinycolor from 'tinycolor2';
|
|
8
|
-
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
9
|
-
export const TextBackColorAction = ({ editor, colorPickerProps }) => {
|
|
10
|
-
const ref = useRef(null);
|
|
11
|
-
const handleClearBackgroundColor = () => {
|
|
12
|
-
editor.chain().focus().unsetBackgroundColor().run();
|
|
13
|
-
ref.current?.setOpen(false);
|
|
14
|
-
};
|
|
15
|
-
const activeColor = editor.getAttributes('textStyle').backgroundColor;
|
|
16
|
-
return (_jsx(ColorPicker, { ...colorPickerProps, ref: ref, value: editor.getAttributes('textStyle').backgroundColor, onChange: v => editor.chain().focus().setBackgroundColor(v).run(), usedColorsStorageKey: "text-backgrounds", popoverProps: {
|
|
17
|
-
content: ({ colorGrid, usedColors, customColorPicker }) => (_jsxs(Flex, { vertical: true, gap: 8, children: [colorGrid, usedColors, customColorPicker, _jsx(Button, { icon: _jsx(BrushCleaningIcon, { size: 16 }), onClick: handleClearBackgroundColor, type: "text", children: "Clear" })] })),
|
|
18
|
-
}, children: _jsx(Tooltip, { title: TOOLTIPS.HIGHLIGHT.TITLE, placement: "top", children: _jsx(Button, { size: "small", icon: _jsx(HighlighterIcon, { color: tinycolor(activeColor).isValid() ? activeColor : undefined, size: 16 }) }) }) }));
|
|
19
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { Editor } from '@tiptap/core';
|
|
3
|
-
import { ColorPickerProps } from '../../ColorPicker/ColorPicker';
|
|
4
|
-
interface IconProps extends React.SVGProps<SVGSVGElement> {
|
|
5
|
-
color?: string;
|
|
6
|
-
textColor?: string;
|
|
7
|
-
size?: number;
|
|
8
|
-
}
|
|
9
|
-
export declare const TextColorIcon: (props: IconProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
export interface TextColorActionProps {
|
|
11
|
-
editor: Editor;
|
|
12
|
-
colorPickerProps?: ColorPickerProps;
|
|
13
|
-
}
|
|
14
|
-
export declare const TextColorAction: ({ editor, colorPickerProps }: TextColorActionProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Tooltip } from 'antd';
|
|
3
|
-
import { ColorPicker } from '../../ColorPicker';
|
|
4
|
-
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
5
|
-
import tinycolor from 'tinycolor2';
|
|
6
|
-
const { TOOLTIPS } = TEXT_EDITOR_CONSTANTS;
|
|
7
|
-
export const TextColorIcon = (props) => {
|
|
8
|
-
const { color, textColor, size, ...rest } = props;
|
|
9
|
-
return (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size || 24, height: size || 24, viewBox: "0 0 24 24", fill: "none", stroke: color || 'currentColor', strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", ...rest, children: [_jsx("path", { stroke: textColor, d: "M4 20h16" }), _jsx("path", { d: "m6 16 6-12 6 12" }), _jsx("path", { d: "M8 12h8" })] }));
|
|
10
|
-
};
|
|
11
|
-
export const TextColorAction = ({ editor, colorPickerProps }) => {
|
|
12
|
-
const activeColor = editor.getAttributes('textStyle').color;
|
|
13
|
-
return (_jsx(ColorPicker, { ...colorPickerProps, value: editor.getAttributes('textStyle').color, onChange: v => editor.chain().focus().setColor(v).run(), usedColorsStorageKey: "text-colors", children: _jsx(Tooltip, { title: TOOLTIPS.TEXT_COLOR.TITLE, placement: "top", children: _jsx(Button, { size: "small", icon: _jsx(TextColorIcon, { size: 16, textColor: tinycolor(activeColor) ? activeColor : undefined }) }) }) }));
|
|
14
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { TEXT_EDITOR_CONSTANTS } from '../../../constants';
|
|
3
|
-
import { TextEditorSelect } from '../../Select';
|
|
4
|
-
const { TEXT_TRANSFORM } = TEXT_EDITOR_CONSTANTS;
|
|
5
|
-
export const TextTransformAction = ({ editor }) => (_jsx(TextEditorSelect, { value: editor.getAttributes('textStyle').textTransform || TEXT_TRANSFORM.OPTIONS.NONE.VALUE, style: { width: 120 }, size: "small", options: [
|
|
6
|
-
{
|
|
7
|
-
label: TEXT_TRANSFORM.OPTIONS.UPPERCASE.LABEL,
|
|
8
|
-
value: TEXT_TRANSFORM.OPTIONS.UPPERCASE.VALUE,
|
|
9
|
-
disabled: editor.getAttributes('textTransform').textTransform ===
|
|
10
|
-
TEXT_TRANSFORM.OPTIONS.UPPERCASE.VALUE,
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
label: TEXT_TRANSFORM.OPTIONS.LOWERCASE.LABEL,
|
|
14
|
-
value: TEXT_TRANSFORM.OPTIONS.LOWERCASE.VALUE,
|
|
15
|
-
disabled: editor.getAttributes('textTransform').textTransform ===
|
|
16
|
-
TEXT_TRANSFORM.OPTIONS.LOWERCASE.VALUE,
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
label: TEXT_TRANSFORM.OPTIONS.CAPITALIZE.LABEL,
|
|
20
|
-
value: TEXT_TRANSFORM.OPTIONS.CAPITALIZE.VALUE,
|
|
21
|
-
disabled: editor.getAttributes('textTransform').textTransform ===
|
|
22
|
-
TEXT_TRANSFORM.OPTIONS.CAPITALIZE.VALUE,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
label: TEXT_TRANSFORM.OPTIONS.NONE.LABEL,
|
|
26
|
-
value: TEXT_TRANSFORM.OPTIONS.NONE.VALUE,
|
|
27
|
-
},
|
|
28
|
-
], onChange: v => {
|
|
29
|
-
editor.chain().focus().setTextTransform(v).run();
|
|
30
|
-
}, placeholder: TEXT_TRANSFORM.PLACEHOLDER }));
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Tooltip } from 'antd';
|
|
3
|
-
import { UnderlineIcon } from 'lucide-react';
|
|
4
|
-
import { formatHotkey } from '../../../utils';
|
|
5
|
-
export const UnderlineAction = ({ editor }) => (_jsx(Tooltip, { title: `Underline (${formatHotkey('U')})`, placement: "top", children: _jsx(Button, { size: "small", onClick: () => editor.chain().focus().toggleUnderline().run(), disabled: !editor.can().chain().focus().toggleUnderline().run(), type: editor.isActive('underline') ? 'primary' : 'default', icon: _jsx(UnderlineIcon, { size: 16 }) }) }));
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Button, Tooltip } from 'antd';
|
|
3
|
-
import { Link2OffIcon } from 'lucide-react';
|
|
4
|
-
// Hooks
|
|
5
|
-
import { useLinkHandler } from '../../../hooks/useLinkHandler';
|
|
6
|
-
export const UnsetLinkAction = (props) => {
|
|
7
|
-
const { editor } = props;
|
|
8
|
-
const { unsetLink } = useLinkHandler({ editor });
|
|
9
|
-
return (_jsx(Tooltip, { title: "Remove link", children: _jsx(Button, { size: "small", icon: _jsx(Link2OffIcon, { size: 16 }), onClick: () => unsetLink() }) }));
|
|
10
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export * from './BoldAction';
|
|
2
|
-
export * from './BulletListAction';
|
|
3
|
-
export * from './ClearFormattingAction';
|
|
4
|
-
export * from './FontFamilyAction';
|
|
5
|
-
export * from './FontSizeAction';
|
|
6
|
-
export * from './ItalicAction';
|
|
7
|
-
export * from './StrikeAction';
|
|
8
|
-
export * from './SuperscriptAction';
|
|
9
|
-
export * from './SubscriptAction';
|
|
10
|
-
export * from './TextTransformAction';
|
|
11
|
-
export * from './LinkAction';
|
|
12
|
-
export * from './SmartTagAction';
|
|
13
|
-
export * from './TextColorAction';
|
|
14
|
-
export * from './HighlightAction';
|
|
15
|
-
export * from './OrderedListAction';
|
|
16
|
-
export * from './TextAlignAction';
|
|
17
|
-
export * from './IndentAction';
|
|
18
|
-
export * from './OutdentAction';
|
|
19
|
-
export * from './UnderlineAction';
|
|
20
|
-
export * from './EmojiAction';
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export * from './BoldAction';
|
|
2
|
-
export * from './BulletListAction';
|
|
3
|
-
export * from './ClearFormattingAction';
|
|
4
|
-
export * from './FontFamilyAction';
|
|
5
|
-
export * from './FontSizeAction';
|
|
6
|
-
export * from './ItalicAction';
|
|
7
|
-
export * from './StrikeAction';
|
|
8
|
-
export * from './SuperscriptAction';
|
|
9
|
-
export * from './SubscriptAction';
|
|
10
|
-
export * from './TextTransformAction';
|
|
11
|
-
export * from './LinkAction';
|
|
12
|
-
export * from './SmartTagAction';
|
|
13
|
-
export * from './TextColorAction';
|
|
14
|
-
export * from './HighlightAction';
|
|
15
|
-
export * from './OrderedListAction';
|
|
16
|
-
export * from './TextAlignAction';
|
|
17
|
-
export * from './IndentAction';
|
|
18
|
-
export * from './OutdentAction';
|
|
19
|
-
export * from './UnderlineAction';
|
|
20
|
-
export * from './EmojiAction';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Toolbar, type ToolbarProps } from './Toolbar';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Toolbar } from './Toolbar';
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { EditorState } from '@tiptap/pm/state';
|
|
2
|
-
import { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
3
|
-
/**
|
|
4
|
-
* Configuration for document emptiness detection
|
|
5
|
-
*/
|
|
6
|
-
export interface DocumentStateConfig {
|
|
7
|
-
/** Minimum size to consider document as having content */
|
|
8
|
-
minContentSize?: number;
|
|
9
|
-
/** Whether to consider whitespace-only content as empty */
|
|
10
|
-
ignoreWhitespace?: boolean;
|
|
11
|
-
/** Custom validation function */
|
|
12
|
-
customValidator?: (doc: ProseMirrorNode) => boolean;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Calculates the minimum size of an empty document based on schema
|
|
16
|
-
*/
|
|
17
|
-
export declare function calculateEmptyDocumentSize(state: EditorState): number;
|
|
18
|
-
/**
|
|
19
|
-
* Checks if document is effectively empty
|
|
20
|
-
*/
|
|
21
|
-
export declare function isDocumentEmpty(state: EditorState, config?: DocumentStateConfig): boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Checks if document has meaningful content
|
|
24
|
-
*/
|
|
25
|
-
export declare function hasDocumentContent(state: EditorState, config?: DocumentStateConfig): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Gets document content statistics
|
|
28
|
-
*/
|
|
29
|
-
export declare function getDocumentStats(state: EditorState): {
|
|
30
|
-
nodeSize: number;
|
|
31
|
-
textLength: number;
|
|
32
|
-
trimmedTextLength: number;
|
|
33
|
-
nodeCount: void;
|
|
34
|
-
isEmpty: boolean;
|
|
35
|
-
emptyDocumentSize: number;
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Document state change detector
|
|
39
|
-
*/
|
|
40
|
-
export declare class DocumentStateTracker {
|
|
41
|
-
private previousState;
|
|
42
|
-
/**
|
|
43
|
-
* Updates tracker with new state and returns changes
|
|
44
|
-
*/
|
|
45
|
-
update(state: EditorState): {
|
|
46
|
-
isEmpty: boolean;
|
|
47
|
-
wasEmpty: boolean;
|
|
48
|
-
becameEmpty: boolean;
|
|
49
|
-
becameNonEmpty: boolean;
|
|
50
|
-
sizeChanged: boolean;
|
|
51
|
-
textLengthChanged: boolean;
|
|
52
|
-
};
|
|
53
|
-
/**
|
|
54
|
-
* Resets the tracker
|
|
55
|
-
*/
|
|
56
|
-
reset(): void;
|
|
57
|
-
}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default configuration for document state detection
|
|
3
|
-
*/
|
|
4
|
-
const DEFAULT_CONFIG = {
|
|
5
|
-
minContentSize: 4, // Standard ProseMirror empty doc size
|
|
6
|
-
ignoreWhitespace: true,
|
|
7
|
-
customValidator: () => false,
|
|
8
|
-
};
|
|
9
|
-
/**
|
|
10
|
-
* Calculates the minimum size of an empty document based on schema
|
|
11
|
-
*/
|
|
12
|
-
export function calculateEmptyDocumentSize(state) {
|
|
13
|
-
// Create a minimal document with the same schema
|
|
14
|
-
const emptyDoc = state.schema.topNodeType.createAndFill();
|
|
15
|
-
return emptyDoc?.nodeSize ?? 4;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Checks if document is effectively empty
|
|
19
|
-
*/
|
|
20
|
-
export function isDocumentEmpty(state, config = {}) {
|
|
21
|
-
const { minContentSize, ignoreWhitespace, customValidator } = {
|
|
22
|
-
...DEFAULT_CONFIG,
|
|
23
|
-
...config,
|
|
24
|
-
};
|
|
25
|
-
const { doc } = state;
|
|
26
|
-
// Use custom validator if provided
|
|
27
|
-
if (customValidator(doc)) {
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
// Check document size
|
|
31
|
-
const calculatedMinSize = calculateEmptyDocumentSize(state);
|
|
32
|
-
const effectiveMinSize = minContentSize === 4 ? calculatedMinSize : minContentSize;
|
|
33
|
-
if (doc.nodeSize <= effectiveMinSize) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
// Check if content is only whitespace
|
|
37
|
-
if (ignoreWhitespace) {
|
|
38
|
-
const textContent = doc.textContent.trim();
|
|
39
|
-
return textContent.length === 0;
|
|
40
|
-
}
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Checks if document has meaningful content
|
|
45
|
-
*/
|
|
46
|
-
export function hasDocumentContent(state, config = {}) {
|
|
47
|
-
return !isDocumentEmpty(state, config);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Gets document content statistics
|
|
51
|
-
*/
|
|
52
|
-
export function getDocumentStats(state) {
|
|
53
|
-
const { doc } = state;
|
|
54
|
-
return {
|
|
55
|
-
nodeSize: doc.nodeSize,
|
|
56
|
-
textLength: doc.textContent.length,
|
|
57
|
-
trimmedTextLength: doc.textContent.trim().length,
|
|
58
|
-
nodeCount: doc.nodesBetween(0, doc.nodeSize, () => true),
|
|
59
|
-
isEmpty: isDocumentEmpty(state),
|
|
60
|
-
emptyDocumentSize: calculateEmptyDocumentSize(state),
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Document state change detector
|
|
65
|
-
*/
|
|
66
|
-
export class DocumentStateTracker {
|
|
67
|
-
constructor() {
|
|
68
|
-
this.previousState = null;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Updates tracker with new state and returns changes
|
|
72
|
-
*/
|
|
73
|
-
update(state) {
|
|
74
|
-
const isEmpty = isDocumentEmpty(state);
|
|
75
|
-
const { nodeSize } = state.doc;
|
|
76
|
-
const textLength = state.doc.textContent.length;
|
|
77
|
-
const result = {
|
|
78
|
-
isEmpty,
|
|
79
|
-
wasEmpty: this.previousState?.isEmpty ?? true,
|
|
80
|
-
becameEmpty: false,
|
|
81
|
-
becameNonEmpty: false,
|
|
82
|
-
sizeChanged: false,
|
|
83
|
-
textLengthChanged: false,
|
|
84
|
-
};
|
|
85
|
-
if (this.previousState) {
|
|
86
|
-
result.becameEmpty = !this.previousState.isEmpty && isEmpty;
|
|
87
|
-
result.becameNonEmpty = this.previousState.isEmpty && !isEmpty;
|
|
88
|
-
result.sizeChanged = this.previousState.nodeSize !== nodeSize;
|
|
89
|
-
result.textLengthChanged = this.previousState.textLength !== textLength;
|
|
90
|
-
}
|
|
91
|
-
this.previousState = { isEmpty, nodeSize, textLength };
|
|
92
|
-
return result;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Resets the tracker
|
|
96
|
-
*/
|
|
97
|
-
reset() {
|
|
98
|
-
this.previousState = null;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { FontConfig } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Gets the appropriate bold font weight for a given font family
|
|
4
|
-
* @param currentFontFamily The font family to find bold weight for
|
|
5
|
-
* @param fonts Array of available font configurations
|
|
6
|
-
* @param minBoldWeight Minimum weight considered bold (default 700)
|
|
7
|
-
* @returns The first available bold weight for the font family, or minBoldWeight if none found
|
|
8
|
-
*/
|
|
9
|
-
export declare const getBoldFontWeight: (currentFontFamily: string, fonts: FontConfig[], minBoldWeight?: number) => number;
|
|
10
|
-
/**
|
|
11
|
-
* Gets the modifier key based on the platform
|
|
12
|
-
* @returns Platform-appropriate modifier key
|
|
13
|
-
*/
|
|
14
|
-
export declare const getModifierKey: () => "⌘" | "Ctrl";
|
|
15
|
-
/**
|
|
16
|
-
* Formats a hotkey string with the appropriate modifier
|
|
17
|
-
* @param key The key to format
|
|
18
|
-
* @returns Formatted hotkey string
|
|
19
|
-
*/
|
|
20
|
-
export declare const formatHotkey: (key: string) => string;
|
|
21
|
-
/**
|
|
22
|
-
* Validates if a font family name is a generic CSS font
|
|
23
|
-
* @param fontFamily Font family name to check
|
|
24
|
-
* @returns true if it's a generic font family
|
|
25
|
-
*/
|
|
26
|
-
export declare function isGenericFontFamily(fontFamily: string): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Extracts the primary font from a font-family string
|
|
29
|
-
* @param fontFamily Font family string (may contain fallbacks)
|
|
30
|
-
* @returns Primary font name
|
|
31
|
-
*/
|
|
32
|
-
export declare function getPrimaryFontFamily(fontFamily: string): string;
|
|
33
|
-
/**
|
|
34
|
-
* Checks if a font weight is considered bold
|
|
35
|
-
* @param weight Font weight to check
|
|
36
|
-
* @param threshold Bold threshold (default 600)
|
|
37
|
-
* @returns true if weight is bold
|
|
38
|
-
*/
|
|
39
|
-
export declare function isBoldWeight(weight: string | number, threshold?: number): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Gets all available font weights for a font family
|
|
42
|
-
* @param fontFamily Font family name
|
|
43
|
-
* @param fonts Array of font configurations
|
|
44
|
-
* @returns Array of available weights
|
|
45
|
-
*/
|
|
46
|
-
export declare function getFontWeights(fontFamily: string, fonts: FontConfig[]): number[];
|
|
47
|
-
/**
|
|
48
|
-
* Finds the closest available font weight
|
|
49
|
-
* @param targetWeight Desired font weight
|
|
50
|
-
* @param availableWeights Array of available weights
|
|
51
|
-
* @returns Closest available weight
|
|
52
|
-
*/
|
|
53
|
-
export declare function getClosestFontWeight(targetWeight: number, availableWeights: number[]): number;
|
|
54
|
-
/**
|
|
55
|
-
* Validates font configuration
|
|
56
|
-
* @param fontConfig Font configuration to validate
|
|
57
|
-
* @returns true if configuration is valid
|
|
58
|
-
*/
|
|
59
|
-
export declare function isValidFontConfig(fontConfig: FontConfig): boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Sorts font configurations alphabetically by name
|
|
62
|
-
* @param fonts Array of font configurations
|
|
63
|
-
* @returns Sorted array of font configurations
|
|
64
|
-
*/
|
|
65
|
-
export declare function sortFontsByName(fonts: FontConfig[]): FontConfig[];
|
|
66
|
-
/**
|
|
67
|
-
* Groups fonts by category (if category property exists)
|
|
68
|
-
* @param fonts Array of font configurations
|
|
69
|
-
* @returns Object with fonts grouped by category
|
|
70
|
-
*/
|
|
71
|
-
export declare function groupFontsByCategory(fonts: FontConfig[]): Record<string, FontConfig[]>;
|
|
72
|
-
/**
|
|
73
|
-
* Checks if a font is web safe
|
|
74
|
-
* @param fontFamily Font family name
|
|
75
|
-
* @returns true if font is web safe
|
|
76
|
-
*/
|
|
77
|
-
export declare function isWebSafeFont(fontFamily: string): boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Creates a font stack with appropriate fallbacks
|
|
80
|
-
* @param primaryFont Primary font family
|
|
81
|
-
* @param category Font category for fallback selection
|
|
82
|
-
* @returns Complete font stack string
|
|
83
|
-
*/
|
|
84
|
-
export declare function createFontStack(primaryFont: string, category?: 'serif' | 'sans-serif' | 'monospace'): string;
|