-
-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MDXEditor v2 is here! Here's how you can upgrade #275
Comments
Thanks for the update! I think the docs need some update, e.g. the docs for directives: My solution now is this: import {
insertDirective$,
usePublisher
} from '@mdxeditor/editor';
const MyComponent = () => {
const insertDirective = usePublisher(insertDirective$)
...
} |
@Haschtl - thanks! pushed a commit that fixes the docs. The plugin specific hooks are no longer necessary, you can just use the gurx ones. |
really nice work! Excited to play with the plugins at some point, just a basic user for now |
FYI, for anyone that is attempting to run unit tests locally via Vitest, I had to make this adjustment in my export default defineConfig({
plugins: [react()],
test: {
...
server: {
deps: {
inline: ["@mdxeditor/editor", "@mdxeditor/gurx"],
},
},
},
}); |
Where can I find the |
It's called useCellValues. |
Specifically asking because I am disabling the underline keyboard shortcut in my editor. How can I access const BoldItalicToggles = () => {
const [theLexicalEditor] = useCellValues('rootEditor');
useEffect(
() =>
theLexicalEditor?.registerCommand(
FORMAT_TEXT_COMMAND,
(payload) => {
if (payload === 'underline') {
return true;
}
return false;
},
COMMAND_PRIORITY_CRITICAL,
),
[theLexicalEditor],
);
return (
<>
<UndoRedo />
<BoldItalicUnderlineToggles />
</>
);
}; |
The new hooks accept cell and signal references instead of strings. In your case, you can import There's also the singular variant, which is a bit faster - |
@petyosi I'm using Next.js with pages router, on GH Actions when trying to build the app I get the following errors: |
Sorry, none of that looks familiar. Can you replicate in a sandbox? |
MDXEditor has a new major version with several breaking changes and dependency upgrades. The public API has not changed much, though - unless you have written custom plugins, you might not be affected by it.
If you're upgrading from v1, read the upgrade summary in the docs, and if something does not work, post a comment here with a runnable reproduction.
The text was updated successfully, but these errors were encountered: