@mdxeditor/editor 3.32.0 → 3.32.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/dist/index.d.ts
CHANGED
|
@@ -1387,15 +1387,7 @@ export declare class ImageNode extends DecoratorNode<JSX.Element> {
|
|
|
1387
1387
|
* Holds the image placeholder.
|
|
1388
1388
|
* @group Image
|
|
1389
1389
|
*/
|
|
1390
|
-
export declare const imagePlaceholder$: NodeRef<
|
|
1391
|
-
|
|
1392
|
-
declare function ImagePlaceholder(): JSX.Element {
|
|
1393
|
-
return (
|
|
1394
|
-
<div className={styles.imagePlaceholder}>
|
|
1395
|
-
<ImageIcon />
|
|
1396
|
-
</div>
|
|
1397
|
-
)
|
|
1398
|
-
}
|
|
1390
|
+
export declare const imagePlaceholder$: NodeRef< FC<{}> | null>;
|
|
1399
1391
|
|
|
1400
1392
|
/**
|
|
1401
1393
|
* A plugin that adds support for images.
|
|
@@ -3,7 +3,6 @@ import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext
|
|
|
3
3
|
import { useLexicalNodeSelection } from "@lexical/react/useLexicalNodeSelection";
|
|
4
4
|
import { mergeRegister } from "@lexical/utils";
|
|
5
5
|
import { useCellValues } from "@mdxeditor/gurx";
|
|
6
|
-
import { ImageIcon } from "@radix-ui/react-icons";
|
|
7
6
|
import classNames from "classnames";
|
|
8
7
|
import { $isNodeSelection, $getSelection, $getNodeByKey, $setSelection, SELECTION_CHANGE_COMMAND, COMMAND_PRIORITY_LOW, CLICK_COMMAND, DRAGSTART_COMMAND, KEY_DELETE_COMMAND, KEY_BACKSPACE_COMMAND, KEY_ENTER_COMMAND, KEY_ESCAPE_COMMAND } from "lexical";
|
|
9
8
|
import { imagePlaceholder$, disableImageResize$, imagePreviewHandler$, editImageToolbarComponent$ } from "./index.js";
|
|
@@ -242,10 +241,6 @@ function ImageEditor({ src, title, alt, nodeKey, width, height, rest }) {
|
|
|
242
241
|
}
|
|
243
242
|
))) : null;
|
|
244
243
|
}
|
|
245
|
-
function ImagePlaceholder() {
|
|
246
|
-
return /* @__PURE__ */ React__default.createElement("div", { className: styles.imagePlaceholder }, /* @__PURE__ */ React__default.createElement(ImageIcon, null));
|
|
247
|
-
}
|
|
248
244
|
export {
|
|
249
|
-
ImageEditor
|
|
250
|
-
ImagePlaceholder
|
|
245
|
+
ImageEditor
|
|
251
246
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React__default from "react";
|
|
2
|
+
import { ImageIcon } from "@radix-ui/react-icons";
|
|
3
|
+
import styles from "../../styles/ui.module.css.js";
|
|
4
|
+
const ImagePlaceholder = () => {
|
|
5
|
+
return /* @__PURE__ */ React__default.createElement("div", { className: styles.imagePlaceholder }, /* @__PURE__ */ React__default.createElement(ImageIcon, null));
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
ImagePlaceholder
|
|
9
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ImagePlaceholder } from "./
|
|
1
|
+
import { ImagePlaceholder } from "./ImagePlaceholder.js";
|
|
2
2
|
import { mergeRegister, $wrapNodeInElement } from "@lexical/utils";
|
|
3
3
|
import { Signal, Cell, Action, withLatestFrom, mapTo, map } from "@mdxeditor/gurx";
|
|
4
4
|
import { createCommand, $getNodeByKey, $insertNodes, $isRootOrShadowRoot, $createParagraphNode, COMMAND_PRIORITY_EDITOR, DRAGSTART_COMMAND, COMMAND_PRIORITY_HIGH, DRAGOVER_COMMAND, COMMAND_PRIORITY_LOW, DROP_COMMAND, PASTE_COMMAND, COMMAND_PRIORITY_CRITICAL, $createRangeSelection, $setSelection, $getSelection, $isNodeSelection } from "lexical";
|
|
@@ -31,10 +31,15 @@ const THEMATIC_BREAK = {
|
|
|
31
31
|
export: (node) => {
|
|
32
32
|
return $isHorizontalRuleNode(node) ? "***" : null;
|
|
33
33
|
},
|
|
34
|
-
regExp: /^(---|\*\*\*|___)
|
|
35
|
-
replace: (parentNode) => {
|
|
36
|
-
const
|
|
37
|
-
parentNode.
|
|
34
|
+
regExp: /^(---|\*\*\*|___)\s?$/,
|
|
35
|
+
replace: (parentNode, _1, _2, isImport) => {
|
|
36
|
+
const line = $createHorizontalRuleNode();
|
|
37
|
+
if (isImport || parentNode.getNextSibling() != null) {
|
|
38
|
+
parentNode.replace(line);
|
|
39
|
+
} else {
|
|
40
|
+
parentNode.insertBefore(line);
|
|
41
|
+
}
|
|
42
|
+
line.selectNext();
|
|
38
43
|
},
|
|
39
44
|
type: "element"
|
|
40
45
|
};
|