Skip to content

Instantly share code, notes, and snippets.

View mharris717's full-sized avatar

Mike Harris mharris717

View GitHub Profile

isSelected

1. Overview

The isSelected method is defined as an instance method on the LexicalNode class (in packages/lexical/src/LexicalNode.ts). Its purpose is to determine whether "this" node is included in a given selection (or—if no selection is provided—the current selection returned by $getSelection()). In other words, it tells you whether that node is "selected" by comparing its own unique key with the list of node keys that make up the selection.

2. How is it implemented?

When isSelected is called, it does the following:

export class HttpTool {
constructor(readonly name: string) {}
url() {
const n = this.name.toLowerCase().replace("/", "-");
return `https://${n}.web.val.run`;
}
async call(ops: any): Promise<string> {
const url = this.url();
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<!-- saved from url=(0052)https://www.espn.com/nba/boxscore/_/gameId/401585418 -->
<html lang="en" data-react-helmet="lang">
<head class="at-element-marker">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script
async=""
src="./Grizzlies 113-110 Bucks (Feb 15, 2024) Box Score - ESPN_files/P31187EE2-AC6E-46CB-BB54-D07591BED067.js"
></script>
<style type="text/css" class="bc-style-j8Fbje7Qq-default">
from textual.app import App
from textual.reactive import reactive
from textual.widget import Widget
from textual.widgets import Footer, Header, Input, Label, ListItem, ListView, Static
"""
My naive expectation was that, when I update Numbers#term, the ListView would
re-render. But it doesn't.
I am almost positive I understand why. If term was used in a render method, it would smart refresh.
@mharris717
mharris717 / schema.json
Created March 27, 2023 15:50
subset.json
{
"components": {
"parameters": {
"owner": {
"name": "owner",
"description": "The account owner of the repository. The name is not case sensitive.",
"in": "path",
"required": true,
"schema": {
"type": "string"
export const NUM_BOARDS = 16;
export const NUM_GUESSES = 21;
export const START_DATE = (() => {
// Use this method so that the start date is offset by current timezone offset
// Old method had problems with the start date being before DST
const utcDate = new Date("2022-02-14T00:00:00Z").getTime();
const offset = new Date().getTimezoneOffset();
return new Date(utcDate + offset * 60 * 1000);
@mharris717
mharris717 / _tour.md
Last active August 2, 2021 15:35
DX-4084 Secondary Insurance
{
"openapi": "3.0.1",
"info": {
"title": "API for modeling Orgs, Projects, and Users",
"description": "",
"version": "0.0.1"
},
"servers": [
{
"url": "https://api.liveramp.com/orgs"
@mharris717
mharris717 / child_type.js
Created April 24, 2019 15:43
Change child type on parent data changes
/* global describe, it, beforeEach */
import expect from "expect";
import { create } from "../src/microstates";
function isStateType(obj, T) {
return obj.constructor.name === `Microstate<${T}>`;
}
function withInitBehavior(T, f) {
@mharris717
mharris717 / fetch.test.js
Last active March 21, 2019 15:06
Instance Fetch
/* global describe, it, beforeEach */
import expect from "expect";
import Identity from "../src/identity";
import { create } from "../src/microstates";
import { TodoMVC } from "./todomvc";
import Promise from "bluebird";
export default class FetchAttr {