среда, 30 января 2019 г.

[Ckeditor] adds extra

html tags fix

If you pass HTML content to Twig template and escape it with raw filter/function, and get extra <p> tags, like in this example:

<p></p>
<p>my passed HTML content from CKeditor</p>
<p></p>

It means you should unwrap <p> tag, which wraps Twig content variable.
Bad Twig case:

<p>{{ page.content|raw }}</p>

Good Twig case:
{{ page.content|raw }}

It occurs because <p> cannot be nested, so tag cannot be unclosed, and if at next opens a new <p>, previous tag becomes automatically closed. 

понедельник, 28 января 2019 г.

[Webpack] Module not found: Error: Empty dependency (no request) fix

If you have these errors in Webpack (encore):
This dependency was not found:

*  in ./node_modules/css-loader??ref--1-2!./src/AppBundle/Resources/public/css/styles.css


or:

Module build failed: ModuleNotFoundError: Module not found: Error: Empty dependency (no request)
   at factoryCallback (/var/www/project/core/node_modules/webpack/lib/Compilation.js:282:40)


It because you have background-image("") without an url. Add it or remove this attribute.

вторник, 22 января 2019 г.

Symfony commands "environment variable not found" at migrating to symfony/dotenv fix

Add use Symfony\Component\Dotenv\Dotenv; at the beginning of file bin/console.php at the beginning of file and before line "require __DIR__.'/../vendor/autoload.php';"add (new Dotenv())->load(__DIR__.'/../.env');


So it should looks like:
#!/usr/bin/env php
<?php

use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;

// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read https://symfony.com/doc/current/setup.html#checking-symfony-application-configuration-and-setup
// for more information
//umask(0000);

set_time_limit(0);

require __DIR__.'/../vendor/autoload.php';
(new Dotenv())->load(__DIR__.'/../.env');

$input = new ArgvInput();
$env = $input->getParameterOption(['--env', '-e'], getenv('SYMFONY_ENV') ?: 'dev');
$debug = getenv('SYMFONY_DEBUG') !== '0' && !$input->hasParameterOption(['--no-debug', '']) && $env !== 'prod';

if ($debug) {
    Debug::enable();
}

$kernel = new AppKernel($env, $debug);
$application = new Application($kernel);
$application->run($input);

суббота, 19 января 2019 г.

jest encountered an unexpected token + equals symbol

Also if you have error "Jest encountered an unexpected token"  , as in code below:

class App extends Component {
        state={
             ^             value: 'value'     }

add to your .babelrc
{
  "presets": ["env", "react"],
  "plugins": ["transform-class-properties"]
}


четверг, 10 января 2019 г.

[Sulu] how to fix [extensionsData] This value is not valid. ({"{{ value }}":"NULL"})

If you have error "[extensionsData] This value is not valid. ({"{{ value }}":"NULL"})" in Symfony Profiler, downgrade symfony version to 3.4.15. Problem occured in symfony version 3.4.21.

воскресенье, 6 января 2019 г.

[Linux] Fix opera/chrome browser video (again)

Run sudo apt-get install chromium-codecs-ffmpeg-extr
then  sudo ln -sf /usr/lib/chromium-browser/libffmpeg.so /usr/lib/x86_64-linux-gnu/opera/libffmpeg.so
runs on opera 57

вторник, 1 января 2019 г.

[Krita] make photoshop compatible shortcuts

If you want adobe photoshop compatible hotkeys, go to Settings > Configure Krita > Keyboard Shortcuts tab > Shortcut schemes and select there "photoshop_compatible". Real KDE way.