Skip to content

Commit 3c1864c

Browse files
authored
INT-3362: updated dependencies. (#601)
* INT-3362: updated dependencies. * INT-3362: Update
1 parent 9891fe6 commit 3c1864c

15 files changed

Lines changed: 3587 additions & 3520 deletions

.eslintrc.json

Lines changed: 0 additions & 28 deletions
This file was deleted.

eslint.config.mjs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import tinyPlugin from '@tinymce/eslint-plugin';
2+
import { defineConfig } from "eslint/config";
3+
4+
export default defineConfig([
5+
tinyPlugin.configs.editor,
6+
{
7+
files: ["**/*.ts", "**/*.tsx"],
8+
languageOptions: {
9+
ecmaVersion: 5,
10+
sourceType: "module",
11+
12+
parserOptions: {
13+
project: "tsconfig.json",
14+
},
15+
},
16+
17+
rules: {
18+
"@tinymce/prefer-fun": "off",
19+
"@typescript-eslint/no-unsafe-argument": "off",
20+
},
21+
},
22+
{
23+
files: ["src/test/**/*"],
24+
25+
rules: {
26+
"@typescript-eslint/no-unused-vars": ["warn", {
27+
argsIgnorePattern: "^_",
28+
}],
29+
30+
"no-var": "off",
31+
},
32+
}
33+
]);

package.json

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"author": "Ephox Corporation DBA Tiny Technologies, Inc.",
2727
"license": "MIT",
2828
"dependencies": {
29-
"prop-types": "^15.6.2"
29+
"prop-types": "^15.8.1"
3030
},
3131
"peerDependencies": {
3232
"react": "^19.0.0 || ^18.0.0 || ^17.0.1 || ^16.7.0",
@@ -39,44 +39,44 @@
3939
}
4040
},
4141
"devDependencies": {
42-
"@babel/core": "^7.26.9",
43-
"@babel/preset-env": "^7.26.9",
44-
"@babel/preset-react": "^7.26.3",
45-
"@babel/preset-typescript": "^7.26.0",
42+
"@babel/core": "^7.28.4",
43+
"@babel/preset-env": "^7.28.3",
44+
"@babel/preset-react": "^7.27.1",
45+
"@babel/preset-typescript": "^7.27.1",
4646
"@ephox/agar": "^8.0.1",
4747
"@ephox/bedrock-client": "^15.0.0",
4848
"@ephox/bedrock-server": "^15.0.3-alpha.0",
49-
"@ephox/katamari": "^9.1.5",
50-
"@ephox/mcagar": "^9.0.0-alpha.0",
51-
"@ephox/sand": "^6.0.9",
52-
"@ephox/sugar": "^9.2.1",
53-
"@storybook/addon-essentials": "^8.6.4",
54-
"@storybook/addon-interactions": "^8.6.4",
55-
"@storybook/addon-links": "^8.6.4",
56-
"@storybook/blocks": "^8.6.4",
57-
"@storybook/react": "^8.6.4",
58-
"@storybook/react-vite": "^8.6.4",
49+
"@ephox/katamari": "^9.1.6",
50+
"@ephox/mcagar": "^9.0.1",
51+
"@ephox/sand": "^6.0.10",
52+
"@ephox/sugar": "^9.3.1",
53+
"@storybook/addon-essentials": "^8.6.14",
54+
"@storybook/addon-interactions": "^8.6.14",
55+
"@storybook/addon-links": "8.6.14",
56+
"@storybook/blocks": "^8.6.14",
57+
"@storybook/react": "^8.6.14",
58+
"@storybook/react-vite": "^8.6.14",
5959
"@tinymce/beehive-flow": "^0.19.0",
60-
"@tinymce/eslint-plugin": "^2.4.0",
60+
"@tinymce/eslint-plugin": "^3.0.0",
6161
"@tinymce/miniature": "^6.0.0",
62-
"@types/node": "^22.13.10",
63-
"@types/prop-types": "^15.7.14",
64-
"@types/react": "^19.0.0",
65-
"@types/react-dom": "^19.0.0",
66-
"gh-pages": "^6.1.0",
67-
"react": "^19.0.0",
68-
"react-dom": "^19.0.0",
62+
"@types/node": "^24.5.0",
63+
"@types/prop-types": "^15.7.15",
64+
"@types/react": "^19.1.13",
65+
"@types/react-dom": "^19.1.9",
66+
"gh-pages": "^6.3.0",
67+
"react": "^19.1.1",
68+
"react-dom": "^19.1.1",
6969
"rimraf": "^6.0.1",
70-
"storybook": "^8.6.4",
71-
"tinymce": "^8.0.1",
70+
"storybook": "^8.6.14",
71+
"tinymce": "^8.0.2",
7272
"tinymce-4": "npm:tinymce@^4",
7373
"tinymce-5": "npm:tinymce@^5",
7474
"tinymce-6": "npm:tinymce@^6",
7575
"tinymce-7": "npm:tinymce@^7",
7676
"tinymce-7.5": "npm:tinymce@7.5",
7777
"tinymce-8": "npm:tinymce@^8.0.0",
7878
"typescript": "~5.8.2",
79-
"vite": "^6.2.1"
79+
"vite": "^7.1.5"
8080
},
8181
"version": "6.3.1-rc",
8282
"name": "@tinymce/tinymce-react"

src/main/ts/Utils.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { eventPropTypes, IEventPropTypes } from './components/EditorPropTypes';
2-
import { IAllProps } from './components/Editor';
3-
import type { Editor as TinyMCEEditor, EditorEvent } from 'tinymce';
1+
import type { EditorEvent, TinyMCE, Editor as TinyMCEEditor } from 'tinymce';
2+
3+
import type { IAllProps } from './components/Editor';
4+
import { eventPropTypes, type IEventPropTypes } from './components/EditorPropTypes';
45
import { getTinymce } from './TinyMCE';
56

67
export const isFunction = (x: unknown): x is Function => typeof x === 'function';
@@ -53,7 +54,7 @@ export const configHandlers = (
5354
lookup,
5455
editor.on.bind(editor),
5556
editor.off.bind(editor),
56-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
57+
5758
(handlerLookup, key) => (e) => handlerLookup(key)?.(e, editor),
5859
prevProps,
5960
props,
@@ -85,9 +86,9 @@ const normalizePluginArray = (plugins?: string | string[]): string[] => {
8586
// eslint-disable-next-line max-len
8687
export const mergePlugins = (initPlugins: string | string[] | undefined, inputPlugins: string | string[] | undefined): string[] => normalizePluginArray(initPlugins).concat(normalizePluginArray(inputPlugins));
8788

88-
export const isBeforeInputEventAvailable = () => window.InputEvent && typeof (InputEvent.prototype as any).getTargetRanges === 'function';
89+
export const isBeforeInputEventAvailable = (): boolean => window.InputEvent && typeof (InputEvent.prototype as any).getTargetRanges === 'function';
8990

90-
export const isInDoc = (elem: Node) => {
91+
export const isInDoc = (elem: Node): boolean => {
9192
if (!('isConnected' in Node.prototype)) {
9293
// Fallback for IE and old Edge
9394
let current = elem;
@@ -102,7 +103,7 @@ export const isInDoc = (elem: Node) => {
102103
return elem.isConnected;
103104
};
104105

105-
export const setMode = (editor: TinyMCEEditor | undefined, mode: 'readonly' | 'design') => {
106+
export const setMode = (editor: TinyMCEEditor | undefined, mode: 'readonly' | 'design'): void => {
106107
if (editor !== undefined) {
107108
if (editor.mode != null && typeof editor.mode === 'object' && typeof editor.mode.set === 'function') {
108109
editor.mode.set(mode);
@@ -112,7 +113,7 @@ export const setMode = (editor: TinyMCEEditor | undefined, mode: 'readonly' | 'd
112113
}
113114
};
114115

115-
export const getTinymceOrError = (view: Window) => {
116+
export const getTinymceOrError = (view: Window): TinyMCE => {
116117
const tinymce = getTinymce(view);
117118
if (!tinymce) {
118119
throw new Error('tinymce should have been loaded into global scope');
@@ -121,4 +122,4 @@ export const getTinymceOrError = (view: Window) => {
121122
return tinymce;
122123
};
123124

124-
export const isDisabledOptionSupported = (editor: TinyMCEEditor) => editor.options && editor.options.isRegistered('disabled');
125+
export const isDisabledOptionSupported = (editor: TinyMCEEditor): boolean => editor.options && editor.options.isRegistered('disabled');

src/main/ts/components/Editor.tsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import * as React from 'react';
22
import type { Bookmark, EditorEvent, TinyMCE, Editor as TinyMCEEditor } from 'tinymce';
3-
import { IEvents } from '../Events';
4-
import { ScriptItem, ScriptLoader } from '../ScriptLoader2';
5-
import { configHandlers, isBeforeInputEventAvailable,
6-
isFunction, isInDoc, isTextareaOrInput, mergePlugins,
7-
setMode, uuid, isDisabledOptionSupported,
8-
getTinymceOrError } from '../Utils';
9-
import { EditorPropTypes, IEditorPropTypes } from './EditorPropTypes';
3+
4+
import type { IEvents } from '../Events';
5+
import { type ScriptItem, ScriptLoader } from '../ScriptLoader2';
106
import { getTinymce } from '../TinyMCE';
7+
import {
8+
configHandlers,
9+
getTinymceOrError,
10+
isBeforeInputEventAvailable,
11+
isDisabledOptionSupported,
12+
isFunction, isInDoc, isTextareaOrInput, mergePlugins,
13+
setMode, uuid
14+
} from '../Utils';
15+
16+
import { EditorPropTypes, type IEditorPropTypes } from './EditorPropTypes';
1117

1218
const changeEvents = 'change keyup compositionend setcontent CommentChange';
1319

@@ -175,7 +181,7 @@ export class Editor extends React.Component<IAllProps> {
175181
return this.elementRef.current?.ownerDocument.defaultView ?? window;
176182
}
177183

178-
public componentDidUpdate(prevProps: Partial<IAllProps>) {
184+
public componentDidUpdate(prevProps: Partial<IAllProps>): void {
179185
if (this.rollbackTimer) {
180186
clearTimeout(this.rollbackTimer);
181187
this.rollbackTimer = undefined;
@@ -235,7 +241,7 @@ export class Editor extends React.Component<IAllProps> {
235241
}
236242
}
237243

238-
public componentDidMount() {
244+
public componentDidMount(): void {
239245
if (getTinymce(this.view) !== null) {
240246
this.initialise();
241247
} else if (Array.isArray(this.props.tinymceScriptSrc) && this.props.tinymceScriptSrc.length === 0) {
@@ -258,7 +264,7 @@ export class Editor extends React.Component<IAllProps> {
258264
}
259265
}
260266

261-
public componentWillUnmount() {
267+
public componentWillUnmount(): void {
262268
const editor = this.editor;
263269
if (editor) {
264270
editor.off(changeEvents, this.handleEditorChange);
@@ -275,7 +281,7 @@ export class Editor extends React.Component<IAllProps> {
275281
}
276282
}
277283

278-
public render() {
284+
public render(): React.ReactElement {
279285
return this.inline ? this.renderInline() : this.renderIframe();
280286
}
281287

src/main/ts/components/EditorPropTypes.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import * as PropTypes from 'prop-types';
2+
23
import { IEvents } from '../Events';
4+
35
import { IProps } from './Editor';
46

57
export type CopyProps<T> = { [P in keyof T]: PropTypes.Requireable<unknown> };

src/stories/Editor.stories.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { StoryObj } from '@storybook/react';
22
import React from 'react';
33
import { EditorEvent, Events, Editor as TinyMCEEditor } from 'tinymce';
4+
45
import { Editor, IAllProps } from '../main/ts/components/Editor';
56

67
const apiKey = 'qagffr3pkuv17a8on1afax661irst1hbr4e6tbv888sz91jc';

src/test/ts/alien/Loader.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
import { before, context } from '@ephox/bedrock-client';
12
import { Fun, Optional } from '@ephox/katamari';
23
import { Remove, SugarElement, SugarNode } from '@ephox/sugar';
4+
import { VersionLoader } from '@tinymce/miniature';
35
import * as React from 'react';
46
import * as ReactDOMClient from 'react-dom/client';
5-
import { Editor, IAllProps, IProps, Version } from '../../../main/ts/components/Editor';
6-
import { Editor as TinyMCEEditor } from 'tinymce';
7-
import { before, context } from '@ephox/bedrock-client';
8-
import { VersionLoader } from '@tinymce/miniature';
97
import { setMode } from 'src/main/ts/Utils';
8+
import { Editor as TinyMCEEditor } from 'tinymce';
9+
10+
import { Editor, IAllProps, IProps, Version } from '../../../main/ts/components/Editor';
1011

1112
// @ts-expect-error Remove when dispose polyfill is not needed
1213
Symbol.dispose ??= Symbol('Symbol.dispose');

src/test/ts/alien/TestHelpers.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,20 @@ interface EventHandlerArgs<T> {
88
editor: TinyMCEEditor;
99
}
1010

11+
interface EventStore {
12+
each: <T>(name: string, assertState: (state: EventHandlerArgs<T>[]) => void) => void;
13+
createHandler: <T>(name: string) => HandlerType<T>;
14+
clearState: () => void;
15+
}
16+
1117
type HandlerType<A> = (a: A, editor: TinyMCEEditor) => unknown;
1218

1319
const VERSIONS: Version[] = [ '5', '6', '7', '8' ];
1420
const CLOUD_VERSIONS: Version[] = [ '5', '6', '7', '8' ];
1521

1622
const VALID_API_KEY = 'qagffr3pkuv17a8on1afax661irst1hbr4e6tbv888sz91jc';
1723

18-
const EventStore = () => {
24+
const EventStore = (): EventStore => {
1925
const state: Cell<Record<string, EventHandlerArgs<unknown>[]>> = Cell({});
2026

2127
const createHandler = <T>(name: string): HandlerType<T> => (event: T, editor) => {
@@ -48,9 +54,9 @@ const EventStore = () => {
4854
};
4955

5056
export {
51-
VALID_API_KEY,
52-
EventStore,
53-
VERSIONS,
5457
CLOUD_VERSIONS,
55-
Version
56-
};
58+
EventStore,
59+
VALID_API_KEY,
60+
Version,
61+
VERSIONS
62+
};

src/test/ts/browser/EditorBehaviorTest.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { PlatformDetection } from '@ephox/sand';
2-
import * as Loader from '../alien/Loader';
3-
4-
import { describe, it } from '@ephox/bedrock-client';
51

62
import { Assertions, Waiter } from '@ephox/agar';
3+
import { describe, it } from '@ephox/bedrock-client';
74
import { TinyAssertions, TinySelections } from '@ephox/mcagar';
5+
import { PlatformDetection } from '@ephox/sand';
86
import { EditorEvent, Events, Editor as TinyMCEEditor } from 'tinymce';
7+
98
import { getTinymce } from '../../../main/ts/TinyMCE';
9+
import * as Loader from '../alien/Loader';
1010
import { EventStore, VERSIONS } from '../alien/TestHelpers';
1111

1212
type SetContentEvent = EditorEvent<Events.EditorEventMap['SetContent']>;

0 commit comments

Comments
 (0)