- md5
- 661ff0d0d6b71357736e5963879bdba5
- sha1
- f4dd0c0f7f202d946007cf84965cead8900eebde
- sha256
- 5be4e8e93b7e5c644813bee6402929598d30db697056766637b6f98fc8fdc624
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
/**
* @copyright (C) 2023 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
/**
* A decorator for Editor instance.
*/
class JoomlaEditorDecorator {
/**
* Internal! The property should not be accessed directly.
* The editor instance.
* @type {Object}
*/
// instance = null;
/**
* Internal! The property should not be accessed directly.
* The editor type/name, eg: tinymce, codemirror, none etc.
* @type {string}
*/
// type = '';
/**
* Internal! The property should not be accessed directly.
* HTML ID of the editor.
* @type {string}
*/
// id = '';
/**
* Class constructor.
*
* @param {Object} instance The editor instance
* @param {string} type The editor type/name
* @param {string} id The editor ID
*/
constructor(instance, type, id) {
if (!instance || !type || !id) {
throw new Error('Missed values for class constructor');
}
this.instance = instance;
this.type = type;
this.id = id;
}
/**
* Returns the editor instance object.
*
* @returns {Object}
*/
getRawInstance() {
return this.instance;
}
/**
* Returns the editor type/name.
*
* @returns {string}
*/
getType() {
return this.type;
}
/**
* Returns the editor id.
*
* @returns {string}
*/
getId() {
return this.id;
}
/**
* Return the complete data from the editor.
* Should be implemented by editor provider.
*
* @returns {string}
*/
// eslint-disable-next-line class-methods-use-this
getValue() {
throw new Error('Not implemented');
}
/**
* Replace the complete data of the editor
* Should be implemented by editor provider.
*
* @param {string} value Value to set.
*
* @returns {JoomlaEditorDecorator}
*/
// eslint-disable-next-line class-methods-use-this, no-unused-vars
setValue(value) {
throw new Error('Not implemented');
}
/**
* Return the selected text from the editor.
* Should be implemented by editor provider.
*
* @returns {string}
*/
// eslint-disable-next-line class-methods-use-this
getSelection() {
throw new Error('Not implemented');
}
/**
* Replace the selected text. If nothing selected, will insert the data at the cursor.
* Should be implemented by editor provider.
*
* @param {string} value
*
* @returns {JoomlaEditorDecorator}
*/
// eslint-disable-next-line class-methods-use-this, no-unused-vars
replaceSelection(value) {
throw new Error('Not implemented');
}
/**
* Toggles the editor disabled mode. When the editor is active then everything should be usable.
* When inactive the editor should be unusable AND disabled for form validation.
* Should be implemented by editor provider.
*
* @param {boolean} enable True to enable, false or undefined to disable.
*
* @returns {JoomlaEditorDecorator}
*/
// eslint-disable-next-line class-methods-use-this, no-unused-vars
disable(enable) {
throw new Error('Not implemented');
}
}
export { JoomlaEditorDecorator as default };
The same content is in 78 releases, Joomla 5.0.0-beta1 to 6.0.0-alpha3. See them all, or every version of this file.