This is the oldest abuse of notation in the book, namely using the same symbol for operators acting on vectors (kets) as you use for such in a representation (bras, hence wavefunctions). Physicists are blasé about it, assuming you understand what they mean.
As per @knzhou 's suggestion, for the purposes of this discussion (only!), I'll use different symbols for each, $\hat A$ and $\tilde A$, respectively,
$$
\tilde {A} \psi (x) \equiv \langle x| \hat A |\psi \rangle ~.
$$
This is to say
$$
\tilde A \langle x | \psi \rangle \equiv \int \!\! dy ~~ \langle x| \hat A |y\rangle \langle y |\psi \rangle .
$$
So you may think of $\tilde A$ as a matrix representation of $\hat A$ in x-space (here, but you could equally work in p-space, l,m-space, ...), where you contract over indices (y) of it with those of the "vector in x-space", here the wavefunction. Assuming one understands what is meant, one conflates the tilde and the caret, and all is fine. Books using this ritual abuse of notation, however, ought to at least throw in an explanatory footnote...
For your particular operator, of course,
$$
\hat X = \int \!\! dy ~~ |y\rangle y \langle y | \\
\tilde X \psi(x) = \int \!\! dy ~~ x \delta(x-y) ~ \psi (y) =x \psi(x),
$$
diagonal in this representation. The authors of your text simply stress that $\tilde X$ and $\hat X$ have the same eigenvalues.
But, of course, the momentum, e.g., is not diagonal, in this representation,
$$
\hat P = \int \!\! dy ~~ |y\rangle \frac{\hbar}{i} \partial_y \langle y | \\
\tilde P \psi(x) = \frac{\hbar}{i} \partial_x~ \psi (x) =-i\hbar \partial_x \psi(x),
$$
and so on.
In real life, one just uses the caret without excessive confusion.