/**
* HTML block node for the admin editor.
*
* Renders a first-class `htmlBlock` in the Portable Text editor with:
* - A textarea for editing raw HTML source
* - Selection ring, drag handle, and delete action
*
* Modeled on `PluginBlockNode.tsx` (atom node with React node view) and
* the existing `{ _type: "htmlBlock", _key, html }` Portable Text shape
* used by the WordPress and Contentful importers.
*/
import { Button } from "@cloudflare/kumo";
import { useLingui } from "@lingui/react/macro";
import { BracketsAngle, DotsSixVertical, Trash } from "@phosphor-icons/react";
import { Node, mergeAttributes } from "@tiptap/core";
import type { NodeViewProps } from "@tiptap/react";
import { ReactNodeViewRenderer, NodeViewWrapper } from "@tiptap/react";
import * as React from "react";
import { cn } from "../../lib/utils";
// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------
/**
* True when focus is inside a text input or textarea (e.g. the HTML block's
* source