test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fix for `cmd-r` when the cursor is on or in-between | |
// `<span style="display: inline-block" />` and a text | |
// node. This behavior depends on `traverseDOM`’s | |
// `findNode` resolving to the sibling text node. | |
const [isCmdArrowR, newAnchorNode] = detectIsCmdArrowR(e, props.state) | |
if (isCmdArrowR) { | |
e.preventDefault() | |
console.log("test") | |
const selection = document.getSelection() | |
const range = document.createRange() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import PropTypes from "prop-types" | |
import useMethods from "use-methods" | |
import { Title } from "./Title" | |
// `isBreakNode` checks whether a node is `<br />` OR | |
// `<span><br /></span>`. | |
function isBreakNode(node) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function utility(value) { | |
// .. | |
return value | |
} | |
const methods = (state) => { | |
a() { | |
// .. | |
}, | |
b(value) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
html { -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; text-size-adjust: 100%; } | |
* { all: unset; } | |
head, style, script { display: none; } | |
html { box-sizing: border-box; } | |
*, *:before, *:after { box-sizing: inherit; } | |
[contenteditable="true"] { -webkit-user-modify: read-write; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See github.com/google/closure-library/blob/master/closure/goog/color/color.js#L164 | |
// for reference. | |
function hexToRgb(hexColor) { | |
// hexColor = goog.color.normalizeHex(hexColor); | |
var rgb = parseInt(hexColor.substr(1), 16); | |
var r = rgb >> 16; | |
var g = (rgb >> 8) & 255; | |
var b = rgb & 255; | |
return [r, g, b]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.debug h1, | |
.debug h2, | |
.debug p, | |
.debug blockquote { | |
margin-bottom: -1px !important; | |
background-image: | |
linear-gradient( | |
#B3E5FCFF 0.5px, | |
#B3E5FC00 0.5px, | |
#B3E5FC00 calc(var(--lh) * 0.5em - 0.25px), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function InterDynamicTracking(fontSize) { | |
var a = -0.0223, b = 0.185, c = -0.1745; | |
// tracking = a + b * e ^ (c * fontSize) | |
return a + b * Math.pow(Math.E, c * fontSize) | |
} | |
// See rsms.me/inter/dynmetrics for reference. | |
const A = -0.0223 // Don’t change. | |
const B = 0.185 // Don’t change. | |
const C = -0.1745 // Don’t change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Whitespace regexes based on Perl. | |
// | |
// See `perldoc perlrecharclass` for reference. | |
const reH = /[\u{0009}|\u{0020}|\u{00a0}|\u{1680}|\u{180e}|\u{2000}|\u{2001}|\u{2002}|\u{2003}|\u{2004}|\u{2005}|\u{2006}|\u{2007}|\u{2008}|\u{2009}|\u{200a}|\u{202f}|\u{205f}|\u{3000}]/gu | |
const reV = /[\u{000a}|\u{000b}|\u{000c}|\u{000d}|\u{0085}|\u{2028}|\u{2029}]/gu | |
const reHV = /[\u{0009}|\u{0020}|\u{00a0}|\u{1680}|\u{180e}|\u{2000}|\u{2001}|\u{2002}|\u{2003}|\u{2004}|\u{2005}|\u{2006}|\u{2007}|\u{2008}|\u{2009}|\u{200a}|\u{202f}|\u{205f}|\u{3000}|\u{000a}|\u{000b}|\u{000c}|\u{000d}|\u{0085}|\u{2028}|\u{2029}]/gu | |
// H: Horizontal e.g. `\h` in Perl. | |
// V: Vertical e.g. `\v` in Perl. | |
// HV: Horizontal and vertical e.g. `\h\v` in Perl. |
here's an example