Skip to content

Commit

Permalink
chore: cleanup code. remove commented out code. restore codeblock. re…
Browse files Browse the repository at this point in the history
…move empty code element
  • Loading branch information
roadlittledawn committed Dec 7, 2021
1 parent f4b824c commit 6b52866
Showing 1 changed file with 8 additions and 58 deletions.
66 changes: 8 additions & 58 deletions scripts/actions/utils/handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,15 @@ const { omit } = require('lodash');
// const all = require('hast-util-to-mdast/lib/all');

module.exports = {
// CodeBlock: {
// serialize: (h, node) =>
// h(
// node,
// 'pre',
// {
// 'data-type': 'component',
// 'data-component': 'CodeBlock',
// 'data-props': serializeJSValue(omit(node, ['type'])),
// },
// [h(node, 'code')]
// ),
// deserialize: (h, node) =>
// h(node, 'code', deserializeJSValue(node.properties.dataProps)),
// },
CodeBlock: {
serialize: (h, node) => {
// console.log('start:', node);
return h(
node,
'pre',
{
'data-type': 'component',
'data-component': 'CodeBlock',
'data-props': serializeJSValue(omit(node, ['type'])),
},
[h(node, 'code')]
);
},
deserialize: (h, node) => {
const results = h(
node,
'code',
deserializeJSValue(node.properties.dataProps)
);
// console.log('end:', results);
return results;
},
serialize: (h, node) =>
h(node, 'pre', {
'data-type': 'component',
'data-component': 'CodeBlock',
'data-props': serializeJSValue(omit(node, ['type'])),
}),
deserialize: (h, node) =>
h(node, 'code', deserializeJSValue(node.properties.dataProps)),
},
import: {
deserialize: (h, node) => {
Expand Down Expand Up @@ -135,23 +106,6 @@ module.exports = {
},
DoNotTranslate: {
deserialize: deserializeComponent,
// deserialize: (h, node) => {
// console.dir(node, { depth: null });
// return h(
// node,
// node.properties.dataTag,
// deserializeJSValue(node.properties.dataProps)
// );
// },
// serialize: (h, node) => {
// const inferredTagName = node.type === 'mdxSpanElement' ? 'span' : 'div';
// return h(node, inferredTagName, {
// 'data-type': 'component',
// 'data-component': 'DoNotTranslate',
// 'data-tag': inferredTagName,
// 'data-props': serializeJSValue(omit(node, ['type'])),
// });
// },
serialize: (h, node) =>
serializeComponent(h, node, {
classNames: 'notranslate',
Expand Down Expand Up @@ -328,8 +282,4 @@ module.exports = {
deserialize: deserializeComponent,
serialize: serializeComponent,
},
span: {
deserialize: deserializeComponent,
serialize: serializeComponent,
},
};

0 comments on commit 6b52866

Please sign in to comment.