Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ability to hide/disable specific button actions #3

Closed
RobiNN1 opened this issue Jul 26, 2018 · 11 comments
Closed

Allow ability to hide/disable specific button actions #3

RobiNN1 opened this issue Jul 26, 2018 · 11 comments

Comments

@RobiNN1
Copy link
Contributor

RobiNN1 commented Jul 26, 2018

How disable plugins?
jQuery v2.2.4 Also tested with latest jQuery but no changes

This doesn't work

$("#mdeditor").markdownEditor({
      bsVersion: '3.3.7',
      enableEmojies: false,
       dropUp: {
           export: false
           }
       });
@kartik-v
Copy link
Owner

I am not clear with the issue. Please go through the plugin usage in the documentation to understand how to setup and use the plugin.

@RobiNN1
Copy link
Contributor Author

RobiNN1 commented Jul 27, 2018

I have read the documentation before setup but it still does not work. I need only disable emojis and export.

Html file only with editor (copied from readme)

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css">
    <link href="css/markdown-editor.min.css" media="all" rel="stylesheet" type="text/css"/>
    <link href="plugins/highlight/highlight.min.css" media="all" rel="stylesheet" type="text/css"/>
    <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
    <script src="http://twemoji.maxcdn.com/2/twemoji.min.js?11.0"></script>
    <script src="plugins/purify/purify.min.js" type="text/javascript"></script>
    <script src="plugins/markdown-it/markdown-it.min.js" type="text/javascript"></script>
    <script src="plugins/markdown-it/markdown-it-deflist.min.js" type="text/javascript"></script>
    <script src="plugins/markdown-it/markdown-it-footnote.min.js" type="text/javascript"></script>
    <script src="plugins/markdown-it/markdown-it-abbr.min.js" type="text/javascript"></script>
    <script src="plugins/markdown-it/markdown-it-sub.min.js" type="text/javascript"></script>
    <script src="plugins/markdown-it/markdown-it-sup.min.js" type="text/javascript"></script>
    <script src="plugins/markdown-it/markdown-it-ins.min.js" type="text/javascript"></script>
    <script src="plugins/markdown-it/markdown-it-mark.min.js" type="text/javascript"></script>
    <script src="plugins/markdown-it/markdown-it-smartarrows.min.js" type="text/javascript"></script>
    <script src="plugins/markdown-it/markdown-it-checkbox.min.js" type="text/javascript"></script>
    <script src="plugins/markdown-it/markdown-it-cjk-breaks.min.js" type="text/javascript"></script>
    <script src="plugins/markdown-it/markdown-it-emoji.min.js" type="text/javascript"></script>
    <script src="plugins/highlight/highlight.min.js" type="text/javascript"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.bundle.min.js" type="text/javascript"></script>
    <script src="js/markdown-editor.min.js" type="text/javascript"></script>
    <script src="js/locales/en.js" type="text/javascript"></script>
    <script type="text/javascript">$(function () {
    $("#textarea-id").markdownEditor({
        enableEmojies: false,
        dropUp: {
            export: false
        }
    });
});</script>
</head>
<body>
    <textarea id="textarea-id"></textarea>
</body>
</html>

@kartik-v
Copy link
Owner

Initialize the plugin on document.ready.

@RobiNN1
Copy link
Contributor Author

RobiNN1 commented Jul 27, 2018

Already is initialized and all is loaded
$(function () { this is shorthand for $(document ).ready()

<script type="text/javascript">$(function () {
    $("#textarea-id").markdownEditor({
        enableEmojies: false,
        dropUp: {
            export: false
        }
    });
});</script>

@kartik-v
Copy link
Owner

Am not able to reproduce any issues with this - could you please create a JS Fiddle for this and share? That may help you narrow down to the problem.

@RobiNN1
Copy link
Contributor Author

RobiNN1 commented Jul 27, 2018

@RobiNN1
Copy link
Contributor Author

RobiNN1 commented Oct 21, 2018

Is it fixed?

@kartik-v
Copy link
Owner

Sorry - not got a time to check this. Will check and update.

@kartik-v
Copy link
Owner

The recommended method to hide or show only your own toolbar buttons is to actually override toolbarHeaderL, toolbarHeaderR, toolbarFooterL and toolbarFooterR - to show only the buttons you need.

However I will record an enhancement to see if this can be done better.

@kartik-v kartik-v changed the title Disable plugin Allow ability to hide/disable specific button actions Oct 22, 2018
@kartik-v
Copy link
Owner

Ok I added in an enhancement. You can hide specific button actions in the toolbar via new property hiddenActions. Set the list of button action keys you wish to hide. For your use case this will work:

$(function () {
    $("#textarea-id").markdownEditor({
        hiddenActions: ['emoji', 'export']
    });
});

@RobiNN1
Copy link
Contributor Author

RobiNN1 commented Oct 22, 2018

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants