Giter Site home page Giter Site logo

2amigos / yii2-ckeditor-widget Goto Github PK

View Code? Open in Web Editor NEW
171.0 29.0 108.0 1.91 MB

CKEditor WYSIWYG widget for Yii2.

Home Page: https://2amigos.us/open-source/ckeditor-widget

License: Other

PHP 95.05% JavaScript 4.95%
2amigos ckeditor-widget yii inline-editing widget wysiwyg

yii2-ckeditor-widget's People

Contributors

creocoder avatar drnixx avatar dsainst avatar fork12 avatar mbv avatar muhammad1992 avatar muhammadcahya avatar nabikaz avatar platx avatar schmunk42 avatar soovorow avatar techie42 avatar tonydspaniard avatar vstaheev 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  avatar  avatar  avatar  avatar

yii2-ckeditor-widget's Issues

Constraint on width of CKEditor

I've got CKEditor displaying and functioning correctly using your widget. Unfortunately, what I've got is a miniscule, very narrow editor. Looking at the source code, I found that the editor is contained within a div with this specification <div class="col-sm-6 col-sm-offset-3">. I've tried going through your widget code and can't find where this is set, and none of the parameter settings that I've been able to intuit or imagine tell me how to correct this weird setting. (Your instructions don't include what settings will work, and the comments in your widget code don't provide much if anything.) What I want is to have the editor's div setup as <div class="col-lg-12">. (The editor will never be used on a mobile device or anything else with a small screen.)

How can I achieve this?

It would also be helpful to know how to make changes to the CKEditor.config settings. In particular, I need to change the CKEditor.config.uiColor setting. I've tried to do this in the config.js for CKEditor, in your widgets\full.php (I'm using the full preset), and as a last resort, tried doing a CKEditor.replace in the _form.php file itself. They all seem somehow to get trounced in the widget generation and produce no effect whatsoever.

Some general questions

Hi,

Can you tell me how I update the config.js file to add this line in order to prevent filtering (for example I want to be able to add iframe (you tube) content

config.allowedContent = true;

Addition - sorted this one...sorry! Still working on the styles, and integration with ckfinder...

Also, I want to be able to change the styles.js file - can you tell me the best way to do this without having to edit the file itself?

Also, any tips on integrating with ckfinder would be great !!!!!!!!!!!!!! (I've tried using iutbay/yii2-kcfinder
without much joy).

Problem on install.

I have always this error:

composer update

Loading composer repositories with package information
Updating dependencies (including require-dev)
Reading bower.json of bower-asset/jquery (2.1.3)
Reading bower.json of bower-asset/jquery.inputmask (3.1.61)
Reading bower.json of bower-asset/punycode (v1.3.2)
Reading bower.json of bower-asset/yii2-pjax (v2.0.4)
Reading bower.json of bower-asset/jquery-ui (1.11.4)
Reading bower.json of bower-asset/bootstrap (v3.3.4)
Reading bower.json of bower-asset/typeahead.js (v0.10.5)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- 2amigos/yii2-ckeditor-widget 1.0.2 requires ckeditor/ckeditor dev-full/stable -> no matching package found.
- 2amigos/yii2-ckeditor-widget 1.0.1 requires ckeditor/ckeditor dev-full/stable -> no matching package found.
- 2amigos/yii2-ckeditor-widget 1.0.0 requires ckeditor/ckeditor dev-full/stable -> no matching package found.
- Installation request for 2amigos/yii2-ckeditor-widget ~1.0 -> satisfiable by 2amigos/yii2-ckeditor-widget[1.0.0, 1.0.1, 1.0.2].

Potential causes:

Read http://getcomposer.org/doc/articles/troubleshooting.md for further common problems.

My composer:

{
    "name": "yiisoft/yii2-app-advanced",
    "description": "Yii 2 Advanced Application Template",
    "keywords": ["yii2", "framework", "advanced", "application template"],
    "homepage": "http://www.yiiframework.com/",
    "type": "project",
    "license": "BSD-3-Clause",
    "support": {
        "issues": "https://github.com/yiisoft/yii2/issues?state=open",
        "forum": "http://www.yiiframework.com/forum/",
        "wiki": "http://www.yiiframework.com/wiki/",
        "irc": "irc://irc.freenode.net/yii",
        "source": "https://github.com/yiisoft/yii2"
    },
    "minimum-stability": "stable",
    "require": {
        "php": ">=5.4.0",
        "yiisoft/yii2": "*",
        "yiisoft/yii2-bootstrap": "*",
        "yiisoft/yii2-swiftmailer": "*",
        "mdmsoft/yii2-admin": "*",
        "kartik-v/yii2-widgets": "*",
        "2amigos/yii2-ckeditor-widget" : "~1.0"
    },
    "require-dev": {
        "yiisoft/yii2-codeception": "*",
        "yiisoft/yii2-debug": "*",
        "yiisoft/yii2-gii": "*",
        "yiisoft/yii2-faker": "*"
    },
    "config": {
        "process-timeout": 1800
    },
    "extra": {
        "asset-installer-paths": {
            "npm-asset-library": "vendor/npm",
            "bower-asset-library": "vendor/bower"
        }
    }
}

Updated CKeditor or use Bower

I'm having trouble with minification with this version.
Is the current version "4.5.6", already solves the problem CKEDITOR.getUrl ();

Sorry for my English.

Adding CKeditor options

CKEditor strips html and body tags and I can see that we can set it using 'FCKConfig.ProtectedTags' => 'html|head|body'

Where do we specify this in the widget?

ExtraPlugins don't work

$form->field($model, 'content')->textarea(['rows' => 6])->widget(CKEditor::className(),[
            'preset' => 'full',
            'clientOptions' => [
                'allowedContent' => true,
                'extraPlugins' => 'pluginName'
            ]
        ]) ;

This don't work, assets not render plugin.js

Two fields in same page, only the first render ckeditor

Code

<?php

use dosamigos\ckeditor\CKEditor;
use yii\widgets\ActiveForm;
use yii\helpers\Html;
use common\modules\relatorio\models\RelatorioHelper;

/**
 * @var yii\web\View $this
 * @var \common\modules\configuracao\Configuracao $modelCabecalho (Configuração do cabeçalho)
 * @var \common\modules\configuracao\Configuracao $modelRodape (Configuração do rodapé)
 */

$form = ActiveForm::begin(['id' => 'form-configuracoes']);
?>
<h1 class="jumbotron"> Configurações Relatório </h1>
<?php
    echo Html::label(Yii::t('app', 'Cabeçalho'), Html::getInputId($modelCabecalho, 'valor'));
    echo $form->field($modelCabecalho, 'valor', ['template' => '{input}{hint}{error}'])->widget(CKEditor::className(), [
        'options' => ['rows' => 3],
        'clientOptions' => ['removePlugins' => 'save', 'removeButtons' => 'Source,Flash', 'width' => 832, 'height' => 150],
        'preset' => 'full'
    ]);

    echo Html::label(Yii::t('app', 'Rodapé'), Html::getInputId($modelRodape, 'valor'));
    echo $form->field($modelRodape, 'valor', ['template' => '{input}{hint}{error}'])->widget(CKEditor::className(), [
        'options' => ['rows' => 3],
        'clientOptions' => ['removePlugins' => 'save', 'removeButtons' => 'Source,Flash', 'width' => 832, 'height' => 150],
        'preset' => 'full'
    ]);
    echo Html::submitButton('Enviar', ['class' => 'btn btn-primary']);
    ActiveForm::end();
?>

Page Result

Page

Where did I go wrong?
Best Regards

require non-dev version

Hi Toni,
I know this extension has no release yet, but let me note this here ... the dev version of ckedior is not visible in a stable project.
If you need a dev version of ckeditor for development you can use branch aliases.

config.baseHref not working

I've tried this way but not working.

field($page, 'content')->textarea()->widget(CKEditor::className(), [ 'options' => ['rows' => 5], 'preset' => 'full', 'clientOptions' => [ 'baseHref' => 'http://www.example.com/path/' ], ]) ?>

And I've tried edit on config.js also not working
CKEDITOR.editorConfig = function( config ) {
// Define changes to default configuration here. For example:
// config.language = 'fr';
// config.uiColor = '#AADC6E';
};
CKEDITOR.config.baseHref = 'http://www.example.com/path/';

Could you tell the right way?
Thanks a lot before, your yii2-ckeditor-widget is helpful.

Initilized with jquery

Hiii,
How can i initilized with jquery??

Text editor option is not same when i initilized with jquery and widgets provided by you.I initilized with this code.
$("#initText").ckeditor(function() {});

Thank you in advanced.

Add allowed empty tag like <i> configuration

I added html tag with font awesome tag like empty

<i class="fa fa-camera-retro fa-lg"></i>

tag and it's not save, how to add configuration in array config like :

config.protectedSource.push(/<i[^>]><\/i>/g);
CKEDITOR.dtd.$removeEmpty['i'] = false;

Image upload should work with CSRF validation

On setting filebrowserUploadUrl CKEditor should submit Yii::$app->request->csrfParam and Yii::$app->request->csrfToken so that the form works with CSRF validation.

As far as I know, the only way to solve this is injecting a hidden input in the upload form:

function prepareCkEditor(containerId)
{
    if (jQuery('#' + containerId).length > 0) {

        jQuery(document).on('click', '.cke_dialog_tabs a:eq(2)', function(event) {

            var csrfTokenInput = jQuery('<input />');
            csrfTokenInput.attr('type', 'hidden');
            csrfTokenInput.attr('name', window.csrfVar);
            csrfTokenInput.val(window.csrfToken);

            jQuery('.cke_dialog_ui_input_file iframe').contents().find('form').append(csrfTokenInput);
        });
    }
}

Adding Code Highlight Plugin

I have a CKEditor extension I have been using and its having a highlightjs for Code syntax highlighting and a Pack of Emoticons for my forum. Now I want to migrate to this extension and need to know if there is easy way to add them without tampering with vendors DIR. Is there a way/plan to have them? They are pretty basic of stuffs these days

Cannot customize toolbarGroups

Hi, thank you for the widget. It is nice and easy to use.
I want to customize the tollbar, but I couldn't make it work. Can you explain me how to customize the toolbar? thanks.
I tried with the folling way, but it is not working :(

<?= $form->field($model, 'post_content')->widget(CKEditor::className(), [
        'options' => ['rows' => 15],
        'preset' => 'full',
        'clientOptions' => [
            'skin' => 'bootstrapck',
            'format_tags' => 'p;h1;h2;h3;pre',
            'enterMode' => 'CKEDITOR.ENTER_BR',
            'toolbarGroups' => "
                [
                    { name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
                    { name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },
                    { name: 'links' },
                    { name: 'insert' },
                    { name: 'forms' },
                    { name: 'tools' },
                    { name: 'document',    groups: [ 'mode', 'document', 'doctools' ] },
                    { name: 'others' },
                    '/',
                    { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
                    { name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align' ] },
                    { name: 'styles' },
                    { name: 'colors' },
                    { name: 'about' }
                ];
            ",
        ],
    ]) ?>

Image upload not working

I used this code

field($model, 'information')->widget(CKEditor::className(),[ 'editorOptions' => [ 'preset' => 'full', 'inline' => false, //'filebrowserBrowseUrl'=>Yii::$app->getUrlManager()->createUrl('dashboard/test',['type'=>'Images']), 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('dashboard/test') ], ]);?>

but this is not working

if fixed it please help

How to disable beforeunload action when user is submitting a form?

How to disable beforeunload action when user is submitting a form?

Example:

<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>
<?= $form->field($model, 'text')->widget(\dosamigos\ckeditor\CKEditor::className(),[
   'options' => ['rows' => 10],
   'preset' => 'full'
]); ?>

Several toolbar not show

Many Several toolbar not show. Like forms, align, colors etc. I used full preset.

'toolbarGroups' => [
['name' => 'document', 'groups' => ['mode', 'document', 'doctools']],
['name' => 'clipboard', 'groups' => ['clipboard', 'undo']],
['name' => 'editing', 'groups' => [ 'find', 'selection', 'spellchecker']],
['name' => 'forms'],
'/',
['name' => 'basicstyles', 'groups' => ['basicstyles', 'colors','cleanup']],
['name' => 'paragraph', 'groups' => [ 'list', 'indent', 'blocks', 'align', 'bidi' ]],
['name' => 'links'],
['name' => 'insert'],
'/',
['name' => 'styles'],
['name' => 'blocks'],
['name' => 'colors'],
['name' => 'tools'],
['name' => 'others'],
],

Am not able to install

composer require 2amigos/yii2-ckeditor-widget:~1.0

while i run this i get error saying the dependent ckeditor dev-full/stable there is no stable version

CKEditor do not save written content after first save() try

I am using your widget in my application. There is a "content" field responsible for accepting text, and in my view it is defined like this:

<?= $form->field($model, 'content')->widget(CKEditor::className(), 
    ['options' => ['rows' => 6],'preset' => 'full']) ?>

In my model there are only two rules defined for this content field: required and string.

When I write something in the CKEditor field and try to submit changes, I will get error " Content cannot be blank. " If I try to submit again ( without changing anything, just press submit button again ), everything that was written will be saved.

If I turn off required rule, I will be able to submit form, but text that is written in CKEditor field will not be saved.

What do you think, why is this happening ?

ActiveForm and enableClientValidation=true

Hello

Thanks for this useful widget.

Just a little problem with ActiveForm and client validation on a required field, submit button will not trigger validation on the first time (since corresponding input is not updated). I can make a PR for this if you want.

How to add lineheight plugin?

There is just a brief introduction in the homepage to add plugin, but can someone please give a more detail steps I need to to to include a plugin? For example, I want to integrate the lineheight plugin, how can I do it? Directly download the plugin folder and put it in vendor folder? Or somewhere else? Thanks!

CKEditor bar doesn't show

When i try to add a field with a CKEditor, it doesn't show the bar. All it shows is a resizable text input window. (see image)

ckeditor_img

Code:

use dosamigos\ckeditor\CKEditor;

$form = ActiveForm::begin() ?>  
<?= $form->field($model, 'name')->widget(CKEditor::className(), [
    'options' => ['rows' => 6],
    'preset' => 'basic'
]) ?>
<?php ActiveForm::end() ?>

Strange tooltip/ text appear when mouse hover on editor

This is my code :

<?php 
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\base\DynamicModel;
use dosamigos\ckeditor\CKEditor; 
?>

<?php 
$model = new \yii\base\DynamicModel(['cms_content']);
?>
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, 'cms_content')->widget(CKEditor::className(), [
        'options' => ['rows' => 6],
        'preset' => 'full'
    ]) ?>
<?php ActiveForm::end(); ?>

When I move cursor into textarea, strange tooltip are fired beside textarea Rich Text Editor, dynamicmodel-cms_content
how could this happen ?

Missing widget plugin

I need an addon widget to install another external plugin. But I couldn't find this addon in vendor/2amigos/yii2-ckeditor-widget/src/assets/ckeditor/plugins and bower.io

Options >> Rows

Setting 'options' => ['rows' => 12] does nothing. There are still only the default 5 rows.

Toolbar

When I select 'standard' as an option for the editor it displays the toolbars on three lines. There is enough space for these to display on a single line.

How can I make the editor do this as it looks very bad?

Missing sourcedialog plugin

Hello

It should be great to use another branch of ckeditor since dev-full/stable do not include common plugins (e.g. sourcedialog). And why not using bower assets ?

.git folder

Hi!

I am tríing to install my vendor folder on a shared hosting server, so only ftp is available.
My solution is to use an own git repository for all the files I need in production and then use git-ftp to upload changes.

My problem is that in your extension folder there is an other .git folder, so I can't push this to my bitbucket repository.

Is there any way to ignore the .git folder somehow (ex. in the .gitignore file)?
Or do you have a working solution, how to deploy vendor folder on shared hosing?

Thanks,
Norbert.

In Active Form on Submit send the html code

I was trying to use this repo using active form.
Editor was showing on screen.
But when i enter data and submit the data then only normal text is posted to the action of active form.
Is there is any way to access the html data of the editor on click submit.

After last composer update, the full version not render...

After last update, the full version of ckeditor not render, only the basic or standart... why? :/

composer.json

"2amigos/yii2-ckeditor-widget" : "~1.0"

code

echo $form->field($modelCabecalho, 'valor', ['template' => '{input}{hint}{error}'])->widget(CKEditor::className(), [
    'options' => ['rows' => 3],
    'preset' => 'full'
]);

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.