Skip to content

Commit

Permalink
Image size saving fix (#377)
Browse files Browse the repository at this point in the history
* Update ImageBlock.ts

* Update index.ts

* Update image styling

Update the image styling to not show the image containers background.
  • Loading branch information
Bowens20832 committed Feb 28, 2024
1 parent f942946 commit 5dd2b37
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,17 @@ export const ImageBlock = Image.extend({
},

renderHTML({ HTMLAttributes }) {
return ['img', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)]
return [
'div',
{class: "my-8 shadow-xl rounded-xl"},
[
'img',
{
class: "rounded-xl",
...HTMLAttributes
}
]
]
},

addCommands() {
Expand Down
7 changes: 6 additions & 1 deletion source/elegant/src/pages/api/admin/images/[slug]/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ export default async function handler(
const response = await fetch(
`https://raw.githubusercontent.com/${REPO_OWNER}/${REPO_SLUG}/${REPO_BRANCH}/${
MONOREPO_PATH ? MONOREPO_PATH + '/' : ''
}public/images/${req.query?.slug}`
}public/images/${req.query?.slug}`,
{
headers: {
authorization: `token ${session.access_token}`
}
}
);

if (response.status === 200 && response.body) {
Expand Down
2 changes: 1 addition & 1 deletion source/elegant/src/utils/Hooks/useEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const useEditor = ({ ...rhfMethods }) => {
renderHTML({ HTMLAttributes }) {
return [
'div',
{class: "my-8 shadow-xl"},
{class: "my-8 shadow-xl rounded-xl"},
[
'img',
{
Expand Down

0 comments on commit 5dd2b37

Please sign in to comment.