kartik-v / yii2-markdown

Advanced Markdown editing and conversion utilities for Yii Framework 2.0

Home Page:http://demos.krajee.com/markdown

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Full screen, preview, and export buttons don't work

amnah opened this issue · comments

These three buttons don't seem to work, but everything else does (bold italics etc).

No javascript errors in console.

Fresh installation:

  1. composer.json "kartik-v/yii2-markdown": "dev-master"
  2. add module 'markdown' => [ 'class' => 'kartik\markdown\Module' ]
  3. add to view
    <?=  MarkdownEditor::widget([
        'model' => $model,
        'attribute' => 'text',
    ]) ?>

The plugin requires bootstrap modal.js to be loaded in your view for the modal popup for full screen toggling. Check if you have BootstrapPluginAsset or something loading the bootstrap JS.

It looks like it's there. This is a fresh installation.

In file /web/assets/cd20e318/js/bootstrap.js

/* ========================================================================
 * Bootstrap: modal.js v3.3.1
 * http://getbootstrap.com/javascript/#modals
 * ========================================================================
 * Copyright 2011-2014 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * ======================================================================== */

Check for javascript errors due to other jquery/javascript conflicts that could be causing this. You can check for JS errors on your browser console (e.g. using Firebug in Firefox).

It is possible that your asset dependency is not correct.

I pushed in a fix with release v1.2.0 to make SURE that the extension is dependent on BootstrapPluginAsset now. It maybe possible that your bootstrap assets are loading in the wrong sequence earlier. This fix should avoid this. You may upgrade packages via composer and let know.

There's a bug in your fix, missing a comma. See:

public $depends = [
        'yii\web\YiiAsset',
        'yii\bootstrap\BootstrapAsset'
        'yii\bootstrap\BootstrapPluginAsset'
    ];

Regardless, it didn't work....

What did seem to work is using jquery-ui.

composer.json
    "yiisoft/yii2-jui": "*",

Then if I add a DatePicker to the form, it works properly.

Is jquery-ui supposed to be a dependency in this?

No JUI is not needed for this extension.

The extension works in isolation with just dependency on Jquery and Bootstrap.

Unfortunately, not able to replicate your scenario or your environment even for a fresh install. In case you can debug your environment let know.

This seems to be a chrome issue or something; it works fine in firefox.

It's really weird, but it looks like it stems from kv-markdown.js.

If I add an alert('hi'); at the end of the file, it works.