truerte-react 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/LICENSE.txt +22 -0
  3. package/README.md +54 -0
  4. package/lib/cjs/main/ts/EventNames.d.ts +8 -0
  5. package/lib/cjs/main/ts/EventNames.js +87 -0
  6. package/lib/cjs/main/ts/Events.d.ts +94 -0
  7. package/lib/cjs/main/ts/Events.js +2 -0
  8. package/lib/cjs/main/ts/ScriptLoader2.d.ts +10 -0
  9. package/lib/cjs/main/ts/ScriptLoader2.js +138 -0
  10. package/lib/cjs/main/ts/TrueRTE.d.ts +3 -0
  11. package/lib/cjs/main/ts/TrueRTE.js +8 -0
  12. package/lib/cjs/main/ts/Utils.d.ts +18 -0
  13. package/lib/cjs/main/ts/Utils.js +53 -0
  14. package/lib/cjs/main/ts/Uuid.d.ts +6 -0
  15. package/lib/cjs/main/ts/Uuid.js +16 -0
  16. package/lib/cjs/main/ts/components/Editor.d.ts +171 -0
  17. package/lib/cjs/main/ts/components/Editor.js +358 -0
  18. package/lib/cjs/main/ts/index.d.ts +2 -0
  19. package/lib/cjs/main/ts/index.js +5 -0
  20. package/lib/es2015/main/ts/EventNames.d.ts +8 -0
  21. package/lib/es2015/main/ts/EventNames.js +84 -0
  22. package/lib/es2015/main/ts/Events.d.ts +94 -0
  23. package/lib/es2015/main/ts/Events.js +1 -0
  24. package/lib/es2015/main/ts/ScriptLoader2.d.ts +10 -0
  25. package/lib/es2015/main/ts/ScriptLoader2.js +135 -0
  26. package/lib/es2015/main/ts/TrueRTE.d.ts +3 -0
  27. package/lib/es2015/main/ts/TrueRTE.js +5 -0
  28. package/lib/es2015/main/ts/Utils.d.ts +18 -0
  29. package/lib/es2015/main/ts/Utils.js +43 -0
  30. package/lib/es2015/main/ts/Uuid.d.ts +6 -0
  31. package/lib/es2015/main/ts/Uuid.js +12 -0
  32. package/lib/es2015/main/ts/components/Editor.d.ts +171 -0
  33. package/lib/es2015/main/ts/components/Editor.js +354 -0
  34. package/lib/es2015/main/ts/index.d.ts +2 -0
  35. package/lib/es2015/main/ts/index.js +2 -0
  36. package/package.json +63 -0
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Official TrueRTE React component
3
+ * Copyright (c) 2022 Ephox Corporation DBA Tiny Technologies, Inc.
4
+ * Copyright (c) 2024 TrueRTE contributors
5
+ * Licensed under the MIT license (https://github.com/truerte/truerte-react/blob/main/LICENSE.TXT)
6
+ */
7
+ import type { Editor as TrueRTEEditor, EditorEvent, Events } from 'truerte';
8
+ import { customEvents, nativeEvents, validEvents } from './EventNames';
9
+ export type EventHandler<A> = (a: EditorEvent<A>, editor: TrueRTEEditor) => unknown;
10
+ type EEventHandler<K extends keyof Events.EditorEventMap> = EventHandler<Events.EditorEventMap[K]>;
11
+ /** Ensures that T extends U, and returns T. */
12
+ type EnsureExtends<T extends U, U> = T;
13
+ export type INativeEvents = EnsureExtends<{
14
+ onBeforePaste: EEventHandler<'beforepaste'>;
15
+ onBlur: EEventHandler<'blur'>;
16
+ onClick: EEventHandler<'click'>;
17
+ onCompositionEnd: EEventHandler<'compositionend'>;
18
+ onCompositionStart: EEventHandler<'compositionstart'>;
19
+ onCompositionUpdate: EEventHandler<'compositionupdate'>;
20
+ onContextMenu: EEventHandler<'contextmenu'>;
21
+ onCopy: EEventHandler<'copy'>;
22
+ onCut: EEventHandler<'cut'>;
23
+ onDblclick: EEventHandler<'dblclick'>;
24
+ onDrag: EEventHandler<'drag'>;
25
+ onDragDrop: EEventHandler<'dragdrop'>;
26
+ onDragEnd: EEventHandler<'dragend'>;
27
+ onDragGesture: EEventHandler<'draggesture'>;
28
+ onDragOver: EEventHandler<'dragover'>;
29
+ onDrop: EEventHandler<'drop'>;
30
+ onFocus: EEventHandler<'focus'>;
31
+ onFocusIn: EEventHandler<'focusin'>;
32
+ onFocusOut: EEventHandler<'focusout'>;
33
+ onInput: EEventHandler<'input'>;
34
+ onKeyDown: EEventHandler<'keydown'>;
35
+ onKeyPress: EEventHandler<'keypress'>;
36
+ onKeyUp: EEventHandler<'keyup'>;
37
+ onMouseDown: EEventHandler<'mousedown'>;
38
+ onMouseEnter: EEventHandler<'mouseenter'>;
39
+ onMouseLeave: EEventHandler<'mouseleave'>;
40
+ onMouseMove: EEventHandler<'mousemove'>;
41
+ onMouseOut: EEventHandler<'mouseout'>;
42
+ onMouseOver: EEventHandler<'mouseover'>;
43
+ onMouseUp: EEventHandler<'mouseup'>;
44
+ onPaste: EEventHandler<'paste'>;
45
+ onSelectionChange: EEventHandler<'selectionchange'>;
46
+ }, Record<`on${typeof nativeEvents[number]}`, unknown>>;
47
+ export type ICustomEvents = EnsureExtends<{
48
+ onActivate: EEventHandler<'activate'>;
49
+ onAddUndo: EEventHandler<'AddUndo'>;
50
+ onBeforeAddUndo: EEventHandler<'BeforeAddUndo'>;
51
+ onBeforeExecCommand: EEventHandler<'BeforeExecCommand'>;
52
+ onBeforeGetContent: EEventHandler<'BeforeGetContent'>;
53
+ onBeforeRenderUI: EventHandler<unknown>;
54
+ onBeforeSetContent: EEventHandler<'BeforeSetContent'>;
55
+ onChange: EventHandler<unknown>;
56
+ onClearUndos: EEventHandler<'ClearUndos'>;
57
+ onCommentChange: EventHandler<unknown>;
58
+ onDeactivate: EEventHandler<'deactivate'>;
59
+ onDirty: EventHandler<unknown>;
60
+ onExecCommand: EEventHandler<'ExecCommand'>;
61
+ onGetContent: EEventHandler<'GetContent'>;
62
+ onHide: EventHandler<unknown>;
63
+ onInit: EEventHandler<'init'>;
64
+ onLoadContent: EEventHandler<'LoadContent'>;
65
+ onNodeChange: EEventHandler<'NodeChange'>;
66
+ onPostProcess: EventHandler<unknown>;
67
+ onPostRender: EEventHandler<'PostRender'>;
68
+ onPreProcess: EventHandler<unknown>;
69
+ onProgressState: EEventHandler<'ProgressState'>;
70
+ onRedo: EEventHandler<'Redo'>;
71
+ onRemove: EEventHandler<'remove'>;
72
+ onReset: EventHandler<unknown>;
73
+ onResizeEditor: EventHandler<unknown>;
74
+ onSaveContent: EventHandler<unknown>;
75
+ onSetAttrib: EventHandler<unknown>;
76
+ onObjectResizeStart: EEventHandler<'ObjectResizeStart'>;
77
+ onObjectResized: EEventHandler<'ObjectResized'>;
78
+ onObjectSelected: EEventHandler<'ObjectSelected'>;
79
+ onSetContent: EEventHandler<'SetContent'>;
80
+ onShow: EventHandler<unknown>;
81
+ onSubmit: EventHandler<unknown>;
82
+ onUndo: EEventHandler<'Undo'>;
83
+ onVisualAid: EventHandler<unknown>;
84
+ onSkinLoadError: EEventHandler<'SkinLoadError'>;
85
+ onThemeLoadError: EEventHandler<'ThemeLoadError'>;
86
+ onModelLoadError: EEventHandler<'ModelLoadError'>;
87
+ onPluginLoadError: EEventHandler<'PluginLoadError'>;
88
+ onIconsLoadError: EEventHandler<'IconsLoadError'>;
89
+ onLanguageLoadError: EEventHandler<'LanguageLoadError'>;
90
+ onScriptsLoad: () => void;
91
+ onScriptsLoadError: (err: unknown) => void;
92
+ }, Record<`on${typeof customEvents[number]}`, unknown>>;
93
+ export type IEvents = EnsureExtends<INativeEvents & ICustomEvents, Record<`on${typeof validEvents[number]}`, unknown>>;
94
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ export type CallbackFn = () => void;
2
+ export interface ScriptItem {
3
+ src: string;
4
+ async?: boolean;
5
+ defer?: boolean;
6
+ }
7
+ export declare const ScriptLoader: {
8
+ loadList: (doc: Document, items: ScriptItem[], delay: number, success: () => void, failure?: (err: unknown) => void) => void;
9
+ reinitialize: () => void;
10
+ };
@@ -0,0 +1,135 @@
1
+ /**
2
+ * Official TrueRTE React component
3
+ * Copyright (c) 2022 Ephox Corporation DBA Tiny Technologies, Inc.
4
+ * Copyright (c) 2024 TrueRTE contributors
5
+ * Licensed under the MIT license (https://github.com/truerte/truerte-react/blob/main/LICENSE.TXT)
6
+ */
7
+ import { uuid } from './Uuid';
8
+ const injectScriptTag = (doc, item, handler) => {
9
+ var _a, _b;
10
+ const scriptTag = doc.createElement('script');
11
+ scriptTag.referrerPolicy = 'origin';
12
+ scriptTag.type = 'application/javascript';
13
+ scriptTag.id = item.id;
14
+ scriptTag.src = item.src;
15
+ scriptTag.async = (_a = item.async) !== null && _a !== void 0 ? _a : false;
16
+ scriptTag.defer = (_b = item.defer) !== null && _b !== void 0 ? _b : false;
17
+ const loadHandler = () => {
18
+ scriptTag.removeEventListener('load', loadHandler);
19
+ scriptTag.removeEventListener('error', errorHandler);
20
+ handler(item.src);
21
+ };
22
+ const errorHandler = (err) => {
23
+ scriptTag.removeEventListener('load', loadHandler);
24
+ scriptTag.removeEventListener('error', errorHandler);
25
+ handler(item.src, err);
26
+ };
27
+ scriptTag.addEventListener('load', loadHandler);
28
+ scriptTag.addEventListener('error', errorHandler);
29
+ if (doc.head) {
30
+ doc.head.appendChild(scriptTag);
31
+ }
32
+ };
33
+ const createDocumentScriptLoader = (doc) => {
34
+ let lookup = {};
35
+ const scriptLoadOrErrorHandler = (src, err) => {
36
+ const item = lookup[src];
37
+ item.done = true;
38
+ item.error = err;
39
+ for (const h of item.handlers) {
40
+ h(src, err);
41
+ }
42
+ item.handlers = [];
43
+ };
44
+ const loadScripts = (items, success, failure) => {
45
+ // eslint-disable-next-line no-console
46
+ const failureOrLog = (err) => failure !== undefined ? failure(err) : console.error(err);
47
+ if (items.length === 0) {
48
+ failureOrLog(new Error('At least one script must be provided'));
49
+ return;
50
+ }
51
+ let successCount = 0;
52
+ let failed = false;
53
+ const loaded = (_src, err) => {
54
+ if (failed) {
55
+ return;
56
+ }
57
+ if (err) {
58
+ failed = true;
59
+ failureOrLog(err);
60
+ }
61
+ else if (++successCount === items.length) {
62
+ success();
63
+ }
64
+ };
65
+ for (const item of items) {
66
+ const existing = lookup[item.src];
67
+ if (existing) {
68
+ if (existing.done) {
69
+ loaded(item.src, existing.error);
70
+ }
71
+ else {
72
+ existing.handlers.push(loaded);
73
+ }
74
+ }
75
+ else {
76
+ // create a new entry
77
+ const id = uuid('tiny-');
78
+ lookup[item.src] = {
79
+ id,
80
+ src: item.src,
81
+ done: false,
82
+ error: null,
83
+ handlers: [loaded],
84
+ };
85
+ injectScriptTag(doc, Object.assign({ id }, item), scriptLoadOrErrorHandler);
86
+ }
87
+ }
88
+ };
89
+ const deleteScripts = () => {
90
+ var _a;
91
+ for (const item of Object.values(lookup)) {
92
+ const scriptTag = doc.getElementById(item.id);
93
+ if (scriptTag != null && scriptTag.tagName === 'SCRIPT') {
94
+ (_a = scriptTag.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(scriptTag);
95
+ }
96
+ }
97
+ lookup = {};
98
+ };
99
+ const getDocument = () => doc;
100
+ return {
101
+ loadScripts,
102
+ deleteScripts,
103
+ getDocument
104
+ };
105
+ };
106
+ const createScriptLoader = () => {
107
+ const cache = [];
108
+ const getDocumentScriptLoader = (doc) => {
109
+ let loader = cache.find((l) => l.getDocument() === doc);
110
+ if (loader === undefined) {
111
+ loader = createDocumentScriptLoader(doc);
112
+ cache.push(loader);
113
+ }
114
+ return loader;
115
+ };
116
+ const loadList = (doc, items, delay, success, failure) => {
117
+ const doLoad = () => getDocumentScriptLoader(doc).loadScripts(items, success, failure);
118
+ if (delay > 0) {
119
+ setTimeout(doLoad, delay);
120
+ }
121
+ else {
122
+ doLoad();
123
+ }
124
+ };
125
+ const reinitialize = () => {
126
+ for (let loader = cache.pop(); loader != null; loader = cache.pop()) {
127
+ loader.deleteScripts();
128
+ }
129
+ };
130
+ return {
131
+ loadList,
132
+ reinitialize
133
+ };
134
+ };
135
+ export const ScriptLoader = createScriptLoader();
@@ -0,0 +1,3 @@
1
+ import type { TrueRTE as TrueRTEGlobal } from 'truerte';
2
+ declare const getTrueRTE: (view: Window) => TrueRTEGlobal | null;
3
+ export { getTrueRTE };
@@ -0,0 +1,5 @@
1
+ const getTrueRTE = (view) => {
2
+ const global = view;
3
+ return global && global.truerte ? global.truerte : null;
4
+ };
5
+ export { getTrueRTE };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Official TrueRTE React component
3
+ * Copyright (c) 2022 Ephox Corporation DBA Tiny Technologies, Inc.
4
+ * Copyright (c) 2024 TrueRTE contributors
5
+ * Licensed under the MIT license (https://github.com/truerte/truerte-react/blob/main/LICENSE.TXT)
6
+ */
7
+ import { IEvents } from './Events';
8
+ import { IAllProps } from './components/Editor';
9
+ import type { Editor as TrueRTEEditor, EditorEvent } from 'truerte';
10
+ export declare const isFunction: (x: unknown) => x is Function;
11
+ type PropLookup = <K extends keyof IAllProps>(key: K) => IAllProps[K] | undefined;
12
+ export declare const configHandlers2: <H>(handlerLookup: PropLookup, on: (name: string, handler: H) => void, off: (name: string, handler: H) => void, adapter: <K extends keyof IEvents>(lookup: PropLookup, key: K) => H, prevProps: Partial<IAllProps>, props: Partial<IAllProps>, boundHandlers: Record<string, H>) => void;
13
+ export declare const configHandlers: (editor: TrueRTEEditor, prevProps: Partial<IAllProps>, props: Partial<IAllProps>, boundHandlers: Record<string, (event: EditorEvent<any>) => unknown>, lookup: PropLookup) => void;
14
+ export declare const isTextareaOrInput: (element: Element | null) => element is (HTMLTextAreaElement | HTMLInputElement);
15
+ export declare const mergePlugins: (initPlugins: string | string[] | undefined, inputPlugins: string | string[] | undefined) => string[];
16
+ export declare const isBeforeInputEventAvailable: () => boolean;
17
+ export declare const setMode: (editor: TrueRTEEditor | undefined, mode: "readonly" | "design") => void;
18
+ export {};
@@ -0,0 +1,43 @@
1
+ // TODO: Use what possible from `@truerte/framework-integration-shared`
2
+ export const isFunction = (x) => typeof x === 'function';
3
+ const isEventProp = (name) => {
4
+ return name.startsWith('on') /* && name !== 'onEditorChange' */;
5
+ };
6
+ const eventAttrToEventName = (attrName) => attrName.substring(2);
7
+ export const configHandlers2 = (handlerLookup, on, off, adapter, prevProps, props, boundHandlers) => {
8
+ const prevEventKeys = Object.keys(prevProps).filter(isEventProp);
9
+ const currEventKeys = Object.keys(props).filter(isEventProp);
10
+ const removedKeys = prevEventKeys.filter((key) => props[key] === undefined);
11
+ const addedKeys = currEventKeys.filter((key) => prevProps[key] === undefined);
12
+ removedKeys.forEach((key) => {
13
+ // remove event handler
14
+ const eventName = eventAttrToEventName(key);
15
+ const wrappedHandler = boundHandlers[eventName];
16
+ off(eventName, wrappedHandler);
17
+ delete boundHandlers[eventName];
18
+ });
19
+ addedKeys.forEach((key) => {
20
+ const wrappedHandler = adapter(handlerLookup, key);
21
+ const eventName = eventAttrToEventName(key);
22
+ boundHandlers[eventName] = wrappedHandler;
23
+ on(eventName, wrappedHandler);
24
+ });
25
+ };
26
+ export const configHandlers = (editor, prevProps, props, boundHandlers, lookup) => configHandlers2(lookup, editor.on.bind(editor), editor.off.bind(editor),
27
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
28
+ (handlerLookup, key) => (e) => { var _a; return (_a = handlerLookup(key)) === null || _a === void 0 ? void 0 : _a(e, editor); }, prevProps, props, boundHandlers);
29
+ export const isTextareaOrInput = (element) => element !== null && (element.tagName.toLowerCase() === 'textarea' || element.tagName.toLowerCase() === 'input');
30
+ const normalizePluginArray = (plugins) => {
31
+ if (typeof plugins === 'undefined' || plugins === '') {
32
+ return [];
33
+ }
34
+ return Array.isArray(plugins) ? plugins : plugins.split(' ');
35
+ };
36
+ // eslint-disable-next-line max-len
37
+ export const mergePlugins = (initPlugins, inputPlugins) => normalizePluginArray(initPlugins).concat(normalizePluginArray(inputPlugins));
38
+ export const isBeforeInputEventAvailable = () => window.InputEvent && typeof InputEvent.prototype.getTargetRanges === 'function';
39
+ export const setMode = (editor, mode) => {
40
+ if (editor !== undefined) {
41
+ editor.mode.set(mode);
42
+ }
43
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Official TrueRTE React component
3
+ * Copyright (c) 2026 TrueRTE contributors
4
+ * Licensed under the MIT license (https://github.com/truerte/truerte-react/blob/main/LICENSE.TXT)
5
+ */
6
+ export declare const uuid: (prefix: string) => string;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Official TrueRTE React component
3
+ * Copyright (c) 2026 TrueRTE contributors
4
+ * Licensed under the MIT license (https://github.com/truerte/truerte-react/blob/main/LICENSE.TXT)
5
+ */
6
+ let unique = 0;
7
+ export const uuid = (prefix) => {
8
+ const time = Date.now();
9
+ const random = Math.floor(Math.random() * 1000000000);
10
+ unique++;
11
+ return prefix + '_' + random + unique + String(time);
12
+ };
@@ -0,0 +1,171 @@
1
+ /**
2
+ * Official TrueRTE React component
3
+ * Copyright (c) 2022 Ephox Corporation DBA Tiny Technologies, Inc.
4
+ * Copyright (c) 2024 TrueRTE contributors
5
+ * Licensed under the MIT license (https://github.com/truerte/truerte-react/blob/main/LICENSE.TXT)
6
+ */
7
+ import * as React from 'react';
8
+ import { IEvents } from '../Events';
9
+ import type { Editor as TrueRTEEditor, TrueRTE } from 'truerte';
10
+ type OmitStringIndexSignature<T> = {
11
+ [K in keyof T as string extends K ? never : K]: T[K];
12
+ };
13
+ interface DoNotUse<T extends string> {
14
+ __brand: T;
15
+ }
16
+ type OmittedInitProps = 'selector' | 'target' | 'readonly';
17
+ type EditorOptions = Parameters<TrueRTE['init']>[0];
18
+ export type InitOptions = Omit<OmitStringIndexSignature<EditorOptions>, OmittedInitProps> & {
19
+ selector?: DoNotUse<'selector prop is handled internally by the component'>;
20
+ target?: DoNotUse<'target prop is handled internally by the component'>;
21
+ readonly?: DoNotUse<'readonly prop is overridden by the component, use the `disabled` prop instead'>;
22
+ } & {
23
+ [key: string]: unknown;
24
+ };
25
+ export type Version = `${'1'}${'' | `.${number}` | `.${number}.${number}`}`;
26
+ export type EditorInstanceRef = React.Ref<TrueRTEEditor | null>;
27
+ export interface IProps {
28
+ /**
29
+ * @see {@link https://www.truerte.org/docs/truerte/1/react-ref/#id React Tech Ref - id}
30
+ * @description The ID of the element to render the editor into.
31
+ */
32
+ id: string;
33
+ /**
34
+ * @see {@link https://www.truerte.org/docs/truerte/1/react-ref/#inline React Tech Ref - inline}
35
+ * @description Whether the editor should be rendered inline. Equivalent to the `inline` option in TrueRTE.
36
+ */
37
+ inline: boolean;
38
+ /**
39
+ * @see {@link https://www.truerte.org/docs/truerte/1/react-ref/#initialvalue React Tech Ref - initialValue}
40
+ * @description The initial HTML content of the editor.
41
+ *
42
+ * IMPORTANT: Ensure that this is **not** updated by `onEditorChange` or the editor will be unusable.
43
+ */
44
+ initialValue: string;
45
+ /**
46
+ * @see {@link https://www.truerte.org/docs/truerte/1/react-ref/#oneditorchange React Tech Ref - onEditorChange}
47
+ * @description Used to store the state of the editor outside the component. Typically used for controlled components.
48
+ * @param a The current HTML content of the editor.
49
+ * @param editor The TrueRTE editor instance.
50
+ * @returns void
51
+ */
52
+ onEditorChange: (a: string, editor: TrueRTEEditor) => void;
53
+ /**
54
+ * @see {@link https://www.truerte.org/docs/truerte/1/react-ref/#value React Tech Ref - value}
55
+ * @description The current HTML content of the editor. Typically used for controlled components.
56
+ */
57
+ value: string;
58
+ /**
59
+ * @see {@link https://www.truerte.org/docs/truerte/1/react-ref/#init React Tech Ref - init}
60
+ * @description Additional settings passed to `truerte.init()` when initializing the editor.
61
+ */
62
+ init: InitOptions;
63
+ /**
64
+ * @see {@link https://www.truerte.org/docs/truerte/1/react-ref/#tagname React Tech Ref - tagName}
65
+ * @description The tag name of the element to render the editor into. Only valid when `inline` is `true`.
66
+ */
67
+ tagName: string;
68
+ /**
69
+ * @see {@link https://www.truerte.org/docs/truerte/1/react-ref/#tabIndex React Tech Ref - tabIndex}
70
+ * @description The tab index of the element that the editor wraps.
71
+ */
72
+ tabIndex: number;
73
+ /**
74
+ * @description The TrueRTE version to use when loading from jsDelivr CDN. By default, version 1
75
+ * (that is, the latest minor and patch release of the major version 1) will be used.
76
+ * For more info about the possible version formats, see the {@link https://www.jsdelivr.com/documentation#id-npm jsDelivr documentation}.
77
+ */
78
+ cdnVersion: Version;
79
+ /**
80
+ * @see {@link https://www.truerte.org/docs/truerte/1/react-ref/#plugins React Tech Ref - plugins}
81
+ * @description The plugins to load into the editor. Equivalent to the `plugins` option in TrueRTE.
82
+ */
83
+ plugins: NonNullable<EditorOptions['plugins']>;
84
+ /**
85
+ * @see {@link https://www.truerte.org/docs/truerte/1/react-ref/#toolbar React Tech Ref - toolbar}
86
+ * @description The toolbar to load into the editor. Equivalent to the `toolbar` option in TrueRTE.
87
+ */
88
+ toolbar: NonNullable<EditorOptions['toolbar']>;
89
+ /**
90
+ * @see {@link https://www.truerte.org/docs/truerte/1/react-ref/#disabled React Tech Ref - disabled}
91
+ * @description Whether the editor should be "disabled" (read-only).
92
+ */
93
+ disabled: boolean;
94
+ /**
95
+ * @see {@link https://www.truerte.org/docs/truerte/1/react-ref/#textareaname React Tech Ref - textareaName}
96
+ * @description Set the `name` attribute of the `textarea` element used for the editor in forms. Only valid in iframe mode.
97
+ */
98
+ textareaName: string;
99
+ /**
100
+ * @description Optional external ref that receives the underlying TrueRTE editor instance.
101
+ * Use this for imperative control from outside the component.
102
+ */
103
+ editorRef: EditorInstanceRef;
104
+ /**
105
+ * @description The URL of the TrueRTE script to lazy load.
106
+ */
107
+ truerteScriptSrc: string;
108
+ /**
109
+ * @description When true, automatically configures `icons: 'truerte-lucide'`
110
+ * unless you explicitly provide `init.icons` or `init.icons_url`.
111
+ */
112
+ useLucideIcons: boolean;
113
+ /**
114
+ * @see {@link https://www.truerte.org/docs/truerte/1/react-ref/#rollback React Tech Ref - rollback}
115
+ * @description The number of milliseconds to wait before reverting to the previous value when the editor's content changes.
116
+ */
117
+ rollback: number | false;
118
+ /**
119
+ * @see {@link https://www.truerte.org/docs/truerte/1/react-ref/#scriptloading React Tech Ref - scriptLoading}
120
+ * @description Options for how the TrueRTE script should be loaded.
121
+ * @property async Whether the script should be loaded with the `async` attribute.
122
+ * @property defer Whether the script should be loaded with the `defer` attribute.
123
+ * @property delay The number of milliseconds to wait before loading the script.
124
+ */
125
+ scriptLoading: {
126
+ async?: boolean;
127
+ defer?: boolean;
128
+ delay?: number;
129
+ };
130
+ }
131
+ export interface IAllProps extends Partial<IProps>, Partial<IEvents> {
132
+ }
133
+ /**
134
+ * @see {@link https://www.truerte.org/docs/truerte/1/react-ref/ TrueRTE React Technical Reference}
135
+ */
136
+ export declare class Editor extends React.Component<IAllProps> {
137
+ static defaultProps: Partial<IAllProps>;
138
+ editor?: TrueRTEEditor;
139
+ private id;
140
+ private elementRef;
141
+ private inline;
142
+ private currentContent?;
143
+ private boundHandlers;
144
+ private rollbackTimer;
145
+ private valueCursor;
146
+ constructor(props: Partial<IAllProps>);
147
+ private get view();
148
+ componentDidUpdate(prevProps: Partial<IAllProps>): void;
149
+ componentDidMount(): void;
150
+ componentWillUnmount(): void;
151
+ render(): React.ReactElement<{
152
+ ref: React.RefObject<HTMLElement | null>;
153
+ id: string;
154
+ tabIndex: number | undefined;
155
+ }, string | React.JSXElementConstructor<any>>;
156
+ getEditor(): TrueRTEEditor | undefined;
157
+ private beforeInputEvent;
158
+ private renderInline;
159
+ private renderIframe;
160
+ private getScriptSources;
161
+ private getInitialValue;
162
+ private bindHandlers;
163
+ private rollbackChange;
164
+ private handleBeforeInput;
165
+ private handleBeforeInputSpecial;
166
+ private handleEditorChange;
167
+ private handleEditorChangeSpecial;
168
+ private assignEditorRef;
169
+ private initialise;
170
+ }
171
+ export {};