/*! * Jodit Editor PRO (https://xdsoft.net/jodit/) * See LICENSE.md in the project root for license information. * Copyright (c) 2013-2022 Valeriy Chupurnov. All rights reserved. https://xdsoft.net/jodit/pro/ */ import type { CanUndef, IJodit } from 'jodit/types'; // import type { IEmoji, IEmojiData } from './interface'; // import type { IAutoCompleteItem } from '../autocomplete/interface'; import { Plugin } from 'jodit/core/plugin'; import { Dialog } from 'jodit/modules'; // import { Emoji } from './ui/emoji'; // import { trim } from 'jodit/core/helpers'; // import { autobind } from 'jodit/core/decorators'; import { Jodit } from '../../index'; import autobind from 'autobind-decorator'; import { Button } from 'jodit/core/ui/button'; import './config'; import { attr, css } from 'jodit/src/core/helpers'; import { IframeType, InlinePopupAttribute } from '../inline-popup/inline-popup'; export const enum PostMessagePath { Editor = 'superclub/editor', Vote = 'superclub/vote', Superclub = 'superclub', Chat = 'superclub/chat' } const enum RequestCommand { Initialize = 'initialize', CreateVote = 'create/vote', ResetVote = 'reset/vote' } const enum ResponseCommand { CreateSuccess = 'create/vote/success', Ready = 'ready', MeasureHeightSuccess = 'measure/height/success' } export class vote extends Plugin { // /** @override */ // override hasStyle: boolean = !Jodit.fatMode; private __dialog!: Dialog; private __voteIframe!: HTMLIFrameElement; // private __voteId!: number; /** @override */ protected async afterInit(jodit: IJodit): Promise { jodit.e .on('toggleVote', this.toggleVote) .on('isVoteOpened', () => this.__dialog?.isOpened); window.addEventListener('message', this.messageHandler); } /** @override */ protected beforeDestruct(jodit: IJodit): void {} @autobind toggleVote(target: CanUndef): void { if (!this.__dialog) { this.__dialog = new Dialog({ resizable: false, draggable: false }); this.__dialog.setHeader(this.jodit.i18n('poll')).setSize(600, 700); } this.__voteIframe = this.jodit.c.fromHTML( `