/*! * Jodit Editor (https://xdsoft.net/jodit/) * Released under MIT see LICENSE.txt in the project root for license information. * Copyright (c) 2013-2021 Valeriy Chupurnov. All rights reserved. https://xdsoft.net */ import './resizer.less'; import type { HTMLTagNames, IBound, Nullable } from '../../types'; import type { IJodit } from '../../types'; import { Config } from '../../config'; import * as consts from '../../core/constants'; import { IS_IE } from '../../core/constants'; import { Dom } from '../../core/dom'; import { $$, attr, css, offset, innerWidth, markOwner } from '../../core/helpers'; import { Plugin } from '../../core/plugin'; import { eventEmitter } from '../../core/global'; import { autobind, debounce, watch } from '../../core/decorators'; /** * The module creates a supporting frame for resizing of the elements img and table * @module Resizer * @params {Object} parent Jodit main object */ /** * @property{boolean} useIframeResizer=true Use true frame for editing iframe size */ declare module '../../config' { interface Config { allowResizeTags: HTMLTagNames[]; resizer: { showSize: boolean; hideSizeTimeout: number; min_width: number; min_height: number; }; } } Config.prototype.allowResizeTags = ['img', 'iframe', 'table', 'jodit']; /** * @property {object} resizer * @property {int} resizer.min_width=10 The minimum width for the editable element * @property {int} resizer.min_height=10 The minimum height for the item being edited * @property {boolean} resizer.showSize=true Show size */ Config.prototype.resizer = { showSize: true, hideSizeTimeout: 1000, min_width: 10, min_height: 10 }; const keyBInd = '__jodit-resizer_binded'; /** * Resize table and img * @param {Jodit} editor */ export class resizer extends Plugin { private LOCK_KEY = 'resizer'; private handle!: HTMLElement; private element: null | HTMLElement = null; private isResized: boolean = false; private isShown: boolean = false; private start_x: number = 0; private start_y: number = 0; private width: number = 0; private height: number = 0; private ratio: number = 0; private rect = this.j.c.fromHTML( `