Skip to content

Conversation

jennspencer
Copy link
Contributor

PR App Fix RM-XYZ

🧰 Changes

embeds and images had a few kinks still, and they've been worked out? mostly? (🤞🏻)

🧬 QA & Testing

echo "${NODE_ENV}" > public/data/build-env && \
npx ts-node ./bin/print-webpack-config.ts > ./build-time-webpack-config.json && \
npm run ui

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hee hee

// url,
// };

// parent.children[index] = mdNode;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kellyjosephprice i commented out some of your image stuff because it was gettin' rull weird with my changes and i figured we could work it out later

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this means 'complexImages' won't render as the image widget in the editor, right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for embeds, I think we need to convert them from JSX to mdast/slate-y type nodes for the editor to pick them up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it works in the editor playground, but i haven't checked in a project yet (doing so now)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you change the playground source to:

<Image align="center" className="border" url="https://drastik.ch/wp-content/uploads/2023/06/blackcat.gif" />

does it load as a widget or as JSX?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the playground, yeah
image

image

but in the dash editor not so much, goddammit

Copy link
Collaborator

@kellyjosephprice kellyjosephprice May 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OH I think it's falling through to here:

const hProperties = attributes(node);
// @ts-ignore
const mdNode: CodeTabs = {
children: node.children as any,
type: types[node.name],
...(['tr', 'td'].includes(node.name)
? {}
: {
data: {
hName: node.name,
...(Object.keys(hProperties).length ? { hProperties } : {}),
},
}),
position: node.position,

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add embeds to this map:

const types = {
Callout: NodeTypes['callout'],
Code: 'code',
CodeTabs: NodeTypes['codeTabs'],
Glossary: NodeTypes['glossary'],
Image: 'image',
Table: 'table',
Variable: NodeTypes['variable'],
td: 'tableCell',
tr: 'tableRow',
};

And then they'll get picked up in the editor?

// url,
// };

// parent.children[index] = mdNode;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this means 'complexImages' won't render as the image widget in the editor, right?

// url,
// };

// parent.children[index] = mdNode;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for embeds, I think we need to convert them from JSX to mdast/slate-y type nodes for the editor to pick them up.

return memo;
}, {} as T);

export const isMDXElement = (node: Node): node is MdxJsxFlowElement | MdxJsxTextElement => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼 👍🏼

Copy link
Collaborator

@kellyjosephprice kellyjosephprice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still reviewing, but the only thing I'm seeing in the app is that the compilers aren't adding newlines?

@jennspencer
Copy link
Contributor Author

this still needs some cleanup, but i'd like to get this merged ASAP for QA purposes!

Copy link
Collaborator

@kellyjosephprice kellyjosephprice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me.

@@ -1,6 +1,6 @@
import { mdast } from '../index';

describe.skip('Parse html block', () => {
describe('Parse html block', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@@ -1,12 +1,12 @@
export enum NodeTypes {
callout = 'rdme-callout',
codeTabs = 'code-tabs',
embed = 'embed',
embedBlock = 'embed-block',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a regular embed block still?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh, no. i changed the structure enough that the serializing/deserializing was getting to be spaghetti with the current/old embed block, so i just moved it all wholesale to a new block/block type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it also allows me more freedom to dial in the new image and embed blocks, haha

@jennspencer jennspencer merged commit 67e0fec into beta Jun 12, 2024
@jennspencer jennspencer deleted the fix/embeds-images branch June 12, 2024 18:18
rafegoldberg pushed a commit that referenced this pull request Jun 12, 2024
## Version 6.75.0-beta.53

### 🛠 Fixes & Updates

* embeds and images save better ([#893](#893)) ([67e0fec](67e0fec))

<!--SKIP CI-->
@rafegoldberg
Copy link
Contributor

This PR was released!

🚀 Changes included in v6.75.0-beta.53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants