Skip to content

Commit

Permalink
Added documentation about buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
xdan committed Mar 1, 2025
1 parent ef74389 commit b96eb32
Showing 1 changed file with 35 additions and 36 deletions.
71 changes: 35 additions & 36 deletions docs/buttons.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Jodit.make('#editor', {

{% include [Example1](./_includes/example1.md) %}


> We implement the [IControlType](https://xdsoft.net/jodit/docs/interfaces/types.IControlType.html) interface.
We are using the pre-connected icon `source`.
Expand Down Expand Up @@ -313,18 +312,18 @@ For this purpose, the [IControlType](https://xdsoft.net/jodit/docs/interfaces/ty
```js
Jodit.make('#editor', {
buttons: [
{
name: 'button',
icon: 'cut',
isDisabled: (editor, control) => {
return editor.selection.isCollapsed();
},
exec: editor => {
editor.execCommand('cut');
}
}
]
buttons: [
{
name: 'button',
icon: 'cut',
isDisabled: (editor, control) => {
return editor.selection.isCollapsed();
},
exec: editor => {
editor.execCommand('cut');
}
}
]
});
```
Expand All @@ -334,18 +333,18 @@ There is also the `isActive` method, which can be used to signal to the user tha
```js
Jodit.make('#editor', {
buttons: [
{
icon: 'link',
isActive: (editor, control) => {
const current = editor.selection.current();
return Jodit.modules.Dom.closest(current, 'a', editor.editor);
},
exec: editor => {
editor.execCommand('unlink');
}
}
]
buttons: [
{
icon: 'link',
isActive: (editor, control) => {
const current = editor.selection.current();
return Jodit.modules.Dom.closest(current, 'a', editor.editor);
},
exec: editor => {
editor.execCommand('unlink');
}
}
]
});
```
Expand All @@ -355,16 +354,16 @@ You can even remove the button from the toolbar entirely if it is not needed at
```js
Jodit.make('#editor', {
buttons: [
{
icon: 'link',
isVisible: (editor, control) => {
return editor.selection.isCollapsed();
},
exec: editor => {
editor.execCommand('unlink');
}
}
]
buttons: [
{
icon: 'link',
isVisible: (editor, control) => {
return editor.selection.isCollapsed();
},
exec: editor => {
editor.execCommand('unlink');
}
}
]
});
```

0 comments on commit b96eb32

Please sign in to comment.