From 218a171b79cc796ce8ccd31ac6c309c141c0aa36 Mon Sep 17 00:00:00 2001 From: Fabian Date: Tue, 1 Oct 2024 08:55:40 +0200 Subject: [PATCH] Type fixes, closes #155 --- package.json | 2 +- src/toolbox.js | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 424e20e..b7d0075 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@editorjs/table", "description": "Table for Editor.js", - "version": "2.4.1", + "version": "2.4.2", "license": "MIT", "repository": "https://github.com/editor-js/table", "files": [ diff --git a/src/toolbox.js b/src/toolbox.js index f28c8d3..453cd14 100644 --- a/src/toolbox.js +++ b/src/toolbox.js @@ -1,6 +1,16 @@ import Popover from "./utils/popover"; import * as $ from "./utils/dom"; import { IconMenuSmall } from "@codexteam/icons"; + +/** + * @typedef {object} PopoverItem + * @property {string} label - button text + * @property {string} icon - button icon + * @property {boolean} confirmationRequired - if true, a confirmation state will be applied on the first click + * @property {function} hideIf - if provided, item will be hid, if this method returns true + * @property {function} onClick - click callback + */ + /** * Toolbox is a menu for manipulation of rows/cols * @@ -14,11 +24,12 @@ export default class Toolbox { /** * Creates toolbox buttons and toolbox menus * - * @param {object} api - Editor.js api - * @param {PopoverItem[]} items - Editor.js api - * @param {function} onOpen - callback fired when the Popover is opening - * @param {function} onClose - callback fired when the Popover is closing - * @param {string} [cssModifier] - the modifier for the Toolbox. Allows to add some specific styles. + * @param {Object} config + * @param {any} config.api - Editor.js api + * @param {PopoverItem[]} config.items - Editor.js api + * @param {function} config.onOpen - callback fired when the Popover is opening + * @param {function} config.onClose - callback fired when the Popover is closing + * @param {string} config.cssModifier - the modifier for the Toolbox. Allows to add some specific styles. */ constructor({ api, items, onOpen, onClose, cssModifier = "" }) { this.api = api;