How to use the @brainly/html-sketchapp.nodeTreeToSketchPage function in @brainly/html-sketchapp

To help you get started, we’ve selected a few @brainly/html-sketchapp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github meetalva / alva / src / preview / preview.tsx View on Github external
JSON.stringify({
						type: PreviewMessageType.ContentResponse,
						id,
						payload: {
							document: new XMLSerializer().serializeToString(document),
							location: window.location.href,
							height: rec.height,
							width: rec.width
						}
					})
				);

				break;
			}
			case PreviewMessageType.SketchExportRequest: {
				const sketchPage = HtmlSketchApp.nodeTreeToSketchPage(document.documentElement, {
					pageName: payload.pageName,
					addArtboard: true,
					artboardName: payload.artboardName,
					getGroupName: node =>
						node.getAttribute('data-sketch-name') || `(${node.nodeName.toLowerCase()})`,
					getRectangleName: () => 'background',
					skipSystemFonts: true
				});

				const page = sketchPage.toJSON();

				connection.send(
					JSON.stringify({
						type: PreviewMessageType.SketchExportResponse,
						id,
						payload: { page }
github html-sketchapp / html-sketchapp-example / src / page2layers.js View on Github external
export function run(mainNode = document.body) {
  const page = nodeTreeToSketchPage(mainNode);

  page.setName(document.title);
  return page.toJSON();
}