Giter Site home page Giter Site logo

yii2-imperavi-widget's Introduction

Imperavi Redactor Widget for Yii 2

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

Imperavi Redactor Widget is a wrapper for Imperavi Redactor 10.2.5, a high quality WYSIWYG editor.

Note that Imperavi Redactor itself is a proprietary commercial copyrighted software but since Yii community bought OEM license you can use it for free with Yii.

Install

The preferred way to install this extension is through composer.

Either run

$ php composer.phar require --prefer-dist vova07/yii2-imperavi-widget "*"

or add

"vova07/yii2-imperavi-widget": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code:

Like a widget

echo \vova07\imperavi\Widget::widget([
    'name' => 'redactor',
    'settings' => [
        'lang' => 'ru',
        'minHeight' => 200,
        'plugins' => [
            'clips',
            'fullscreen',
        ],
        'clips' => [
            ['Lorem ipsum...', 'Lorem...'],
            ['red', '<span class="label-red">red</span>'],
            ['green', '<span class="label-green">green</span>'],
            ['blue', '<span class="label-blue">blue</span>'],
        ],
    ],
]);

Like an ActiveForm widget

use vova07\imperavi\Widget;

echo $form->field($model, 'content')->widget(Widget::className(), [
    'settings' => [
        'lang' => 'ru',
        'minHeight' => 200,
        'plugins' => [
            'clips',
            'fullscreen',
        ],
        'clips' => [
            ['Lorem ipsum...', 'Lorem...'],
            ['red', '<span class="label-red">red</span>'],
            ['green', '<span class="label-green">green</span>'],
            ['blue', '<span class="label-blue">blue</span>'],
        ],
    ],
]);

Like a widget for a predefined textarea

echo \vova07\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'ru',
        'minHeight' => 200,
        'plugins' => [
            'clips',
            'fullscreen',
        ],
        'clips' => [
            ['Lorem ipsum...', 'Lorem...'],
            ['red', '<span class="label-red">red</span>'],
            ['green', '<span class="label-green">green</span>'],
            ['blue', '<span class="label-blue">blue</span>'],
        ],
    ],
]);

Add images that have already been uploaded

// DefaultController.php
public function actions()
{
    return [
        'images-get' => [
            'class' => 'vova07\imperavi\actions\GetImagesAction',
            'url' => 'http://my-site.com/images/', // Directory URL address, where files are stored.
            'path' => '@alias/to/my/path', // Or absolute path to directory where files are stored.
            'options' => ['only' => ['*.jpg', '*.jpeg', '*.png', '*.gif', '*.ico']], // These options are by default.
        ],
    ];
}

// View.php
echo \vova07\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'ru',
        'minHeight' => 200,
        'imageUpload' => Url::to(['default/image-upload']),
        'imageManagerJson' => Url::to(['/default/images-get']),
        'plugins' => [
            'imagemanager',
        ],
    ],
]);

Add files that have already been uploaded

// DefaultController.php
public function actions()
{
    return [
        'files-get' => [
            'class' => 'vova07\imperavi\actions\GetFilesAction',
            'url' => 'http://my-site.com/files/', // Directory URL address, where files are stored.
            'path' => '@alias/to/my/path', // Or absolute path to directory where files are stored.
            'options' => ['only' => ['*.txt', '*.md']], // These options are by default.
        ],
    ];
}

// View.php
echo \vova07\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'ru',
        'minHeight' => 200,
        'fileUpload' => Url::to(['default/file-upload']),
        'fileManagerJson' => Url::to(['/default/files-get']),
        'plugins' => [
            'filemanager',
        ],
    ],
]);

Upload image

// DefaultController.php
public function actions()
{
    return [
        'image-upload' => [
            'class' => 'vova07\imperavi\actions\UploadFileAction',
            'url' => 'http://my-site.com/images/', // Directory URL address, where files are stored.
            'path' => '@alias/to/my/path', // Or absolute path to directory where files are stored.
        ],
    ];
}

// View.php
echo \vova07\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'ru',
        'minHeight' => 200,
        'imageUpload' => Url::to(['/default/image-upload']),
        'plugins' => [
            'imagemanager',
        ],
    ],
]);

Upload file

// DefaultController.php
public function actions()
{
    return [
        'file-upload' => [
            'class' => 'vova07\imperavi\actions\UploadFileAction',
            'url' => 'http://my-site.com/files/', // Directory URL address, where files are stored.
            'path' => '@alias/to/my/path', // Or absolute path to directory where files are stored.
            'uploadOnlyImage' => false, // For any kind of files uploading.
        ],
    ];
}

// View.php
echo \vova07\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'ru',
        'minHeight' => 200,
        'fileUpload' => Url::to(['/default/file-upload']),
        'plugins' => [
            'filemanager',
        ],
    ],
]);

Upload and replace a file with the same name

// DefaultController.php
public function actions()
{
    return [
        'file-upload' => [
            'class' => 'vova07\imperavi\actions\UploadFileAction',
            'url' => 'http://my-site.com/files/', // Directory URL address, where files are stored.
            'path' => '@alias/to/my/path', // Or absolute path to directory where files are stored.
            'uploadOnlyImage' => false, // For any kind of files uploading.
            'unique' => false,
            'replace' => true, // By default it throw an excepiton instead.
        ],
    ];
}

// View.php
echo \vova07\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'ru',
        'minHeight' => 200,
        'fileUpload' => Url::to(['/default/file-upload']),
        'plugins' => [
            'filemanager',
        ],
    ],
]);

Upload file and translit its name

// DefaultController.php
public function actions()
{
    return [
        'file-upload' => [
            'class' => 'vova07\imperavi\actions\UploadFileAction',
            'url' => 'http://my-site.com/files/', // Directory URL address, where files are stored.
            'path' => '@alias/to/my/path', // Or absolute path to directory where files are stored.
            'uploadOnlyImage' => false, // For any kind of files uploading.
            'unique' => false,
            'translit' => true,
        ],
    ];
}

// View.php
echo \vova07\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'ru',
        'minHeight' => 200,
        'fileUpload' => Url::to(['/default/file-upload']),
        'plugins' => [
            'filemanager',
        ],
    ]
]);

Add custom plugins

echo \vova07\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'ru',
        'minHeight' => 200,
        'plugins' => [
            'clips',
            'fullscreen'
        ]
    ],
    'plugins' => [
        'my-custom-plugin' => 'app\assets\MyPluginBundle',
    ],
]);

Enable custom image manager with delete functionality

// DefaultController.php
public function actions()
{
    return [
        'images-get' => [
            'class' => 'vova07\imperavi\actions\GetImagesAction',
            'url' => 'http://my-site.com/images/', // Directory URL address, where files are stored.
            'path' => '@alias/to/my/path', // Or absolute path to directory where files are stored.
        ],
        'image-upload' => [
            'class' => 'vova07\imperavi\actions\UploadFileAction',
            'url' => 'http://my-site.com/images/', // Directory URL address, where files are stored.
            'path' => '@alias/to/my/path', // Or absolute path to directory where files are stored.
        ],
        'file-delete' => [
            'class' => 'vova07\imperavi\actions\DeleteFileAction',
            'url' => 'http://my-site.com/statics/', // Directory URL address, where files are stored.
            'path' => '/var/www/my-site.com/web/statics', // Or absolute path to directory where files are stored.
        ],
    ];
}

// View.php
echo \vova07\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'ru',
        'minHeight' => 200,
        'imageUpload' => Url::to(['/default/image-upload']),
        'imageDelete' => Url::to(['/default/file-delete']),
        'imageManagerJson' => Url::to(['/default/images-get']),
    ],
    'plugins' => [
        'imagemanager' => 'vova07\imperavi\bundles\ImageManagerAsset',              
    ],
]);

Enable custom file manager with delete functionality

// DefaultController.php
public function actions()
{
    return [
        'files-get' => [
            'class' => 'vova07\imperavi\actions\GetFilesAction',
            'url' => 'http://my-site.com/images/', // Directory URL address, where files are stored.
            'path' => '@alias/to/my/path', // Or absolute path to directory where files are stored.
        ],
        'file-upload' => [
            'class' => 'vova07\imperavi\actions\UploadFileAction',
            'url' => 'http://my-site.com/files/', // Directory URL address, where files are stored.
            'path' => '@alias/to/my/path', // Or absolute path to directory where files are stored.
            'uploadOnlyImage' => false, // For any kind of files uploading.
        ],
        'file-delete' => [
            'class' => 'vova07\imperavi\actions\DeleteFileAction',
            'url' => 'http://my-site.com/statics/', // Directory URL address, where files are stored.
            'path' => '/var/www/my-site.com/web/statics', // Or absolute path to directory where files are stored.
        ],
    ];
}

// View.php
echo \vova07\imperavi\Widget::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'ru',
        'minHeight' => 200,
        'fileUpload' => Url::to(['/default/file-upload']),
        'fileDelete' => Url::to(['/default/file-delete']),
        'fileManagerJson' => Url::to(['/default/files-get']),
    ],
    'plugins' => [
        'filemanager' => 'vova07\imperavi\bundles\FileManagerAsset',              
    ],
]);

Testing

$ phpunit

Further Information

Please, check the Imperavi Redactor v10 documentation for further information about its configuration options.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The BSD License (BSD). Please see License File for more information.

Upgrade guide

Please check the UPGRADE GUIDE for details.

yii2-imperavi-widget's People

Contributors

aaiyo avatar bocceli avatar bscheshirwork avatar bzzim avatar do6po avatar elisdn avatar greeflas avatar hamrak avatar jcvalerio avatar marcovtwout avatar maxmirazh33 avatar onmotion avatar sensetivity avatar silverfire avatar vova07 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2-imperavi-widget's Issues

Second call of widget doesnt get rendered when ....

Hi,

plugins is there but empty or rather commented out.

            use vova07\imperavi\Widget as Redactor;
            <?= $form->field($content,'description')->widget(Redactor::className(), [
                        'settings' => [                            
                            'lang' => 'en',
                            'minHeight' => 200,
                            'pastePlainText' => true,
                            'plugins' => [                                        
                                #'counter',
                                #'textdirection',
                            ]
                        ]
                    ]);
                ?>

            <?= $form->field($content,'notes')->widget(Redactor::className(), [
                        'settings' => [                            
                            'lang' => 'en',
                            'minHeight' => 200,
                            'pastePlainText' => true,
                            'plugins' => [                                        
                                #'counter',
                                #'textdirection',
                            ]
                        ]
                    ]);
                ?>

If you remove it, the second call for the wiget works once more.

            use vova07\imperavi\Widget as Redactor;
            <?= $form->field($content,'description')->widget(Redactor::className(), [
                        'settings' => [                            
                            'lang' => 'en',
                            'minHeight' => 200,
                            'pastePlainText' => true,
                        ]
                    ]);
                ?>

            <?= $form->field($content,'notes')->widget(Redactor::className(), [
                        'settings' => [                            
                            'lang' => 'en',
                            'minHeight' => 200,
                            'pastePlainText' => true,
                        ]
                    ]);
                ?>

Keep the code rolling :)

Best regards

Incorrect language check

by default Yii language = en-US

Now you use:

if (!isset($this->settings['lang']) && Yii::$app->language !== 'en') {
    $this->settings['lang'] = substr(Yii::$app->language, 0, 2);
}

it is incorrect, we need

if (!isset($this->settings['lang']) && ($lang = substr(Yii::$app->language, 0, 2)) !== 'en') {
    $this->settings['lang'] = $lang;
}

Обновление до Imperavi II

Скажите пожалуйста планируется обновить плагин до версии Imperavi II, или нужно покупать лицензию?

Setting not workin

Hello guys!
I have a problem with this widget. My code is
echo Form::widget([
'model' => $model,
'form' => $form,
'columns' => 1,
'attributes' => [
'body' => [
'type' => Form::INPUT_WIDGET,
'widgetClass' => Redactor::className(),
'settings' => [
'lang' => 'it',
'minHeight' => 200,
'plugins' => [ 'text-direction' ]
]
],
]
]);
but hte minHeight is not working!
Even, how can i load the lang correctly?

Thanks!

imageUpload

what do you mean about default controller; i have to create a new controller under the extention
or i have to put this
public function actions()
{
return [
'image-upload' => [
'class' => 'vova07\imperavi\actions\UploadAction',
'url' => 'http://my-site.com/images/', // Directory URL address, where files are stored.
'path' => '@alias/to/my/path' // Or absolute path to directory where files are stored.
],
];
}
to my form controller .
i tried the second one but giving me # url unknow
please give somme explanation about uploading file and image;
sorry for my bad english

Errors With Latest Version of widget

I just installed the widget in an advanced template and when I attempt to use it I'm getting the following error:

TypeError: undefined is not a function (evaluating 'jQuery("#event-description").redactor')
(anonymous function) (create, line 304)
fire (jquery.js, line 3073)
fireWith (jquery.js, line 3185)
ready (jquery.js, line 3391)
completed (jquery.js, line 3407)

Here is the code I'm using:

<?php
    echo $form->field($model, 'description')->widget(vova07\imperavi\Widget::className(), [
        'settings' => [
            // 'lang' => 'ru',
            'minHeight' => 200,
            'pastePlainText' => true,
            'plugins' => [
                'clips',
                'fullscreen'
            ]
        ]
    ]);
    ?>

Any ideas what I might be doing wrong?

Thanks.

html button in toolbar doesnt shows

Не показывается кнопка html в тулбаре, ни при дефолтном конфиге, ни если задать ее через конфиг ('buttons' => ['html',...]).

No upload error message visible

I added the widget and configured image uploads as described here: https://github.com/vova07/yii2-imperavi-widget#upload-image

I open the form page, click the add image button and pick a file. The modal closes, but the image is not visible, and no feedback message is visible. When I look in my network tab, I see the upload request returned a JSON response containing an error {"error":"Het bestand \"IMG_9230.JPG\" is te groot. Het kan niet groter zijn dan 2.097.152 bytes."} (file too big)

image

Добавление своих плагинов

'''
php

if (isset($this->settings['plugins'])) {
$asset->plugins = $this->settings['plugins'];
}
'''
Надо как-то отделить, или опцию отдельно для кастомных плагинов сделать, которые своими ассетами вручную регистрироваться будут

Split options to own variables for usage with DI

It convenient to use Dependency Injector to define default configuration for all project, but if you want to specify plugins or image\file options (imageUpload, fileUpload, imageGetJson) for particular view, all other settings become reseted.
I suggest to define separate variables (buttons, plugins, imageUpload and etc) and implode them into settings while running the widget. Property "settings" will remain for backward compatibility...
If you will agree, I can write a pull request.

Can We Get the Latest Redactor 10.0.3?

There are some significant bug fixes in that latest release that would be great to be able to use. In particular the image resizing bug is a biggie that is affecting my clients.

Thanks again for the great work!

How to add source code plugin.

i would like to add the html soucre code with "div , span " etc but default editor not supporting these html tags and replace with tag " p".

Please help to enable or support the Html tag in editor.

Toolbar not showing

Hi.

I cant seem to get a toolbar for my widget. Im using

echo $form->field($model, 'body')->widget(Widget::className(), [
'settings' => [
'lang' => 'no',
'minHeight' => 200,
'pastePlainText' => true,
'plugins' => [
'clips',
'fullscreen'
],
'imageUpload' => Url::to(['/default/image-upload'])
]

as my code, and its all installed with the composer. I get no error messages, and i get a textbox that reacts to indent and Ctrl-B to make text bold, so its obviously working to some extent.

Any ideas what might be wrong?

Add element-style margin-right: 15px to tag <body>?!

Hi, Vova! Tnx for your nice job!
I have the next problem: connected redactor - that's ok, but when i clicked the buttons "link" and "alignment", and moving mouse-point over the dropdown-menu, all page-content "shifts" or "rides" to the left-side.
I saw the source-code - there exactly at this moment added to tag body css "style="margin-right:15px". Perhaps to fix it somehow?

How to disable jquery?

Hi!
I'm did redefine Asset comment 'yii\web\JqueryAsset' in $depends
And reload registerClientScripts() method in

$asset = Yii::$container->get(\backend\assets\Imperavi::className());

But jquery whatever include ;[

9-я версия

а можно сделать ветку с 9.25 версией или в опцию на выбор ассета с той и той версий - в 10 - изменился апи все плагины в дауне, хорошо у меня форк был предыдущей версии, вставила свой репо.... так-то вообще нежданчик

Расширяемость UploadAction

  1. Хочу писать в базу информацию о файле: новое имя, размер файла, путь к нему и т.п.
  2. Сохранять файлы в разные папки /md5{2}/md5{2,2}/filename и т.п.
    Для этого мне надо расширить yii2-imperavi-widget/src/actions/UploadAction.php

Из за того, что там всё в одном методе run(), я не могу достать $model для получения информации о файле. Я не могу добавить логику формирования $this->path, т.к. нет для него геттера, который можно было-бы переопределить.

Пропала иконка image

Установил на новый проект редактор, конфигурация:
2

И на тулбаре нет иконки вставить изображение:
1

При чем не важно, что делать с конфигурацией, подключать плагины или не подключать, даже если оставить просто вот так:

        <?= $form->field($model, 'description')->widget(\vova07\imperavi\Widget::className(), [
            'settings' => [
                'lang' => 'ru',
                'minHeight' => 200,
            ]
        ]);
        ?>

иконки вставить изображение все равно нет.

Uploading images to the same directory with the same name

When unique is set to false and we upload image to the same directory with the same name, it simply overwrites previous one with the same name.

We can handle it like that:

  • Throw exception (depending on option for example).
  • Add confirmation window.

What do you think?

Video plugin not working

Looks like it's working when editing, but after saving or toggling HTML mode, the youtube iframe is removed. Looks like iframes are not allowed. Tried tweaking deniedTags and allowedTags, but did not help.

Is the video plugin broken?

Проблема с двумя редакторами на странице

В общем, ситуация следующая.

Есть два вызова редактора на странице с доп. плагином.

<?= $form->field($model, 'first_content')->widget(\vova07\imperavi\Widget::className(), [
                'settings' => [
                    'lang' => 'ru',
                    'minHeight' => 200,
                    'plugins' => [
                        'clips',
                        'fullscreen',
                        'relink'
                    ],
                ],
                'plugins' => [
                    'relink' => 'app\assets\ServicePagesReLinks'
                ]

            ]); ?>


<?= $form->field($model, 'second_content')->widget(\vova07\imperavi\Widget::className(), [
                'settings' => [
                    'lang' => 'ru',
                    'minHeight' => 200,
                    'plugins' => [
                        'clips',
                        'fullscreen',
                        'relink'
                    ]
                ],
                'plugins' => [
                    'relink' => 'app\assets\ServicePagesReLinks'
                ]
            ]); ?>

Дело в том, что если я подключаю плагин relink один раз - проблем не возникает. Если же прописываю как в коде выше, второе текстовое поле вылетает с ошибкой и не может якобы найти файл (но в первом редакторе работает всё как надо:

GET http://site.ru/zakaz/assets/71fb10c8/plugins/relink/relink.js
jquery.js:1458 Uncaught Error: Syntax error, unrecognized expression: a.re-[object Object]

Я косячу с выводом, или это баг?

10-я версия редактора релизнулась

Пока еще нет в yii-ext, но думаю, что стоит уже мониторить :)
Только отдельным релизом что-ли, а то лично у меня на проекте, юзается 9.x редактор и там плагин сломается после случайного composer update.

imageGetJson deprecated

Привет!

// спасибо за виджет!

Пытался включить возможность выбора картинки с сервера(без загрузки). Ничего не получилось :( Там кнопка должна получиться или как? В итоге, выяснилось что imageGetJson выкинули начиная с 10й версии: http://imperavi.com/redactor/docs/whats-new-10/

Наверное стоит выкинуть этот код из виджета и описания.

И теперь не очень понятно как заставить redactor получать картинки с сервера...

Image rotation

Sometimes redactor rotates vertical-oriented image 90 degree.

update article 67

Generate thumbnails for uploaded images

Imagemanager supports to send thumbs pathes. Why didn't use it?
It is not so hard to resize images.
Additional path for thumbs could be setuped in the 'images-get' action.
Or maybe just add suffix '_thumb' and put them in the same directory with original images.
Also is good idea to setup max size of original images and resize them too.

Ошибка в FileHelper

При использовании плагина с изображениями не отображаються ищображения которые уже загружены на сервер.
error
В дебагере браузера видно что в переменные thumb и image передаеться не url изображения, а путь к нему.
Настройки плагина:

'images-get' => [
    'class' => 'vova07\imperavi\actions\GetAction',
    'url' => 'http://my-site.dev/upload/images/', // Directory URL address, where files are stored.
    'path' => '@webroot/upload/images', // Or absolute path to directory where files are stored.
    'type' => GetAction::TYPE_IMAGES,                
],

'settings' => [
    'lang' => 'ru',
    'minHeight' => 200,
    'imageManagerJson' => Url::to(['/blog/post/images-get']),
    'imageUpload' => Url::to(['/blog/post/image-upload']),
    'plugins' => [
        'table',
        'imagemanager',
        'clips',
        'fullscreen',
    ]
]

Update to 10.0.8

Could you update your extension to newest version of script, please?
There is a fix in this build included from the forum thread.

Не передаётся токен csrf

В Widget::init устанавливается параметр uploadFields, которого нет в redactor.js и соответственно ключ не передаётся на сервер и вызывает exception 'yii\web\BadRequestHttpException' with message 'Не удалось проверить переданные данные.'

Если заменить

$this->settings['uploadFields'][Yii::$app->request->csrfParam] = Yii::$app->request->getCsrfToken();

На:

$this->settings['uploadImageFields'][Yii::$app->request->csrfParam] = Yii::$app->request->getCsrfToken();
$this->settings['uploadFileFields'][Yii::$app->request->csrfParam] = Yii::$app->request->getCsrfToken();

загрузка начинает работать

Delete table row

Hi! Is it possible to delete table row in this redactor without using of source mode? I don't see item Delete row in the table dropdown list.

Ability to define custom "clips"

I wanted to use custom defined "clips", but after configuring nothing happened.

My code:

$form->field($model, 'attachment')->widget(Widget::className(), [
                    'settings' => [
                        'minHeight' => 200,
                        'imageManagerJson' => Url::to(['/site/images-get']),
                        'imageUpload' => Url::to(['/site/image-upload']),
                        'plugins' => [
                            'clips',
                            'imagemanager'
                        ],
                        'clipsJson' => '[{ "title": "TEST Button", "clip": "<a>This is a button</a>" }]'
                    ]

Use incorrect selector for redactor

I use custom id for my textarea

<?= $form->field($model, 'content')->widget(Widget::className(), [
    'options' => [
        'id' => "content-{$lang['id']}", 
        'name' => $prefix . '[content]',
    ],
    'settings' => [
        'minHeight' => 100,
        'imageUpload' => Url::to(['/image/images/redactorupload']),
        'imageGetJson' => Url::to('/image/images/redactorindex'),
    ],
]); ?>

but now if selector = null you create compose it such as:

$this->selector = $this->hasModel() ? '#' . Html::getInputId($this->model, $this->attribute) : '#' . $this->getId();

I think you should use $this->options['id'] param

How to pass plugins settings without registering it as assets

I'm trying to pass my plugin to the editor:

'settings' => [
    'plugins' => ['myplugin']
]

The problem is that the widget will register that plugin assuming we're using one of the basic plugins, as a result we get 404: .../assets/8aa582f4/plugins/myplugin/myplugin.js.

Should we maybe introduce an option to not to register plugin asset? Or add a const with all basic plugins available to check if needed plugin is your package and should be registered as asset or external.

Table plugin not showing

Hi, I was able to get the imagemanager working. But, the table plugin is not showing. I recently updated using composer too. my code -

echo $form->field($model, 'main_content')->widget(Widget::className(), [
'settings' => [
'minHeight' => 300,
'plugins' => [
'clips',
'fullscreen',
'table',
'imagemanager',
],
'imageUpload' => Url::to(['/page/image-upload']),
'imageManagerJson' => Url::to(['/page/images-get']),
]
]);

imperavi_widget_snip

Пустая text-aria

Всегда все было норм, теперь делаю новый сайт, вставил редактор, в post запросе пусто, нет данных. Все облазил, в консоле ошибок нет, просто не отрпавляется, как будто нет поля в форме вовсе. В чем может быть проблема?

Как правильно использовать экшен Get с OpenServer под Windows

Использую так:
public function actions()
{
$folder_from_date = date('/Y/m/d/');
return [
'get' => [
'class' => 'vova07\imperavi\actions\GetAction',
'url' => 'http://yii2blog/uploads/news'.$folder_from_date, // Directory URL address, where files are stored.
'path' => 'uploads/news'.$folder_from_date, // Or absolute path to directory where files are stored.
],

Получаю это:
img src="uploads\news\2014\08\01\53db628fa6c8f.jpg" class="redactorfolder redactorfolder0" rel="uploads\news\2014\08\01\53db628fa6c8f.jpg" title="53db628fa6c8f.jpg"

Естественно, это не работает - превьюшки не отображаются - путь неверный и слеши не в ту сторону. С загрузкой файлов и картинок все ок.

похоже вот тут в Get ->
/**
* @inheritdoc
*/
public function run()
{
Yii::$app->response->format = Response::FORMAT_JSON;
return FileHelper::findFiles($this->path, $this->options);
}

надо пробежаться по массиву FileHelper, везде спереди подставить url и \ поменять на /

P.S. спасибо за отличное расширение и за yii2-start :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.