@scottjgilbert/lexical-blog-editor 0.1.4 → 1.0.0-beta.2
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/README.md +73 -67
- package/build/Editor.d.ts +8 -3
- package/build/Editor.d.ts.map +1 -1
- package/build/Editor.js +13 -8
- package/build/EditorExport.d.ts +4 -0
- package/build/EditorExport.d.ts.map +1 -0
- package/build/EditorExport.js +13 -0
- package/build/appSettings.d.ts +1 -1
- package/build/appSettings.js +1 -1
- package/build/buildHTMLConfig.d.ts +1 -1
- package/build/buildHTMLConfig.d.ts.map +1 -1
- package/build/buildHTMLConfig.js +35 -11
- package/build/context/FlashMessageContext.d.ts +2 -2
- package/build/context/FlashMessageContext.d.ts.map +1 -1
- package/build/context/FlashMessageContext.js +4 -3
- package/build/context/SharedHistoryContext.d.ts +3 -3
- package/build/context/SharedHistoryContext.d.ts.map +1 -1
- package/build/context/SharedHistoryContext.js +3 -2
- package/build/context/ToolbarContext.d.ts +1 -0
- package/build/context/ToolbarContext.d.ts.map +1 -1
- package/build/context/ToolbarContext.js +2 -0
- package/build/hooks/useModal.d.ts.map +1 -1
- package/build/hooks/useModal.js +1 -0
- package/build/hooks/useReport.d.ts +0 -7
- package/build/hooks/useReport.d.ts.map +1 -1
- package/build/hooks/useReport.js +1 -0
- package/build/index.css +283 -246
- package/build/index.d.ts +3 -3
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/nodes/CodeNode/CodeHighlightNode.d.ts +35 -0
- package/build/nodes/CodeNode/CodeHighlightNode.d.ts.map +1 -0
- package/build/nodes/CodeNode/CodeHighlightNode.js +88 -0
- package/build/nodes/CodeNode/CodeHighlighterShiki.d.ts +22 -0
- package/build/nodes/CodeNode/CodeHighlighterShiki.d.ts.map +1 -0
- package/build/nodes/CodeNode/CodeHighlighterShiki.js +644 -0
- package/build/nodes/CodeNode/CodeNode.d.ts +48 -0
- package/build/nodes/CodeNode/CodeNode.d.ts.map +1 -0
- package/build/nodes/CodeNode/CodeNode.js +367 -0
- package/build/nodes/CodeNode/FacadeShiki.d.ts +18 -0
- package/build/nodes/CodeNode/FacadeShiki.d.ts.map +1 -0
- package/build/nodes/CodeNode/FacadeShiki.js +159 -0
- package/build/nodes/CodeNode/FlatStructureUtils.d.ts +21 -0
- package/build/nodes/CodeNode/FlatStructureUtils.d.ts.map +1 -0
- package/build/nodes/CodeNode/FlatStructureUtils.js +85 -0
- package/build/nodes/CodeNode/invariant.d.ts +2 -0
- package/build/nodes/CodeNode/invariant.d.ts.map +1 -0
- package/build/nodes/CodeNode/invariant.js +6 -0
- package/build/nodes/DateTimeNode/DateTimeComponent.d.ts.map +1 -1
- package/build/nodes/DateTimeNode/DateTimeComponent.js +1 -0
- package/build/nodes/DateTimeNode/DateTimeNode.css +21 -0
- package/build/nodes/FigmaNode/FigmaNode.d.ts.map +1 -0
- package/build/nodes/FigmaNode/ServerFigmaNode.d.ts +21 -0
- package/build/nodes/FigmaNode/ServerFigmaNode.d.ts.map +1 -0
- package/build/nodes/FigmaNode/ServerFigmaNode.js +48 -0
- package/build/nodes/ImageComponent.d.ts.map +1 -1
- package/build/nodes/ImageComponent.js +1 -2
- package/build/nodes/ImageNode.d.ts +7 -7
- package/build/nodes/ImageNode.d.ts.map +1 -1
- package/build/nodes/ImageNode.js +30 -30
- package/build/nodes/LayoutContainerNode.d.ts +2 -2
- package/build/nodes/LayoutContainerNode.d.ts.map +1 -1
- package/build/nodes/LayoutContainerNode.js +10 -10
- package/build/nodes/PlaygroundNodes/PlaygroundNodes.d.ts.map +1 -0
- package/build/nodes/{PlaygroundNodes.js → PlaygroundNodes/PlaygroundNodes.js} +19 -21
- package/build/nodes/PlaygroundNodes/ServerPlaygroundNodes.d.ts +11 -0
- package/build/nodes/PlaygroundNodes/ServerPlaygroundNodes.d.ts.map +1 -0
- package/build/nodes/PlaygroundNodes/ServerPlaygroundNodes.js +65 -0
- package/build/nodes/TweetNode/ServerTweetNode.d.ts +20 -0
- package/build/nodes/TweetNode/ServerTweetNode.d.ts.map +1 -0
- package/build/nodes/TweetNode/ServerTweetNode.js +59 -0
- package/build/nodes/TweetNode/TweetNode.d.ts.map +1 -0
- package/build/nodes/YouTubeNode/ServerYouTubeNode.d.ts +21 -0
- package/build/nodes/YouTubeNode/ServerYouTubeNode.d.ts.map +1 -0
- package/build/nodes/YouTubeNode/ServerYouTubeNode.js +67 -0
- package/build/nodes/YouTubeNode/YouTubeNode.d.ts.map +1 -0
- package/build/plugins/ActionsPlugin/index.d.ts +0 -7
- package/build/plugins/ActionsPlugin/index.d.ts.map +1 -1
- package/build/plugins/ActionsPlugin/index.js +2 -1
- package/build/plugins/AutoEmbedPlugin/index.d.ts +2 -9
- package/build/plugins/AutoEmbedPlugin/index.d.ts.map +1 -1
- package/build/plugins/AutoEmbedPlugin/index.js +30 -29
- package/build/plugins/AutoLinkPlugin/index.d.ts +1 -1
- package/build/plugins/AutoLinkPlugin/index.d.ts.map +1 -1
- package/build/plugins/AutoLinkPlugin/index.js +3 -2
- package/build/plugins/CodeActionMenuPlugin/components/CopyButton/index.d.ts +1 -1
- package/build/plugins/CodeActionMenuPlugin/components/CopyButton/index.d.ts.map +1 -1
- package/build/plugins/CodeActionMenuPlugin/components/CopyButton/index.js +7 -6
- package/build/plugins/CodeActionMenuPlugin/components/PrettierButton/index.d.ts +2 -2
- package/build/plugins/CodeActionMenuPlugin/components/PrettierButton/index.d.ts.map +1 -1
- package/build/plugins/CodeActionMenuPlugin/components/PrettierButton/index.js +25 -24
- package/build/plugins/CodeActionMenuPlugin/index.d.ts +2 -9
- package/build/plugins/CodeActionMenuPlugin/index.d.ts.map +1 -1
- package/build/plugins/CodeActionMenuPlugin/index.js +22 -20
- package/build/plugins/CodeActionMenuPlugin/utils.d.ts.map +1 -1
- package/build/plugins/CodeActionMenuPlugin/utils.js +3 -2
- package/build/plugins/CodeHighlightPrismPlugin/index.d.ts +1 -1
- package/build/plugins/CodeHighlightPrismPlugin/index.d.ts.map +1 -1
- package/build/plugins/CodeHighlightPrismPlugin/index.js +4 -10
- package/build/plugins/CodeHighlightShikiPlugin/index.d.ts +1 -1
- package/build/plugins/CodeHighlightShikiPlugin/index.d.ts.map +1 -1
- package/build/plugins/CodeHighlightShikiPlugin/index.js +3 -3
- package/build/plugins/CollapsiblePlugin/Collapsible.css +17 -1
- package/build/plugins/CollapsiblePlugin/index.d.ts +1 -1
- package/build/plugins/CollapsiblePlugin/index.d.ts.map +1 -1
- package/build/plugins/CollapsiblePlugin/index.js +11 -10
- package/build/plugins/ComponentPickerPlugin/index.d.ts.map +1 -1
- package/build/plugins/ComponentPickerPlugin/index.js +3 -8
- package/build/plugins/ContextMenuPlugin/index.d.ts +1 -1
- package/build/plugins/ContextMenuPlugin/index.d.ts.map +1 -1
- package/build/plugins/ContextMenuPlugin/index.js +15 -14
- package/build/plugins/DateTimePlugin/index.d.ts +2 -2
- package/build/plugins/DateTimePlugin/index.d.ts.map +1 -1
- package/build/plugins/DateTimePlugin/index.js +8 -14
- package/build/plugins/DragDropPastePlugin/index.d.ts +0 -7
- package/build/plugins/DragDropPastePlugin/index.d.ts.map +1 -1
- package/build/plugins/DragDropPastePlugin/index.js +12 -11
- package/build/plugins/DraggableBlockPlugin/index.css +6 -0
- package/build/plugins/DraggableBlockPlugin/index.d.ts +2 -2
- package/build/plugins/DraggableBlockPlugin/index.d.ts.map +1 -1
- package/build/plugins/DraggableBlockPlugin/index.js +23 -22
- package/build/plugins/EmojiPickerPlugin/index.d.ts +0 -7
- package/build/plugins/EmojiPickerPlugin/index.d.ts.map +1 -1
- package/build/plugins/EmojiPickerPlugin/index.js +1 -0
- package/build/plugins/EmojisPlugin/index.d.ts +1 -8
- package/build/plugins/EmojisPlugin/index.d.ts.map +1 -1
- package/build/plugins/EmojisPlugin/index.js +10 -16
- package/build/plugins/EquationsPlugin/index.d.ts +3 -3
- package/build/plugins/EquationsPlugin/index.d.ts.map +1 -1
- package/build/plugins/EquationsPlugin/index.js +14 -10
- package/build/plugins/FigmaPlugin/index.d.ts +2 -2
- package/build/plugins/FigmaPlugin/index.d.ts.map +1 -1
- package/build/plugins/FigmaPlugin/index.js +8 -14
- package/build/plugins/FloatingLinkEditorPlugin/index.css +11 -0
- package/build/plugins/FloatingLinkEditorPlugin/index.d.ts +3 -3
- package/build/plugins/FloatingLinkEditorPlugin/index.d.ts.map +1 -1
- package/build/plugins/FloatingLinkEditorPlugin/index.js +28 -27
- package/build/plugins/FloatingTextFormatToolbarPlugin/index.css +15 -0
- package/build/plugins/FloatingTextFormatToolbarPlugin/index.d.ts.map +1 -1
- package/build/plugins/FloatingTextFormatToolbarPlugin/index.js +2 -1
- package/build/plugins/ImagesPlugin/index.d.ts +3 -3
- package/build/plugins/ImagesPlugin/index.d.ts.map +1 -1
- package/build/plugins/ImagesPlugin/index.js +38 -37
- package/build/plugins/KeywordsPlugin/index.d.ts +1 -8
- package/build/plugins/KeywordsPlugin/index.d.ts.map +1 -1
- package/build/plugins/KeywordsPlugin/index.js +6 -12
- package/build/plugins/LayoutPlugin/InsertLayoutDialog.d.ts +2 -2
- package/build/plugins/LayoutPlugin/InsertLayoutDialog.d.ts.map +1 -1
- package/build/plugins/LayoutPlugin/InsertLayoutDialog.js +10 -9
- package/build/plugins/LayoutPlugin/LayoutPlugin.d.ts +1 -1
- package/build/plugins/LayoutPlugin/LayoutPlugin.d.ts.map +1 -1
- package/build/plugins/LayoutPlugin/LayoutPlugin.js +8 -14
- package/build/plugins/LinkPlugin/index.d.ts.map +1 -1
- package/build/plugins/LinkPlugin/index.js +1 -0
- package/build/plugins/MarkdownShortcutPlugin/index.d.ts.map +1 -1
- package/build/plugins/MarkdownShortcutPlugin/index.js +1 -0
- package/build/plugins/MarkdownTransformers/index.d.ts +1 -1
- package/build/plugins/MarkdownTransformers/index.d.ts.map +1 -1
- package/build/plugins/MarkdownTransformers/index.js +25 -25
- package/build/plugins/PasteLogPlugin/index.d.ts.map +1 -1
- package/build/plugins/PasteLogPlugin/index.js +1 -0
- package/build/plugins/ShortcutsPlugin/index.d.ts +0 -7
- package/build/plugins/ShortcutsPlugin/index.d.ts.map +1 -1
- package/build/plugins/ShortcutsPlugin/index.js +1 -0
- package/build/plugins/SpeechToTextPlugin/index.d.ts +2 -2
- package/build/plugins/SpeechToTextPlugin/index.d.ts.map +1 -1
- package/build/plugins/SpeechToTextPlugin/index.js +7 -11
- package/build/plugins/TabFocusPlugin/index.d.ts +0 -7
- package/build/plugins/TabFocusPlugin/index.d.ts.map +1 -1
- package/build/plugins/TabFocusPlugin/index.js +6 -5
- package/build/plugins/TableActionMenuPlugin/index.d.ts +1 -8
- package/build/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
- package/build/plugins/TableActionMenuPlugin/index.js +41 -40
- package/build/plugins/TableCellResizer/index.d.ts +2 -2
- package/build/plugins/TableCellResizer/index.d.ts.map +1 -1
- package/build/plugins/TableCellResizer/index.js +43 -42
- package/build/plugins/TableHoverActionsPlugin/index.d.ts +1 -8
- package/build/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
- package/build/plugins/TableHoverActionsPlugin/index.js +19 -18
- package/build/plugins/TableHoverActionsV2Plugin/index.d.ts.map +1 -1
- package/build/plugins/TableHoverActionsV2Plugin/index.js +1 -0
- package/build/plugins/TablePlugin.d.ts +2 -2
- package/build/plugins/TablePlugin.d.ts.map +1 -1
- package/build/plugins/TablePlugin.js +11 -10
- package/build/plugins/TableScrollShadowPlugin/index.d.ts +0 -7
- package/build/plugins/TableScrollShadowPlugin/index.d.ts.map +1 -1
- package/build/plugins/TableScrollShadowPlugin/index.js +9 -8
- package/build/plugins/TestRecorderPlugin/index.d.ts +1 -8
- package/build/plugins/TestRecorderPlugin/index.d.ts.map +1 -1
- package/build/plugins/TestRecorderPlugin/index.js +45 -44
- package/build/plugins/ToolbarPlugin/fontSize.d.ts +2 -2
- package/build/plugins/ToolbarPlugin/fontSize.d.ts.map +1 -1
- package/build/plugins/ToolbarPlugin/fontSize.js +19 -18
- package/build/plugins/ToolbarPlugin/index.d.ts.map +1 -1
- package/build/plugins/ToolbarPlugin/index.js +68 -60
- package/build/plugins/ToolbarPlugin/languages.d.ts +14 -0
- package/build/plugins/ToolbarPlugin/languages.d.ts.map +1 -0
- package/build/plugins/ToolbarPlugin/languages.js +185 -0
- package/build/plugins/ToolbarPlugin/utils.d.ts +2 -2
- package/build/plugins/ToolbarPlugin/utils.js +21 -21
- package/build/plugins/TwitterPlugin/index.d.ts +2 -2
- package/build/plugins/TwitterPlugin/index.d.ts.map +1 -1
- package/build/plugins/TwitterPlugin/index.js +8 -14
- package/build/plugins/YouTubePlugin/index.d.ts +2 -2
- package/build/plugins/YouTubePlugin/index.d.ts.map +1 -1
- package/build/plugins/YouTubePlugin/index.js +8 -14
- package/build/themes/PlaygroundEditorTheme.css +301 -33
- package/build/themes/ViewerTheme.css +899 -0
- package/build/{plugins/MentionsPlugin/index.d.ts → themes/ViewerTheme.d.ts} +5 -3
- package/build/themes/ViewerTheme.d.ts.map +1 -0
- package/build/themes/ViewerTheme.js +124 -0
- package/build/themes/ViewerThemeComplete.css +1043 -0
- package/build/ui/ColorPicker.d.ts +2 -2
- package/build/ui/ColorPicker.d.ts.map +1 -1
- package/build/ui/ColorPicker.js +47 -46
- package/build/ui/DropDown.d.ts.map +1 -1
- package/build/ui/DropDown.js +1 -0
- package/build/ui/FlashMessage.d.ts +3 -3
- package/build/ui/FlashMessage.d.ts.map +1 -1
- package/build/ui/FlashMessage.js +3 -2
- package/build/ui/ImageResizer.d.ts +3 -3
- package/build/ui/ImageResizer.d.ts.map +1 -1
- package/build/ui/ImageResizer.js +20 -19
- package/build/ui/KatexEquationAlterer.css +3 -1
- package/build/ui/KatexEquationAlterer.d.ts.map +1 -1
- package/build/ui/KatexEquationAlterer.js +1 -0
- package/build/ui/KatexRenderer.d.ts.map +1 -1
- package/build/ui/KatexRenderer.js +1 -0
- package/build/ui/Modal.d.ts.map +1 -1
- package/build/ui/Modal.js +1 -0
- package/build/ui/Switch.d.ts +2 -2
- package/build/ui/Switch.d.ts.map +1 -1
- package/build/ui/Switch.js +3 -2
- package/build/ui/TextInput.d.ts.map +1 -1
- package/build/ui/TextInput.js +1 -0
- package/build/utils/ServerBlockWithAlignableContents.d.ts +22 -0
- package/build/utils/ServerBlockWithAlignableContents.d.ts.map +1 -0
- package/build/utils/ServerBlockWithAlignableContents.js +6 -0
- package/build/utils/focusUtils.d.ts.map +1 -1
- package/build/utils/focusUtils.js +4 -3
- package/build/utils/getDOMRangeRect.d.ts.map +1 -1
- package/build/utils/getDOMRangeRect.js +1 -0
- package/build/utils/setFloatingElemPosition.d.ts.map +1 -1
- package/build/utils/setFloatingElemPosition.js +5 -4
- package/build/utils/swipe.d.ts +0 -7
- package/build/utils/swipe.d.ts.map +1 -1
- package/build/utils/swipe.js +5 -11
- package/build/viewer/Viewer.d.ts +18 -0
- package/build/viewer/Viewer.d.ts.map +1 -0
- package/build/viewer/Viewer.js +105 -0
- package/build/viewer/client.d.ts +18 -0
- package/build/viewer/client.d.ts.map +1 -0
- package/build/viewer/client.js +97 -0
- package/build/viewer/index.d.ts +4 -0
- package/build/viewer/index.d.ts.map +1 -0
- package/build/viewer/index.js +2 -0
- package/package.json +58 -36
- package/build/collaboration.d.ts +0 -12
- package/build/collaboration.d.ts.map +0 -1
- package/build/collaboration.js +0 -32
- package/build/nodes/FigmaNode.d.ts.map +0 -1
- package/build/nodes/PageBreakNode/index.css +0 -64
- package/build/nodes/PageBreakNode/index.d.ts +0 -25
- package/build/nodes/PageBreakNode/index.d.ts.map +0 -1
- package/build/nodes/PageBreakNode/index.js +0 -83
- package/build/nodes/PlaygroundNodes.d.ts.map +0 -1
- package/build/nodes/PollComponent.d.ts +0 -17
- package/build/nodes/PollComponent.d.ts.map +0 -1
- package/build/nodes/PollComponent.js +0 -85
- package/build/nodes/PollNode.css +0 -165
- package/build/nodes/PollNode.d.ts +0 -51
- package/build/nodes/PollNode.d.ts.map +0 -1
- package/build/nodes/PollNode.js +0 -153
- package/build/nodes/StickyComponent.d.ts +0 -18
- package/build/nodes/StickyComponent.d.ts.map +0 -1
- package/build/nodes/StickyComponent.js +0 -155
- package/build/nodes/StickyNode.css +0 -37
- package/build/nodes/StickyNode.d.ts +0 -39
- package/build/nodes/StickyNode.d.ts.map +0 -1
- package/build/nodes/StickyNode.js +0 -66
- package/build/nodes/TweetNode.d.ts.map +0 -1
- package/build/nodes/YouTubeNode.d.ts.map +0 -1
- package/build/plugins/DocsPlugin/index.d.ts +0 -10
- package/build/plugins/DocsPlugin/index.d.ts.map +0 -1
- package/build/plugins/DocsPlugin/index.js +0 -4
- package/build/plugins/MaxLengthPlugin/index.d.ts +0 -11
- package/build/plugins/MaxLengthPlugin/index.d.ts.map +0 -1
- package/build/plugins/MaxLengthPlugin/index.js +0 -44
- package/build/plugins/MentionsPlugin/index.d.ts.map +0 -1
- package/build/plugins/MentionsPlugin/index.js +0 -562
- package/build/plugins/PageBreakPlugin/index.d.ts +0 -12
- package/build/plugins/PageBreakPlugin/index.d.ts.map +0 -1
- package/build/plugins/PageBreakPlugin/index.js +0 -34
- package/build/plugins/StickyPlugin/index.d.ts +0 -10
- package/build/plugins/StickyPlugin/index.d.ts.map +0 -1
- package/build/plugins/StickyPlugin/index.js +0 -19
- package/build/plugins/TreeViewPlugin/index.d.ts +0 -10
- package/build/plugins/TreeViewPlugin/index.d.ts.map +0 -1
- package/build/plugins/TreeViewPlugin/index.js +0 -7
- package/build/plugins/TypingPerfPlugin/index.d.ts +0 -10
- package/build/plugins/TypingPerfPlugin/index.d.ts.map +0 -1
- package/build/plugins/TypingPerfPlugin/index.js +0 -100
- package/build/plugins/VersionsPlugin/index.css +0 -57
- package/build/plugins/VersionsPlugin/index.d.ts +0 -14
- package/build/plugins/VersionsPlugin/index.d.ts.map +0 -1
- package/build/plugins/VersionsPlugin/index.js +0 -147
- /package/build/nodes/{FigmaNode.d.ts → FigmaNode/FigmaNode.d.ts} +0 -0
- /package/build/nodes/{FigmaNode.js → FigmaNode/FigmaNode.js} +0 -0
- /package/build/nodes/{PlaygroundNodes.d.ts → PlaygroundNodes/PlaygroundNodes.d.ts} +0 -0
- /package/build/nodes/{TweetNode.d.ts → TweetNode/TweetNode.d.ts} +0 -0
- /package/build/nodes/{TweetNode.js → TweetNode/TweetNode.js} +0 -0
- /package/build/nodes/{YouTubeNode.d.ts → YouTubeNode/YouTubeNode.d.ts} +0 -0
- /package/build/nodes/{YouTubeNode.js → YouTubeNode/YouTubeNode.js} +0 -0
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useLexicalComposerContext } from
|
|
3
|
-
import { INSERT_TABLE_COMMAND, TableCellNode, TableNode, TableRowNode, } from
|
|
4
|
-
import { createContext, useContext, useEffect, useMemo, useState } from
|
|
5
|
-
import Button from
|
|
6
|
-
import { DialogActions } from
|
|
7
|
-
import TextInput from
|
|
3
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
4
|
+
import { INSERT_TABLE_COMMAND, TableCellNode, TableNode, TableRowNode, } from "@lexical/table";
|
|
5
|
+
import { createContext, useContext, useEffect, useMemo, useState } from "react";
|
|
6
|
+
import Button from "../ui/Button";
|
|
7
|
+
import { DialogActions } from "../ui/Dialog";
|
|
8
|
+
import TextInput from "../ui/TextInput";
|
|
8
9
|
export const CellContext = createContext({
|
|
9
10
|
cellEditorConfig: null,
|
|
10
11
|
cellEditorPlugins: null,
|
|
@@ -26,8 +27,8 @@ export function TableContext({ children }) {
|
|
|
26
27
|
}), [contextValue.cellEditorConfig, contextValue.cellEditorPlugins]), children: children }));
|
|
27
28
|
}
|
|
28
29
|
export function InsertTableDialog({ activeEditor, onClose, }) {
|
|
29
|
-
const [rows, setRows] = useState(
|
|
30
|
-
const [columns, setColumns] = useState(
|
|
30
|
+
const [rows, setRows] = useState("5");
|
|
31
|
+
const [columns, setColumns] = useState("5");
|
|
31
32
|
const [isDisabled, setIsDisabled] = useState(true);
|
|
32
33
|
useEffect(() => {
|
|
33
34
|
const row = Number(rows);
|
|
@@ -46,14 +47,14 @@ export function InsertTableDialog({ activeEditor, onClose, }) {
|
|
|
46
47
|
});
|
|
47
48
|
onClose();
|
|
48
49
|
};
|
|
49
|
-
return (_jsxs(_Fragment, { children: [_jsx(TextInput, { placeholder:
|
|
50
|
+
return (_jsxs(_Fragment, { children: [_jsx(TextInput, { placeholder: "# of rows (1-500)", label: "Rows", onChange: setRows, value: rows, "data-test-id": "table-modal-rows", type: "number" }), _jsx(TextInput, { placeholder: "# of columns (1-50)", label: "Columns", onChange: setColumns, value: columns, "data-test-id": "table-modal-columns", type: "number" }), _jsx(DialogActions, { "data-test-id": "table-model-confirm-insert", children: _jsx(Button, { disabled: isDisabled, onClick: onClick, children: "Confirm" }) })] }));
|
|
50
51
|
}
|
|
51
52
|
export function TablePlugin({ cellEditorConfig, children, }) {
|
|
52
53
|
const [editor] = useLexicalComposerContext();
|
|
53
54
|
const cellContext = useContext(CellContext);
|
|
54
55
|
useEffect(() => {
|
|
55
56
|
if (!editor.hasNodes([TableNode, TableRowNode, TableCellNode])) {
|
|
56
|
-
throw new Error(
|
|
57
|
+
throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");
|
|
57
58
|
}
|
|
58
59
|
}, [editor]);
|
|
59
60
|
useEffect(() => {
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
1
|
export default function TableScrollShadowPlugin(): null;
|
|
9
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/TableScrollShadowPlugin/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/TableScrollShadowPlugin/index.tsx"],"names":[],"mappings":"AA+CA,MAAM,CAAC,OAAO,UAAU,uBAAuB,IAAI,IAAI,CAiGtD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
/**
|
|
2
3
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
4
|
*
|
|
@@ -5,12 +6,12 @@
|
|
|
5
6
|
* LICENSE file in the root directory of this source tree.
|
|
6
7
|
*
|
|
7
8
|
*/
|
|
8
|
-
import { useLexicalComposerContext } from
|
|
9
|
-
import { useEffect } from
|
|
10
|
-
const SCROLLABLE_WRAPPER_CLASS =
|
|
11
|
-
const HAS_SCROLL_RIGHT_CLASS =
|
|
12
|
-
const HAS_SCROLL_LEFT_CLASS =
|
|
13
|
-
const HAS_SCROLL_MIDDLE_CLASS =
|
|
9
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
10
|
+
import { useEffect } from "react";
|
|
11
|
+
const SCROLLABLE_WRAPPER_CLASS = "PlaygroundEditorTheme__tableScrollableWrapper";
|
|
12
|
+
const HAS_SCROLL_RIGHT_CLASS = "PlaygroundEditorTheme__tableScrollRight";
|
|
13
|
+
const HAS_SCROLL_LEFT_CLASS = "PlaygroundEditorTheme__tableScrollLeft";
|
|
14
|
+
const HAS_SCROLL_MIDDLE_CLASS = "PlaygroundEditorTheme__tableScrollMiddle";
|
|
14
15
|
function updateTableScrollState(element) {
|
|
15
16
|
const hasScroll = element.scrollWidth > element.clientWidth;
|
|
16
17
|
// Adding and removing 1 and -1 for floating point precision
|
|
@@ -68,7 +69,7 @@ export default function TableScrollShadowPlugin() {
|
|
|
68
69
|
const handler = () => {
|
|
69
70
|
updateTableScrollState(wrapper);
|
|
70
71
|
};
|
|
71
|
-
wrapper.addEventListener(
|
|
72
|
+
wrapper.addEventListener("scroll", handler, { passive: true });
|
|
72
73
|
scrollHandlers.set(wrapper, handler);
|
|
73
74
|
};
|
|
74
75
|
const wrappers = editorElement.querySelectorAll(`.${SCROLLABLE_WRAPPER_CLASS}`);
|
|
@@ -105,7 +106,7 @@ export default function TableScrollShadowPlugin() {
|
|
|
105
106
|
resizeObserver.disconnect();
|
|
106
107
|
wrapperObserver.disconnect();
|
|
107
108
|
scrollHandlers.forEach((handler, wrapper) => {
|
|
108
|
-
wrapper.removeEventListener(
|
|
109
|
+
wrapper.removeEventListener("scroll", handler);
|
|
109
110
|
});
|
|
110
111
|
scrollHandlers.clear();
|
|
111
112
|
};
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
import type { JSX } from 'react';
|
|
1
|
+
import type { JSX } from "react";
|
|
9
2
|
export declare function isSelectAll(event: KeyboardEvent): boolean;
|
|
10
3
|
export default function TestRecorderPlugin(): JSX.Element;
|
|
11
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/TestRecorderPlugin/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/TestRecorderPlugin/index.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAiGjC,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAKzD;AAoWD,MAAM,CAAC,OAAO,UAAU,kBAAkB,IAAI,GAAG,CAAC,OAAO,CAUxD"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useLexicalComposerContext } from
|
|
3
|
-
import { IS_APPLE } from
|
|
4
|
-
import { $createParagraphNode, $createTextNode, $getRoot, getDOMSelection, } from
|
|
5
|
-
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from
|
|
3
|
+
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
4
|
+
import { IS_APPLE } from "@lexical/utils";
|
|
5
|
+
import { $createParagraphNode, $createTextNode, $getRoot, getDOMSelection, } from "lexical";
|
|
6
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState, } from "react";
|
|
6
7
|
const copy = (text) => {
|
|
7
8
|
var _a, _b;
|
|
8
|
-
const textArea = document.createElement(
|
|
9
|
-
textArea.value = text ||
|
|
10
|
-
textArea.style.position =
|
|
11
|
-
textArea.style.opacity =
|
|
9
|
+
const textArea = document.createElement("textarea");
|
|
10
|
+
textArea.value = text || "";
|
|
11
|
+
textArea.style.position = "absolute";
|
|
12
|
+
textArea.style.opacity = "0";
|
|
12
13
|
(_a = document.body) === null || _a === void 0 ? void 0 : _a.appendChild(textArea);
|
|
13
14
|
textArea.focus();
|
|
14
15
|
textArea.select();
|
|
15
16
|
try {
|
|
16
|
-
const result = document.execCommand(
|
|
17
|
+
const result = document.execCommand("copy");
|
|
17
18
|
// eslint-disable-next-line no-console
|
|
18
19
|
console.log(result);
|
|
19
20
|
}
|
|
@@ -24,10 +25,10 @@ const copy = (text) => {
|
|
|
24
25
|
};
|
|
25
26
|
const download = (filename, text) => {
|
|
26
27
|
var _a, _b;
|
|
27
|
-
const a = document.createElement(
|
|
28
|
-
a.setAttribute(
|
|
29
|
-
a.setAttribute(
|
|
30
|
-
a.style.display =
|
|
28
|
+
const a = document.createElement("a");
|
|
29
|
+
a.setAttribute("href", "data:text/plain;charset=utf-8," + encodeURIComponent(text || ""));
|
|
30
|
+
a.setAttribute("download", filename);
|
|
31
|
+
a.style.display = "none";
|
|
31
32
|
(_a = document.body) === null || _a === void 0 ? void 0 : _a.appendChild(a);
|
|
32
33
|
a.click();
|
|
33
34
|
(_b = document.body) === null || _b === void 0 ? void 0 : _b.removeChild(a);
|
|
@@ -35,25 +36,25 @@ const download = (filename, text) => {
|
|
|
35
36
|
const formatStep = (step) => {
|
|
36
37
|
const formatOneStep = (name, value) => {
|
|
37
38
|
switch (name) {
|
|
38
|
-
case
|
|
39
|
+
case "click": {
|
|
39
40
|
return ` await page.mouse.click(${value.x}, ${value.y});`;
|
|
40
41
|
}
|
|
41
|
-
case
|
|
42
|
+
case "press": {
|
|
42
43
|
return ` await page.keyboard.press('${value}');`;
|
|
43
44
|
}
|
|
44
|
-
case
|
|
45
|
+
case "keydown": {
|
|
45
46
|
return ` await page.keyboard.keydown('${value}');`;
|
|
46
47
|
}
|
|
47
|
-
case
|
|
48
|
+
case "keyup": {
|
|
48
49
|
return ` await page.keyboard.keyup('${value}');`;
|
|
49
50
|
}
|
|
50
|
-
case
|
|
51
|
+
case "type": {
|
|
51
52
|
return ` await page.keyboard.type('${value}');`;
|
|
52
53
|
}
|
|
53
|
-
case
|
|
54
|
+
case "selectAll": {
|
|
54
55
|
return ` await selectAll(page);`;
|
|
55
56
|
}
|
|
56
|
-
case
|
|
57
|
+
case "snapshot": {
|
|
57
58
|
return ` await assertHTMLSnapshot(page);
|
|
58
59
|
await assertSelection(page, {
|
|
59
60
|
anchorPath: [${value.anchorPath.toString()}],
|
|
@@ -80,7 +81,7 @@ const formatStep = (step) => {
|
|
|
80
81
|
}
|
|
81
82
|
};
|
|
82
83
|
export function isSelectAll(event) {
|
|
83
|
-
return (event.key.toLowerCase() ===
|
|
84
|
+
return (event.key.toLowerCase() === "a" &&
|
|
84
85
|
(IS_APPLE ? event.metaKey : event.ctrlKey));
|
|
85
86
|
}
|
|
86
87
|
// stolen from LexicalSelection-test
|
|
@@ -108,20 +109,20 @@ function getPathFromNodeToEditor(node, rootElement) {
|
|
|
108
109
|
return path;
|
|
109
110
|
}
|
|
110
111
|
const keyPresses = new Set([
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
"Enter",
|
|
113
|
+
"Backspace",
|
|
114
|
+
"Delete",
|
|
115
|
+
"Escape",
|
|
116
|
+
"ArrowLeft",
|
|
117
|
+
"ArrowRight",
|
|
118
|
+
"ArrowUp",
|
|
119
|
+
"ArrowDown",
|
|
119
120
|
]);
|
|
120
121
|
function useTestRecorder(editor) {
|
|
121
122
|
const [steps, setSteps] = useState([]);
|
|
122
123
|
const [isRecording, setIsRecording] = useState(false);
|
|
123
|
-
const [, setCurrentInnerHTML] = useState(
|
|
124
|
-
const [templatedTest, setTemplatedTest] = useState(
|
|
124
|
+
const [, setCurrentInnerHTML] = useState("");
|
|
125
|
+
const [templatedTest, setTemplatedTest] = useState("");
|
|
125
126
|
const previousSelectionRef = useRef(null);
|
|
126
127
|
const skipNextSelectionChangeRef = useRef(false);
|
|
127
128
|
const preRef = useRef(null);
|
|
@@ -178,7 +179,7 @@ ${steps.map(formatStep).join(`\n`)}
|
|
|
178
179
|
const lastStep = steps[currentIndex];
|
|
179
180
|
if (lastStep) {
|
|
180
181
|
if (lastStep.name === name) {
|
|
181
|
-
if (name ===
|
|
182
|
+
if (name === "type") {
|
|
182
183
|
// for typing events we just append the text
|
|
183
184
|
return [
|
|
184
185
|
...steps.slice(0, currentIndex),
|
|
@@ -207,16 +208,16 @@ ${steps.map(formatStep).join(`\n`)}
|
|
|
207
208
|
}
|
|
208
209
|
const key = event.key;
|
|
209
210
|
if (isSelectAll(event)) {
|
|
210
|
-
pushStep(
|
|
211
|
+
pushStep("selectAll", "");
|
|
211
212
|
}
|
|
212
213
|
else if (keyPresses.has(key)) {
|
|
213
|
-
pushStep(
|
|
214
|
+
pushStep("press", event.key);
|
|
214
215
|
}
|
|
215
216
|
else if ([...key].length > 1) {
|
|
216
|
-
pushStep(
|
|
217
|
+
pushStep("keydown", event.key);
|
|
217
218
|
}
|
|
218
219
|
else {
|
|
219
|
-
pushStep(
|
|
220
|
+
pushStep("type", event.key);
|
|
220
221
|
}
|
|
221
222
|
};
|
|
222
223
|
const onKeyUp = (event) => {
|
|
@@ -225,17 +226,17 @@ ${steps.map(formatStep).join(`\n`)}
|
|
|
225
226
|
}
|
|
226
227
|
const key = event.key;
|
|
227
228
|
if (!keyPresses.has(key) && [...key].length > 1) {
|
|
228
|
-
pushStep(
|
|
229
|
+
pushStep("keyup", event.key);
|
|
229
230
|
}
|
|
230
231
|
};
|
|
231
232
|
return editor.registerRootListener((rootElement, prevRootElement) => {
|
|
232
233
|
if (prevRootElement !== null) {
|
|
233
|
-
prevRootElement.removeEventListener(
|
|
234
|
-
prevRootElement.removeEventListener(
|
|
234
|
+
prevRootElement.removeEventListener("keydown", onKeyDown);
|
|
235
|
+
prevRootElement.removeEventListener("keyup", onKeyUp);
|
|
235
236
|
}
|
|
236
237
|
if (rootElement !== null) {
|
|
237
|
-
rootElement.addEventListener(
|
|
238
|
-
rootElement.addEventListener(
|
|
238
|
+
rootElement.addEventListener("keydown", onKeyDown);
|
|
239
|
+
rootElement.addEventListener("keyup", onKeyUp);
|
|
239
240
|
}
|
|
240
241
|
});
|
|
241
242
|
}, [editor, isRecording, pushStep]);
|
|
@@ -331,7 +332,7 @@ ${steps.map(formatStep).join(`\n`)}
|
|
|
331
332
|
if (focusNode !== null) {
|
|
332
333
|
focusPath = getPathFromNodeToEditor(focusNode, rootElement);
|
|
333
334
|
}
|
|
334
|
-
pushStep(
|
|
335
|
+
pushStep("snapshot", {
|
|
335
336
|
anchorNode,
|
|
336
337
|
anchorOffset,
|
|
337
338
|
anchorPath,
|
|
@@ -344,9 +345,9 @@ ${steps.map(formatStep).join(`\n`)}
|
|
|
344
345
|
copy(generateTestContent());
|
|
345
346
|
}, [generateTestContent]);
|
|
346
347
|
const onDownloadClick = useCallback(() => {
|
|
347
|
-
download(
|
|
348
|
+
download("test.js", generateTestContent());
|
|
348
349
|
}, [generateTestContent]);
|
|
349
|
-
const button = (_jsx("button", { id: "test-recorder-button", className: `editor-dev-button ${isRecording ?
|
|
350
|
+
const button = (_jsx("button", { id: "test-recorder-button", className: `editor-dev-button ${isRecording ? "active" : ""}`, onClick: () => toggleEditorSelection(getCurrentEditor()), title: isRecording ? "Disable test recorder" : "Enable test recorder" }));
|
|
350
351
|
const output = isRecording ? (_jsxs("div", { className: "test-recorder-output", children: [_jsxs("div", { className: "test-recorder-toolbar", children: [_jsx("button", { className: "test-recorder-button", id: "test-recorder-button-snapshot", title: "Insert snapshot", onClick: onSnapshotClick }), _jsx("button", { className: "test-recorder-button", id: "test-recorder-button-copy", title: "Copy to clipboard", onClick: onCopyClick }), _jsx("button", { className: "test-recorder-button", id: "test-recorder-button-download", title: "Download as a file", onClick: onDownloadClick })] }), _jsx("pre", { id: "test-recorder", ref: preRef, children: templatedTest })] })) : null;
|
|
351
352
|
return [button, output];
|
|
352
353
|
}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
|
-
import
|
|
9
|
-
import { LexicalEditor } from
|
|
8
|
+
import "./fontSize.css";
|
|
9
|
+
import { LexicalEditor } from "lexical";
|
|
10
10
|
export declare function parseFontSizeForToolbar(input: string): string;
|
|
11
11
|
export declare function parseAllowedFontSize(input: string): string;
|
|
12
12
|
export default function FontSize({ selectionFontSize, disabled, editor, }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fontSize.d.ts","sourceRoot":"","sources":["../../../src/plugins/ToolbarPlugin/fontSize.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fontSize.d.ts","sourceRoot":"","sources":["../../../src/plugins/ToolbarPlugin/fontSize.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,gBAAgB,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AA8BxC,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAS7D;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAS1D;AAED,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,iBAAiB,EACjB,QAAQ,EACR,MAAM,GACP,EAAE;IACD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,aAAa,CAAC;CACvB,2CA2HA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
3
|
/**
|
|
3
4
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
@@ -6,18 +7,18 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
6
7
|
* LICENSE file in the root directory of this source tree.
|
|
7
8
|
*
|
|
8
9
|
*/
|
|
9
|
-
import
|
|
10
|
-
import * as React from
|
|
11
|
-
import { MAX_ALLOWED_FONT_SIZE, MIN_ALLOWED_FONT_SIZE, } from
|
|
12
|
-
import { isKeyboardInput } from
|
|
13
|
-
import { SHORTCUTS } from
|
|
14
|
-
import { updateFontSize, updateFontSizeInSelection, UpdateFontSizeType, } from
|
|
10
|
+
import "./fontSize.css";
|
|
11
|
+
import * as React from "react";
|
|
12
|
+
import { MAX_ALLOWED_FONT_SIZE, MIN_ALLOWED_FONT_SIZE, } from "../../context/ToolbarContext";
|
|
13
|
+
import { isKeyboardInput } from "../../utils/focusUtils";
|
|
14
|
+
import { SHORTCUTS } from "../ShortcutsPlugin/shortcuts";
|
|
15
|
+
import { updateFontSize, updateFontSizeInSelection, UpdateFontSizeType, } from "./utils";
|
|
15
16
|
function parseFontSize(input) {
|
|
16
17
|
const match = input.match(/^(\d+(?:\.\d+)?)(px|pt)$/);
|
|
17
18
|
return match ? [Number(match[1]), match[2]] : null;
|
|
18
19
|
}
|
|
19
20
|
function normalizeToPx(fontSize, unit) {
|
|
20
|
-
return unit ===
|
|
21
|
+
return unit === "pt" ? Math.round((fontSize * 4) / 3) : fontSize;
|
|
21
22
|
}
|
|
22
23
|
function isValidFontSize(fontSizePx) {
|
|
23
24
|
return (fontSizePx >= MIN_ALLOWED_FONT_SIZE && fontSizePx <= MAX_ALLOWED_FONT_SIZE);
|
|
@@ -25,7 +26,7 @@ function isValidFontSize(fontSizePx) {
|
|
|
25
26
|
export function parseFontSizeForToolbar(input) {
|
|
26
27
|
const parsed = parseFontSize(input);
|
|
27
28
|
if (!parsed) {
|
|
28
|
-
return
|
|
29
|
+
return "";
|
|
29
30
|
}
|
|
30
31
|
const [fontSize, unit] = parsed;
|
|
31
32
|
const fontSizePx = normalizeToPx(fontSize, unit);
|
|
@@ -34,11 +35,11 @@ export function parseFontSizeForToolbar(input) {
|
|
|
34
35
|
export function parseAllowedFontSize(input) {
|
|
35
36
|
const parsed = parseFontSize(input);
|
|
36
37
|
if (!parsed) {
|
|
37
|
-
return
|
|
38
|
+
return "";
|
|
38
39
|
}
|
|
39
40
|
const [fontSize, unit] = parsed;
|
|
40
41
|
const fontSizePx = normalizeToPx(fontSize, unit);
|
|
41
|
-
return isValidFontSize(fontSizePx) ? input :
|
|
42
|
+
return isValidFontSize(fontSizePx) ? input : "";
|
|
42
43
|
}
|
|
43
44
|
export default function FontSize({ selectionFontSize, disabled, editor, }) {
|
|
44
45
|
const [inputValue, setInputValue] = React.useState(selectionFontSize);
|
|
@@ -46,23 +47,23 @@ export default function FontSize({ selectionFontSize, disabled, editor, }) {
|
|
|
46
47
|
const [isMouseMode, setIsMouseMode] = React.useState(false);
|
|
47
48
|
const handleKeyPress = (e) => {
|
|
48
49
|
const inputValueNumber = Number(inputValue);
|
|
49
|
-
if (e.key ===
|
|
50
|
+
if (e.key === "Tab") {
|
|
50
51
|
return;
|
|
51
52
|
}
|
|
52
|
-
if ([
|
|
53
|
+
if (["e", "E", "+", "-"].includes(e.key) || isNaN(inputValueNumber)) {
|
|
53
54
|
e.preventDefault();
|
|
54
|
-
setInputValue(
|
|
55
|
+
setInputValue("");
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
58
|
setInputChangeFlag(true);
|
|
58
|
-
if (e.key ===
|
|
59
|
+
if (e.key === "Enter" || e.key === "Escape") {
|
|
59
60
|
e.preventDefault();
|
|
60
61
|
updateFontSizeByInputValue(inputValueNumber, !isMouseMode);
|
|
61
62
|
}
|
|
62
63
|
};
|
|
63
64
|
const handleInputBlur = () => {
|
|
64
65
|
setIsMouseMode(false);
|
|
65
|
-
if (inputValue !==
|
|
66
|
+
if (inputValue !== "" && inputChangeFlag) {
|
|
66
67
|
const inputValueNumber = Number(inputValue);
|
|
67
68
|
updateFontSizeByInputValue(inputValueNumber);
|
|
68
69
|
}
|
|
@@ -79,18 +80,18 @@ export default function FontSize({ selectionFontSize, disabled, editor, }) {
|
|
|
79
80
|
updatedFontSize = MIN_ALLOWED_FONT_SIZE;
|
|
80
81
|
}
|
|
81
82
|
setInputValue(String(updatedFontSize));
|
|
82
|
-
updateFontSizeInSelection(editor, String(updatedFontSize) +
|
|
83
|
+
updateFontSizeInSelection(editor, String(updatedFontSize) + "px", null, skipRefocus);
|
|
83
84
|
setInputChangeFlag(false);
|
|
84
85
|
};
|
|
85
86
|
React.useEffect(() => {
|
|
86
87
|
setInputValue(selectionFontSize);
|
|
87
88
|
}, [selectionFontSize]);
|
|
88
89
|
return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", disabled: disabled ||
|
|
89
|
-
(selectionFontSize !==
|
|
90
|
+
(selectionFontSize !== "" &&
|
|
90
91
|
Number(inputValue) <= MIN_ALLOWED_FONT_SIZE), onClick: (e) => {
|
|
91
92
|
updateFontSize(editor, UpdateFontSizeType.decrement, inputValue, isKeyboardInput(e));
|
|
92
93
|
}, className: "toolbar-item font-decrement", "aria-label": "Decrease font size", title: `Decrease font size (${SHORTCUTS.DECREASE_FONT_SIZE})`, children: _jsx("i", { className: "format minus-icon" }) }), _jsx("input", { type: "number", title: "Font size", value: inputValue, disabled: disabled, className: "toolbar-item font-size-input", min: MIN_ALLOWED_FONT_SIZE, max: MAX_ALLOWED_FONT_SIZE, onChange: (e) => setInputValue(e.target.value), onClick: handleClick, onKeyDown: handleKeyPress, onBlur: handleInputBlur }), _jsx("button", { type: "button", disabled: disabled ||
|
|
93
|
-
(selectionFontSize !==
|
|
94
|
+
(selectionFontSize !== "" &&
|
|
94
95
|
Number(inputValue) >= MAX_ALLOWED_FONT_SIZE), onClick: (e) => {
|
|
95
96
|
updateFontSize(editor, UpdateFontSizeType.increment, inputValue, isKeyboardInput(e));
|
|
96
97
|
}, className: "toolbar-item font-increment", "aria-label": "Increase font size", title: `Increase font size (${SHORTCUTS.INCREASE_FONT_SIZE})`, children: _jsx("i", { className: "format add-icon" }) })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/ToolbarPlugin/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/ToolbarPlugin/index.tsx"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AA0BjC,OAAO,EAkBL,aAAa,EAUd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAoC,MAAM,OAAO,CAAC;AAqenE,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EACpC,MAAM,EACN,YAAY,EACZ,eAAe,EACf,iBAAiB,GAClB,EAAE;IACD,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,EAAE,aAAa,CAAC;IAC5B,eAAe,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;IACzC,iBAAiB,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC;CACtC,GAAG,GAAG,CAAC,OAAO,CA82Bd"}
|