📜 ⬆️ ⬇️

Typographer for TinyMCE

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 the typographer 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.
')



Opportunities:



Installation:


  1. Download PHP script Studio Lebedev to work with their typographer
  2. Download the typograph studio Muravyov
  3. 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)
  4. 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.
  5. Unpack the archive with the plugin in the TinyMCE plugin folder (for example / tinymce / plugins / )
  6. In the /tinymce/plugins/typograf/typograf.php file, set the MCETYPOGRAF_ENGINES constant to point to the folder with the typographers
  7. 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…"
  8. Optionally, if you use TinyMCE.Compressor , then the plugin must also be registered in the compressor config file in the plugins

Planned features:



Known bugs:



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.

Source: https://habr.com/ru/post/67687/


All Articles