import { ButtonPill, ButtonPillSmall } from "@wix/wix-ui-icons-common";
import buttonDataDefaults from "./../ricos-schema/legacy/statics/button.defaults.json.js";
import { ButtonData_Type } from "./../ricos-schema/next-schema/index.js";
import {
  Node_Type,
  RicosPluginToolbarNames,
  quickActionsModalSections
} from "./../ricos-types/index.js";
import { getInitialLinkData } from "./../_shared/link/get-initial-link-data.js";
import { actionButtonConverter, linkButtonConverter } from "./button-converters.js";
import { DEFAULT_CONFIG } from "./constants.js";
import { getAddButtons } from "./get-add-buttons.js";
import { getToolbarButtons } from "./get-toolbar-buttons.js";
import { tiptapExtensionsMap } from "./tiptap/tiptap.js";
import { ACTION_BUTTON_TYPE, LINK_BUTTON_TYPE } from "./types.js";
const pluginLinkButton = (config) => {
  const type = LINK_BUTTON_TYPE;
  return {
    config: { type: "linkButton", ...DEFAULT_CONFIG, ...config },
    type,
    pmMarkConverters: [],
    pmNodeConverters: [linkButtonConverter],
    toolbar: {
      names: [RicosPluginToolbarNames.LINK_BUTTON],
      getButtons: (c, services) => getToolbarButtons({ config: c, services, type })
    },
    getAddButtons: (c, services) => getAddButtons(c, services, type),
    tiptapExtensions: tiptapExtensionsMap({ disableResize: config?.disableResize ?? false })[type],
    getQuickActions: ({ pluginServices }) => [
      {
        id: Node_Type.BUTTON,
        icon: pluginServices?.context.isMobile ? ButtonPill : ButtonPillSmall,
        title: "QuickActionsPlugin_ActionTitle_Button",
        section: quickActionsModalSections.FormatLayout,
        tags: ["action", "link", "call-to-action", "interactive", "clickable"],
        command: ({ publicCommands }) => {
          const initialLinkOptions = getInitialLinkData(
            pluginServices.editorProps.generalLinkSettings?.initialLinkOptions
          );
          publicCommands.insertBlockWithBlankLines(LINK_BUTTON_TYPE, {
            ...buttonDataDefaults,
            link: initialLinkOptions,
            // @ts-expect-error
            type: ButtonData_Type.LINK
          });
        }
      }
    ]
  };
};
const pluginActionButton = (config) => {
  const type = ACTION_BUTTON_TYPE;
  return {
    config: { type: "actionButton", ...DEFAULT_CONFIG, ...config },
    type,
    pmMarkConverters: [],
    pmNodeConverters: [actionButtonConverter],
    toolbar: {
      names: [RicosPluginToolbarNames.ACTION_BUTTON],
      getButtons: (config2, services) => getToolbarButtons({ config: config2, services, type })
    },
    getAddButtons: (config2, services) => getAddButtons(config2, services, type),
    tiptapExtensions: tiptapExtensionsMap({ disableResize: config?.disableResize ?? false })[type]
  };
};
export {
  pluginActionButton,
  pluginLinkButton
};
//# sourceMappingURL=editor.js.map

import { injectCss } from "./viewer-styles-inject.js";
injectCss();
