@mdxeditor/editor 0.15.2 → 0.17.0
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/MDXEditor.d.ts +5 -0
- package/dist/MDXEditor.js +8 -2
- package/dist/gurx/react.js +1 -1
- package/dist/index.js +2 -1
- package/dist/plugins/codeblock/index.d.ts +12 -2
- package/dist/plugins/codemirror/CodeMirrorEditor.js +6 -3
- package/dist/plugins/codemirror/index.d.ts +16 -2
- package/dist/plugins/core/index.d.ts +11 -2
- package/dist/plugins/core/index.js +12 -4
- package/dist/plugins/diff-source/SourceEditor.js +2 -1
- package/dist/plugins/diff-source/index.d.ts +12 -2
- package/dist/plugins/directives/index.d.ts +12 -2
- package/dist/plugins/frontmatter/FrontmatterEditor.js +4 -1
- package/dist/plugins/frontmatter/index.d.ts +12 -2
- package/dist/plugins/headings/index.d.ts +348 -3
- package/dist/plugins/headings/index.js +22 -10
- package/dist/plugins/image/index.d.ts +12 -2
- package/dist/plugins/jsx/index.d.ts +12 -2
- package/dist/plugins/link/index.d.ts +1 -0
- package/dist/plugins/link-dialog/index.d.ts +10 -2
- package/dist/plugins/lists/index.d.ts +12 -2
- package/dist/plugins/markdown-shortcut/index.d.ts +2 -1
- package/dist/plugins/markdown-shortcut/index.js +35 -3
- package/dist/plugins/quote/index.d.ts +9 -2
- package/dist/plugins/sandpack/SandpackEditor.js +3 -1
- package/dist/plugins/sandpack/index.d.ts +16 -2
- package/dist/plugins/table/index.d.ts +12 -2
- package/dist/plugins/thematic-break/index.d.ts +12 -2
- package/dist/plugins/toolbar/components/BlockTypeSelect.js +3 -1
- package/dist/plugins/toolbar/components/DiffSourceToggleWrapper.js +1 -1
- package/dist/plugins/toolbar/index.d.ts +10 -2
- package/dist/plugins/toolbar/index.js +3 -2
- package/dist/plugins/toolbar/primitives/DialogButton.js +2 -2
- package/dist/plugins/toolbar/primitives/select.js +14 -2
- package/dist/plugins/toolbar/primitives/toolbar.d.ts +4 -1
- package/dist/plugins/toolbar/primitives/toolbar.js +12 -8
- package/dist/style.css +211 -169
- package/dist/styles/ui.module.css.js +88 -85
- package/package.json +1 -1
|
@@ -11,7 +11,18 @@ const SelectItem = React__default.forwardRef(
|
|
|
11
11
|
}
|
|
12
12
|
);
|
|
13
13
|
const SelectTrigger = ({ title, placeholder, className }) => {
|
|
14
|
-
|
|
14
|
+
const [readOnly] = corePluginHooks.useEmitterValues("readOnly");
|
|
15
|
+
return /* @__PURE__ */ React__default.createElement(TooltipWrap, { title }, /* @__PURE__ */ React__default.createElement(
|
|
16
|
+
RadixSelect.Trigger,
|
|
17
|
+
{
|
|
18
|
+
"aria-label": placeholder,
|
|
19
|
+
className: classNames(styles.selectTrigger, className),
|
|
20
|
+
"data-toolbar-item": true,
|
|
21
|
+
disabled: readOnly
|
|
22
|
+
},
|
|
23
|
+
/* @__PURE__ */ React__default.createElement(RadixSelect.Value, { placeholder }),
|
|
24
|
+
/* @__PURE__ */ React__default.createElement(RadixSelect.Icon, { className: styles.selectDropdownArrow }, /* @__PURE__ */ React__default.createElement(DropDownIcon, null))
|
|
25
|
+
));
|
|
15
26
|
};
|
|
16
27
|
const SelectContent = ({
|
|
17
28
|
children,
|
|
@@ -25,7 +36,8 @@ const SelectButtonTrigger = ({
|
|
|
25
36
|
title,
|
|
26
37
|
className
|
|
27
38
|
}) => {
|
|
28
|
-
|
|
39
|
+
const [readOnly] = corePluginHooks.useEmitterValues("readOnly");
|
|
40
|
+
return /* @__PURE__ */ React__default.createElement(TooltipWrap, { title }, /* @__PURE__ */ React__default.createElement(RadixSelect.Trigger, { className: classNames(styles.toolbarButtonSelectTrigger, className), disabled: readOnly }, children, /* @__PURE__ */ React__default.createElement(RadixSelect.Icon, { className: styles.selectDropdownArrow }, /* @__PURE__ */ React__default.createElement(DropDownIcon, null))));
|
|
29
41
|
};
|
|
30
42
|
const Select = (props) => {
|
|
31
43
|
return /* @__PURE__ */ React__default.createElement(RadixSelect.Root, { value: props.value || void 0, onValueChange: props.onChange }, /* @__PURE__ */ React__default.createElement(SelectTrigger, { title: props.triggerTitle, placeholder: props.placeholder }), /* @__PURE__ */ React__default.createElement(SelectContent, null, props.items.map((item, index) => {
|
|
@@ -4,7 +4,10 @@ import { EditorInFocus } from '../../core';
|
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
*/
|
|
7
|
-
export declare const Root:
|
|
7
|
+
export declare const Root: React.FC<{
|
|
8
|
+
readOnly: boolean;
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}>;
|
|
8
11
|
/**
|
|
9
12
|
* A toolbar button primitive.
|
|
10
13
|
*/
|
|
@@ -6,12 +6,6 @@ import styles from "../../../styles/ui.module.css.js";
|
|
|
6
6
|
import { TooltipWrap } from "./TooltipWrap.js";
|
|
7
7
|
import { SelectButtonTrigger, SelectContent, SelectItem } from "./select.js";
|
|
8
8
|
import { corePluginHooks } from "../../core/index.js";
|
|
9
|
-
function decorate(Component, decoratedProps) {
|
|
10
|
-
return (props) => {
|
|
11
|
-
const className = classNames(decoratedProps.className, props.className);
|
|
12
|
-
return /* @__PURE__ */ React__default.createElement(Component, { ...decoratedProps, ...props, className });
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
9
|
function decorateWithRef(Component, decoratedProps) {
|
|
16
10
|
return React__default.forwardRef((props, ref) => {
|
|
17
11
|
const className = classNames(decoratedProps.className, props.className);
|
|
@@ -23,7 +17,16 @@ function addTooltipToChildren(Component) {
|
|
|
23
17
|
return /* @__PURE__ */ React__default.createElement(Component, { ...props }, /* @__PURE__ */ React__default.createElement(TooltipWrap, { title }, children));
|
|
24
18
|
};
|
|
25
19
|
}
|
|
26
|
-
const Root =
|
|
20
|
+
const Root = ({ readOnly, children }) => {
|
|
21
|
+
return /* @__PURE__ */ React__default.createElement(
|
|
22
|
+
RadixToolbar.Root,
|
|
23
|
+
{
|
|
24
|
+
className: classNames(styles.toolbarRoot, { [styles.readOnlyToolbarRoot]: readOnly }),
|
|
25
|
+
...readOnly ? { tabIndex: -1 } : {}
|
|
26
|
+
},
|
|
27
|
+
children
|
|
28
|
+
);
|
|
29
|
+
};
|
|
27
30
|
const Button = decorateWithRef(RadixToolbar.Button, { className: styles.toolbarButton, "data-toolbar-item": true });
|
|
28
31
|
const ButtonWithTooltip = addTooltipToChildren(Button);
|
|
29
32
|
const ToolbarToggleItem = decorateWithRef(RadixToolbar.ToggleItem, {
|
|
@@ -74,7 +77,8 @@ const SingleChoiceToggleGroup = ({ value, onChange, className, items }) => {
|
|
|
74
77
|
));
|
|
75
78
|
};
|
|
76
79
|
const ButtonOrDropdownButton = (props) => {
|
|
77
|
-
|
|
80
|
+
const [readOnly] = corePluginHooks.useEmitterValues("readOnly");
|
|
81
|
+
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, props.items.length === 1 ? /* @__PURE__ */ React__default.createElement(ButtonWithTooltip, { title: props.title, onClick: () => props.onChoose(""), disabled: readOnly }, props.children) : /* @__PURE__ */ React__default.createElement(RadixSelect.Root, { value: "", onValueChange: props.onChoose }, /* @__PURE__ */ React__default.createElement(SelectButtonTrigger, { title: props.title }, props.children), /* @__PURE__ */ React__default.createElement(SelectContent, { className: styles.toolbarButtonDropdownContainer }, props.items.map((item, index) => /* @__PURE__ */ React__default.createElement(SelectItem, { key: index, value: item.value }, item.label)))));
|
|
78
82
|
};
|
|
79
83
|
function isConditionalContentsOption(option) {
|
|
80
84
|
return Object.hasOwn(option, "when");
|