UNPKG

jodit

Version:

Jodit is an awesome and useful wysiwyg editor with filebrowser

46 lines (45 loc) 1.83 kB
/*! * Jodit Editor (https://xdsoft.net/jodit/) * Released under MIT see LICENSE.txt in the project root for license information. * Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net */ import { Dom } from "../../core/dom/index.js"; import { Icon } from "../../core/ui/icon.js"; import { Config } from "../../config.js"; import indentIcon from "./icons/indent.svg.js"; import outdentIcon from "./icons/outdent.svg.js"; import { getKey } from "./helpers.js"; Icon.set('indent', indentIcon).set('outdent', outdentIcon); Config.prototype.controls.indent = { tooltip: 'Increase Indent' }; Config.prototype.controls.outdent = { isDisabled: (editor) => { var _a; const current = editor.s.current(); if (!current) { return true; } // A list item whose list is nested inside another list item can be // outdented (un-nested) by the `tab` plugin, even without an inline // indent margin. Keep the button enabled in that case. See #1247 if ((_a = editor.o.tab) === null || _a === void 0 ? void 0 : _a.tabInsideLiInsertNewList) { const li = Dom.closest(current, 'li', editor.editor); if (li) { const list = Dom.closest(li, ['ul', 'ol'], editor.editor); if (list && Dom.closest(list, 'li', editor.editor)) { return false; } } } const currentBox = Dom.closest(current, Dom.isBlock, editor.editor); if (currentBox) { const arrow = getKey(editor.o.direction, currentBox); return (!currentBox.style[arrow] || parseInt(currentBox.style[arrow], 10) <= 0); } return true; }, tooltip: 'Decrease Indent' }; Config.prototype.indentMargin = 10;