=== KDA Custom Editor Buttons ===
Contributors: deniskey
Tags: classic editor, tinymce, buttons, formats, custom html
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 1.5.5
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Custom TinyMCE toolbar buttons and Formats for the Classic Editor — wrap, insert templates, add classes, or open a code snippet dialog.

== Description ==

KDA Custom Editor Buttons lets you define your own Classic Editor controls:

* Wrap selection in any tag / CSS class
* Insert HTML templates (e.g. definition lists)
* Add a class to the current block (optionally with a tag)
* Open a code snippet dialog (language, line numbers, edit in place)
* Show each control on the toolbar, in Formats, or both
* Limit buttons to selected post types (including custom types such as `articles`)

Front-end CSS still belongs to your theme if you want a custom look; the plugin ships a neutral snippet window, Copy, line numbers, and token colors. Prism.js and Highlight.js are bundled, so nothing is loaded from a CDN. The admin UI is English and can be translated through translate.wordpress.org.

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/kda-custom-editor-buttons`
2. Activate the plugin through the Plugins menu
3. Go to Settings → KDA Editor Buttons
4. Use Classic Editor when editing content

== Frequently Asked Questions ==

= Does it work with the block editor (Gutenberg)? =

Version 1 targets Classic Editor / TinyMCE. A soft admin notice appears if the block editor is the default.

= Will my theme styles apply? =

Yes on the front end, if the theme defines the classes you insert. The plugin also ships a default snippet window and token colors (light/dark). You can replace those stylesheets with the `kda_ceb_snippet_css` and `kda_ceb_highlight_css` filters.

= How do I style the editor preview? =

Use the standard WordPress `mce_css` filter in your theme, or the plugin filters `kda_ceb_snippet_css` / `kda_ceb_highlight_css`. The plugin does not store custom CSS.

= Can I use my own Prism.js / Highlight.js files? =

Yes, with the PHP filters `kda_ceb_prism_base` and `kda_ceb_highlightjs_base` in your theme. See `docs/adding-a-button.en.md` (or `.ru.md`).

= Is there a Russian translation? =

English is the source language. Translations are managed on translate.wordpress.org. Documentation: `docs/adding-a-button.en.md` and `docs/adding-a-button.ru.md`.

== Changelog ==

= 1.5.5 =
* Remove the Editor preview CSS field — no arbitrary CSS is stored or served any more (use `mce_css` or the plugin stylesheet filters)
* Remove the Prism.js / Highlight.js folder settings; libraries load from the plugin folder, with the `kda_ceb_prism_base` / `kda_ceb_highlightjs_base` filters for theme developers
* Delete values saved by those fields in earlier versions on update
* Update bundled Highlight.js to 11.12.0 and Prism.js to 1.30.0
* Translations move to translate.wordpress.org (bundled .po/.mo files removed)

= 1.5.4 =
* Escape live HTML/script tags inside snippets on output so mixed PHP+HTML cannot break the page
* Strip leftover highlighter artifacts (`tok-kw`) before highlighting

= 1.5.3 =
* Auto-detect language in the code dialog (mixed PHP/HTML included); language label is never shown for auto

= 1.5.2 =
* Always remove plugin options on uninstall; remove optional Uninstall checkbox from settings

= 1.5.1 =
* Load Prism.js / Highlight.js from a theme folder or URL (settings fields + filters)
* Settings links to download pages and docs

= 1.5.0 =
* Front-end highlight engine setting: Built-in, Prism.js, or Highlight.js (vendored, no CDN)
* Code dialog beautify uses js-beautify for JS/JSON/CSS/HTML/XML; built-in fallback for PHP/SQL/Bash

= 1.4.6 =
* Reliable XML/HTML beautify on OK (tokenizer; no external library)

= 1.4.5 =
* Code dialog always beautifies on OK (checkbox removed; TinyMCE was not submitting it)

= 1.4.4 =
* Remove truncated exit hint from the code dialog (hint stays in the visual editor only)

= 1.4.3 =
* Complete Russian translation (admin, editor dialogs, exit hint, Copy)
* Full EN/RU user guides

= 1.4.2 =
* Visible exit hint in the visual editor and the code dialog

= 1.4.1 =
* Reliable leave-block keys (Ctrl+Enter, Escape, empty last line); strip leftover BR

= 1.4.0 =
* Neutral snippet window + kda_ceb_snippet_css
* Only plugin `<pre>` blocks are enhanced
* Quicktags (Text mode), editor token preview, dark palette, languages in settings

= 1.3.2 =
* Unwrap leftover theme code-wrap chrome so a plugin-only update can restyle snippets

= 1.3.1 =
* Snippet chrome: no empty language bar; Copy overlays the block unless Show language is on

= 1.3.0 =
* Front-end highlight, Copy, and line numbers ship with the plugin (theme-independent)
* Filter `kda_ceb_highlight_css` to use a theme stylesheet for token colors
* Leave a code block in the editor: empty last line + Enter, or Ctrl+Enter

= 1.2.2 =
* Code dialog: Show language is optional and off by default
* Line numbers sit on each code line (no overlay mismatch)

= 1.2.1 =
* Code dialog: Beautify code option (on by default) cleans extra spaces and indentation

= 1.2.0 =
* New action: Code snippet dialog (language, line numbers, edit-in-place)
* Demo: CODE wraps a short `pre.dk-code` line; BLOCK opens a large snippet window

= 1.1.0 =
* Dashicons picker, live toolbar preview, fields shown by action
* Toggle wrap / add class (second click removes the format)
* Toolbar row 1–3 and grouped menu buttons
* Optional delete data on uninstall
* Docs: adding a button (EN/RU)

= 1.0.0 =
* Initial release: configurable buttons, Formats, kses whitelist, import, export/copy
