jodit
Version:
Jodit is an awesome and useful wysiwyg editor with filebrowser
46 lines (45 loc) • 1.35 kB
JavaScript
/*!
* Jodit Editor (https://xdsoft.net/jodit/)
* Released under MIT see LICENSE.txt in the project root for license information.
* Copyright (c) 2013-2026 Valerii Chupurnov. All rights reserved. https://xdsoft.net
*/
import { Component } from "./component.js";
export class ViewComponent extends Component {
/**
* Shortcut for `this.jodit`
*/
get j() {
return this.jodit;
}
get defaultTimeout() {
return this.j.defaultTimeout;
}
i18n(text, ...params) {
return this.j.i18n(text, ...params);
}
/**
* Attach component to View
*/
setParentView(jodit) {
this.jodit = jodit;
// Inherit the owner window from the parent view — for an editor
// created with a custom `ownerWindow` (e.g. inside an iframe) the
// component default (the global `window`) is wrong: outside-click
// handlers of dropdowns/popups listened to the wrong window. See
// https://github.com/xdan/jodit/issues/965
if (jodit.ow) {
this.ownerWindow = jodit.ow;
}
jodit.components.add(this);
return this;
}
constructor(jodit) {
super();
this.setParentView(jodit);
}
/** @override */
destruct() {
this.j.components.delete(this);
return super.destruct();
}
}