mirror of
https://github.com/codex-team/editor.js
synced 2024-06-29 10:50:23 +02:00
inline-tools: prevent default behaviour on clicks to prevent form submitting (#454)
* fix inline-tool buttons * prevent default on inline-tool clicks * update * update version from package json * update version and use badgen in README * upd
This commit is contained in:
parent
cbe8fd2965
commit
bdae8d3fad
|
@ -1,6 +1,6 @@
|
||||||
<p align="center"><img src="https://capella.pics/3c0b525b-50d9-4720-8aad-9148114cfa6e.jpg"></p>
|
<p align="center"><img src="https://capella.pics/3c0b525b-50d9-4720-8aad-9148114cfa6e.jpg"></p>
|
||||||
|
|
||||||
![](https://flat.badgen.net/badge/CodeX%20Editor/v2.0.10/blue?icon=npm)
|
[![](https://flat.badgen.net/npm/v/codex.editor?icon=npm)](https://www.npmjs.com/package/codex.editor)
|
||||||
|
|
||||||
## Version 2.0-beta is here!
|
## Version 2.0-beta is here!
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "codex.editor",
|
"name": "codex.editor",
|
||||||
"version": "2.0.10",
|
"version": "2.0.12",
|
||||||
"description": "Codex Editor. Native JS, based on API and Open Source",
|
"description": "Codex Editor. Native JS, based on API and Open Source",
|
||||||
"main": "build/codex-editor.js",
|
"main": "build/codex-editor.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
@ -44,6 +44,7 @@ export default class BoldInlineTool implements InlineTool {
|
||||||
*/
|
*/
|
||||||
public render(): HTMLElement {
|
public render(): HTMLElement {
|
||||||
this.nodes.button = document.createElement('button');
|
this.nodes.button = document.createElement('button');
|
||||||
|
this.nodes.button.type = 'button';
|
||||||
this.nodes.button.classList.add(this.CSS.button, this.CSS.buttonModifier);
|
this.nodes.button.classList.add(this.CSS.button, this.CSS.buttonModifier);
|
||||||
this.nodes.button.appendChild($.svg('bold', 13, 15));
|
this.nodes.button.appendChild($.svg('bold', 13, 15));
|
||||||
return this.nodes.button;
|
return this.nodes.button;
|
||||||
|
|
|
@ -43,6 +43,7 @@ export default class ItalicInlineTool implements InlineTool {
|
||||||
*/
|
*/
|
||||||
public render(): HTMLElement {
|
public render(): HTMLElement {
|
||||||
this.nodes.button = document.createElement('button');
|
this.nodes.button = document.createElement('button');
|
||||||
|
this.nodes.button.type = 'button';
|
||||||
this.nodes.button.classList.add(this.CSS.button, this.CSS.buttonModifier);
|
this.nodes.button.classList.add(this.CSS.button, this.CSS.buttonModifier);
|
||||||
this.nodes.button.appendChild($.svg('italic', 6, 15));
|
this.nodes.button.appendChild($.svg('italic', 6, 15));
|
||||||
return this.nodes.button;
|
return this.nodes.button;
|
||||||
|
|
|
@ -71,6 +71,7 @@ export default class LinkInlineTool implements InlineTool {
|
||||||
*/
|
*/
|
||||||
public render(): HTMLElement {
|
public render(): HTMLElement {
|
||||||
this.nodes.button = document.createElement('button');
|
this.nodes.button = document.createElement('button');
|
||||||
|
this.nodes.button.type = 'button';
|
||||||
this.nodes.button.classList.add(this.CSS.button, this.CSS.buttonModifier);
|
this.nodes.button.classList.add(this.CSS.button, this.CSS.buttonModifier);
|
||||||
this.nodes.button.appendChild($.svg('link', 15, 14));
|
this.nodes.button.appendChild($.svg('link', 15, 14));
|
||||||
this.nodes.button.appendChild($.svg('unlink', 16, 18));
|
this.nodes.button.appendChild($.svg('unlink', 16, 18));
|
||||||
|
|
|
@ -304,8 +304,9 @@ export default class InlineToolbar extends Module {
|
||||||
this.nodes.actions.appendChild(actions);
|
this.nodes.actions.appendChild(actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Editor.Listeners.on(button, 'click', () => {
|
this.Editor.Listeners.on(button, 'click', (event) => {
|
||||||
this.toolClicked(tool);
|
this.toolClicked(tool);
|
||||||
|
event.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue