Skip to content

Commit

Permalink
Version 2.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronef committed Aug 22, 2023
2 parents e1324fc + 2e2afcc commit d352bef
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# (MODX)EvolutionCMS.snippets.ddTypograph changelog


## Version 2.6.1 (2023-08-23)
* \* TinyMCE empty lines (`<p>&nbsp;</p>`) are no longer modified.


## Version 2.6 (2023-08-22)
* \+ Parameters → `optAlign_useClasses`: The new parameter. Allows to use CSS classes instead of inline styles for optical alignment (`<span class="oa_comma_b">` instead of `<span style="margin-right:-0.2em;">`).
* \+ README:
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG_ru.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# (MODX)EvolutionCMS.snippets.ddTypograph changelog


## Версия 2.6.1 (2023-08-23)
* \* Пустые строки TinyMCE (`<p>&nbsp;</p>`) больше не изменяются.


## Версия 2.6 (2023-08-22)
* \+ Параметры → `optAlign_useClasses`: Новый параметр. Позволяет использовать CSS-классы вместо inline-стилей для оптического выравнивания (`<span class="oa_comma_b">` вместо `<span style="margin-right:-0.2em;">`).
* \+ README:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ require_once(
#### 1. Elements → Snippets: Create a new snippet with the following data

1. Snippet name: `ddTypograph`.
2. Description: `<b>2.6</b> Snippet for text typography. The snippet doesn’t use third-party services, also it sends no requests. In other words, everything is performed on your server.`.
2. Description: `<b>2.6.1</b> Snippet for text typography. The snippet doesn’t use third-party services, also it sends no requests. In other words, everything is performed on your server.`.
3. Category: `Core`.
4. Parse DocBlock: `no`.
5. Snippet code (php): Insert content of the `ddTypograph_snippet.php` file from the archive.
Expand Down
5 changes: 3 additions & 2 deletions README_ru.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# (MODX)EvolutionCMS.snippets.ddTypograph

Сниппет типографирует текст. Не использует сторонних сервисов, не отправляет никаких запросов, всё делается прямо у вас на сервере.
Сниппет типографирует текст.
Не использует сторонних сервисов, не отправляет никаких запросов, всё делается прямо у вас на сервере.


## Использует
Expand Down Expand Up @@ -41,7 +42,7 @@ require_once(
#### 1. Элементы → Сниппеты: Создайте новый сниппет со следующими параметрами

1. Название сниппета: `ddTypograph`.
2. Описание: `<b>2.6</b> Сниппет типографирует текст. Не использует сторонних сервисов, не отправляет никаких запросов, всё делается прямо у вас на сервере.`.
2. Описание: `<b>2.6.1</b> Сниппет типографирует текст. Не использует сторонних сервисов, не отправляет никаких запросов, всё делается прямо у вас на сервере.`.
3. Категория: `Core`.
4. Анализировать DocBlock: `no`.
5. Код сниппета (php): Вставьте содержимое файла `ddTypograph_snippet.php` из архива.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dd/evolutioncms-snippets-ddtypograph",
"type": "modxevo-snippet",
"version": "2.6.0",
"version": "2.6.1",
"description": "Snippet for text typography. The snippet doesn't use third-party services, also it sends no requests. In other words, everything is performed on your server.",
"keywords": [
"modx",
Expand Down
2 changes: 1 addition & 1 deletion ddTypograph_snippet.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* ddTypograph
* @version 2.6 (2023-08-22)
* @version 2.6.1 (2023-08-23)
*
* @see README.md
*
Expand Down
18 changes: 16 additions & 2 deletions src/Snippet.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class Snippet extends \DDTools\Snippet {
protected
$version = '2.6.0',
$version = '2.6.1',

$params = [
//Defaults
Expand Down Expand Up @@ -54,7 +54,7 @@ protected function prepareParams($params = []){

/**
* run
* @version 1.1 (2023-08-22)
* @version 1.2 (2023-08-23)
*
* @return {string}
*/
Expand All @@ -73,6 +73,13 @@ public function run(){
$result
);

//Save &nbsp; in empty lines (it will be replaced back after EMT call)
$result = str_replace(
'<p>&nbsp;</p>',
'<span class="_notg_start"></span><p>&nbsp;</p><span class="_notg_end"></span>',
$result
);

if (!isset($ddTypograph)){
$ddTypograph = new \EMTypograph();
}
Expand Down Expand Up @@ -321,6 +328,13 @@ public function run(){

//Типографируем
$result = $ddTypograph->apply();

//Clean back empty lines
$result = str_replace(
'<span class="_notg_start"></span><p>&nbsp;</p><span class="_notg_end"></span>',
'<p>&nbsp;</p>',
$result
);
}

return $result;
Expand Down

0 comments on commit d352bef

Please sign in to comment.