chore: Define classname in EditorStyleHelper (#9735)

This commit is contained in:
Tom Moor
2025-07-25 22:08:54 -04:00
committed by GitHub
parent 80090f12be
commit 0125e2b05d
3 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -1333,7 +1333,7 @@ code {
font-family: ${props.theme.fontFamilyMono};
font-size: 90%;
.code-word {
.${EditorStyleHelper.codeWord} {
white-space: nowrap;
}
}
+2 -2
View File
@@ -1,5 +1,6 @@
import { EditorState, Plugin } from "prosemirror-state";
import { Decoration, DecorationSet } from "prosemirror-view";
import { EditorStyleHelper } from "../styles/EditorStyleHelper";
interface CodeWordDecorationsConfig {
/** CSS class to apply to word decorations */
@@ -9,7 +10,7 @@ interface CodeWordDecorationsConfig {
class CodeWordDecorationsPlugin extends Plugin {
constructor(config: CodeWordDecorationsConfig = {}) {
const defaultConfig: Required<CodeWordDecorationsConfig> = {
className: "code-word",
className: EditorStyleHelper.codeWord,
};
const finalConfig = { ...defaultConfig, ...config };
@@ -50,7 +51,6 @@ class CodeWordDecorationsPlugin extends Plugin {
}
state.doc.descendants((node, pos) => {
// Only process text nodes
if (node.isText && node.text) {
// Check if this text node has the code_inline mark
const codeMark = node.marks.find((mark) => mark.type === codeMarkType);
@@ -12,6 +12,10 @@ export class EditorStyleHelper {
static readonly comment = "comment-marker";
// Code
static readonly codeWord = "code-word";
// Tables
/** Table wrapper */