Skip to content

Commit

Permalink
Restore base64 fixes lost during rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonpayton committed Jul 17, 2024
1 parent 6a75734 commit 9bc1c4c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
transpilePluginFiles,
} from './transpile-plugin-files';
import { __, _x, sprintf } from '../../i18n';
import { base64EncodeBlockAttributes } from '../../base64';
import { base64EncodeBlockAttributes, stringToBase64 } from '../../base64';

export type PlaygroundDemoProps = Attributes & {
inBlockEditor: boolean;
Expand Down Expand Up @@ -299,7 +299,7 @@ export default function PlaygroundPreview({
files: files.filter((f) => !isErrorLogFile(f)),
};

const encodedFullPageAttributes = btoa(
const encodedFullPageAttributes = stringToBase64(
JSON.stringify(base64EncodeBlockAttributes(fullPageAttributes))
);
fullPageUrl.searchParams.append(
Expand Down
4 changes: 2 additions & 2 deletions packages/wordpress-playground-block/src/view.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { createRoot } from '@wordpress/element';
import PlaygroundPreview from './components/playground-preview';
import { base64DecodeBlockAttributes } from './base64';
import { base64DecodeBlockAttributes, base64ToString } from './base64';

function renderPlaygroundPreview() {
const playgroundDemo = Array.from(
Expand All @@ -18,7 +18,7 @@ function renderPlaygroundPreview() {
const encodedAttributes = urlParams.get(
'playground-attributes'
) as string;
const attributeJson = atob(encodedAttributes);
const attributeJson = base64ToString(encodedAttributes);
const attributes = base64DecodeBlockAttributes(
JSON.parse(attributeJson)
) as any;
Expand Down

0 comments on commit 9bc1c4c

Please sign in to comment.