Closed morivitalii closed 10 years ago
Have you checked the Markdown Editor documentation? You can customize virtually every option and all the use cases you need above can be setup as mentioned in the editor settings.
For example to change a button icon there are 2 methods:
icon
to each button's options. It will render the bootstrap glyphicon.icon
to null in buttonOptions
and set the label
to a html markup to generate the icon. You need to set encodeLabels
to false in buttonOptions
or individually set encodeLabel
to false for each button so that it renders the html markup for button icons. For example to set a custom toolbar:use kartik\markdown\MarkdownEditor;
$customToolbar = [
[
'buttons' => [
MarkdownEditor::BTN_BOLD => ['label'=>'<img src="/images/bold.png">', 'title' => 'Bold'],
MarkdownEditor::BTN_ITALIC => ['label'=>'<span class="custom-icon-italic"></span>', 'title' => 'Italic'],
]
],
[
'buttons' => [
MarkdownEditor::BTN_LINK => ['icon' => 'link', 'title' => 'URL/Link'],
MarkdownEditor::BTN_IMAGE => ['icon' => 'picture', 'title' => 'Image'],
],
],
];
// usage with model and a custom toolbar
echo MarkdownEditor::widget([
'model' => $model,
'attribute' => 'markdown',
'buttonOptions' => ['encodeLabels' => false],
'toolbar' => $customToolbar
]);
Thank you. I will choose the second method
I want to use this css framework https://github.com/olton/Metro-UI-CSS with editor This framewok is not compatible with twitter bootstrap. Can you add more features for compatibility with other css frameworks? For example. Icons. twb - class="glyphicon glyphicon-{$icon}", metroui - class="icon-{$icon}"