import { Smile, SmileSmall } from "@wix/wix-ui-icons-common";
import { quickActionsModalSections } from "./../ricos-types/index.js";
import { posToDOMRect } from "./../tiptap/index.js";
import { getTipTapExtensions } from "./extension.js";
import { getAddButtons } from "./get-add-buttons.js";
import { EmojiInsertModal } from "./modals/insert-modal.js";
import { EMOJI_TYPE, emojiModals } from "./types.js";
const pluginEmoji = (config) => {
  return {
    config: { type: "emoji", ...config },
    type: EMOJI_TYPE,
    tiptapExtensions: getTipTapExtensions(),
    getAddButtons: (config2, services) => getAddButtons(config2, services),
    getQuickActions: ({ pluginServices }) => {
      const isMobile = pluginServices?.context.isMobile;
      return [
        {
          id: EMOJI_TYPE,
          title: "QuickActionsPlugin_ActionTitle_Emoji",
          icon: isMobile ? Smile : SmileSmall,
          section: quickActionsModalSections.FormatLayout,
          tags: ["smiley", "emoticon", "face", "reaction", "emotions", "symbol"],
          command: ({ modalService, editor }) => {
            modalService.togglePluginPanel({
              id: emojiModals.insert,
              Component: EmojiInsertModal,
              componentProps: {},
              isMobile,
              positioning: {
                referenceElement: {
                  getBoundingClientRect: () => posToDOMRect(
                    editor.view,
                    editor.view.state.selection.from,
                    editor.view.state.selection.to
                  )
                },
                placement: isMobile ? "bottom" : "bottom-start"
              },
              onClickOutside: () => modalService.closeModal(emojiModals.insert),
              mobileLayout: "drawer"
            });
          }
        }
      ];
    }
  };
};
export {
  pluginEmoji
};
//# sourceMappingURL=editor.js.map
