yiiext / imperavi-redactor-widget Goto Github PK
View Code? Open in Web Editor NEWImperavi Redactor WYSIWYG widget (OEM-licensed for Yii)
Home Page: http://yiiext.github.com/extensions/imperavi-redactor-widget/
License: Other
Imperavi Redactor WYSIWYG widget (OEM-licensed for Yii)
Home Page: http://yiiext.github.com/extensions/imperavi-redactor-widget/
License: Other
With debug set to false so that redactor.min.js is used, I get a javascript error when trying to close an editor with $("#someId").destroyEditor();
Uncaught TypeError: Object [object Object] has no method 'destroyEditor'
Works fine with redactor.js
You should definitely write in readme that this widget requires 'jquery' clientScript['package']
. Otherwise it will load its own version of jquery that may break things (I had 2 versions of jq).
Hello,
I have rewritten your widget for Yii2 and I need only to add languages support.
https://github.com/asofter/yii2-imperavi-redactor
and also this widget has composer support.
I have a small request - can you publish this widget to the packagist site?
Thanks
If we pass to the options a 'lang' param, nothing happen.
I suggest to create in the "asset" folder another folder named say "langs". And to put there some (or maybe all) translation files.
After that in order to include lang file we will need to slightly change registerClientScript method of the widget class:
protected function registerClientScript()
{
/** @var $cs CClientScript */
$cs = Yii::app()->clientScript;
if (!isset($cs->packages[self::PACKAGE_ID])) {
/** @var $am CAssetManager */
$am = Yii::app()->assetManager;
$jsFiles = array(
'redactor' . (YII_DEBUG ? '' : '.min') . '.js',
);
//The changes are here. If there is a lang param - then include its file
if (isset($this->options['lang'])) {
$jsFiles[] = 'langs/' . $this->options['lang'] . '.js';
}
$cs->packages[self::PACKAGE_ID] = array(
'basePath' => dirname(__FILE__) . '/assets',
'baseUrl' => $am->publish(dirname(__FILE__) . '/assets'),
'js' => $jsFiles,
'css' => array(
'redactor.css',
),
'depends' => array(
'jquery',
),
);
}
$cs->registerPackage(self::PACKAGE_ID);
$cs->registerScript(
$this->id,
'jQuery(' . CJavaScript::encode($this->selector) . ').redactor(' . CJavaScript::encode($this->options) . ');',
CClientScript::POS_READY
);
}
Undo works is unpredictable. If you paste text from the clipboard, edit it a bit, and then press undo, then canceled the whole pasting text from the clipboard.
Replace all indexOf by using jquery $.inArray method,
After changing, you can have redactor view, but the redactor function still doen't work.
//'lang' => 'en', // when this is not commented in the example code,
//this caused the en.js file to be missing from assets folder
//'toolbar' => 'false', // Sample code has quotes around false which causes js error
'toolbar' => false,
Just an fyi
thanks for creating it and making it easy to use. I look forward to seeing more yii usage examples
Данный участок кода:
Yii::app()->clientScript
->addPackage(self::PACKAGE_ID, $this->package)
->registerPackage(self::PACKAGE_ID)
->registerScript(
$this->id,
'jQuery(' . CJavaScript::encode($this->selector) . ').redactor(' . CJavaScript::encode($this->options) . ');',
CClientScript::POS_READY
);
Вызывает следующую ошибку:
Fatal error: Call to a member function registerPackage() on a non-object in ...\www\protected\extensions\imperavi-redactor-widget\ImperaviRedactorWidget.php on line 96
При замене участка кода на следующий - все ок:
Yii::app()->clientScript;
Yii::app()->clientScript->addPackage(self::PACKAGE_ID, $this->package);
Yii::app()->clientScript->registerPackage(self::PACKAGE_ID);
Yii::app()->clientScript->registerScript(
$this->id,
'jQuery(' . CJavaScript::encode($this->selector) . ').redactor(' . CJavaScript::encode($this->options) . ');',
CClientScript::POS_READY
);
The OEM license expired on december 11 2013 if i am correct. Are there any plans to extend the OEM license? I ask this because we use the Redactor widget in a custom Yii CMS.
Copied from the license page;
The OEM License: Holders of the OEM License may use the Software as if they had the Corporate/Business license. In addition OEM License holder’s clients are allowed to develop their own products based on or containing Redactor. License holder’s clients do not have to obtain their own Developer licenses. However, neither license holder nor license holder’s clients can sell Redactor as a sole product (with or without modification); License holder and license holder’s clients should use it fairly; we still hold all the rights for Redactor’s code, and we solely determine “fair use” of Redactor. The OEM License holders may expect priority response to their support requests and the highest quality of service and support, including but not limited to: priority bug fixes in the Software, help with installation of the Software, reasonable customization, phone, Skype or other live consultations, etc. The OEM License is limited to one year from the date of purchase.
(source: http://imperavi.com/redactor/license/)
9.0.4 contains way too many bugs to be usable. Please update to 9.1.0 ASAP
There appears to be no way to pass a custom toolbar or additonal buttons. The orignal docs show you're supposed to pass a json style array, but within the yii widget, I haven't found a way to pass this correctly and there are no widget documentation examples. Can you update the docs and show how to make the yii widget do this?
Может быть стоит поддержать версии php ниже 5.3?
If you drag an image from your local computer to the edit field everything runs smoothly. But when you try to insert the same image file from a local computer by copy / paste - we get an error: "Uncaught TypeError: Cannot call method 'getAsFile' of undefined ".
The same behavior is on the demo page http://imperavi.com/redactor/examples/drag_and_drop/
Chrome, version 30.0.1599.69 m
Redactor 9.1.5
When a placeholder is in place for Redactor the placeholder just disappears once Redactor receives focus. If I focus the Redactor input field, the placeholder disappears and even after focusing another field (without entering any text) the placeholder never shows up again.
Regards
Привет!
У нас возникла проблема с установкой данного расширения через composer.
Суть вот в чем: есть файл https://github.com/yupe/yupe/blob/master/composer.json#L77 с нашими зависимостями, устанавливается все корректно, в Yii-приложении все работает корректно. Проблемы начинаются при использовании бинарников из каталога /vendor/bin, к примеру при попытке запустить codeception командой /vendor/bin/codecept получаю вот такую ошибку:
PHP Fatal error: Class 'CInputWidget' not found in /var/www/yupe/vendor/yiiext/imperavi-redactor-widget/ImperaviRedactorWidget.php on line 19
Если в наш composer.json прописать секцию:
"autoload": {
"classmap": ["vendor/yiisoft/yii/framework"]
},
и перегенерить автолоадер - проблема уходит, но имхо, это не совсем правильно. Подскажите, чем вызвана необходимость наличия секции:
"autoload": {
"files": ["ImperaviRedactorWidget.php"]
}
в вашем файле тогда как, например https://github.com/yiiext/nested-set-behavior корректно работает и без нее ?
For toolbar customization you have to pass a "buttons" parameter inside initial dictionary
After CJavaScript::encode($this->options) it becomes escaped and not executable
При инициализации редактора можно передать параметр "buttons", который должен содержать массив, описывающий кастомный тулбар.
http://imperavi.com/redactor/docs/toolbar/
После экранирования яваскрипта массив не воспринимается как должный.
http://imperavi.com/redactor/log/
Version 9.0.4 July 11, 2013
Changelog:
Improved: Fullscreen Plugin
Improved: inline styles handling, including some minor plugin improvements (fontcolor, fontfamily) for Chrome, IE and Safari
Fixed: dropdown issues on mobile devices
FIxed: issues with '$' character being removed
Fixed: issue with '$' inside of pre tag
Fixed: issue with cursor jumping to the top left corner in Chrome when creating a list
Fixed: issue with fullscreen in iframe mode in IE and Firefox
Fixed: issue with inherited inline link styles
Fixed: pasting in IE11
Fixed: image uploads in IE11
Fixed: other various issues with IE11
FIxed: issue with extra line breaks in lists in IE9
Fixed: an issue with Redactor running in iframe in Firefox
Fixed: link tooltip didn't disappear when a user clicked outside Redactor
Fixed: issue with maxHeight in fullscreen mode
Whether I use 'fixed' or 'toolbarFixed' it doesn't work anymore.
Looking at their example (http://imperavi.com/redactor/examples/fixed/) I've noticed that their parameter names have no quotes surrounding them, while the code generated by the Yii plugin has quotes.
I am not sure if it matters...
Generated:
jQuery('#Article_content').redactor({'lang':'fr','autoresize':true,'imageUpload':'/article/imageUpload','toolbarFixed':true,'toolbarFixedBox':true,'minHeight':200,'autosave':'/article/autosave/111','buttons':['html','|','formatting','|','bold','italic','deleted','|','unorderedlist','orderedlist','outdent','indent','|','image','video','file','table','link','|','fontcolor','backcolor','|','alignment','|','horizontalrule']});
Sample:
$('#redactor_content').redactor({ toolbarFixed: true });
Hi,
I am facing an issue in Safari Browser. When I am trying to insert an Image in editor with out selecting editor area or remove any HTML tag e.g. p tag or any other and leave editor empty then trying to insert an image it give me an error "HIERARCHY_REQUEST_ERR: DOM Exception 3: A Node was inserted somewhere it doesn't belong." I am not able to trace this issue.
Could you please help me in this.
Thank you
New version available http://imperavi.com/redactor/log/
При попытке задать функцию callback на загрузку файла
[php]
$this->widget('ImperaviRedactorWidget',array(
'model'=>$model,
'attribute'=>'content',
'options' => array(
'resize'=>false,
//'toolbar'=>'mini',
'remove_classes'=>true,
'imageUploadFunction'=>"function(data)
{
alert(data);
}"
// 'cssPath'=>Yii::app()->baseUrl.'/css/',
),
'htmlOptions' => array('style'=>"width: 100%; height: 400px;"),
));
[php]
вставляется вот такой код
//
Commit a7fdd00 seems to have broken setting a custom baseUrl for redactor plugins.
From the documentation:
// You can set base path to assets
'basePath' => 'application.components.imperavi.my_plugin',
// or url, basePath will be ignored.
However,
if (!isset($plugin['baseUrl'], $plugin['basePath']))
evaluates to true and overwrites $plugin['baseUrl'] unless both baseUrl and basePath are set.
Можно с данным расширением, поле сделать обязательным. Или следует переписать расширение?
Bundled version of Redactor is not compatible with jQuery 1.9. Please update Redactor to version 8.2.2 to make it compatible.
is that possible to post the doc about manipulating images using the plugin? Like a inserting image example.
I downloaded the latest version of this widget and I can't seem to get 'observeLinks' to do anything. Everything else seems to work fine.
I tested their website example and their link editor does not work for new links.
http://imperavi.com/redactor/examples/links/
I can't seem to get mine to work at all.
Here is what my code produces...
jQuery(function($) {
jQuery('article').redactor({'lang':'en','imageUpload':'admin/image','observeLinks':true,'plugins':['fullscreen']});
});
FYI, I am using the latest Google Chrome, but I tried it in Firefox as well.
There appears to be a bug when using the toolbar to remove a background color. Even on the demo site at http://imperavi.com/redactor/examples/wym/
If you highlight a word and choose a background color from the "inversed A" on the toolbar, the color will apply. Then if you attempt to highlight the same text and the same button choose None from the bottom of the color picker, the color will not be removed.
Условия воспроизведения:
Нажатие на Backspace удаляет весь текст до начала строки (см. https://vimeo.com/72288982).
Если в тексте содержатся символы латинского алфавита или цифры — Backspace ведёт себе корректно и удаляет по одному символу.
Нам удалось решить проблему изменением регулярного выражения в строке 1393:
Старое значение:
var value = $.trim(current.nodeValue.replace(/[^\u0000-~/g, ''));
Новое значение:
var value = $.trim(current.nodeValue.replace(/[^\u0000-\u1C7F]/g, ''));
Символ u1C7F
был выбран как последний символ таблицы Unicode, принадлежащий распространённому алфавиту.
If redactor empty and backspace pressed it breaks redactor work in FF at MacOS X, but in Safari works fine (i can't confirm that cause not have MacOS, here is screenshot from some user
At Windows FF, if i press backspace in empty redactor it just change height (as in screenshot from MacOS), but then quickly restore it. At second press on backspace nothing happens - redactor works normally.
Hello,
Seems there is a bug with "fontcolor" plugin when trying to color part of text. Please check video: https://www.monosnap.com/file/VgjyxM03And5hdBzh5db0fhAGtZs87
I didn't found where I can report an issue on imperavi.com, so I've made a post here.
Thanks!
Столкнулся с непонятным багом и пока не могу понять откуда он взялся. Может быть какой-то конфликт яваскриптов, ибо на одном сайте редактор работает, а на другом нет.
В общем суть в том, что если используется редактор, то поле, на которое навешан редактор, вообще отсутствует в POST данных.
Если редактор убрать, то поле появляется.
Не могу понять, в какую сторону копать?
Version 9.0.1 June 10, 2013 http://imperavi.com/redactor/log/
When uploading images, we can specify CSRF data in "uploadfilds" option. But for Clipboard Uploads these parameters are not provided and we have no options to put data for CSRF token.
I tried to enable autosave. My content was scrambled.
I look at the network activity, and I saw that my
<p>test</p>
was sent in the POST as
%3Cp%3Etest%3C%2Fp%3E%0A
Seems too much to me no?
My controller simply tried to save the content directly into the model, like is always done with regular forms, but it is saved scrambled.
Is that a bug?
Hi,
I was thinking that we should clean the user input written in redactor widget. How should we do this? I tried with CmsInput, see thread in yii forum, http://www.yiiframework.com/forum/index.php/topic/48744-yii-imperavi-redactor-widget-cmsinput/. In addition, I also think to use yii built in CHtmlPurifier.
Can anyone provide feedback/example on what is the best to implement this.
Thank you in advance.
Daniel
When you change the position of the image in the text by dragging the relative link to the image is replaced by the absolute
Hello have some error . use Yii Boilerplate with Twitter Bootstrap .
Uncaught TypeError: Cannot read property 'dropdown' of undefined redactor.js:656
Redactor.init redactor.js:656
Redactor redactor.js:597
(anonymous function) redactor.js:100
jQuery.extend.each jquery.js:660
jQuery.fn.jQuery.each jquery.js:271
jQuery.fn.redactor redactor.js:93
(anonymous function) contact.html:79
fire jquery.js:1075
self.fireWith jquery.js:1193
jQuery.extend.ready jquery.js:435
DOMContentLoaded
$this->widget('ImperaviRedactorWidget',array(
// you can either use it for model attribute
'model'=>$model,
'attribute'=>'fulltext',
'options'=>array(
'lang'=>'ru',
),
'htmlOptions'=>array(
'rows'=>15, 'cols'=>50, 'class'=>'span11'
),
));
Данный участок кода:
Yii::app()->clientScript
->addPackage(self::PACKAGE_ID, $this->package)
->registerPackage(self::PACKAGE_ID)
->registerScript(
$this->id,
'jQuery(' . CJavaScript::encode($this->selector) . ').redactor(' . CJavaScript::encode($this->options) . ');',
CClientScript::POS_READY
);
Вызывает следующую ошибку:
Fatal error: Call to a member function registerPackage() on a non-object in ...\www\protected\extensions\imperavi-redactor-widget\ImperaviRedactorWidget.php on line 96
При замене участка кода на следующий - все ок:
Yii::app()->clientScript;
Yii::app()->clientScript->addPackage(self::PACKAGE_ID, $this->package);
Yii::app()->clientScript->registerPackage(self::PACKAGE_ID);
Yii::app()->clientScript->registerScript(
$this->id,
'jQuery(' . CJavaScript::encode($this->selector) . ').redactor(' . CJavaScript::encode($this->options) . ');',
CClientScript::POS_READY
);
Rename repo into imperavi-redactor
Rename class into ImperaviRedactor
I think the suffix is unnecessary
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.