2017 © Pedro Peláez
 

yii2-extension yii2-markitup

MarkItUp widget for Yii2

image

coderlex/yii2-markitup

MarkItUp widget for Yii2

  • Saturday, January 30, 2016
  • by coderlex
  • Repository
  • 1 Watchers
  • 0 Stars
  • 96 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 3 Versions
  • 2 % Grown

The README.md

yii2-markitup

MarkItUp (http://markitup.jaysalvat.com) widget for Yii2, (*1)

Install via composer

Run in your console:, (*2)

php composer.phar global require "fxp/composer-asset-plugin:1.0.0"
php composer.phar require "coderlex/yii2-markitup" "*"

Basic usage

$form = \yii\widgets\ActiveForm::begin();
print $form->field($model, 'content')->widget(\coderlex\markitup\MarkItUp::className(), [
    // Textarea options (default):
    'options' => ['class' => 'form-control', 'style' => 'overflow:auto;resize:none;'],
    // Skin (default):
    'skin' => 'simple',
    // JS widget initialization options:
    'clientOptions' => [
        'markupSet' => [    
            [
                'name' => 'Bold',
                'key' => 'B',
                'className' => 'markitup-bold',
                'openWith' => '[b]',
                'closeWith' => '[/b]'
            ],
            // ...
            ['separator' => '---------------'],
            [
                'name' => 'Numeric List',
                'className' => 'markitup-nlist',
                'openWith' => '[*]',
                'multiline' => true,
                'openBlockWith' => "[list=1]\n",
                'closeBlockWith' => "\n[/list]"
            ],
            // ...
            ['separator' => '---------------'],
            [
                'name' => 'Link',
                'key' => 'L',
                'className' => 'markitup-link',
                'replaceWith' => '[url=[![Link:!:http://]!]](!( title="[![Title]!]")!)[/url]',
                'placeHolder' => 'Your text to link...'
            ],
            // ...
        ]
    ],
]);
\yii\widgets\ActiveForm::end();

Styling:, (*3)

$markitup-btn-height: 24px;
$markitup-btn-width: 24px;

html {
    .markItUpHeader ul a {
        height: $markitup-btn-height;
        width: $markitup-btn-width;
        text-align: center;
        line-height: $markitup-btn-width;
    }
    .markItUpHeader ul .markItUpSeparator {
        height: $markitup-btn-height;
    }
    .markItUpEditor {
        width: 100%;
    }
    .markItUp {
        width: auto;
    }
}
%markitup-button {
    @include fa-icon();
    font-size: 14px;
    display: block;
    text-indent: 0;
    position: absolute;
    left: 0;
    top: 0;
    width: $markitup-btn-width;
    height: $markitup-btn-height;
    line-height: $markitup-btn-height;
}
.markitup-bold a:before {
    @extend %markitup-button;
    content: $fa-var-bold;
}
.markitup-italic a:before {
    @extend %markitup-button;
    content: $fa-var-italic;
}
.markitup-underline a:before {
    @extend %markitup-button;
    content: $fa-var-underline;
}
.markitup-strike a:before {
    @extend %markitup-button;
    content: $fa-var-strikethrough;
}
.markitup-blist a:before {
    @extend %markitup-button;
    content: $fa-var-list-ul;
}
.markitup-nlist a:before {
    @extend %markitup-button;
    content: $fa-var-list-ol;
}
.markitup-image a:before {
    @extend %markitup-button;
    content: $fa-var-picture-o;
}
.markitup-link a:before {
    @extend %markitup-button;
    content: $fa-var-link;
}
.markitup-preview a:before {
    @extend %markitup-button;
    content: $fa-var-eye;
}

The Versions

30/01 2016

dev-master

9999999-dev

MarkItUp widget for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Korostin

yii2 markitup

30/01 2016

1.0.1

1.0.1.0

MarkItUp widget for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Korostin

yii2 markitup

30/01 2016

1.0.0

1.0.0.0

MarkItUp widget for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Alexander Korostin

yii2 markitup