import { DecreaseIndentLight, IncreaseIndentLight } from "@wix/wix-ui-icons-common";
import { RICOS_INDENT_TYPE } from "./../ricos-content/index.js";
import { createShortcut } from "./../ricos-types/index.js";
import { isAlwaysVisible } from "./../_shared/resolvers/is-always-visible.js";
import { isNodeOrCaptionSelected } from "./../_shared/resolvers/is-node-or-caption-selected.js";
import { TEXT_BUTTON_DECREASE_INDENT, TEXT_BUTTON_INCREASE_INDENT } from "./data-hooks.js";
import { DEFAULTS } from "./defaults.js";
import { indent } from "./tiptap.js";
import { INDENT_TYPE } from "./types.js";
const pluginIndent = (config) => {
  return {
    config: { type: "indent", ...DEFAULTS.config, ...config },
    type: INDENT_TYPE,
    shortcuts: [
      createShortcut({
        name: `INDENT.increase`,
        description: "ShortcutsSheet_Formatting_IncreaseIndent",
        keys: { macOs: "Meta+]", windows: "Ctrl+]" },
        command({ publicCommands }) {
          publicCommands.insertDecoration(RICOS_INDENT_TYPE);
          return "continue";
        },
        group: "ShortcutsSheet_Section_Formatting",
        enabled: true,
        showInShortcutSheet: true
      }),
      createShortcut({
        name: `INDENT.decrease`,
        description: "ShortcutsSheet_Formatting_DecreaseIndent",
        keys: { macOs: "Meta+[", windows: "Ctrl+[" },
        command({ publicCommands }) {
          publicCommands.deleteDecoration(RICOS_INDENT_TYPE);
          return "continue";
        },
        group: "ShortcutsSheet_Section_Formatting",
        enabled: true,
        showInShortcutSheet: true
      })
    ],
    textButtons: [
      {
        id: `INDENT.increase`,
        type: "toggle",
        presentation: {
          dataHook: TEXT_BUTTON_INCREASE_INDENT,
          tooltip: "increaseIndentButton_Tooltip",
          icon: IncreaseIndentLight
        },
        attributes: {
          visible: isAlwaysVisible,
          disabled: isNodeOrCaptionSelected
        },
        command: ({ publicCommands }) => () => {
          publicCommands.insertDecoration(RICOS_INDENT_TYPE);
          return true;
        }
      },
      {
        id: `INDENT.decrease`,
        type: "toggle",
        presentation: {
          dataHook: TEXT_BUTTON_DECREASE_INDENT,
          tooltip: "decreaseIndentButton_Tooltip",
          icon: DecreaseIndentLight
        },
        attributes: {
          visible: isAlwaysVisible,
          disabled: isNodeOrCaptionSelected
        },
        command: ({ publicCommands }) => () => {
          publicCommands.deleteDecoration(RICOS_INDENT_TYPE);
          return true;
        }
      }
    ],
    tiptapExtensions: [indent]
  };
};
export {
  pluginIndent
};
//# sourceMappingURL=editor.js.map
