Pull to refresh

Типограф для BuEditor от artlebedev

Reading time1 min
Views1.7K
image

– Это "Типограф"?
— Это «Типограф»!

Итак, есть скачанное приложение от artlebedev.ru (естественно PHP-версия).

Распакованный из архива файл remotetypograf.php кидаем в /public_html/sites/all/modules/bueditor/library.

Создаём файл typo.php с таким содержанием:

<?php
$text = stripslashes ($_REQUEST['text']);

  if ($_POST['text'])
    {  
      include "remotetypograf.php";

      $remoteTypograf = new RemoteTypograf('UTF-8');
      $remoteTypograf->htmlEntities();
      $remoteTypograf->br (false);
      $remoteTypograf->p (true);
      $remoteTypograf->nobr (3);
      
      print $remoteTypograf->processText ($text);
    }
?>


* This source code was highlighted with Source Code Highlighter.


и кидаем в /public_html/sites/all/modules/bueditor/library

Идём в настройки редактора и добавляем кнопку:

js:
$.post('/sites/all/modules/bueditor/library/typo.php',
{ text: editor.active.getContent() }, function(data) { editor.active.setContent(data) });


* This source code was highlighted with Source Code Highlighter.


Замеченный баг/глюк: при наличие в тексте тегов, убиваются абзацы. Так что, сначала типографьте, потом расставляйте тэги.

Удачи!
Tags:
Hubs:
Total votes 22: ↑14 and ↓8+6
Comments11

Articles