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

Custom Button with mode:3 #56

Closed
mdevDE opened this issue May 25, 2018 · 1 comment
Closed

Custom Button with mode:3 #56

mdevDE opened this issue May 25, 2018 · 1 comment

Comments

@mdevDE
Copy link

mdevDE commented May 25, 2018

Jodit Version:** 3.1.96

Code

{
    name    : 'list_test',
    iconURL : 'stuf/dummy.png',
    mode    : 3,
    list    : {
        h1: 'insert Header 1',
        h2: 'insert Header 2',
        clear: 'Empty editor'
    },
    exec    : function(this:any, editor: any) {
        var key = this.args[0],
        value = this.args[1];
        if (key === 'clear') {
            this.val('');
            return;
        }
        editor.selection.insertHTML(' {{test'+key+'}} ');
    },
    template: function(key: string, value: string){
        return '<div>' + value + '</div>';
    }
}

Expected behavior:

  1. The Button should be active in source code mode
  2. The list items should also be active
    Actual behavior:
  3. ok
  4. all items are disabled

jodit bug

@salahatwa
Copy link

this.config.extraButtons= [{
name: 'OnlyParagraph',
icon: 'fa fa-superscript',
mode : 1 | 2 | 3,
tooltip:"EXTERA",
isActive:true,
exec: (editor) => {
var selection = editor.selection;
var text = editor.selection.getHTML();
console.log(text);
var html = '

' + text + '

'
console.log(html);
editor.selection.remove();
editor.selection.insertHTML(html);
}
}]

vinhtranchau added a commit to vinhtranchau/jodit-repo that referenced this issue Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants