@mdxeditor/editor 3.13.0 → 3.15.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/index.d.ts
CHANGED
|
@@ -2662,6 +2662,8 @@ export declare type ToMarkdownExtension = NonNullable<ToMarkdownOptions['extensi
|
|
|
2662
2662
|
/* Excluded from this release type: toMarkdownOptions$ */
|
|
2663
2663
|
export { ToMarkdownOptions }
|
|
2664
2664
|
|
|
2665
|
+
export declare const toolbarClassName$: NodeRef<string>;
|
|
2666
|
+
|
|
2665
2667
|
/**
|
|
2666
2668
|
* The factory function that returns the contents of the toolbar.
|
|
2667
2669
|
* @group Toolbar
|
|
@@ -2674,6 +2676,7 @@ export declare const toolbarContents$: NodeRef<() => default_2.ReactNode>;
|
|
|
2674
2676
|
*/
|
|
2675
2677
|
export declare const toolbarPlugin: (params?: {
|
|
2676
2678
|
toolbarContents: () => default_2.ReactNode;
|
|
2679
|
+
toolbarClassName?: string | undefined;
|
|
2677
2680
|
} | undefined) => RealmPlugin;
|
|
2678
2681
|
|
|
2679
2682
|
/* Excluded from this release type: ToolbarToggleItem */
|
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ import { directivesPlugin, insertDirective$ } from "./plugins/directives/index.j
|
|
|
24
24
|
import { ADMONITION_TYPES, AdmonitionDirectiveDescriptor } from "./directive-editors/AdmonitionDirectiveDescriptor.js";
|
|
25
25
|
import { GenericDirectiveEditor } from "./directive-editors/GenericDirectiveEditor.js";
|
|
26
26
|
import { applyLinkChanges$, cancelLinkEdit$, linkAutocompleteSuggestions$, linkDialogPlugin, linkDialogState$, onClickLinkCallback$, onWindowChange$, openLinkEditDialog$, removeLink$, switchFromPreviewToLinkEdit$, updateLink$ } from "./plugins/link-dialog/index.js";
|
|
27
|
-
import { toolbarContents$, toolbarPlugin } from "./plugins/toolbar/index.js";
|
|
27
|
+
import { toolbarClassName$, toolbarContents$, toolbarPlugin } from "./plugins/toolbar/index.js";
|
|
28
28
|
import { cmExtensions$, diffMarkdown$, diffSourcePlugin, readOnlyDiff$ } from "./plugins/diff-source/index.js";
|
|
29
29
|
import { markdownShortcutPlugin } from "./plugins/markdown-shortcut/index.js";
|
|
30
30
|
import { BlockTypeSelect } from "./plugins/toolbar/components/BlockTypeSelect.js";
|
|
@@ -293,6 +293,7 @@ export {
|
|
|
293
293
|
thrush,
|
|
294
294
|
toMarkdownExtensions$,
|
|
295
295
|
toMarkdownOptions$,
|
|
296
|
+
toolbarClassName$,
|
|
296
297
|
toolbarContents$,
|
|
297
298
|
toolbarPlugin,
|
|
298
299
|
topAreaChildren$,
|
|
@@ -4,6 +4,7 @@ import React__default from "react";
|
|
|
4
4
|
import { addTopAreaChild$, readOnly$ } from "../core/index.js";
|
|
5
5
|
import { Root } from "./primitives/toolbar.js";
|
|
6
6
|
const toolbarContents$ = Cell(() => null);
|
|
7
|
+
const toolbarClassName$ = Cell("");
|
|
7
8
|
const DEFAULT_TOOLBAR_CONTENTS = () => {
|
|
8
9
|
return "This is an empty toolbar. Pass `{toolbarContents: () => { return <>toolbar components</> }}` to the toolbarPlugin to customize it.";
|
|
9
10
|
};
|
|
@@ -11,17 +12,20 @@ const toolbarPlugin = realmPlugin({
|
|
|
11
12
|
init(realm, params) {
|
|
12
13
|
realm.pubIn({
|
|
13
14
|
[toolbarContents$]: (params == null ? void 0 : params.toolbarContents) ?? DEFAULT_TOOLBAR_CONTENTS,
|
|
15
|
+
[toolbarClassName$]: (params == null ? void 0 : params.toolbarClassName) ?? "",
|
|
14
16
|
[addTopAreaChild$]: () => {
|
|
15
|
-
const [toolbarContents, readOnly] = useCellValues(toolbarContents$, readOnly$);
|
|
16
|
-
return /* @__PURE__ */ React__default.createElement(Root, { readOnly }, toolbarContents());
|
|
17
|
+
const [toolbarContents, readOnly, toolbarClassName] = useCellValues(toolbarContents$, readOnly$, toolbarClassName$);
|
|
18
|
+
return /* @__PURE__ */ React__default.createElement(Root, { className: toolbarClassName, readOnly }, toolbarContents());
|
|
17
19
|
}
|
|
18
20
|
});
|
|
19
21
|
},
|
|
20
22
|
update(realm, params) {
|
|
21
23
|
realm.pub(toolbarContents$, (params == null ? void 0 : params.toolbarContents) ?? DEFAULT_TOOLBAR_CONTENTS);
|
|
24
|
+
realm.pub(toolbarClassName$, (params == null ? void 0 : params.toolbarClassName) ?? "");
|
|
22
25
|
}
|
|
23
26
|
});
|
|
24
27
|
export {
|
|
28
|
+
toolbarClassName$,
|
|
25
29
|
toolbarContents$,
|
|
26
30
|
toolbarPlugin
|
|
27
31
|
};
|
|
@@ -18,11 +18,11 @@ function addTooltipToChildren(Component) {
|
|
|
18
18
|
return /* @__PURE__ */ React__default.createElement(Component, { ...props }, /* @__PURE__ */ React__default.createElement(TooltipWrap, { title }, children));
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
const Root = ({ readOnly, children }) => {
|
|
21
|
+
const Root = ({ readOnly, children, className }) => {
|
|
22
22
|
return /* @__PURE__ */ React__default.createElement(
|
|
23
23
|
RadixToolbar.Root,
|
|
24
24
|
{
|
|
25
|
-
className: classNames("mdxeditor-toolbar", styles.toolbarRoot, { [styles.readOnlyToolbarRoot]: readOnly }),
|
|
25
|
+
className: classNames("mdxeditor-toolbar", styles.toolbarRoot, { [styles.readOnlyToolbarRoot]: readOnly }, className),
|
|
26
26
|
...readOnly ? { tabIndex: -1 } : {}
|
|
27
27
|
},
|
|
28
28
|
children
|