It is noticeable that on Habré the issue of typography has recently been increasingly raised, and this is good news, because “typed” texts are more pleasant to read and they look much neater than usual. And in general, it creates the feeling that the author cared about his readers.
About a year and a half ago, I wrote my plug-in for the popular TinyMCE editor, who knew how to print texts through the web interface of thetypographer of Lebedev Studio . Since that time, the plugin has been successfully used in projects of Nimax and Artilleria studios. After a recent post, I decided to publish it, and also improved it a bit - typographer Comrade added. spearance , as well as the typographer studio Muravyov . The method of typography can be chosen immediately before the “operation”.
I present an improved typographer today to the public. ')
It works through the web interface, so it instantly perceives all the bug fixes of the engines used (although, on the other hand, this can be a minus if PHP is reduced in rights on the hosting and cannot establish a connection)
For the case when PHP is cut down - you can use the typograph of the studio Muravyov, it is local
Multilingual interface (for now only Russian and English)
Immediately see the result, directly in the edit field
If something goes wrong - you can abandon the results of the plugin
Unpack both scripts somewhere so that the directory contains the file remotetypograf.php and the directory Jare (with the file Typograf.php ) Important note! - currently version 2.0.0-rc2 of Muravyov Studio typographer has a BOM mark in many files, which can lead to errors like preg_match () [function.preg-match]: Compilation failed on some servers. Also, because of this, the BOM label goes to the output stream of the backend script, adding the empty “P” “/ P” tag to the content. The typographer is trained to deal with this problem by cutting the tag from the server response (thanks to the user pixxxel ). The problem with preg functions is solved by banal reduction of files to normal UTF-8 without a label (I don’t know how it is connected, but it works)
For the lazy, there are both scripts in this archive , however, it may not be the most recent versions, but the problem with BOM is fixed there.
Unpack the archive with the plugin in the TinyMCE plugin folder (for example / tinymce / plugins / )
In the /tinymce/plugins/typograf/typograf.php file, set the MCETYPOGRAF_ENGINES constant to point to the folder with the typographers
When initializing, set the plugin in plugins and theme_advanced_buttonsX , for example: tinyMCE.init({ … "plugins": "…table,advimage,advlink, typograf ", "theme_advanced_buttons1": "…pagebreak,|,spellchecker, typograf ,|,advcode…"
Optionally, if you use TinyMCE.Compressor , then the plugin must also be registered in the compressor config file in the plugins
Planned features:
Expansion of a circle of engines
Support for typing texts in different languages. So far, both of the plugins used do not allow to set the language or directly quotation marks Tov. spearance promised to do it in the 3rd version of his typographer, nothing is yet known from Lebedev
Known bugs:
If the allocation is too tricky (after a few cells of the table, for example), the Range object can be bogged down, I am still working with it ...
PS Theoretically, the bug can sit in any program;) Any feedback is appreciated. PPS Comments to the code inside the plug-in is not in Russian ... I wrote this - I have not translated it yet.