kartik-v / yii2-markdown

Advanced Markdown editing and conversion utilities for Yii Framework 2.0
http://demos.krajee.com/markdown
Other
89 stars 41 forks source link

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

Closed amnah closed 9 years ago

amnah commented 9 years ago

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',
    ]) ?>
kartik-v commented 9 years ago

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.

amnah commented 9 years ago

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)
 * ======================================================================== */
kartik-v commented 9 years ago

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

kartik-v commented 9 years ago

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.

amnah commented 9 years ago

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

amnah commented 9 years ago

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?

kartik-v commented 9 years ago

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.

amnah commented 9 years ago

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.

derekisbusy commented 9 years ago

I have fixed this issue in my branch...

https://github.com/derekisbusy/yii2-markdown/pull/1/commits