Skip to content

Commit

Permalink
lets keep this for now
Browse files Browse the repository at this point in the history
  • Loading branch information
asturur committed Aug 20, 2023
1 parent e953530 commit c6f6c57
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
11 changes: 11 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,3 +266,14 @@ exports.createPages = async ({ graphql, actions }) => {
context: { docList },
});
};

exports.onCreateWebpackConfig = ({
stage,
rules,
loaders,
plugins,
actions,
}) => {
// console.log({ plugins, actions, loaders, stage, rules });
console.log(rules.js.toString());
};
3 changes: 1 addition & 2 deletions src/components/CodeEditor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import * as fabric from 'fabric';
import { debounce } from 'lodash';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { Helmet } from 'react-helmet';
import { functionToCodeString } from './utils';

export const CodeEditor = ({ code: codeProp, children, canvasId }) => {
const divRef = useRef();
Expand Down Expand Up @@ -54,7 +53,7 @@ export const CodeEditor = ({ code: codeProp, children, canvasId }) => {
return null;
},
});
const parsedCode = functionToCodeString(codeProp);
const parsedCode = codeProp;

const startState = EditorState.create({
doc: parsedCode,
Expand Down
4 changes: 2 additions & 2 deletions src/content/demo/animating-crosses/code.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function code(canvasEl, fabric) {
export const code = `
const canvas = new fabric.Canvas(canvasEl);
class Cross extends fabric.Object {
Expand Down Expand Up @@ -71,4 +71,4 @@ export function code(canvasEl, fabric) {
canvas.requestRenderAll();
requestAnimationFrame(animate);
});
}
`;
4 changes: 2 additions & 2 deletions src/content/demo/animation-easing/code.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function code(canvasEl, fabric) {
export const code = `
const canvas = new fabric.Canvas(canvasEl);
const rect = new fabric.Rect({
Expand Down Expand Up @@ -28,4 +28,4 @@ export function code(canvasEl, fabric) {
}
);
};
}
`;
4 changes: 2 additions & 2 deletions src/content/demo/clipping/code.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function code(canvasEl, fabric) {
export const code = `
const canvas = new fabric.Canvas(canvasEl);
const demoImg = 'http://fabricjs.com/assets/pug.jpg';
Expand Down Expand Up @@ -40,4 +40,4 @@ export function code(canvasEl, fabric) {
canvas.add(img);
canvas.setActiveObject(img);
});
}
`;
6 changes: 2 additions & 4 deletions src/content/demo/loading-custom-fonts/code.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export function code(canvasEl, fabric) {
export const code = `
const urlMap = {
VT323:
'url(https://fonts.gstatic.com/s/vt323/v17/pxiKyp0ihIEF2isfFJXUdVNF.woff2)',
Expand Down Expand Up @@ -74,6 +74,4 @@ export function code(canvasEl, fabric) {
});
canvas.add(pacifico, vt323, lato100, lato900);
});
}

export const codeString = '';
`;
4 changes: 2 additions & 2 deletions src/content/demo/simple-test/code.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export function code(canvasEl, fabric) {
export const code = `
const canvas = new fabric.Canvas(canvasEl);
const rect = new fabric.Rect({ width: 100, height: 100 });
canvas.add(rect);
}
`;

0 comments on commit c6f6c57

Please sign in to comment.