Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 48 additions & 44 deletions public/handwritten/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// ⚠ Warning: This is just a javascript copy of /src/components/HandwrittenText/utils/handwriteText.ts
// ⚠ Warning: This is just a javascript copy of
// /src/components/HandwrittenText/utils/handwriteText.ts

function handwriteText(options) {
function getElement(elementId) {
Expand Down Expand Up @@ -593,21 +594,20 @@ function handwriteText(options) {
var canvasElement = getElement('canvas');

/*
var styleSelectElement = getElement('select-style');
var biasSliderElement = getElement('bias-slider');
var speedSliderElement = getElement('speed-slider');
var widthSliderElement = getElement('width-slider');
var styleSelectElement = getElement('select-style');
var biasSliderElement = getElement('bias-slider');
var speedSliderElement = getElement('speed-slider');
var widthSliderElement = getElement('width-slider');

widthSliderElement.oninput = () =>
((r) => {
for (; canvasElement.lastChild; ) canvasElement.removeChild(canvasElement.lastChild);
if (K(r) != 0) {
const e = options.width; /*parseFloat(widthSliderElement.value)* /
const a = z(r);
for (let l = 0; l < K(a); l++) (r = a[l]), K(r) < 2 || q(r, t, e);
}
})(tr);
*/
widthSliderElement.oninput = () =>
((r) => {
for (; canvasElement.lastChild; )
canvasElement.removeChild(canvasElement.lastChild); if (K(r) != 0) { const e =
options.width; /*parseFloat(widthSliderElement.value)* / const a = z(r); for
(let l = 0; l < K(a); l++) (r = a[l]), K(r) < 2 || q(r, t, e);
}
})(tr);
*/

let ur;
let fr;
Expand All @@ -624,7 +624,8 @@ function handwriteText(options) {
}, 200);
})();

// --------------------------------------- Press [Write!] button ---------------------------------------
// --------------------------------------- Press [Write!] button
// ---------------------------------------

fetch(ur)
.then((res) => {
Expand Down Expand Up @@ -689,12 +690,13 @@ function handwriteText(options) {
handleWriteClick();

/*
getElement('draw-button').addEventListener('mousedown', handleWriteClick);
getElement('text-input').addEventListener('keydown', (event) => {
return event.keyCode === 13 ? handleWriteClick() : 1;
});
getElement('loading-indicator').remove();
*/
getElement('draw-button').addEventListener('mousedown',
handleWriteClick);
getElement('text-input').addEventListener('keydown', (event) => {
return event.keyCode === 13 ? handleWriteClick() : 1;
});
getElement('loading-indicator').remove();
*/
}
};
return init(), at;
Expand All @@ -703,27 +705,29 @@ function handwriteText(options) {
});

/*
// --------------------------------------- Saving ---------------------------------------
// --------------------------------------- Saving
---------------------------------------

getElement('save-button').addEventListener('click', () => {
const r = getElement('canvas').getBBox();
const width = [hr(r.x - 3), hr(r.y - 3), hr(r.width + 6), hr(r.height + 6)].join(' ');
const svgElement = getElement('canvas');
svgElement.setAttribute('viewBox', width);
const extremeSvg = new XMLSerializer().serializeToString(svgElement);
svgElement.removeAttribute('viewBox');
const popOutActionElement = window.document.createElement('a');
popOutActionElement.setAttribute('href', `data:image/svg+xml;base64,${window.btoa(extremeSvg)}`);
popOutActionElement.setAttribute(
'download',
`${Z.toString()
.toLowerCase()
.replace(/\s+/g, '-')
.replace(/[^\w\-]+/g, '')
.replace(/\-\-+/g, '-')
.trim()}.svg`,
);
popOutActionElement.click();
});
*/
getElement('save-button').addEventListener('click', () => {
const r = getElement('canvas').getBBox();
const width = [hr(r.x - 3), hr(r.y - 3), hr(r.width + 6), hr(r.height +
6)].join(' '); const svgElement = getElement('canvas');
svgElement.setAttribute('viewBox', width);
const extremeSvg = new XMLSerializer().serializeToString(svgElement);
svgElement.removeAttribute('viewBox');
const popOutActionElement = window.document.createElement('a');
popOutActionElement.setAttribute('href',
`data:image/svg+xml;base64,${window.btoa(extremeSvg)}`);
popOutActionElement.setAttribute(
'download',
`${Z.toString()
.toLowerCase()
.replace(/\s+/g, '-')
.replace(/[^\w\-]+/g, '')
.replace(/\-\-+/g, '-')
.trim()}.svg`,
);
popOutActionElement.click();
});
*/
}
5 changes: 3 additions & 2 deletions public/visual-testing/common.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
// TODO: Do not show the Next.js errors in the iframes (they are not relevant in this case)
// TODO: Do not show the Next.js errors in the iframes (they are not relevant in
// this case)
window.document.querySelectorAll('iframe').forEach((iframeElement) => {
function hideNextjsErrors() {
const iframeDocument = iframeElement.contentDocument;
iframeDocument.body.innerHTML =
iframeDocument.body.innerHTML +
`
`
<style>
body{
overflow: auto !important;
Expand Down
4 changes: 2 additions & 2 deletions src/components/AiComponents/AiComponentsRoot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function AiComponentsRoot(props: AiComponentsRootProps) {
if (componentElement.getAttribute('data-ai-activated')) {
continue;
}

const componentType = componentElement.getAttribute('data-ai-component');


Expand All @@ -91,7 +91,7 @@ export function AiComponentsRoot(props: AiComponentsRootProps) {
case '${componentType}':
console.info(\`🌟 Activating \${componentType} component\`, componentElement);
(${
activate.toString() /* <- TODO: Is there some option to:
activate.toString() /* <- TODO: Is there some option to:
- Use non-minified code (disable/bypass minification in just one file/function)
- OR just Put a real name on the function
*/
Expand Down
2 changes: 1 addition & 1 deletion src/components/ExportPreviewModal/ExportPreviewModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export function ExportPreviewModal(props: ExportPreviewModalProps) {
if(isLinked){
continue;
}

const href = linkElement.getAttribute('href');

if(href.startsWith('blob:')){
Expand Down
2 changes: 1 addition & 1 deletion src/components/Hint/Hint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function Hint(props: HintProps) {
};
hintTarget.addEventListener('click', hintTargetClickHandler);

/*
/*
element.addEventListener('mouseenter', () => {
hintContainer.style.opacity = '1';
});
Expand Down
Loading