vova07 / yii2-imperavi-widget Goto Github PK
View Code? Open in Web Editor NEWImperavi Redactor widget for Yii 2
License: Other
Imperavi Redactor widget for Yii 2
License: Other
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?
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?
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.
Из за того, что там всё в одном методе run(), я не могу достать $model для получения информации о файле. Я не могу добавить логику формирования $this->path, т.к. нет для него геттера, который можно было-бы переопределить.
Не могли бы вы пополнить папку assets всеми плагинами с официального сайта?
Нужен плагин Source Code, которого нет.
Планируется ли добавление новых плагинов?
Hello @vova07 your plugin is awesome but it have some issues on file upload. that is Yii2 currently yii file validator scheme was altered that alteration was not compatible with your plugin. for example types and wrongType are removed from FileValidator for more details please read here https://github.com/yiisoft/yii2/blob/master/framework/validators/FileValidator.php but you are plugin use this attribute in UploadAction.
Всегда все было норм, теперь делаю новый сайт, вставил редактор, в post запросе пусто, нет данных. Все облазил, в консоле ошибок нет, просто не отрпавляется, как будто нет поля в форме вовсе. В чем может быть проблема?
Есть ActiveForm c
'enableAjaxValidation' => true, 'enableClientValidation' => false,
validateOnChange и validateOnBlur включены по умолчанию. Но редактор не реагирует.
Как это пофиксить?
Привет!
// спасибо за виджет!
Пытался включить возможность выбора картинки с сервера(без загрузки). Ничего не получилось :( Там кнопка должна получиться или как? В итоге, выяснилось что imageGetJson выкинули начиная с 10й версии: http://imperavi.com/redactor/docs/whats-new-10/
Наверное стоит выкинуть этот код из виджета и описания.
И теперь не очень понятно как заставить redactor получать картинки с сервера...
When trying to use it with ActiveForm
New release 10.0.5
parent::init() сыпет ексепшен "Either 'name', or 'model' and 'attribute' properties".
When pastePlainText
option is true, then not created link at upload file
Не показывается кнопка html в тулбаре, ни при дефолтном конфиге, ни если задать ее через конфиг ('buttons' => ['html',...]).
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!
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
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
Установил на новый проект редактор, конфигурация:
И на тулбаре нет иконки вставить изображение:
При чем не важно, что делать с конфигурацией, подключать плагины или не подключать, даже если оставить просто вот так:
<?= $form->field($model, 'description')->widget(\vova07\imperavi\Widget::className(), [
'settings' => [
'lang' => 'ru',
'minHeight' => 200,
]
]);
?>
иконки вставить изображение все равно нет.
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.
Hi!
Please update redactor.js to latest version 10.2.3
Please update the redactor to new version. It fixes some important bugs.
ругается : 'Uncaught ReferenceError: RedactorPlugins is not defined'
откатился на 9.2.5 заработало ...
может пофиксили...
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!
При использовании плагина с изображениями не отображаються ищображения которые уже загружены на сервер.
В дебагере браузера видно что в переменные 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',
]
]
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
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.
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)
В общем, ситуация следующая.
Есть два вызова редактора на странице с доп. плагином.
<?= $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]
Я косячу с выводом, или это баг?
Пока еще нет в yii-ext, но думаю, что стоит уже мониторить :)
Только отдельным релизом что-ли, а то лично у меня на проекте, юзается 9.x редактор и там плагин сломается после случайного composer update.
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;
}
В 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();
загрузка начинает работать
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.
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?
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']),
]
]);
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:
What do you think?
Использую так:
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 :)
How to delete uploaded images?
а можно сделать ветку с 9.25 версией или в опцию на выбор ассета с той и той версий - в 10 - изменился апи все плагины в дауне, хорошо у меня форк был предыдущей версии, вставила свой репо.... так-то вообще нежданчик
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 ;[
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>" }]'
]
'''
php
if (isset($this->settings['plugins'])) {
$asset->plugins = $this->settings['plugins'];
}
'''
Надо как-то отделить, или опцию отдельно для кастомных плагинов сделать, которые своими ассетами вручную регистрироваться будут
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.
Скажите пожалуйста планируется обновить плагин до версии Imperavi II, или нужно покупать лицензию?
Could you update your extension to newest version of script, please?
There is a fix in this build included from the forum thread.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.