Giter Site home page Giter Site logo

yiiext / imperavi-redactor-widget Goto Github PK

View Code? Open in Web Editor NEW
409.0 92.0 152.0 2.18 MB

Imperavi Redactor WYSIWYG widget (OEM-licensed for Yii)

Home Page: http://yiiext.github.com/extensions/imperavi-redactor-widget/

License: Other

PHP 0.87% JavaScript 84.72% CSS 14.42%

imperavi-redactor-widget's People

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  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

imperavi-redactor-widget's Issues

Problem with assets/redactor.min.js - destroyEditor()

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

jQuery package dependancy

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).

Composer

I have a small request - can you publish this widget to the packagist site?
Thanks

Add language support

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

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.

en.js missing? and toolbar => false vs 'false'

    //'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
            );

Redactor OEM license expired

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/)

can't pass custom toolbar

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?

Redactor placeholder

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.json

Привет!

У нас возникла проблема с установкой данного расширения через 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 корректно работает и без нее ?

Javascript encoding toolbar

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/
После экранирования яваскрипта массив не воспринимается как должный.

New version 9.1.9 available

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

Fixed does not work anymore

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 });

Safari Issue

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

imageUploadFunction

При попытке задать функцию 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]

вставляется вот такой код
//

Setting plugin baseUrl broken since a7fdd00

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.

Documentation Manage Images

is that possible to post the doc about manipulating images using the plugin? Like a inserting image example.

oberveLinks

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.

Removing background color doesn't work

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 удаляет целые строки

Условия воспроизведения:

  • ввести в пустое окно редактор текст, целиком состоящий из символов кириллицы
  • или перевести каретку (Shift+Enter) и ввести текст, целиком состоящий из символов кириллицы

Нажатие на 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, принадлежащий распространённому алфавиту.

Backspace in empty redactor breaks it in FF at MacOs

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 skitch

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.

Поле, на которое навешан редактор, отсутствует в POST данных

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

Clipboard Uploads CSRF parameters

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.

Autosave double encoding?

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?

have some trouble with js

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'
),
));

Call to a member function registerPackage() on a non-object

Данный участок кода:

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 extension

Rename repo into imperavi-redactor
Rename class into ImperaviRedactor

I think the suffix is unnecessary

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.