🎉 Add an option to enable and disable HTML paste

This commit is contained in:
Aitor Moreno
2025-11-03 10:23:58 +01:00
parent 0a3fe9836a
commit d73be5832b
8 changed files with 109 additions and 19 deletions

View File

@@ -58,7 +58,7 @@ import SafeGuard from "./SafeGuard.js";
* Supported options for the SelectionController.
*
* @typedef {Object} SelectionControllerOptions
* @property {Object} [debug] An object with references to DOM elements that will keep all the debugging values.
* @property {SelectionControllerDebug} [debug] An object with references to DOM elements that will keep all the debugging values.
*/
/**
@@ -203,6 +203,11 @@ export class SelectionController extends EventTarget {
*/
#fixInsertCompositionText = false;
/**
* @type {TextEditorOptions}
*/
#options
/**
* Constructor
*
@@ -219,6 +224,7 @@ export class SelectionController extends EventTarget {
throw new TypeError("Invalid EventTarget");
}
*/
this.#options = options;
this.#debug = options?.debug;
this.#styleDefaults = options?.styleDefaults;
this.#selection = selection;
@@ -238,6 +244,15 @@ export class SelectionController extends EventTarget {
return this.#currentStyle;
}
/**
* Text editor options.
*
* @type {TextEditorOptions}
*/
get options() {
return this.#options;
}
/**
* Applies the default styles to the currentStyle
* CSSStyleDeclaration.