Skip to content

Instantly share code, notes, and snippets.

funtion WidthField({ label, describing }) {
// Not sure about `describing`, but wanted some way to associate what the whole field is related to
return (
<Fieldset>
<Legend><VisuallyHidden>{describing}</VisuallyHidden> {label}</Legend>
<RadioButtonGroup>
<VisuallyHidden><Label> type (?)</Label></VisuallyHidden>
</RadioButtonGroup>
html = <<~HTML
{% assign message = "hello" %}
<div>
{% product 123 %}
<div>{{ product.title }}</div>
{% endproduct %}
{% product 456 %}
Liquid works inside these blocks
<div>{{ message }}</div>
// option 1
{% product 123 %}
<div>
<h2>{% product.title %}</h2>
</div>
{% endproduct %}
// option 2
<div>
import { useEffect } from "react"
import { confirm } from "../modals"
const hrefBlank = element => {
const href = element.getAttribute("href")
return !href || href === "#"
}
function useBeforeLeave({
message = "",
version: 2
jobs:
build:
docker:
- image: cypress/base:8
working_directory: ~/repo
resource_class: large
steps:
- checkout
- restore_cache:
import { html } from "../../packages/editor/src/utils/htm";
context("Captions", () => {
beforeEach(() => {
cy.visit("http://localhost:3000/");
});
it("should show if the image is focused", () => {
cy.setEditorValue(html`
<value>
import { html } from "../../packages/editor/src/utils/htm";
context("Captions", () => {
beforeEach(() => {
cy.visit("http://localhost:3000/");
});
it("should show if the image is focused", () => {
cy.setEditorValue(html`
<value>
import { html } from "../../packages/editor/src/utils/htm";
context("Focusing on placeholder", () => {
beforeEach(() => {
cy.visit("http://localhost:3000/");
});
// We had a bug where trying to change the first line in an empty editor to
// a heading would crash the editor. This is because Slate was trying to
// resolve the selection before the editor has focus. See `change-block`
@brendancarney
brendancarney / slate-captions.js
Created May 13, 2019 20:31
slate-captions.js
import React from "react";
import { Block, Text } from "slate";
export function createCaptioned({ type, caption, data }) {
const block =
typeof caption === "string"
? Block.create({ type: "caption", nodes: [Text.create(caption)] })
: caption;
const captioned = Block.create({