Comments (3)
Hello, I'm getting the same issue, have you been able to fix it?
Trying to use the plugin in a NextJs embebed editor.
from sanity-plugin-markdown.
@pedrobonamin Nope. I've got nothing so far. I've reached out to the Sanity folks on their Slack channel but they've advised me to contact the plugin creators. Hence, here we are.
from sanity-plugin-markdown.
I managed to fix it, following the recommendation from here:
#27
What I did:
- Copied the src folder from this project into my project.
- Updated the MarkdownInput component into this:
export const MarkdownInput = React.forwardRef(
(props: MarkdownInputProps, ref: React.MutableRefObject<any>) => {
const {
value = '',
onChange,
elementProps: { onBlur, onFocus },
reactMdeProps: { options: mdeCustomOptions, ...reactMdeProps } = {},
schemaType,
} = props;
const client = useClient({ apiVersion: '2022-01-01' });
const { imageUrl } =
(schemaType.options as MarkdownOptions | undefined) ?? {};
const imageUpload = useCallback(
(
file: File,
onSuccess: (url: string) => void,
onError: (error: string) => void,
) => {
client.assets
.upload('image', file)
.then((doc) =>
onSuccess(imageUrl ? imageUrl(doc) : `${doc.url}?w=450`),
)
.catch((e) => {
console.error(e);
onError(e.message);
});
},
[client, imageUrl],
);
const mdeOptions: EasyMdeOptions = useMemo(() => {
return {
autofocus: false,
spellChecker: false,
sideBySideFullscreen: false,
uploadImage: true,
imageUploadFunction: imageUpload,
toolbar: defaultMdeTools,
status: false,
...mdeCustomOptions,
};
}, [imageUpload, mdeCustomOptions]);
const handleChange = useCallback(
(newValue: string) => {
onChange(PatchEvent.from(newValue ? set(newValue) : unset()));
},
[onChange],
);
return (
<MarkdownInputStyles focused={props.focused}> // Added some focused styles for this component
<SimpleMdeReact
{...reactMdeProps}
ref={ref}
value={value}
onChange={handleChange}
onBlur={onBlur}
onFocus={onFocus}
options={mdeOptions}
spellCheck={false}
/>
</MarkdownInputStyles>
);
},
);
- Used the plugin from my project instead of the installed one.
from sanity-plugin-markdown.
Related Issues (20)
- Large image overflows the preview container
- Support markdown comment
- Support full page preview
- Sanity V3 Embedding System don't load styles HOT 5
- V3 deploy issue with developer preview 13 and later HOT 13
- Don't add width param to image url, or make it configurable. HOT 2
- Dependency Dashboard
- [3.0.0-v3-studio.3] release seems to be broken
- Expose on paste event api
- Editor jumps to the end when typing HOT 2
- Global CSS cannot be imported from within node_modules on Next.js app HOT 7
- Error: Plugin "markdown@studio-v2" not found
- Does this project work with preview mode
- v3.0.1 full screen causes misplaced layout
- Issue with nextjs + hosted studio HOT 1
- Integration with Cloudinary
- Layout in editor broken HOT 2
- No option to enable spell check HOT 1
- Next 13 crash
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sanity-plugin-markdown.