Hi Sitepoint friends,
I’ve been making progress toward my goal of integrating the TinyMCE text editor. I’m using the self-hosted version 8.0.2, and while I’m happy with several aspects of it, I haven’t yet been able to achieve everything I’m aiming for.
The challenge I’m facing is understanding the “TinyMCE way” of doing things. I’m not sure whether I should be applying changes through TinyMCE’s commands and configuration options, or by directly modifying the local HTML, CSS, and JavaScript.
What I’m trying to build is a code editor that:
-
Displays line numbers
-
Shows the language label
-
Includes a “copy code” button
I’ve hardcoded a version that works when the page loads, but it doesn’t render the way I expect when new code blocks are added via menus and tools. Also, here the local version does not show in the Pen. I suspect this is due to differences in my local setup. On my setup, the language label does appear in the top right, and there’s a button that says “true” (not “copy”) — but the line numbers seem to be hidden (here also). I know they’re there because I inspected the DOM and saw them briefly flash when I refreshed the page (picture).
If anyone has experience with this or knows the best way to get Prism.js and TinyMCE working together properly, I’d really appreciate your help or guidance.
Thanks so much!